This function creates a generative model of the outcome given a matrix of
predictors.
Usage
OutcomeModel(f, family = "gaussian", sigma = 1, f_args = list())
Value
An OutcomeModel object. Attributes:
f
mean function.
sigma
a number for the Gaussian observation noise.
family
a string 'gaussian' or 'binomial'.
Arguments
f
A string that describes the relationships between the predictors and
outcome or a function that takes an input matrix and returns a vector of
outcome: \(E(y|x) = g(f(x))\) where g is a link function that depends on
the family argument.
family
A string, 'gaussian', 'binomial', or 'poisson' for continuous,
binary, or count outcomes.
sigma
A number, Gaussian noise standard deviation if applicable.
# Define BMI as a ratio of weight and height plus random Gaussian error with standard deviation 1.bmi_model <- mpower::OutcomeModel(f = 'weight/(height^2)', sigma = 1, family = 'gaussian')