Retinopathy - Sequential Logit Models
library(catdata)
## Loading required package: MASS
data(retinopathy)
For sequential models again the ”vglm”–function from the ”VGAM”–library is needed, but now family option ”sratio” is required.
library(VGAM)
## Loading required package: stats4
## Loading required package: splines
Now several sequential logit models are fitted and compared by their corresponding deviances. The first model is the sequential logit model with all category–specific effects, so the option ”parallel=FALSE” is used.
seqm1 <- vglm(RET ~ SM + DIAB + GH + BP, family = sratio (link="logitlink", parallel=FALSE), data = retinopathy) deviance(seqm1)
## [1] 891.4193
No category–specific effect for DIAB:
seqm2 <- vglm(RET ~ SM + DIAB + GH + BP, family = sratio (link="logitlink", parallel=FALSE ~ SM + GH + BP), data = retinopathy) deviance(seqm2)
## [1] 891.4428
Testing the removed effect:
1-pchisq(deviance(seqm2)-deviance(seqm1), df=1)
## [1] 0.8781324
No category–specific effect for GH:
seqm3 <- vglm(RET ~ SM + DIAB + GH + BP, family = sratio (link="logitlink", parallel=FALSE ~ SM + BP), data = retinopathy) deviance(seqm3)
## [1] 891.4689
Testing the removed effect:
1-pchisq(deviance(seqm3)-deviance(seqm2), df=1)
## [1] 0.8716468
No category–specific effect for BP:
seqm4 <- vglm(RET ~ SM + DIAB + GH + BP, family = sratio (link="logitlink", parallel=FALSE ~ SM), data = retinopathy) deviance(seqm4)
## [1] 891.9767
Testing the removed effect:
1-pchisq(deviance(seqm4)-deviance(seqm3), df=1)
## [1] 0.4760739
No category–specific effect for GH (only global effects):
seqm5 <- vglm(RET ~ SM + DIAB + GH + BP, family = sratio (link="logitlink", parallel=TRUE), data = retinopathy) deviance(seqm5)
## [1] 897.7104
Testing the removed effect:
1-pchisq(deviance(seqm5)-deviance(seqm4), df=1)
## [1] 0.01664239
As the last test is significant, model ”seqm4” is analyzed in detail.
summary(seqm4)
## ## Call: ## vglm(formula = RET ~ SM + DIAB + GH + BP, family = sratio(link = "logitlink", ## parallel = FALSE ~ SM), data = retinopathy) ## ## Coefficients: ## Estimate Std. Error z value Pr(>|z|) ## (Intercept):1 11.12783 1.16861 9.522 < 2e-16 *** ## (Intercept):2 10.91554 1.21342 8.996 < 2e-16 *** ## SM:1 -0.37755 0.20248 -1.865 0.0622 . ## SM:2 0.49077 0.31285 1.569 0.1167 ## DIAB -0.12823 0.01229 -10.430 < 2e-16 *** ## GH -0.42480 0.06730 -6.312 2.76e-10 *** ## BP -0.06227 0.01220 -5.104 3.33e-07 *** ## --- ## Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1 ## ## Names of linear predictors: logitlink(P[Y=1|Y>=1]), logitlink(P[Y=2|Y>=2]) ## ## Residual deviance: 891.9767 on 1219 degrees of freedom ## ## Log-likelihood: -445.9884 on 1219 degrees of freedom ## ## Number of Fisher scoring iterations: 6 ## ## ## Exponentiated coefficients: ## SM:1 SM:2 DIAB GH BP ## 0.6855376 1.6335785 0.8796526 0.6539010 0.9396286
The summary gives no p–values for the individual covariates, they have to be computed separately. For this purpose the t–values are copied from the summary. The quadratic t–values are the wald–statistics which can be used to produce the individual p–values.
p–value intercept1:
1 - pchisq(9.5223^2, df=1)
## [1] 0
p–value intercept2:
1 - pchisq(8.9957^2, df=1)
## [1] 0
p–value SM1:
1 - pchisq((-1.8646)^2, df=1)
## [1] 0.06223749
p–value SM2:
1 - pchisq(1.5687^2, df=1)
## [1] 0.1167179
p–value DIAB:
1 - pchisq((-10.4303)^2, df=1)
## [1] 0
p-value GH:
1 - pchisq((-6.3116)^2, df=1)
## [1] 2.761653e-10
p–value BP:
1 - pchisq((-5.1037)^2, df=1)
## [1] 3.330761e-07
To receive the corresponding odds–ratios, the following command can be used.
exp(coefficients(seqm4)[3:7])
## SM:1 SM:2 DIAB GH BP ## 0.6855376 1.6335785 0.8796526 0.6539010 0.9396286