Question

I have a GLM Logit regression that works correctly, but when I add a subset argument to the GLM command, I get the following error:

invalid type (list) for variable '(weights)'.

So, the following command works:

glm(formula = A ~ B + C,family = "binomial",data = Data)

But the following command yield the error:

glm(formula = A ~ B + C,family = "binomial",data = Data,subset(Data,D<10))

(I realize that it may be difficult to answer this without seeing my data, but any general help on what may be causing my problem would be greatly appreciated)

Was it helpful?

Solution

Try subset=D<10 instead (you don't need to specify Data again, it is implicitly used as the environment for the subset argument). Because you haven't named the argument, R is interpreting it as the weights argument (which is the next argument after data).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top