
Last chance! 50% off unlimited learning
Sale ends in
grepolr(formula, subjects, data, times, categories, scalevalue = 1, corstr = "independence", maxiter = 10, tol = 0.001, alpha = 0.5, po.test = FALSE, fixed = FALSE, poly = 3, space = NULL)
ar1
uniform
independence
alpha
) during model fitting.categories
}gee
grepolr
function fits generalized estimating equations using the same algorithm as repolr
, and the majority of arguments are the same for both functions. However, rather than estimate K-1 cut-point parameters, as function repolr
does, function grepolr
fits orthogonal polynomial contrasts to model the cut-point parameters. This is particularly useful for long ordinal scores, where K is large, or where a particular form for the cut-point parameters is preferred; e.g. increasing uniformaly at the extremes of the score scale. The function requires two additional arguments, poly
and space
, that indicate the order of the polynomial and the spacing between categories. The latter is normally set to 1:{categories
} when all categories are observed, but can be modified to provide more realsitic models if for instance some categories are not observed.repolr
, srepolr
## conventional equal spacing model
data(QoL)
base.mod <- repolr(QoL~factor(Time)+factor(Treat),subjects="Patient",
data=QoL, categories=10, times=c(1,2,3))
## linear polynomial
space <- 1:10
mod1 <- grepolr(QoL~factor(Time)+factor(Treat),subjects="Patient",
data=QoL, categories=10, times=c(1,2,3),poly=1,space=space)
## cubic polynomial
mod3 <- grepolr(QoL~factor(Time)+factor(Treat),subjects="Patient",
data=QoL, categories=10, times=c(1,2,3),poly=3,space=space)
summary(mod3[["gee"]])
print(paste(round(QIC(base.mod),2),round(QIC(mod3),2),round(QIC(mod1),2)))
## plot cut-point models
plot(x=space[2:10],y=base.mod$gee$coeff[1:9],type="p",xlim=c(1,10),ylab="Cut-points",
xlab="Category Divisions")
lines(x=space[2:length(space)],y=polycuts(mod1),type="l",lty=2)
lines(x=space[2:length(space)],y=polycuts(mod3),type="l",lty=1)
## alternative spacing model
space2 <- c(1,1.5,3,5,5.5,7,7.25,8,9,10)
base.modx <- grepolr(QoL~factor(Time)+factor(Treat),subjects="Patient",
data=QoL, categories=10, times=c(1,2,3),corstr="uniform",poly=8,space=space2)
## cubic polynomial
modx <- grepolr(QoL~factor(Time)+factor(Treat),subjects="Patient",
data=QoL, categories=10, times=c(1,2,3),corstr="uniform",poly=3,space=space2)
summary(modx[["gee"]])
lines(x=space2[2:length(space2)],y=polycuts(modx),type="l",lty=1,col=2)
points(x=space2[2:length(space2)],y=polycuts(base.modx),type="p",col=2)
Run the code above in your browser using DataLab