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

Library: stats
See also: linregstep linregfs2 linregopt gls linregbs linregres doglm

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

Reference(s):

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:

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.



Author: S. Klinke, 19970820
(C) MD*TECH Method and Data Technologies, 05.02.2006