megabot {PResiduals} | R Documentation |
Conditional tests for association.
Description
megabot
tests for correlation between a variable, X, and another variable, Y,
conditional on other variables, Z. The basic approach involves fitting an specified model of X on
Z, a specified model of Y on Z, and then determining whether there is any
remaining 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. The test statistic output
is the correlation between probability-scale residuals. X and Y can
be continous or ordered discrete variables. megabot
replicates the functionality
of cobot
, cocobot
, and countbot
Usage
megabot(
formula,
data,
fit.x,
fit.y,
link.x = c("logit", "probit", "cloglog", "loglog", "cauchit", "logistic"),
link.y = c("logit", "probit", "cloglog", "loglog", "cauchit", "logistic"),
subset,
na.action = getOption("na.action"),
fisher = TRUE,
conf.int = 0.95
)
Arguments
formula |
an object of class |
data |
an optional data frame, list or environment (or object
coercible by |
fit.x , fit.y |
The fitting function used for the model of X or Y on Z. Options are ‘ordinal’, ‘lm’, ‘lm.emp’, ‘poisson’, ‘nb’, and ‘orm’. |
link.x , link.y |
The link family to be used for the ordinal model of X on Z. Defaults to ‘logit’. Other options are ‘probit’, ‘cloglog’,‘loglog’, ‘cauchit’, and ‘logistic’(equivalent with ‘logit’). Used only when ‘fit.x’ is either ‘ordinal’ or ‘orm’. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
action to take when |
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 hypothesis to be
tested is H_0 : X
independent of Y conditional
on Z.
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)
megabot(y|w ~ z, fit.x="ordinal", fit.y="lm.emp", data=PResidData)