我想做以下事情并需要一些帮助:
分别计算“身高”超过“年龄”[lm(Height~Age)] 的斜率和截距
(A) 每个人
(二) 性别
并创建一个包含结果(斜率和截距)的表格。我可以为此使用“申请”吗?
在下一步中,我想做一个统计测试,以确定性别之间的斜率和截距是否显着不同。我知道如何在 R 中进行测试,但也许有一种方法可以结合斜率/截距计算和 T 检验。
示例数据:
example = data.frame(Age = c(1, 3, 6, 9, 12,
1, 3, 6, 9, 12,
1, 3, 6, 9, 12,
1, 3, 6, 9, 12),
Individual = c("Jack", "Jack", "Jack", "Jack", "Jack",
"Jill", "Jill", "Jill", "Jill", "Jill",
"Tony", "Tony", "Tony", "Tony", "Tony",
"Jen", "Jen", "Jen", "Jen","Jen"),
Gender = c("M", "M", "M", "M", "M",
"F", "F", "F", "F", "F",
"M", "M", "M", "M", "M",
"F", "F", "F", "F", "F"),
Height = c(38, 62, 92, 119, 165,
31, 59, 87, 118, 170,
45, 72, 93, 155, 171,
33, 61, 92, 115, 168))