\HeaderA{maop}{Mixed Autoregressive Ordered Probit Models}{maop}
\aliasA{print.maop}{maop}{print.maop}
\aliasA{summary.maop}{maop}{summary.maop}
\keyword{Longitudinal data, ordinal categorical response, pairwise
likelihood, random effects.}{maop}
\begin{Description}\relax
Fits mixed autoregressive ordered probit models to a longitudinal data set by maximum pairwise likelihood.
\end{Description}
\begin{Usage}
\begin{verbatim}
maop(formula, subjects, periods=subjects, randomEffect=FALSE, 
dynamics=NULL, startValues=NULL, distance=2, print.info=TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{formula}] a formula expression of form
\code{response \textasciitilde{} predictors}. The response must be an ordinal factor.  The model fitted is a dynamic generalization of the ordered probit
regression model and it must have an intercept. See the
documentation of \code{\LinkA{formula}{formula}} for other details.

\item[\code{subjects}] identifier for the different subjects in the
longitudinal study. This is a vector of the same length of the response containing
identifiers for the different subjects. See the
example.
\item[\code{periods}] identifier for the different measurement periods of the subjects in the longitudinal study. The
default value is equal to that of \code{subjects} assuming one single measurement period for each patient. Otherwise, \code{periods} is a vector of the same length of the response containing
identifiers for the different measurement periods. See the
example. 
\item[\code{randomEffect}] logical. Should a subject-specific random effect be
included?
\item[\code{dynamics}] a factor whose levels correspond to different
autocorrelation parameters. The default value is \code{NULL}
indicating an unique autocorrelation parameter.
\item[\code{startValues}] starting values. The default value is \code{NULL}
meaning that starting values are computed automatically by the
\code{maop} function
\item[\code{distance}] maximal distance within pairs of observations included in the pseudolikelihood.
\item[\code{print.info}] logical. Should information about computation
status be printed?.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\acronym{MAOP} stands for
\emph{mixed autoregressive ordered probit} models, as described in
Varin and Czado (2009). Model fitting is performed by maximum pairwise
likelihood (Varin, 2008).
\end{Details}
\begin{Value}
An object of class \code{maop}. The
components of an object of the class \code{maop} are

\begin{ldescription}
\item[\code{formula}] fitted model.
\item[\code{subjects}] factor denoting different subjects.
\item[\code{periods}] factor denoting different measurement periods.
\item[\code{isRandomEffect}] whether a subject-specific random effect is
included in the model.
\item[\code{dynamics}] factor denoting different autocorrelation
parameters.
\item[\code{distance}] maximal admissible distance between pairs of observations.
\item[\code{startValues}] starting values.
\item[\code{coeff}] maximum pairwise likelihood estimator.
\item[\code{stdErr}] estimated standard errors.
\item[\code{varMatrix}] estimated variance-covariance matrix of the parameter estimates.
\item[\code{logPair}] maximized log-pairwise likelihood.
\item[\code{clic}] composite likelihood information criterion (Varin and  Vidoni, 2005).
\item[\code{convergence}] integer code as in \code{\LinkA{optim}{optim}} function.
\end{ldescription}
\end{Value}
\begin{Author}\relax
Cristiano Varin
\end{Author}
\begin{References}\relax
Varin, C. and Vidoni, P. (2005). A note on composite likelihood
inference and model selection. \emph{Biometrika}, \bold{92}, 519--528.

Varin, C. (2008). On composite marginal likelihoods. \emph{Advances in
Statistical Analysis}, \bold{92}, 1--28.

Varin, C. and Czado, C. (2009). A mixed autoregressive probit model for
ordinal longitudinal data. \emph{Biostatistics}, to appear.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{migraine}{migraine}}, \code{\LinkA{optim}{optim}}, \code{\LinkA{polr}{polr}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# Fits a MAOP model to migraine data (Varin and Czado, 2009)
data(migraine)
attach(migraine)
# covariates
university <-rep(0,length(HA))
university[ED==5]<-1
university[ED==6]<-1
university[ED==7]<-1
university <- as.factor(university==1)
analgesics <- as.factor(MEDANALG=="Y")
# weather covariates
wc <- factor(cut(MINWC, breaks=c(-50, -10, 0, 10, 30)))
high.pressure <- PMN>10130
high.pressure.yesterday <- PMN1P>10130
change <- rep("persistence", length(high.pressure))
change[(!high.pressure & high.pressure.yesterday)] <- "worse"
change[(high.pressure & !high.pressure.yesterday)] <- "better"
change <- factor(change)
humidity <- cut(RHMN, breaks=c(0, 60, 80, 100))
# model
m <- HA~university+analgesics+wc+humidity+change
# fit model m with different autocorrelation parameters 
# for patients with analgesics intake and those who not 
# try with pairwise likelihood with maximal distance 2
maop2 <- maop(m, subjects=SUBJECT, periods=PERIOD, randomEffect=TRUE, 
dynamics=analgesics, distance=2)
summary(maop2, digits=2)
# pairwise likelihood with maximal distance equals to 6 
maop6 <- maop(m, subjects=SUBJECT, periods=PERIOD, randomEffect=TRUE,
dynamics=analgesics, distance=6, startValues=maop2$coeff)
summary(maop6, digits=2)
\end{ExampleCode}
\end{Examples}

