hurdlemsm_fit {qgcomp} | R Documentation |
Secondary prediction method for the (hurdle) qgcomp MSM.
Description
this is an internal function called by
qgcomp.hurdle.boot
,
but is documented here for clarity. Generally, users will not need to call
this function directly.
Usage
hurdlemsm_fit(
f,
qdata,
intvals,
expnms,
main = TRUE,
degree = 1,
id = NULL,
weights,
MCsize = 10000,
containmix = list(count = TRUE, zero = TRUE),
bayes = FALSE,
x = FALSE,
msmcontrol = hurdlemsm_fit.control(),
...
)
Arguments
f |
an r formula representing the conditional model for the outcome, given all
exposures and covariates. Interaction terms that include exposure variables
should be represented via the |
qdata |
a data frame with quantized exposures (as well as outcome and other covariates) |
intvals |
sequence, the sequence of integer values that the joint exposure is 'set' to for estimating the msm. For quantile g-computation, this is just 0:(q-1), where q is the number of quantiles of exposure. |
expnms |
a character vector with the names of the columns in qdata that represent the exposures of interest (main terms only!) |
main |
logical, internal use: produce estimates of exposure effect (psi) and expected outcomes under g-computation and the MSM |
degree |
polynomial bases for marginal model (e.g. degree = 2 allows that the relationship between the whole exposure mixture and the outcome is quadratic. Default=1) |
id |
(optional) NULL, or variable name indexing individual units of observation (only needed if analyzing data with multiple observations per id/cluster) |
weights |
not yet implemented |
MCsize |
integer: sample size for simulation to approximate marginal hazards ratios |
containmix |
named list of logical scalars with names "count" and "zero" |
bayes |
not used |
x |
keep design matrix? (logical) |
msmcontrol |
named list from |
... |
arguments to hurdle (e.g. dist) |
Details
This function first computes expected outcomes under hypothetical interventions to simultaneously set all exposures to a specific quantile. These predictions are based on g-computation, where the exposures are ‘quantized’, meaning that they take on ordered integer values according to their ranks, and the integer values are determined by the number of quantile cutpoints used. The function then takes these expected outcomes and fits an additional model (a marginal structural model) with the expected outcomes as the outcome and the intervention value of the exposures (the quantile integer) as the exposure. Under causal identification assumptions and correct model specification, the MSM yields a causal exposure-response representing the incremental change in the expected outcome given a joint intervention on all exposures.
See Also
qgcomp.cox.boot
, and qgcomp.cox.noboot
Examples
set.seed(50)
n=100
## Not run:
dat <- data.frame(y=rbinom(n, 1, 0.5)*rpois(n, 1.2), x1=runif(n), x2=runif(n), z=runif(n))
expnms = c("x1", "x2")
q = 4
qdata = quantize(dat, q=q, expnms=expnms)$data
f = y ~ x1 + x2 + z | 1
msmfit <- hurdlemsm_fit(f, qdata, intvals=(1:q)-1, expnms, main=TRUE,
degree=1, id=NULL, MCsize=10000, containmix=list(count=TRUE, zero=FALSE),
x=FALSE)
msmfit$msmfit
## End(Not run)