Giter VIP home page Giter VIP logo

franklelechen / code_3levelhte Goto Github PK

View Code? Open in Web Editor NEW

This project forked from billytian/code_3levelhte

0.0 0.0 0.0 136 KB

This repository includes R code for reproducing Figure 2 and 3, Table 1 to 3, Web Table 1 to 6, and Web Figure 1 in the paper [Li F, Chen X, Tian Z, Esserman DA, Heagerty PJ, Wang R. Planning Three-Level Cluster Randomized Trials to Assess Treatment Effect Heterogeneity. Under Review.]

R 100.00%

code_3levelhte's Introduction

code_3levelHTE

This repository includes an R file that has the functions to implement all the sample size and power methods developed in the paper [Li F, Chen X, Tian Z, Esserman DA, Heagerty PJ, Wang R. Planning Three-Level Cluster Randomized Trials to Assess Treatment Effect Heterogeneity. Under Review.]. Besides, R code for reproducing Figure 2 and 3, Table 1 to 3, Web Table 1 to 6, and Web Figure 1 in the manuscript is also provided in folders.

For questions or comments about the code, please contact Zizhong Tian at [email protected].

For the separate R file "sample size_power_calculations.R", it contains 2x3x3 functions that conveniently implement the sample size and power formulas for testing HTE, ATE, and unadjusted ATE under three levels of randomization scenarios. For the code that help to reproduce the simulations or plots in the paper, the descriptions are as follows:

I. Supporting Files: These supporting files are sourced in the corresponding main files that reproduce the simulation tables and illustrative plots in the main manuscript as well as the supplementary web appendix.

Folder: functions

  1. L1_sim_functions.R = functions about sample size/power formula and data generation under the scenario of level-1 (individual-level) randomization;
  2. L2_sim_functions.R = functions about sample size/power formula and data generation under the scenario of level-2 (subcluster-level) randomization;
  3. L3_sim_functions.R = functions about sample size/power formula and data generation under the scenario of level-3 (cluster-level) randomization;
  4. L1_plot_functions.R = functions used for data application under the scenario of level-1 (individual-level) randomization;
  5. L2_plot_functions.R = functions used for data application under the scenario of level-2 (subcluster-level) randomization;
  6. L3_plot_functions.R = functions used for data application under the scenario of level-3 (cluster-level) randomization;

II. Main Files: These main files are used to reproduce the simulation results and illustrative plots in the main manuscript as well as the web appendix.

Folder: simulations

  1. L1_HTE.R = reproduce the simulation table for testing HTE under level-1 randomization;
  2. L1_OTE.R = reproduce the simulation table for testing ATE under level-1 randomization;
  3. L1_OTE_unadj.R = reproduce the simulation table for testing unadjusted ATE under level-1 randomization;
  4. L2_HTE.R = reproduce the simulation table for testing HTE under level-2 randomization;
  5. L2_OTE.R = reproduce the simulation table for testing ATE under level-2 randomization;
  6. L2_OTE_unadj.R = reproduce the simulation table for testing unadjusted ATE under level-2 randomization;
  7. L3_HTE.R = reproduce the simulation table for testing HTE under level-3 randomization;
  8. L3_OTE.R = reproduce the simulation table for testing ATE under level-3 randomization;
  9. L3_OTE_unadj.R = reproduce the simulation table for testing unadjusted ATE under level-3 randomization;
  10. xtable.R = generate the LaTeX editing version of all table contents;

Folder: plots

  1. Remark_1_Level2.R = reproduce the illustrative variance plot regarding Remark 1 (level-2 randomization);
  2. Remark_1_Level3.R = reproduce the illustrative variance plot regarding Remark 1 (level-3 randomization);
  3. HALI_example_BaselineScore.R = reproduce the power analysis plot in the data application section;

III. Software

Analyses were conducted with R, version 4.0.3 (https://www.r-project.org/) The calculations used R packages nlme (version 3.1-143).

IV. R commands for the installation of R packages

install.packages(c("nlme"))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.