Error: please supply starting values

后端 未结 1 1123
忘了有多久
忘了有多久 2021-01-18 17:12

I am conducting a log binomial regression in R. I want to control for covariates in the model (age and BMI- both continuous variables) whereas the dependent variable is Outc

1条回答
  •  执笔经年
    2021-01-18 17:16

    After some trial and error, using set.seed(123):

    coefini=coef(glm(Outcome~Group+Age, data=data.1,family =binomial(link = "log") ))
    fit2<-glm(Outcome~Group+Age+BMI, data=data.1, family=binomial(link="log"),start=c(coefini,0))
    
    summary(fit2)
    
    Call:
    glm(formula = Outcome ~ Group + Age + BMI, family = binomial(link = "log"), 
        data = data.1, start = c(coefini, 0))
    
    Deviance Residuals: 
        Min       1Q   Median       3Q      Max  
    -1.2457  -0.9699  -0.7725   1.2737   1.6799  
    
    Coefficients:
                  Estimate Std. Error z value Pr(>|z|)
    (Intercept) -1.5816964  1.0616813  -1.490    0.136
    Group1       0.4987848  0.3958399   1.260    0.208
    Age          0.0091428  0.0138985   0.658    0.511
    BMI         -0.0005498  0.0331120  -0.017    0.987
    
    (Dispersion parameter for binomial family taken to be 1)
    
        Null deviance: 65.342  on 49  degrees of freedom
    Residual deviance: 63.456  on 46  degrees of freedom
    AIC: 71.456
    
    Number of Fisher Scoring iterations: 3
    

    0 讨论(0)
提交回复
热议问题