Regress function provides same results regardless of predictors
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all,
I am trying to calculate the linear regression (R squared, p-value) of two variables w and z, once by using variable w as predictor and then using variable z as the predictor. I have written the following script:
%a-predictor
%b-response
a=a';
b=b';
x1=ones(size(a,1),1);
X=[x1 a];
y=b;
[~,~,~,~,stats2] = regress(y, X);
R2=stats2(1);
p2=stats2(3);
reg=[R2 p2];
where I interchange variables a and b being the former firstly "w" and then "z" and the opposite for the latter. However, in either cases I get the same values for R2 and p2. When I try with "Regression Learner App" I do get different values for the two cases. Does anybody know what's going on?
Thanks in advance!
Katerina
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!