wqs_pt {wqspt} | R Documentation |
WQS permutation test
Description
wqs_pt
takes a gwqs
object as an input and runs the permutation
test (Day et al. 2022) to obtain an estimate for the p-value significance for
the WQS coefficient.
Usage
wqs_pt(
model,
niter = 200,
boots = NULL,
b1_pos = TRUE,
b1_constr = FALSE,
rs = FALSE,
plan_strategy = "multicore",
seed = NULL
)
Arguments
model |
A |
niter |
Number of permutation test iterations. |
boots |
Number of bootstrap samples for each permutation test WQS
regression iteration. If |
b1_pos |
A logical value that indicates whether beta values should be positive or negative. |
b1_constr |
Logical value that determines whether to apply positive or negative constraints in the optimization function for the weight optimization. |
rs |
A logical value indicating whether random subset implementation should be performed. |
plan_strategy |
Evaluation strategy for the plan function. You can choose among "sequential", "transparent", "multisession", "multicore", "multiprocess", "cluster" and "remote." See future::plan documentation for full details. |
seed |
(optional) Random seed for the permutation test WQS reference run. This should be the same random seed as used for the main WQS regression run. This seed will be saved in the "gwqs_perm" object as "gwqs_perm$seed". |
Details
To use wqs_pt
, we first need to run an initial WQS regression run while
setting validation = 0
. We will use this gwqs
object as the model argument
for the wqs_pt
function. Note that permutation test has so far only been
validated for linear WQS regression (i.e., family = "gaussian"
) or logistic
WQS regression (i.e., family = binomial(link = "logit")
), though the
permutation test algorithm should also work for all WQS GLMs. Therefore,
this function accepts gwqs
objects made with the following families:
"gaussian" or gaussian(link = "identity"), "binomial" or binomial() with
any accepted link function (e.g., "logit" or "probit"), "poisson" or
poisson(link="log"), "negbin" for negative binomial, and "quasipoisson" or
quasipoisson(link="log"). This function cannot currently accommodate gwqs
objects made with the "multinomial" family, and it is not currently able to
accommodate stratified weights or WQS interaction terms (e.g., y ~ wqs * sex
).
The argument boots
is the number of bootstraps for the WQS regression run
in each permutation test iteration. Note that we may elect a bootstrap count
boots
lower than that specified in the model object for the sake of
efficiency. If boots
is not specified, then we will use the same bootstrap
count in the permutation test WQS regression runs as that specified in the
model argument.
The arguments b1_pos
and rs
should be consistent with the inputs chosen
in the model object. The seed should ideally be consistent with the seed set
in the model object for consistency, though this is not required.
Value
wqs_pt
returns an object of class wqs_pt
, which contains:
perm_test |
List containing: (1) |
gwqs_main |
Main gWQS object (same as model input). |
gwqs_perm |
Permutation test reference gWQS object (NULL if model
|
References
Day, D. B., Sathyanarayana, S., LeWinn, K. Z., Karr, C. J., Mason, W. A., & Szpiro, A. A. (2022). A permutation test-based approach to strengthening inference on the effects of environmental mixtures: comparison between single index analytic methods. Environmental Health Perspectives, 130(8).
Day, D. B., Collett, B. R., Barrett, E. S., Bush, N. R., Swan, S. H., Nguyen, R. H., ... & Sathyanarayana, S. (2021). Phthalate mixtures in pregnancy, autistic traits, and adverse childhood behavioral outcomes. Environment International, 147, 106330.
Loftus, C. T., Bush, N. R., Day, D. B., Ni, Y., Tylavsky, F. A., Karr, C. J., ... & LeWinn, K. Z. (2021). Exposure to prenatal phthalate mixtures and neurodevelopment in the Conditions Affecting Neurocognitive Development and Learning in Early childhood (CANDLE) study. Environment International, 150, 106409.
Examples
library(gWQS)
# mixture names
PCBs <- names(wqs_data)[1:17] #half of the original 34 for quick computation
# create reference wqs object with 5 bootstraps
wqs_main <- gwqs(yLBX ~ wqs, mix_name = PCBs, data = wqs_data, q = 10,
validation = 0, b = 5, b1_pos = TRUE, b1_constr = FALSE,
plan_strategy = "multicore", family = "gaussian", seed = 16)
# Note: We recommend niter = 1000 for the main WQS regression. This example
# has a lower number of bootstraps to serve as a shorter test run.
# run permutation test
perm_test_res <- wqs_pt(wqs_main, niter = 3, b1_pos = TRUE)
# Note: The default value of niter = 200 is the recommended parameter value.
# This example has a lower niter in order to serve as a shorter test run.