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: linregfs2 linregbs linregopt gls linregfs linregres doglm

Quantlet: linregstep
Description: linregstep computes a stepwise regression for a multiple linear regression model.

Reference(s):

Usage: {b,bse,bstan,bpval} = linregstep (x, y, colname{, opt})
Input:
x n x p x d1 x ... x dn array
y n x 1 x d1 x ... x dn array
colname string vector
opt parameter vector
Output:
b p x 1 x d1 x ... x dn array
bse p x 1 x d1 x ... x dn array
bstan p x 1 x d1 x ... x dn array
bpval p x 1 x d1 x ... x dn array

Note:

Example:
library("stats")
setenv("outputstringformat", "%s")
x1 = #(7,1,11,11,7,11,3,1,2,21,1,11,10)
x2 = #(26,29,56,31,52,55,71,31,54,47,40,66,68)
x3 = #(6,15,8,8,6,9,17,22,18,4,23,9,8)
x4 = #(60,52,20,47,33,22,6,44,22,26,34,12,12)
x  = x1~x2~x3~x4
y  = #(78.5,74.3,104.3,87.6,95.9,109.2,102.7,72.5)
y  = y|#(93.1,115.9,83.8,113.3,109.4)
colname=string("X %.f",1:cols(x))
opt = linregopt("Fin", 4.0, "Fout", 3.9)
{b,bse,bstan,bpval} = linregstep(x,y,colname,opt)

Result:
Contents of string
[1,] In : X 4
Contents of string
[1,] In  : X 1
Contents of string
[1,] In  : X 2
Contents of string
[1,] Out : X 4

Contents of EnterandOut
[ 1,] Stepwise Regression
[ 2,] -------------------
[ 3,] F-to-enter 4.00
[ 4,] probability of F-to-enter 0.95
[ 5,] F-to-remove 3.90
[ 6,] probability of F-to-remove 0.94
[ 7,]
[ 8,] Variables entered and dropped in the following Steps:
[ 9,]
[10,] Step  Multiple R      R^2        F        SigF       Variable(s)
[11,]  1     0.8213       0.6745     22.799    0.001  In : X 4
[12,]  2     0.9861       0.9725    176.627    0.000  In : X 1
[13,]  3     0.9911       0.9823    166.832    0.000  In : X 2
[14,]  3     0.9893       0.9787    229.504    0.000  Out: X 4

Contents of ANOVA
[ 1,]
[ 2,] A  N  O  V  A                   SS      df     MSS       F-test   P-value
[ 3,] _________________________________________________________________________
[ 4,] Regression                  2657.859     2  1328.929     229.504   0.0000
[ 5,] Residuals                     57.904 1e+01     5.790
[ 6,] Total Variation                 2716    12   226.314
[ 7,]
[ 8,] Multiple R      = 0.98928
[ 9,] R^2             = 0.97868
[10,] Adjusted R^2    = 0.97441
[11,] Standard Error  = 2.40634

Contents of Summary
[1,] Variables in the Equation for Y:
[2,]
[3,]
[4,] PARAMETERS         Beta         SE         StandB      t-test   P-value  Variable
[5,]   __________________________________________________________________________________
[6,] b[ 0,]=         52.5773       2.2862       0.0000     22.9980   0.0000   Constant
[7,] b[ 1,]=          1.4683       0.1213       0.5741     12.1047   0.0000   X 1
[8,] b[ 2,]=          0.6623       0.0459       0.6850     14.4424   0.0000   X 2



Author: K. Zanter, W. Haerdle, 19980331 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006