PAsso {PAsso} | R Documentation |
Partial association analysis between ordinal responses after adjusting for a set of covariates
Description
This function is mainly designed for conducting the partial association analysis. It provides two ways of using:
1. A user-friendly way: only need "responses", "adjustments", and "data". All the rest of the argument will be setted as default (see Arguments for details of default).
2. An advanced way: user can input a list of fitted models by "fitted.models", then the
"responses" and "adjustments" are not necessary. Supported class of cumulative link models in
clm
, glm
, lrm
,
orm
, polr
, vglm
, .
It generates an object that has partial association matrix, marginal association, and some attributes: "arguments" saves c(association, method, resids.type). "responses" contains the names of response variables. The attribute "adjustments" contains the names of covariates. The "summary" function of "PAsso" class of object provides marginal association ' matrix for comparison purpose.
Usage
PAsso(
responses,
adjustments,
data,
uni.model = c("probit", "logit", "acat"),
models = NULL,
method = c("kendall", "pearson", "wolfsigma"),
resids.type = c("surrogate", "sign", "general", "deviance"),
jitter = c("latent", "uniform"),
jitter.uniform.scale = c("probability", "response"),
fitted.models = NULL,
n_draws = 20,
association = "partial",
...
)
Arguments
responses |
A string vector that specifies response variables. It requires to be equal or greater than two variables in the data frame. |
adjustments |
A string vector specifies covariates/confounders that need to be adjusted. |
data |
A data.frame including responses and adjustments. |
uni.model |
A character string specifying the universal model setting for all
responses. Default |
models |
A string vector contains default link functions of fitting models with
respect to each response variable. If |
method |
A string argument to specify correlation coefficient method.
Three choices |
resids.type |
A character string specifying which type of residuals to generate
Current options are
Although |
jitter |
A character string specifying how to generate surrogate residuals.
Current options are
|
jitter.uniform.scale |
A character string specifying the scale on which to perform
the jittering whenever |
fitted.models |
A list contains all the models (S3 objects) you want to
assess for the partial association between ordinal responses after adjusting
for a set of covariates covariates. All of these models should be applied to the
same dataset, having same covariates, same sample size etc. The models in this
list can be an object of class |
n_draws |
A number to specify draws of surrogate residuls
such that the partial correlation coefficients are calculated repeatedly. The final
correlation coefficients are the average of all partial correlation coefficients.
It is the |
association |
An default argument to specify the partial association. Leave this further development of package such that other association analyses can be embedded. |
... |
Additional optional arguments. |
Value
An object of class "PAsso"
is a list containing at least the following
components. It contains the partial correlation matrix and multiple repeats if
n_draws
> 1. This object has "arguments"
attribute saved as c(association, method, resids.type), "responses" attribute, and
"adjustments" attribute.
The list contains:
corr
The estimated correlation matrix(average of
rep_MatCorr
) of partial association after adjusting confounders;rep_corr
The replications of estimated correlation matrix;
rep_SRs
The replications of surrogate residuals if partial association is applied;
fitted.models
The list stores all fitted.models;
data
The data.frame of original dataset;
mods_n
The sample size of each fitted model;
cor_func
The correlation function after assign different method;
Marg_corr
The marginal association matrix.
References
Liu, D., Li, S., Yu, Y., & Moustaki, I. (2020). Assessing partial association between ordinal variables: quantification, visualization, and hypothesis testing. Journal of the American Statistical Association, 1-14. doi: 10.1080/01621459.2020.1796394
Liu, D., & Zhang, H. (2018). Residuals and diagnostics for ordinal regression models: A surrogate approach. Journal of the American Statistical Association, 113(522), 845-854. doi: 10.1080/01621459.2017.1292915
Li, C., & Shepherd, B. E. (2010). Test of association between two ordinal variables while adjusting for covariates. Journal of the American Statistical Association, 105(490), 612-620. doi: 10.1198/jasa.2010.tm09386
Li, C., & Shepherd, B. E. (2012). A new residual for ordinal outcomes. Biometrika, 99(2), 473-480. doi: 10.1093/biomet/asr073
Franses, P. H., & Paap, R. (2001). Quantitative models in marketing research. Cambridge University Press. doi: 10.1017/CBO9780511753794
Examples
###########################################################
# User-friendly way of using
###########################################################
library(MASS)
# Import ANES2016 data in "PAsso"
data(ANES2016)
# User-friendly way of using: Parial association analysis
PAsso_1 <- PAsso(responses = c("PreVote.num", "PID"),
adjustments = c("income.num", "age", "edu.year"),
data = ANES2016,
method = c("kendall"))
print(PAsso_1, digits = 4)
summary(PAsso_1, digits = 4)
###########################################################
# Advanced way of using
###########################################################
fit.vote<- glm(PreVote.num ~ income.num+ age + edu.year, data = ANES2016,
family = binomial(link = "probit"))
fit.PID<- polr(as.factor(PID) ~ income.num+age+edu.year, data = ANES2016,
method="probit", Hess = TRUE)
PAsso_adv1 <- PAsso(fitted.models=list(fit.vote, fit.PID),
method = c("kendall"),
resids.type = "surrogate")
print(PAsso_adv1, digits = 4)
summary(PAsso_adv1, digits = 4)