0

I am trying to evaluate the assumption of linearity of the log odds of an outcome in relation to continuous predictors by using the boxTidwell function in R. When i try to run these analyses, I am getting en error message (see below), which I believe is due to the fact that there are 0's in my continuous predictors.

x1 <- glm(hereverage20 ~  scstot1f_r + sctcp1f + scpli_rrc1f + sscpag1f, data = ec, family = binomial(link="logit"))
logodds <- x1$linear.predictors
boxTidwell(logodds ~ ec$scstot1f_r + ec$sctcp1f + ec$scpli_rrc1f + ec$sscpag1f)
Error in boxTidwell.default(y, X1, X2, max.iter = max.iter, tol = tol,  : 
  the variables to be transformed must have only positive values

I have 2 questions. Is there anyway I can get this test to work?

One of the things that I did was plot the relationship between each continuous predictor and the log odds of the outcome and it looked like there was a quadratic relationship between the variable and the log odds of the outcome. In this case, what would one recommend doing?

Robert Long
  • 53,316
  • 10
  • 84
  • 148
D. Fowler
  • 111
  • 5
  • duplicate question: https://stats.stackexchange.com/questions/1444/how-should-i-transform-non-negative-data-including-zeros – StatsStudent Aug 29 '20 at 06:47
  • I don't see any questions about what to do if the relationship between a predictor and the log odds of an outcome is quadratic in nature. can someone please provide guidance on this? – D. Fowler Aug 29 '20 at 17:43

0 Answers0