Learn R Programming

miWQS (version 0.4.4)

do.many.wqs: Performing Many WQS Regressions

Description

Second Stage of Multiple Imputation: In order to analyze a complete imputed chemical array (X.imputed), _n_ subjects by _C_ chemicals by _K_ imputations) via weighted quantile sum regression, do.many.wqs() repeatedly performs the same WQS analysis on each imputed dataset. It repeatedly executes the estimate.wqs() function.

Usage

do.many.wqs(y, X.imputed, Z = NULL, ...)

Arguments

y

Outcome: numeric vector or factor. Assumed to be complete, and missing outcomes are ignored. Assumed to follow an exponential family distribution given in family.

X.imputed

Array of complete components with n subjects and C components and K imputations. Must be complete.

Z

Any covariates used. Ideally, a numeric matrix, but Z can be a factor, vector or data-frame. Assumed to be complete; observations with missing covariate values are ignored with a warning printed. If none, enter NULL.

...

Additional arguments passed to estimate.wqs, but the arguments y, X, Z, and place.bdls.Q1 have no effect.

Value

Returns a list with elements that consist of matrix and list versions of estimate.wqs() output:

  • call: the function call, processed by rlist.

  • C: the number of chemicals in mixture, number of columns in X.

  • n: the sample size.

  • wqs.imputed.estimates: Array with rows = # of parameters, 2 columns = mean and standard deviation, and 3rd dimension = K.

  • AIC: The overall fit of WQS models taken as the mean AIC and standard error across all imputation models. Saved as a character element. Calling wqs.fit allows us to see all models.

  • train.index: Observations that are selected to train the data in the last WQS model.

  • q.train: Vector of quantiles used in training data from the last WQS model

  • train.comparison: A list of data-frames that compares the training and validation dataset for all WQS models.

  • initial: Matrix with K columns that contains the initial values used for each WQS analysis.

  • wqs.train.estimates: Data-frame with rows = B. Summarizes statistics from nonlinear regression in the training datasets of all analyses:

    beta1

    estimate using solnp

    beta1_glm, SE_beta1, test_stat, pvalue

    estimates of WQS parameter in model using glm2.

    convergence

    whether or not the samples have converged

    weight estimates

    estimates of weight for each bootstrap.

    imputed

    A number indicating the completed dataset used in WQS analysis.

  • wqs.fit: A list (length = K) of glm2 objects of the WQS model fit to validation data. These are all the WQS estimates for all analyses. See glm2.

See Also

Other wqs: analyze.individually(), coef.wqs(), estimate.wqs.formula(), estimate.wqs(), make.quantile.matrix(), plot.wqs(), print.wqs()

Examples

Run this code
# NOT RUN {
data("simdata87")
# Create 2 multiple imputed datasets using bootstrapping, but only use first 2 chemicals.
set.seed(23234)
l <- impute.boot(
  X = simdata87$X.bdl[, 1:2], DL = simdata87$DL[1:2],
  Z = simdata87$Z.sim[, 1], K = 2
)
# Perform WQS regression on each imputed dataset
set.seed(50679)
bayes.wqs <- do.many.wqs(
  y = simdata87$y.scenario, X.imputed = l$X.imputed,
  Z = simdata87$Z.sim,
  B = 10, family = "binomial"
)
bayes.wqs$wqs.imputed.estimates



# #' @importFrom scales ordinal
# }

Run the code above in your browser using DataLab