gs_info_rd: Information and effect size under risk difference

View source: R/gs_info_rd.R

gs_info_rdR Documentation

Information and effect size under risk difference

Description

Information and effect size under risk difference

Usage

gs_info_rd(
  p_c = tibble::tibble(Stratum = "All", Rate = 0.2),
  p_e = tibble::tibble(Stratum = "All", Rate = 0.15),
  N = tibble::tibble(Stratum = "All", N = c(100, 200, 300), Analysis = 1:3),
  rd0 = 0,
  ratio = 1,
  weight = c("un-stratified", "ss", "invar")
)

Arguments

p_c

rate at the control group

p_e

rate at the experimental group

N

sample size

rd0

the risk difference under H0

ratio

Experimental:Control randomization ratio

weight

weigting method, either "un-stratified" or "ss" or "invar"

Examples

library(tibble)
# --------------------- #
#      example 1        #
# --------------------- #
# un-stratified case with H0: rd0 = 0
gs_info_rd(
  p_c = tibble(Stratum = "All", Rate = .15),
  p_e = tibble(Stratum = "All", Rate = .1),
  N = tibble(Stratum = "All", N = c(100, 200, 300), Analysis = 1:3),
  rd0 = 0,
  ratio = 1
)

# --------------------- #
#      example 2        #
# --------------------- #
# un-stratified case with H0: rd0 != 0
gs_info_rd(
  p_c = tibble(Stratum = "All", Rate = .2),
  p_e = tibble(Stratum = "All", Rate = .15),
  N = tibble(Stratum = "All", N = c(100, 200, 300), Analysis = 1:3),
  rd0 = 0.005,
  ratio = 1
)

# --------------------- #
#      example 3        #
# --------------------- #
# stratified case under sample size weighting and H0: rd0 = 0
gs_info_rd(
  p_c = tibble(Stratum = c("S1", "S2", "S3"), Rate = c(.15, .2, .25)),
  p_e = tibble(Stratum = c("S1", "S2", "S3"), Rate = c(.1, .16, .19)),
  N = tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
             Analysis = rep(1:3, 3),
             N = c(50, 100, 200, 40, 80, 160, 60, 120, 240)),
  rd0 = 0,
  ratio = 1,
  weight = "ss")

# --------------------- #
#      example 4        #
# --------------------- #
# stratified case under inverse variance weighting and H0: rd0 = 0
gs_info_rd(
  p_c = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.15, .2, .25)),
  p_e = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.1, .16, .19)),
  N = tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
             Analysis = rep(1:3, 3),
             N = c(50, 100, 200, 40, 80, 160, 60, 120, 240)),
  rd0 = 0,
  ratio = 1,
  weight = "invar")

# --------------------- #
#      example 5        #
# --------------------- #
# stratified case under sample size weighting and H0: rd0 != 0
gs_info_rd(
  p_c = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.15, .2, .25)),
  p_e = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.1, .16, .19)),
  N = tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
             Analysis = rep(1:3, 3),
             N = c(50, 100, 200, 40, 80, 160, 60, 120, 240)),
  rd0 = 0.02,
  ratio = 1,
  weight = "ss")

# --------------------- #
#      example 6        #
# --------------------- #
# stratified case under inverse variance weighting and H0: rd0 != 0
gs_info_rd(
  p_c = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.15, .2, .25)),
  p_e = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.1, .16, .19)),
  N = tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
             Analysis = rep(1:3, 3),
             N = c(50, 100, 200, 40, 80, 160, 60, 120, 240)),
  rd0 = 0.02,
  ratio = 1,
  weight = "invar")

# --------------------- #
#      example 7        #
# --------------------- #
# stratified case under inverse variance weighting and H0: rd0 != 0 and 
# rd0 difference for different statum
gs_info_rd(
  p_c = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.15, .2, .25)),
  p_e = tibble(Stratum = c("S1", "S2", "S3"),
               Rate = c(.1, .16, .19)),
  N = tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
             Analysis = rep(1:3, 3),
             N = c(50, 100, 200, 40, 80, 160, 60, 120, 240)),
  rd0 = tibble(Stratum = c("S1", "S2", "S3"),
               rd0 = c(0.01, 0.02, 0.03)),
  ratio = 1,
  weight = "invar")


keaven/gsDesign2 documentation built on Oct. 13, 2022, 8:42 p.m.