glm coefficient for the reference level

37 Views Asked by At

I need to know the coefficient of every level of a glm.

Call:  glm(formula = Rep ~ ph_cat1, family = binomial(), data = db)

Coefficients:
(Intercept)     ph_cat12     ph_cat13  
      3.296       -3.381       -4.277  

Degrees of Freedom: 356 Total (i.e. Null);  354 Residual
  (27 osservazioni eliminate a causa di valori mancanti)
Null Deviance:      494.9 
Residual Deviance: 459.5    AIC: 465.5
> coef(full.model[-1])
NULL
> round(coef(full.model))
(Intercept)    ph_cat12    ph_cat13 
          3          -3          -4 

I've tried with +0 and +1

> full.model <- glm(Rep ~ ph_cat1 + 0  , data = db,family=binomial())
> full.model

Call:  glm(formula = Rep ~ ph_cat1 + 0, family = binomial(), 
   data = db)

Coefficients:
ph_cat11  ph_cat12  ph_cat13  
3.29584  -0.08474  -0.98083  

Degrees of Freedom: 357 Total (i.e. Null);  354 Residual
 (27 osservazioni eliminate a causa di valori mancanti)
Null Deviance:      494.9 
Residual Deviance: 459.5    AIC: 465.5
> full.model <- glm(Rep ~ ph_cat1 + 1  , data = db,family=binomial())
> full.model 

Call:  glm(formula = Rep ~ ph_cat1 + 1, family = binomial(), 
   data = db)

Coefficients:
(Intercept)     ph_cat12     ph_cat13  
     3.296       -3.381       -4.277  

Degrees of Freedom: 356 Total (i.e. Null);  354 Residual
 (27 osservazioni eliminate a causa di valori mancanti)
Null Deviance:      494.9 
Residual Deviance: 459.5    AIC: 465.5

I don't understand which one is the correct way to have the correct coefficient for every level.

0

There are 0 best solutions below