“R语言如何中心化”的版本间的差异

来自OBHRM百科
跳转至: 导航搜索
(创建页面,内容为“中心化(centering) ==总平均值中心化(Grand mean centering)== 如果您有一个数据框mydata,里面有变量Score。现在您希望对Score进...”)
(没有差异)

2022年1月28日 (五) 20:54的版本

中心化(centering)

总平均值中心化(Grand mean centering)

如果您有一个数据框mydata,里面有变量Score。现在您希望对Score进行总平均值中心化,具体操作如何:

mydata$Score_grand <- mydata$Score - mean(mydata$Score)

分组平均值中心化(Group mean centering)

> # group-mean centering of original ses variable called cses > mydata$cses <- mydata$ses - ave(mydata$ses,mydata$schoolid)