sim_rstar_glm {holi} | R Documentation |
Simulate Data and Fit GLM and r* Models
Description
This function generates simulated data for main and control groups, fits a generalized linear model (GLM) and an r* model, and returns the results.
Usage
sim_rstar_glm(
n_main,
n_covariates,
true_coef_main,
n_control = NULL,
true_coef_control = NULL,
treatment_effect = NULL,
model = c("logistic", "linear", "poisson"),
skewness_main = NULL,
skewness_control = NULL,
Sigma_main = NULL,
Sigma_control = NULL,
...
)
Arguments
n_main |
Number of observations in the main group. |
n_covariates |
Number of covariates. |
true_coef_main |
True coefficients for the main group. |
n_control |
Number of observations in the control group. |
true_coef_control |
True coefficients for the control group. |
treatment_effect |
Treatment effect size. |
model |
Type of model: "logistic", "linear", or "poisson". |
skewness_main |
Skewness for the main group covariates. |
skewness_control |
Skewness for the control group covariates. |
Sigma_main |
Covariance matrix for the main group covariates. |
Sigma_control |
Covariance matrix for the control group covariates. |
... |
Additional arguments passed to |
Value
A list with fitted GLM and r* models, and the simulated data.
References
Pierce, D. A., & Bellio, R. (2017). Modern Likelihood-Frequentist Inference. International Statistical Review / Revue Internationale de Statistique, 85(3), 519–541. doi:10.1111/insr.12232
Bellio R, Pierce D (2020). likelihoodAsy: Functions for Likelihood Asymptotics. R package version 0.51, https://CRAN.R-project.org/package=likelihoodAsy.
Examples
sim_result <- sim_rstar_glm(
n_main = 100, n_covariates = 2, true_coef_main = c(0.5, -0.3),
n_control = 100, true_coef_control = c(0.2, -0.1),
treatment_effect = 0.5, model = "logistic"
) |> suppressWarnings()