How to determine standard error from Multiple Linear Regression

14 ビュー (過去 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 件のコメント
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