estimate.wqs.formula {miWQS} | R Documentation |
Formula for WQS Regression
Description
A wrapper function for estimate.wqs
to use a formula instead.
Usage
estimate.wqs.formula(formula, data, chem_mix, ..., verbose = FALSE)
Arguments
formula |
An object of class "formula" that consists of an outcome, chemical mixture, and covariates, if any. See |
data |
The data in a data-frame format |
chem_mix |
Indices or column names of variables to be combined into an index. |
... |
Additional WQS parameters passed to |
verbose |
Logical; if TRUE, prints more information. Useful to check for any errors in the code. Default: FALSE. |
See Also
Other wqs:
analyze.individually()
,
coef.wqs()
,
do.many.wqs()
,
estimate.wqs()
,
make.quantile.matrix()
,
plot.wqs()
,
print.wqs()
Examples
# Example 1
set.seed(232)
test.data <- data.frame(x1 = rlnorm(100, 3, 1), x2 = rlnorm(100, 5, 1),
z1 = rlnorm(100, 10, 3), z2 = rbinom(100, 1, 0.7),
y = rnorm(100, 100, 15)
)
estimate.wqs.formula(y ~ ., data = test.data, chem_mix = c("x1", "x2"))
## Not run:
# Example 2: No covariates
estimate.wqs.formula(y ~ x1 + x2, data = test.data, chem_mix = 1:2)
# Example 3: NA in Z
test.data$z1[10] <- NA
estimate.wqs.formula(y ~ ., data = test.data, chem_mix = c("x1", "x2"))
# Example 4: NA in Z and y
test.data$y[1] <- NA
estimate.wqs.formula(y ~ ., data = test.data, chem_mix = c("x1", "x2"))
# Example 5: NA in Z, X, and y
test.data$x1[2] <- NA
estimate.wqs.formula(y ~ ., data = test.data, chem_mix = c("x1", "x2"),
place.bdls.in.Q1 = TRUE
)
# due to time constraints
## End(Not run)
[Package miWQS version 0.4.4 Index]