1

I'm trying to create a logistic regression model with Response (responder / non-responder binomial variable, where response is an event) as dependent variable and Intercept and Treatment as independent variables. Example dataset:

 gender  TRTPN responseCategory 
  <chr>  <dbl> <chr>                         
1 MALE    2     SD                               
2 FEMALE  1     CR                               
3 MALE    2     PD                               
4 MALE    1     SD                            
5 FEMALE  1     PR                               
6 FEMALE  1     SD                    

What I'm doing is first, converting Treatment to a factor. Secondly, run a glm:

regression <- glm(responseCategoryfac ~ TRTPNfac, data = resp1, family = "binomial")
summary(regression)

the output is:

Call:
glm(formula = responseCategoryfac ~ TRTPNfac, family = "binomial", 
    data = resp1)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.3675   0.0831   0.0831   0.1661   0.1661  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)   4.2767     0.5035   8.495   <2e-16 ***
TRTPNfac2     1.3898     1.1211   1.240    0.215    

Could you please tell me why the TRTPNfac1 is included in Intercept? What I'm doing is correctly or not?

Thanks in advance

1 Answers1

-1

Well I can't reproduce your data and it appears you're making both TRTPN and responseCategory factors but if you're asking the question of whether you can simply suppress the intercept please see below...

gender <- c("Male", "Female", "Male", "Male", "Female", "Female")
TRTPN <- c(2,1,2,1,1,1)
responseCategory <- c("SD", "CR", "PD", "SD", "PR", "SD")
resp1 <- data.frame(gender, TRTPN, responseCategory)
resp1$TRTPNfac <- factor(resp1$TRTPN)
resp1$responseCategoryfac <- factor(resp1$responseCategory)
resp1
#>   gender TRTPN responseCategory TRTPNfac responseCategoryfac
#> 1   Male     2               SD        2                  SD
#> 2 Female     1               CR        1                  CR
#> 3   Male     2               PD        2                  PD
#> 4   Male     1               SD        1                  SD
#> 5 Female     1               PR        1                  PR
#> 6 Female     1               SD        1                  SD
summary(glm(responseCategoryfac ~ TRTPNfac, data = resp1, family = "binomial"))
#> 
#> Call:
#> glm(formula = responseCategoryfac ~ TRTPNfac, family = "binomial", 
#>     data = resp1)
#> 
#> Deviance Residuals: 
#>        1         2         3         4         5         6  
#>  0.00008  -1.66511   0.00008   0.75853   0.75853   0.75853  
#> 
#> Coefficients:
#>             Estimate Std. Error z value Pr(>|z|)
#> (Intercept)    1.099      1.155   0.951    0.341
#> TRTPNfac2     18.467   7604.236   0.002    0.998
#> 
#> (Dispersion parameter for binomial family taken to be 1)
#> 
#>     Null deviance: 5.4067  on 5  degrees of freedom
#> Residual deviance: 4.4987  on 4  degrees of freedom
#> AIC: 8.4987
#> 
#> Number of Fisher Scoring iterations: 18
summary(glm(responseCategoryfac ~ -1 + TRTPNfac, data = resp1, family = "binomial"))
#> 
#> Call:
#> glm(formula = responseCategoryfac ~ -1 + TRTPNfac, family = "binomial", 
#>     data = resp1)
#> 
#> Deviance Residuals: 
#>        1         2         3         4         5         6  
#>  0.00008  -1.66511   0.00008   0.75853   0.75853   0.75853  
#> 
#> Coefficients:
#>           Estimate Std. Error z value Pr(>|z|)
#> TRTPNfac1    1.099      1.155   0.951    0.341
#> TRTPNfac2   19.566   7604.235   0.003    0.998
#> 
#> (Dispersion parameter for binomial family taken to be 1)
#> 
#>     Null deviance: 8.3178  on 6  degrees of freedom
#> Residual deviance: 4.4987  on 4  degrees of freedom
#> AIC: 8.4987
#> 
#> Number of Fisher Scoring iterations: 18
Chuck P
  • 3,862
  • 3
  • 9
  • 20
  • Thank you very much for your answer! Do you think it not necessary to make both `TRTPN` and `responseCategory` factors? No I do not need to suppress Intercept, it should be included in the model. – Maria Kischenko May 16 '20 at 12:55