regress with vectors arguments
4 views (last 30 days)
Show older comments
Hello,i know that in regress we make an estimation of our data using some other vector.
In here We have estimation of two data simultaniosly m10 and m5 as shown in the code bellow.
BINT are the intervals of B ,R are the residuals.
I have an output shown bellow.
B has only two values(one for each data vector)
so i think my estimate for m10 is b[1]*v1 and m5 is b[2]*v2
Why B size is 2X1 but R is 10 values,
I cant link visually R,Bint values to the B vector(there is a size mismatch between them).can i somehow visualize the connection between R,Bint values and my coeffient B vector values ?
Thanks.
e=0.001;
T=10;
eT=e*T;
coeff_1 = 0.05;
coeff_2 = 0.07;
n=5;
m10 = 2*eT+3*e + coeff_1*randn(n,1);
m5 = 4*eT+5*e + coeff_2*randn(n,1);
v1=repmat([2,3],n,1);
v2=repmat([4,5],n,1)];
[B,BINT,R] = regress([m10;m5],[v1;v2]);
0 Comments
Answers (1)
Star Strider
on 5 Mar 2020
‘Why B size is 2X1 but R is 10 values’
As I understand your Question, it is because ‘B’ is a (coefficient) vector of parameters, and you are only fitting two colums. There will be one ‘B’ parameter for each column. If you add a third ones column (to specify the intercept) there would be three ‘B’ values (and a more accurate regression).
4 Comments
Star Strider
on 6 Mar 2020
The regress funciton will do all that for you. See Determine Significance of Linear Regression Relationship, and for confidence intervals on the regression, use fitlm and predict.
You can of course code all these yourself. I do not recommend that.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!