zC(stats)
zC()所属R语言包:stats
Sets Contrasts for a Factor
套对比的一个因素
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Sets the "contrasts" attribute for the factor.
设置"contrasts"属性的因素。
用法----------Usage----------
C(object, contr, how.many, ...)
参数----------Arguments----------
参数:object
a factor or ordered factor
一个因素或有序因素
参数:contr
which contrasts to use. Can be a matrix with one row for each level of the factor or a suitable function like contr.poly or a character string giving the name of the function
对比使用。可以是一列的矩阵因子或合适的功能像contr.poly或给函数的名称字符串的每个级别
参数:how.many
the number of contrasts to set, by default one less than nlevels(object).
对比由默认的设置,比nlevels(object)。
参数:...
additional arguments for the function contr.
功能contr额外的参数。
Details
详情----------Details----------
For compatibility with S, contr can be treatment, helmert, sum or poly (without quotes) as shorthand for contr.treatment and so on.
与S的兼容性,contr能treatment,helmert,sum或poly(不含引号)为contr.treatment等速记。
值----------Value----------
The factor object with the "contrasts" attribute set.
因素object"contrasts"属性集。
参考文献----------References----------
Statistical models. Chapter 2 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
参见----------See Also----------
contrasts, contr.sum, etc.
contrasts,contr.sum等。
举例----------Examples----------
## reset contrasts to defaults[#重置为默认值的对比]
options(contrasts=c("contr.treatment", "contr.poly"))
tens <- with(warpbreaks, C(tension, poly, 1))
attributes(tens)
## tension SHOULD be an ordered factor, but as it is not we can use[#张力应是一个有序的因素,但因为它不是我们可以使用]
aov(breaks ~ wool + tens + tension, data=warpbreaks)
## show the use of ... The default contrast is contr.treatment here[#显示使用...这里默认对比度contr.treatment]
summary(lm(breaks ~ wool + C(tension, base=2), data=warpbreaks))
# following on from help(esoph)[下面就从帮助(esoph)]
model3 <- glm(cbind(ncases, ncontrols) ~ agegp + C(tobgp, , 1) +
C(alcgp, , 1), data = esoph, family = binomial())
summary(model3)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|