Learn R Programming

qtlmt (version 0.1-6)

mStep: Model selection in multivariate multiple regression

Description

Select a multivariate multiple regression model via model selection.

Usage

mStep(object, scope, direction=c("both","backward","forward"),
   trace=FALSE, keep=TRUE, steps=1000, k=2, ...)

Arguments

object

initial model in model search.

scope

a single formula, which provides `upper', or a list containing components `upper' and `lower', both formulae; defines the lower and upper bound. See step.

direction

forward selection, backward elimination or stepwise.

trace

whether to track the process for monitoring purpose.

keep

whether to return the change of terms and related statistics.

steps

maximum number of search steps.

k

penalty on a parameter. The selection criterion is the known "AIC" if k = 2 and is "BIC" if k = log(n) where "n" is the sample size.

...

additional arguments to update.

Value

a list with components of a lm object plus `keep' if required.

See Also

mAdd1 and mDrop1

Examples

Run this code
# NOT RUN {
data(etrait)
mdf<- data.frame(traits,markers)
# }
# NOT RUN {
mlm<- lm(cbind(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16) ~
   m1 + m2 + m3 + m4 + m5, data=mdf)

lw<- formula(paste("~ ", paste("m",1:3,collapse=" + ",sep="")))
up<- formula(paste("~", paste("m",1:15,collapse=" + ",sep="")))

ob<- mStep(mlm, scope=list(lower=lw), k=99, direction="backward", data=mdf)
of<- mStep(mlm, scope=list(upper=up), k=5, direction="forward", data=mdf)
o1<- mStep(mlm, scope=list(upper=up), k=5, direction="both", data=mdf)
o2<- mStep(o1, scope=list(upper=up), k=2, direction="forward", data=mdf)
# }

Run the code above in your browser using DataLab