View source: R/PolyMRDataSim_Confounder.R
new_Confounder | R Documentation |
This function defines the Confounder
class for use with
PolyMRDataSim
. It is a simplified way to add a confounder to an
exposure-outcome pair, i.e. correlated error between two simulated
phenotypes.
new_Confounder(
sample_size,
exposure_confounding_function = get_polynomial_function(0.2),
outcome_confounding_function = get_polynomial_function(0.5)
)
sample_size |
Sample size of the simulated exposure-outcome data set. |
exposure_confounding_function |
A function that defines the confounder
contribution to the exposure (default is |
outcome_confounding_function |
A function that defines the confounder
contribution to the outcome (default is |
A list-like object of class Confounder
, containing a vector of
confounder values (confounder_values
) and functions to calculate the
confounder contribution to exposure and outcome (respectively
exposure_confounding_function
and
outcome_confounding_function
). Given an object polymr_data
of
class PolyMRDataSim
, the confounder can be applied through simple
addition, i.e. polymr_data + my_confounder
.
my_confounder <- new_Confounder(1000,
exposure_confounding_function = function(x) 0.3*x,
outcome_confounding_function = function(x) 0.1*x + 0.05*x^2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.