Test simple regression slope
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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)
0 comentarios
Respuestas (1)
Star Strider
el 26 de En. de 2016
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.
0 comentarios
Ver también
Categorías
Más información sobre Hypothesis Tests en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!