knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
rm(list=ls()) library(RobinCar)
Ting Ye, Jun Shao, Yanyao Yi, Qinyuan Zhao (2022+). Toward Better Practice of Covariate Adjustment in Analyzing Randomized Clinical Trials. Journal of the American Statistical Association, in press.
Ting Ye, Marlena Bannick, Yanyao Yi, Jun Shao (2023). Robust variance estimation for covariate-adjusted unconditional treatment effect in randomized clinical trials with binary outcomes. Statistical Theory and Related Fields, 7(2):159-163.
Marlena Bannick, Jun Shao, Jingyi Liu, Yu Du, Yanyao Yi, Ting Ye (2023+). A General Form of Covariate Adjustment in Randomized Clinical Trials.
The dataset that we will use for this is included in the package.
data <- RobinCar:::data_sim data$A <- as.factor(data$A)
fit.anova <- robincar_linear(df = data, response_col="y", treat_col="A", covariate_cols=c("x1", "x3"), car_scheme="simple", adj_method="ANOVA")
fit.ancova <- robincar_linear(df = data, response_col="y", treat_col="A", car_strata_cols=c("z1", "z2"), covariate_cols=c("x1", "x3"), car_scheme="biased-coin", adj_method="ANCOVA")
Include strata variables in the covariates.
fit.anhecova <- robincar_linear(df = data, response_col="y", treat_col="A", car_strata_cols=c("z1", "z2"), covariate_cols=c("x1", "x3", "z1", "z2"), car_scheme="pocock-simon", adj_method="ANHECOVA", contrast_h="diff")
Dichotomize the continuous outcome.
data$y_bin <- ifelse(data$y > 2, 1, 0)
glm.homogeneous<-robincar_glm(df = data, response_col="y_bin", treat_col="A", car_strata_cols=c("z1"), formula="y_bin ~ A", car_scheme="pocock-simon", g_family=binomial(link="logit"), g_accuracy=7) glm.homogeneous
glm.heterogeneous<-robincar_glm(df = data, response_col="y_bin", treat_col="A", car_strata_cols=c("z2"), formula="y_bin ~ A * (x1 + z2)", car_scheme="biased-coin", g_family=binomial(link="logit"), g_accuracy=7) glm.heterogeneous
glm.heterogeneous <- robincar_glm(df = data, response_col="y_bin", treat_col="A", car_strata_cols=c("z2"), formula="y_bin ~ A * (x1 + z2)", car_scheme="biased-coin", g_family=binomial(link="logit"), g_accuracy=7, contrast_h="diff") glm.heterogeneous
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.