cobot
tests for independence between two ordered categorical
variables, X and Y conditional on other variables,
Z. The basic approach involves fitting models of X on
Z and Y on Z and determining whether there is any
remaining information between X and Y. This is done by
computing one of 3 test statistics. T1
compares empirical
distribution of X and Y with the joint fitted
distribution of X and Y under independence conditional
on Z. T2
computes the correlation between ordinal
(probability-scale) residuals from both models and tests the null
of no residual correlation. T3
evaluates the
concordance--disconcordance of data drawn from the joint fitted
distribution of X and Y under conditional independence
with the empirical distribution. Details are given in Li C and
Shepherd BE, Test of association between two ordinal variables
while adjusting for covariates. Journal of the American Statistical
Association 2010, 105:612-620.
cobot(
formula,
link = c("logit", "probit", "cloglog", "loglog", "cauchit"),
link.x = link,
link.y = link,
data,
subset,
na.action = na.fail,
fisher = TRUE,
conf.int = 0.95
)
an object of class Formula
(or one
that can be coerced to that class): a symbolic description of the
model to be fitted. The details of model specification are given
under ‘Details’.
The link family to be used for ordinal models of both X and Y. Defaults to logit. Other options are probit, cloglog,loglog, and cauchit.
The link function to be used for a model of the first
ordered variable. Defaults to value of link
.
The link function to be used for a model of the
second variable. Defaults to value of link
.
an optional data frame, list or environment (or object
coercible by as.data.frame
to a data frame)
containing the variables in the model. If not found in
data
, the variables are taken from
environment(formula)
, typically the environment from which
cobot
is called.
an optional vector specifying a subset of observations to be used in the fitting process.
how NA
s are treated.
logical; if TRUE
, Fisher transformation and delta method a
used to compute p value for the test statistic based on correlation of
residuals.
numeric specifying confidence interval coverage.
object of cobot class.
formula is specified as X | Y ~ Z
.
This indicates that models of X ~ Z
and
Y ~ Z
will be fit. The null hypothsis to be
tested is \(H_0 : X\) independant of Y conditional
on Z.
Note that T2
can be thought of as an adjusted rank
correlation.(Li C and Shepherd BE, A new residual for ordinal
outcomes. Biometrika 2012; 99:473-480)
Li C and Shepherd BE, Test of association between two ordinal variables while adjusting for covariates. Journal of the American Statistical Association 2010, 105:612-620.
Li C and Shepherd BE, A new residual for ordinal outcomes. Biometrika 2012; 99:473-480
# NOT RUN {
data(PResidData)
cobot(x|y~z, data=PResidData)
# }
Run the code above in your browser using DataLab