sim_outnode: Internal: Simulate from the post intervention distribution...

View source: R/joint_PAF.R

sim_outnodeR Documentation

Internal: Simulate from the post intervention distribution corresponding to eliminating a risk factor

Description

Internal: Simulate from the post intervention distribution corresponding to eliminating a risk factor

Usage

sim_outnode(data, col_num, current_mat, parent_list, col_list, model_list)

Arguments

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

Value

An updated data frame (a new version of current_mat) with new columns simulated for variables that the risk factor causally effects.


graphPAF documentation built on Oct. 20, 2022, 5:06 p.m.