Difficulty re-leveling variables in multivariable GLM

I'm doing a multivariable analysis using Poisson regression. Below is my code for the code.

HighBPGLM <- glm(formula = dta$HBP ~ dta$SmokingLVL + dta$alcohol + dta$hiv_status + dta$diabetes, family = poisson(link = log), data = dta, na.action = na.omit)

I re-leveled the smoking LVL to be "never" "current" "past"

Thus, the reference for the analysis should be never. However, when I run the regression, my output is (the exponentiated GLM summary):

FYI "...." represents the estimate

(Intercept) .....

dta$alcohol .....

dta$hiv_status .....

dta$diabetes .....

As you can see, I am missing the estimate and the levels for smokingLVL.

What did I do wrong? and how can I fix it to be

(Intercept) .....

dta$smokingLVL1 ....

dta$smokingLVL2 ....

dta$alcohol .....

dta$hiv_status .....

dta$diabetes .....

In your glm call, you set the data to come from plos.dta but your formula uses data from dta. Did you relevel in plos.dta? Try

HighBPGLM <- glm(formula = HBP ~ SmokingLVL + alcohol + hiv_status + diabetes, 
                  family = poisson(link = log), data = plos.dta, na.action = na.omit)

I apologize. That was an error from creating dummy variables. It's edited now to dta. Thanks.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.