sim_outnode | R Documentation |
Internal: Simulate from the post intervention distribution corresponding to eliminating a risk factor
sim_outnode(data, col_num, current_mat, parent_list, col_list, model_list)
data |
Data frame. A dataframe containing the original variables used for fitting the models. Must contain all variables used in fitting |
col_num |
The indicator for the risk factor that is being eliminated |
current_mat |
The current value of the data frame |
parent_list |
A list. The ith element is the vector of variable names that are direct causes of ith variable in node_vec (Note that the variable names should be columns in data) |
col_list |
Column indicators for the variables in node_vec (note that node_vec is ordered from root to leaves) |
model_list |
List. A list of fitted models corresponding for the outcome variables in node_vec, with parents as described in parent_vec. This list must be in the same order as node_vec and parent_list. Models can be linear (lm), logistic (glm) or ordinal logistic (polr). Non-linear effects of variables (if necessary) should be specified via ns(x, df=y), where ns is the natural spline function from the splines library |
An updated data frame (a new version of current_mat) with new columns simulated for variables that the risk factor causally effects.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.