Learn R Programming

anchors (version 3.0-4)

cpolr: Censored ordered probit

Description

Censored ordered probit for analysis of anchoring vignettes. Used in the context of anchoring vignettes as a parametric model for breaking ties/interval in non-parametric ranks.

Usage

cpolr(formula, data, weights, start, ..., subset, na.action,
                 contrasts = NULL, Hess = TRUE, model = TRUE, method =
                 c("probit", "logistic", "cloglog", "cauchit"), debug = 0)

Arguments

formula
A formula representing 'C' range produced by anchors as a function of other variables: cbind(Cs, Ce) ~ x1 + x2
data
a data frame containing two columns Cs, Ce and the covariates identified in the formula.
weights
optional case weights in fitting. Default to 1.
start
initial values for the parameters. This is in the format 'c(coefficients, zeta)'
...
additional arguments to be passed to optim[stats], most often a 'control' argument.
subset
expression saying which subset of the rows of the data should be used in the fit. All observations are included by default.
na.action
a function to filter missing data.
contrasts
a list of contrasts to be used for some or all of the factors appearing as variables in the model formula.
Hess
logical for whether the Hessian (the observed information matrix) should be returned.
model
logical for whether the model matrix should be returned.
method
default is probit; alternatives are logistic or complementary log-log or cauchit (corresponding to a Cauchy latent variable and only available in R >= 2.1.0).
debug
additional printing if > 0

Value

  • An object of classes c("cpolr", "polr"). This has components
  • coefficientsthe coefficients of the linear predictor, which has no intercept.
  • zetathe intercepts for the class boundaries.
  • deviancethe residual deviance.
  • fitted.valuesa matrix, with a column for each level of the response.
  • levthe names of the response levels.
  • termsthe 'terms' structure describing the model.
  • df.residualthe number of residual degrees of freedoms, calculated using the weights.
  • edfthe (effective) number of degrees of freedom used by the model.
  • n, nobsthe (effective) number of observations, calculated using the weights. ('nobs' is for use by 'stepAIC').
  • callthe matched call.
  • convergencethe convergence code returned by optim.
  • niterthe number of function and gradient evaluations used by optim.
  • HessianHessian matrix from optim.

Details

For cpolr, cpolr.method default is probit; for additional options, see method option in polr

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. 4th edition. Springer.

Wand, Jonathan; Gary King; and Olivia Lau. (2007) ``Anchors: Software for Anchoring Vignettes''. Journal of Statistical Software. Forthcoming. copy at http://wand.stanford.edu/research/anchors-jss.pdf

Wand, Jonathan and Gary King. (2007) Anchoring Vignetttes in R: A (different kind of) Vignette copy at http://wand.stanford.edu/anchors/doc/anchors.pdf

Gary King and Jonathan Wand. "Comparing Incomparable Survey Responses: New Tools for Anchoring Vignettes," Political Analysis, 15, 1 (Winter, 2007): Pp. 46-66, copy at http://gking.harvard.edu/files/abs/c-abs.shtml.

See Also

anchors, polr

Examples

Run this code
data(freedom)

## an example of directly using cpolr:
ra <- anchors(self ~ vign1 + vign3 + vign6, data = freedom, method ="C")
freedom2 <- insert(freedom, ra )
out <- cpolr(cbind(Cs, Ce) ~ as.factor(country) + sex + educ, 
            data = freedom2)
summary(out)


## simplified in the context of anchors:
fo <- list(self= self ~ 1,
           vign = cbind(vign1,vign3,vign6) ~ 1,
           cpolr= ~ as.factor(country) + sex + educ)
ra2 <- anchors(self ~ vign1 + vign3 + vign6, data = freedom, method ="C")
summary(ra, ties="cpolr")

## AVERAGE fitted values
## conditional on observed 
fitted(ra2, ties="cpolr", unconditional=FALSE,average=TRUE)
## unconditional prediction
fitted(ra2, ties="cpolr", unconditional=TRUE,average=TRUE)

## fitted probability for each observation
## conditional on observed 
fitted(ra2, ties="cpolr", unconditional=TRUE, average=FALSE)
## unconditional prediction
fitted(ra2, ties="cpolr", unconditional=TRUE, average=FALSE)

Run the code above in your browser using DataLab