I have a dichotomous outcome (gallstones/no gallstones) and an ordinal predictor variable consisting of four classes (body mass index <25(ref.), 25-30, 30-35, 35-45). I want to perform a test for trend using R.
When running the glm function only the bmi 35-45 is significantly associated to the outcome (gallstones):
glm(formula = gallstones ~ bmi, family = binomial, data = m)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.9282 -0.4058 -0.3624 -0.3624 2.3477
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.6902 0.1476 -18.223 < 2e-16 ***
bmi(25,30] 0.2347 0.2131 1.102 0.2706
bmi(30,35] 0.6108 0.3291 1.856 0.0635 .
bmi(35,45] 2.0712 0.4915 4.214 2.51e-05 ***
To examine if there is a dose-response relationship with a linear trend with rising bmi I perform the analysis of variance with the chi square test:
anova(inc_test_3, test="Chisq")
Analysis of Deviance Table
Model: binomial, link: logit
Response: gallstones
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev Pr(>Chi)
NULL 1489 810.05
bmi 3 15.892 1486 794.16 0.001193 **
It seems that there is significant difference between the obtained estimates from the ordinal bmi predictor.
Is this the correct way to do a test of trend on an ordinal variable?