Questions tagged «factors»

1
在lm公式中删除变量仍会触发对比度误差
我试图仅对数据的一部分运行lm(),并遇到问题。 dt = data.table(y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100), x3 = as.factor(c(rep('men',50), rep('women',50)))) # sample data lm( y ~ ., dt) # Use all x: Works lm( y ~ ., dt[x3 == 'men']) # Use all x, limit to men: doesn't work (as expected) 上面的方法不起作用,因为数据集现在只有人,因此我们不能在模型中包括性别变量x3。但... lm( y …
9 r  formula  lm  factors 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.