splitFrame(robustbase)
splitFrame()所属R语言包:robustbase
Split Continuous and Categorical Predictors
分连续和分类预测
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Splits the design matrix into categorical and continuous predictors. Categorical variables are variables that are factors or ordered factors.
将设计矩阵分类和连续预测。分类变量的变量因素或有序因素。
用法----------Usage----------
splitFrame(mf, x = model.matrix(mt, mf),
type = c("f","fi", "fii"))
参数----------Arguments----------
参数:mf
model frame (as returned by model.frame).
模型框架(返回model.frame)。
参数:x
(optional) design matrix, defaulting to the derived model.matrix.
(可选)设计矩阵,违约派生model.matrix。
参数:type
a character string specifying the split type (see details).
指定分割的一个字符串类型(见详情)。
Details
详细信息----------Details----------
Which split type is used can be controlled with the setting split.type in lmrob.control.
可以控制设置split.type中所使用的分体式中lmrob.control。
There are three split types. The only differences between the types are how interactions between categorical and continuous variables are handled. The extra types of splitting can be used to avoid Too many singular resamples errors.
有三个分割类型。类型之间的唯一的区别是如何处理分类和连续变量之间的相互作用。可用于额外的分裂,以避免太多的奇异重新采样错误。
Type "f", the default, assigns only the intercept, categorical and interactions of categorical variables to x1. Interactions of categorical and continuous variables are assigned to x2.
类型"f",默认情况下,只有截距,分类和的分类变量x1互动分配。相互作用的分类和连续变量被分配到x2。
Type "fi" assigns also interactions between categorical and continuous variables to x1.
类型"fi"分配之间的相互作用的分类和连续变量x1。
Type "fii" assigns not only interactions between categorical and continuous variables to x1, but also the (corresponding) continuous variables themselves.
类型"fii"分配之间的相互作用不仅分类和连续变量x1的,但也(相应的)连续变量本身。
值----------Value----------
A list that includes the following components:
一个列表,包含以下组件:
参数:x1
design matrix containing only categorical variables
设计矩阵只包含分类变量
参数:x1.idx
logical vectors of the variables considered categorical in the original design matrix
逻辑向量的变量考虑在原来的设计矩阵的分类
参数:x2
design matrix containing the continuous variables
设计包含连续变量的矩阵
(作者)----------Author(s)----------
Manuel Koller
参考文献----------References----------
Robust regression with both continuous and categorical predictors. Journal of Statistical Planning and Inference 89, 197–214.
参见----------See Also----------
lmrob.M.S
lmrob.M.S
实例----------Examples----------
data(education)
education <- within(education, Region <- factor(Region))
## no interactions -- same split for all types:[#无相互作用 - 所有类型的相同的分裂:]
fm1 <- lm(Y ~ Region + X1 + X2 + X3, education)
splt <- splitFrame(fm1$model)
str(splt)
## with interactions:[#相互作用:]
fm2 <- lm(Y ~ Region:X1:X2 + X1*X2, education)
s1 <- splitFrame(fm2$model, type="f" )
s2 <- splitFrame(fm2$model, type="fi" )
s3 <- splitFrame(fm2$model, type="fii")
cbind(s1$x1.idx,
s2$x1.idx,
s3$x1.idx)
rbind(p.x1 = c(ncol(s1$x1), ncol(s2$x1), ncol(s3$x1)),
p.x2 = c(ncol(s1$x2), ncol(s2$x2), ncol(s3$x2)))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|