| Statistics Toolbox | ![]() |
Syntax
Description
returns the least squares fit of b = regress(y,X)
y on X by solving the linear model
is a p-by-1 vector of parameters
is an n-by-1 vector of random disturbances
[b,bint,r,rint,stats] = regress(y,X)
returns an estimate of
in b, a 95% confidence interval for
in the p-by-2 vector bint. The residuals are returned in r and a 95% confidence interval for each residual is returned in the n-by-2 vector rint. The vector stats contains the R2 statistic along with the F and p values for the regression.
[b,bint,r,rint,stats] = regress(y,X,alpha)
gives 100(1-alpha)% confidence intervals for bint and rint. For example, alpha = 0.2 gives 80% confidence intervals.
Examples
where I is the identity matrix.
X = [ones(10,1) (1:10)'] X = 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 y = X * [10;1] + normrnd(0,0.1,10,1) y = 11.1165 12.0627 13.0075 14.0352 14.9303 16.1696 17.0059 18.1797 19.0264 20.0872 [b,bint] = regress(y,X,0.05) b = 10.0456 1.0030 bint = 9.9165 10.1747 0.9822 1.0238
Compare b to [10 1]'. Note that bint includes the true model values.
Reference
[1] Chatterjee, S. and A. S. Hadi. Influential Observations, High Leverage Points, and Outliers in Linear Regression. Statistical Science, 1986. pp. 379- 416.
| refline | regstats | ![]() |