Description Usage Arguments Details See Also
View source: R/functions_outcome_model.R
Generates a 'standata_outcome' object from a 'long' data frame of outcome data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | create_standata_outcome(..., datalist = NULL, Mtlist = NULL, covarslist = NULL)
create_standata_outcome_singlestudy(
data = NULL,
unit_id = data$unit_id,
conc = data$conc,
study = data$study,
clust_id = data$clust_id,
case = data$case,
at_risk = data$at_risk,
covars = "1",
scale_covars = TRUE,
xdf = 1,
xfn = "iSpline",
xfnargs = list(),
Mt = NULL,
timefn = "ns",
timedf = 0,
timefnargs = list(),
return_addition = FALSE
)
|
... |
arguments passed to |
datalist |
List of data frames, containing the data in 'long' format. |
Mtlist |
time spline matrix, or a list of such matrices. |
covarslist |
list of covariate variable names for each study, or a list of covariate matrices. |
data |
Optional data frame containing data in a long format. |
unit_id |
Vector identifying the distinct unit (e.g. person) for each observation. |
conc |
Vector of exposure concentrations for each observation. |
study |
Vector identifying the study of each observation. |
clust_id |
Optional vector identifying cluster membership for each observation. |
case |
Count of cases for the observations. In most cases, this is a 0/1 indicator. |
at_risk |
Time at risk for the observation |
covars |
character vector of variables to include as covariates, or a vector/matrix of covariate values. Should not include an intercept. If a character vector, this intercept is automatically removed (so default of "1" leads to no covariates). |
scale_covars |
should the covariate matrix be centered and scaled? |
xdf |
Degrees of freedom for exposure splines |
xfn |
name of function used to generate exposure splines |
xfnargs |
named list of additional arguments for |
Mt |
Optional matrix of time splines |
timefn |
name of function used to generate time splines |
timedf |
degrees of freedom for time spline |
timefnargs |
named list of additional arugments to |
return_addition |
should the modified version of |
An important special case of create_standata_outcome
is when there is only a single study. In this case, the values are passed to create_standata_outcome_singlestudy
without pre-processing.
If using a separate temporal spline for each study, first compute the time splines for each study individually using create_spline
. Combine these into a list and pass that to Mtlist
.
The matrices of adjustment variables are created using the names provided to covarslist
. This is done using formula
and model.matrix
, so transformations and interactions can be used in the typical manner.
create_standata_exposure
, add_spline_exposure
, sample_outcome_model
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.