Function File: [b, bint, r, rint, stats] = regress (y, X, [alpha])
Multiple Linear Regression using Least Squares Fit of y on X with the model
y = X * beta + e.Here,
yis a column vector of observed valuesXis a matrix of regressors, with the first column filled with the constant value 1betais a column vector of regression parameterseis a column vector of random errorsArguments are
- y is the
yin the model- X is the
Xin the model- alpha is the significance level used to calculate the confidence intervals bint and rint (see `Return values' below). If not specified, ALPHA defaults to 0.05
Return values are
- b is the
betain the model- bint is the confidence interval for b
- r is a column vector of residuals
- rint is the confidence interval for r
- stats is a row vector containing:
- The R^2 statistic
- The F statistic
- The p value for the full model
- The estimated error variance
r and rint can be passed to
rcoplotto visualize the residual intervals and identify outliers.NaN values in y and X are removed before calculation begins.
Package: statistics