Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

 Quantlet: linregfs Description: linregfs computes a simple forward selection for a multiple linear regression model.

Reference(s):
Chatterjee, S. and Price, B. (1991), Regression Analysis by Example, Whiley, p. 236

 Usage: {xfs,bfs,pvl} = linregfs (x, y {, alpha}) Input: x n x p regressor variables y n x 1 dependent variable alpha scalar level of testing Output: xfs n x q bfs q x 1 the estimated regression coefficients pvl q x 3 the returned p-values

Note:
The regressors x do not contain an intercept column. The forward selection chooses in each step the variable with the highest correlation coefficient. If the optional significance level alpha is given the selection procedures stops if the regression coefficient is non-significant otherwise all coefficients are computed.

The returned values are xfs, the selected (q>=1)regressors. The first regressor is always the constant term. bfs contains the regression coefficents. pvl contains the selected variable, the p-values of the significance test and the residual sum of squares divided by the number of observations minus the number of parameters.

Example:
```; loads the library stats
library("stats")
; reset random generator
randomize(0)
; generate x
x = normal(1000, 3)
; generate y
y = 10*x[,3]+x[,1].*x[,2]
; do the forward selection
{xfs,bfs,pvl}=linregfs(x, y, 0.05)
; print the regression coefficients and test results
bfs~pvl

```
Result:
```Contents of _tmp
[1,]  0.021854        0     +NAN     +NaN
[2,]   9.9689        3        0   0.8867
[3,]  0.069415        2  0.017246  0.88256

The result includes the constant term (always first), the
third variable and the second variable. The first column
are the regression coefficients. The second column are
the selected variables (0 means constant term). The
third column contains the p-values whereas the last
column contains the residual sum of squares divided by
n-#parameters.
```