Learn R Programming

mplot (version 1.0.6)

lmfence: The fence procedure for linear models

Description

This function implements the fence procedure to find the best linear model.

Usage

lmfence(mf, cstar, nvmax, adaptive = TRUE, trace = TRUE, force.in = NULL, ...)

Arguments

mf

an object of class lm specifying the full model.

cstar

the boundary of the fence, typically found through bootstrapping.

nvmax

the maximum number of variables that will be be considered in the model.

adaptive

logical. If TRUE the boundary of the fence is given by cstar. Otherwise, it the original (non-adaptive) fence is performed where the boundary is cstar*hat(sigma)_M,tildeM.

trace

logical. If TRUE the function prints out its progress as it iterates up through the dimensions.

force.in

the names of variables that should be forced into all estimated models.

...

further arguments (currently unused)

References

Jiming Jiang, Thuan Nguyen, J. Sunil Rao, A simplified adaptive fence procedure, Statistics & Probability Letters, Volume 79, Issue 5, 1 March 2009, Pages 625-629, http://dx.doi.org/10.1016/j.spl.2008.10.014.

See Also

af, glmfence

Other fence: af(), glmfence()

Examples

Run this code
# NOT RUN {
n = 40 # sample size
beta = c(1,2,3,0,0)
K=length(beta)
set.seed(198)
X = cbind(1,matrix(rnorm(n*(K-1)),ncol=K-1))
e = rnorm(n)
y = X%*%beta + e
dat = data.frame(y,X[,-1])
# Non-adaptive approach (not recommended)
lm1 = lm(y~.,data=dat)
lmfence(lm1,cstar=log(n),adaptive=FALSE)
# }

Run the code above in your browser using DataLab