I have a data set with several categorical and quantitative variables. Say A, B, and C are categorical with several levels, X and Y are quantitative.

I know that X ~ A will basically just be a regression using dummy variables, and A ~ X will involve logistic regression. I believe either lm() or glm() can handle these.

However, I've run a regression in R on A ~ B, where categorical variables are read as factors, and it tells me

using type = "numeric" with a factor response will be ignored‘-’ not meaningful for factors‘^’ not meaningful for factors

I read elsewhere that these are all instances of a GLM and I know I've seen the glm() function used in R so I figured I would try that instead, and I get

‘-’ not meaningful for factors

I can see that the formula it's applying involves operations that can't meaningfully be done on factors. If I set family=binomial I get an output, but is that exactly what I want? I've never worked with a multinomial logisitic model but that seems to be what I'm doing and I haven't come across any resource finding that model using glm--so I'm not sure if I need to start using other functions. At this point I'm kind of going off of a sequence of guesses and increasingly unsure that even if I silence all the error messages I'll actually be looking at an output that means what I think it means.

Moreover I may want to look at, say, A ~ B + C + B*C + X + Y + X*Y. If I were to do that, again my question is whether I should be finding a way to get the glm() function to make it happen, or should I be researching other functions?

| cite | improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.