runm {unmconf} | R Documentation |
Generate synthetic data
Description
runm()
generates synthetic data for use of modeling with unmeasured
confounders. Defaults to the case of one unmeasured confounder present and
fixed parameter values. Can be customized. Currently set up to have at most
two unmeasured confounders to pair with unm_glm()
.
Usage
runm(
n,
type = "int",
missing_prop = 0.8,
response = "bin",
response_param = NULL,
response_model_coefs = c(int = -1, z1 = 0.5, z2 = 0.5, z3 = 0.5, u1 = 0.5, x = 0.5),
treatment_model_coefs = c(int = -1, z1 = 0.5, z2 = 0.5, z3 = 0.5, u1 = 0.5),
covariate_fam_list = list("norm", "bin", "norm"),
covariate_param_list = list(c(mean = 0, sd = 1), prob = 0.3, c(0, 2)),
unmeasured_fam_list = list("norm"),
unmeasured_param_list = list(c(mean = 0, sd = 1))
)
Arguments
n |
Number of observations. When |
type |
Type of validation source. Can be |
missing_prop |
Proportion of missing values for internal validation
scenario (i.e., when |
response |
|
response_param |
Nuisance parameters for response type. For |
response_model_coefs |
A named vector of coefficients to generate data
from the response model. This must include an intercept ( |
treatment_model_coefs |
A named vector of coefficients to generate data
from the treatment model. This must include an intercept ( |
covariate_fam_list |
A list of either |
covariate_param_list |
A list of parameters for the respective
distributions in |
unmeasured_fam_list |
A list of either |
unmeasured_param_list |
A list of parameters for the respective
distributions in |
Value
A tibble
Examples
runm(100)
runm(n = 100, type = "int", missing_prop = .75)
runm(n = 100, type = "int", missing_prop = .75) |> attr("params")
runm(100, type = "int", response = "norm")
runm(100, type = "int", response = "norm") |> attr("params")
runm(100, type = "int", response = "norm", response_param = 3) |> attr("params")
runm(100, type = "int", response = "gam")
runm(100, type = "int", response = "gam", response_param = 5) |> attr("params")
runm(100, type = "int", missing_prop = .5, response = "pois")
runm(n = 100, type = "ext")
runm(n = 100, type = "ext") |> attr("params")
runm(n = c(10, 10), type = "ext")
runm(100, type = "ext", response = "norm")
runm(100, type = "int", response = "norm", response_param = 3) |> attr("params")
runm(100, type = "ext", response = "gam")
runm(100, type = "ext", response = "pois")
runm(
n = 100,
type = "int",
missing_prop = .80,
response = "norm",
response_param = c("si_y" = 2),
response_model_coefs = c("int" = -1, "z" = .4,
"u1" = .75, "u2" = .75, "x" = .75),
treatment_model_coefs = c("int" = -1, "z" = .4,
"u1" = .75, "u2" = .75),
covariate_fam_list = list("norm"),
covariate_param_list = list(c(mean = 0, sd = 1)),
unmeasured_fam_list = list("norm", "bin"),
unmeasured_param_list = list(c(mean = 0, sd = 1), c(.3))
)
runm(
n = c(20, 30),
type = "ext",
response = "norm",
response_param = c("si_y" = 2),
response_model_coefs = c("int" = -1, "z1" = .4, "z2" = .5, "z3" = .4,
"u1" = .75, "u2" = .75, "x" = .75),
treatment_model_coefs = c("int" = -1, "z1" = .4, "z2" = .5, "z3" = .4,
"u1" = .75, "u2" = .75),
covariate_fam_list = list("norm", "bin", "norm"),
covariate_param_list = list(c(mean = 0, sd = 1), c(.3), c(0, 2)),
unmeasured_fam_list = list("norm", "bin"),
unmeasured_param_list = list(c(mean = 0, sd = 1), c(.3))
)