cocobot {PResiduals} | R Documentation |
Conditional continuous by ordinal tests for association.
Description
cocobot
tests for independence between an ordered categorical
variable, X, and a continuous variable, Y, conditional on other variables,
Z. The basic approach involves fitting an ordinal model of X on
Z, a linear model of Y on Z, and then determining whether there is any
residual information between X and Y. This is done by
computing residuals for both models, calculating their correlation, and
testing the null of no residual correlation. This procedure is analogous to test statistic
T2
in cobot
. Two test statistics (correlations) are currently output. The first
is the correlation between probability-scale residuals. The second is the correlation between
the observed-minus-expected residual for the continuous outcome model and a latent variable residual
for the ordinal model (Li C and Shepherd BE, 2012).
Usage
cocobot(
formula,
data,
link = c("logit", "probit", "cloglog", "loglog", "cauchit"),
subset,
na.action = getOption("na.action"),
emp = TRUE,
fisher = TRUE,
conf.int = 0.95
)
Arguments
formula |
an object of class |
data |
an optional data frame, list or environment (or object
coercible by |
link |
The link family to be used for the ordinal model of X on Z. Defaults to ‘logit’. Other options are ‘probit’, ‘cloglog’, ‘loglog’, and ‘cauchit’. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
action to take when |
emp |
logical indicating whether the residuals from the model of
Y on Z are computed based on the assumption of normality ( |
fisher |
logical indicating whether to apply fisher transformation to compute confidence intervals and p-values for the correlation. |
conf.int |
numeric specifying confidence interval coverage. |
Details
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. The ordinal variable, X
, must precede the |
and be a factor variable, and Y
must be continuous.
Value
object of ‘cocobot’ class.
References
Li C and Shepherd BE (2012) A new residual for ordinal outcomes. Biometrika. 99: 473–480.
Shepherd BE, Li C, Liu Q (2016) Probability-scale residuals for continuous, discrete, and censored data. The Canadian Journal of Statistics. 44: 463–479.
Examples
data(PResidData)
cocobot(y|w ~ z, data=PResidData)