I am trying to change the reference levels of a categorical variable to get the coefficients of a glm for the “0” group (which was the reference in the original variable). I changed the reference level of a variable with ‘ds.changeRefGroup’, checked the that levels were correctly changed with ‘ds.levels’, bound it to my data frame with ‘ds.cbind’, and checked again that the levels were correct. But no matter what manipulations I do, running ‘ds.glm’ or ‘ds.glmSLMA’ only produces coefficients based on the original reference group. I’ve tried following the examples at: R: Changes the reference level of a factor in the server-side.
Is there something else to do to get to use a different reference group in a glm? Thank you!
I guess the problem is with the ds.cbind. Are you using the same name for the categorical variable after changing the reference group? And if yes, when you cbind to you keep both versions, the original and the variable with the different reference level?
Thank you for following up on all my questions. It seems like there was some problem in the way I was assigning or binding variables, but now it is working for me! I can’t tell where the original error was because I didn’t make any obvious changes to the script. My best guess is that when I was first testing, I might have had different versions and objects with same names that I didn’t realize were being called because it was consistently giving the results with the unchanged reference group, no matter what manipulations I tried.
Apologies for the confusion, and thank you for the response!