
Group variables via variable selection such that the grouped variables are optimal for multivariate analysis.
varGroup(x, z, zscope=NULL, k=qf(0.95,1,nrow(x)-2), kf=k/2,
method=c("pool","best"), direction=c("both","forward","backward"))
a data matrix/frame. Columns are variables to select from.
a data matrix/frame. Columns are variables with elements 1 or not 1 (any others).
which variables in z
to be used for grouping; all if "NULL".
entry/stay value in backward stepwise.
entry/stay value in forward stepwise.
grouping method at each step: pool all the groups selected from each zcope
variable, or choose the largest group (see examples).
forward selection, backward elimination or both stepwise.
indicators of grouped variables.
# NOT RUN {
data(etrait)
varGroup(traits, mdat, zscope=c(42,55), method="pool")
varGroup(traits, mdat, zscope=c(42,55), method="best")
# }
Run the code above in your browser using DataLab