How to determine standard error from Multiple Linear Regression

조회 수: 6 (최근 30일)
Calvin Koh
Calvin Koh 2016년 11월 30일
댓글: Iddo Weiner 2016년 12월 2일
Getting the standard error from regress.
If I have # of equations of the following format
Y = A*Z1 + B*Z2
and I have # of Y, Z1 and Z2 values.
I did a mulitple linear regress to determine the A and B value using the following script.
Y = importdata('C:\Users\Calvin\Desktop\FYP\Regression Script\Y.mat');
Z = importdata('C:\Users\Calvin\Desktop\FYP\Regression Script\Z.mat');
% Multiple Linear Regression to find the coeeficients A, B, C
W = regress(Y,Z);
A = W(1);
B = W(2);
Question: Is there any way I'm able to obtain the error standard error for A and B, ±ΔA & ±ΔB.
Thank you in advance!

채택된 답변

Iddo Weiner
Iddo Weiner 2016년 11월 30일
Hi calvin,
If I understood you correctly - what you're looking for is the second output of regress(), which is a confidence interval. Check out the documentation for more info on how this works.. In general - it gives you a symmetrical zone around your regressor which can be regarded as the errors you refer to (although this isn't exactly a standard error).
Run this short simulation to take a closer look. I tried to keep the same variable names as in your example, so: W is the vector storing the regressors and CI, the second requested output of regress, is the confidence interval.
Y = (1:100)';
Z = randi(100,[100,2]) % get (100,2) random numbers
[W, CI] = regress(Y,Z); % get the regressors and their corresponding confidence intervals
% visualize results
figure
bar(W,'w')
xlim([0 3])
hold on
errorbar(W,[CI(1,2)-W(1), CI(2,2)-W(1)],'pr')
legend('regressor','95% C.I.','safdsad')
set(gca,'XTickLabel',{'W1','W2'})
hold off
{ If this does not answer your question, please provide: (1) the actual data you're working with and (2) a more detailed explanation of what you are looking for }
  댓글 수: 2
Calvin Koh
Calvin Koh 2016년 12월 1일
Thank you so much Iddo! Its the confidence interval that I'm looking for! Really appreciate it! :)
Iddo Weiner
Iddo Weiner 2016년 12월 2일
Glad to help, good luck!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by