estimate.wqs.formula: Formula for WQS Regression

Description Usage Arguments See Also Examples

View source: R/estimate_wqs_formula.R

Description

A wrapper function for estimate.wqs to use a formula instead.

Usage

1
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 stats::formula.

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 estimate.wqs. Note: data arguments (y, X, and Z) have no effect.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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)

miWQS documentation built on April 3, 2021, 1:06 a.m.