Test simple regression slope

10 次查看(过去 30 天)
Martijn Steenwijk
Martijn Steenwijk 2016-1-26
I would like to test whether the slope of a simple y=a*x+b linear regression line equals one. Is the following approach correct?
stats = regstats(y,x,'linear'); % y is a vector of responses, x is a vector of data
beta = stats.beta % this prints the betas of the model
%Perform an F-test that the last coefficient is equal to 1:
SIGMA = stats.covb;
dfe = stats.fstat.dfe;
H = [0 1];
c = [1];
[p,F] = linhyptest(beta,SIGMA,c,H,dfe)

回答(1 个)

Star Strider
Star Strider 2016-1-26
Most hypothesis tests on the parameters test if the parameter is different from zero. My reading of the documentation for regstats and linhyptest leads me to believe they do the same.
In order to see if the parameter is different from a number other than zero, you need the actual confidence limits. If those confidence limits for the slope include 1, then it is not significantly different from 1. The regress function will give you that in ‘bint’ if you as it as:
[b,bint] = regress(y,X);
and remember to include the vector of ones to create an intercept parameter and statistics for it.
Another option is to use polyfit and the File Exchange contribution ‘polyparci’ to get the confidence limits on the parameters.

类别

Help CenterFile Exchange 中查找有关 Linear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by