| Library: | stats |
| See also: | linregstep linregbs linregopt gls linregfs linregres glm doglm |
| Macro: | linregfs2 | |
| Description: | linregfs2 computes a forward selection for a multiple linear regression model. |
Kotz, S., Johnson, N. L. and Read, C. B. (1989), Encyclopedia of Statistical Science, Vol.8, p. 766-767
| Usage: | {b,bse,bstan,bpval} = linregfs2 (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 | scalar | |
| 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 | |
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)
{b,bse,bstan,bpval} = linregfs2(x,y,colname,opt)
Contents of string [1,] In : X 1 Contents of string [1,] In : X 2 Contents of Enter [ 1,] Forward Selection [ 2,] ------------------------------ [ 3,] F-to-enter 4.00 [ 4,] probability of F-to-enter 0.95 [ 5,] [ 6,] Step Multiple R R^2 F SigF Variable(s) [ 7,] 1 0.8213 0.6745 22.799 0.001 In: X 4 [ 8,] 2 0.9861 0.9725 176.627 0.000 In: X 1 [ 9,] 3 0.9911 0.9823 166.832 0.000 In: X 2 [10,] [11,] Variable entered at Step Number 3: X 2 Contents of ANOVA [ 1,] [ 2,] A N O V A SS df MSS F-test P-value [ 3,] _________________________________________________________________________ [ 4,] Regression 2667.790 3 889.263 166.832 0.0000 [ 5,] Residuals 47.973 9 5.330 [ 6,] Total Variation 2716 12 226.314 [ 7,] [ 8,] Multiple R = 0.99113 [ 9,] R^2 = 0.98234 [10,] Adjusted R^2 = 0.97645 [11,] Standard Error = 2.30874 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,]= 71.6483 14.1424 0.0000 5.0662 0.0007 Constant [7,] b[ 1,]= 1.4519 0.1170 0.5677 12.4100 0.0000 X 1 [8,] b[ 2,]= 0.4161 0.1856 0.4304 2.2418 0.0517 X 2 [9,] b[ 3,]= -0.2365 0.1733 -0.2632 -1.3650 0.2054 X 4
| Library: | stats |
| See also: | linregstep linregbs linregopt gls linregfs linregres glm doglm |