-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathgs_info_rd.Rd
More file actions
164 lines (153 loc) · 4.15 KB
/
gs_info_rd.Rd
File metadata and controls
164 lines (153 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs_info_rd.R
\name{gs_info_rd}
\alias{gs_info_rd}
\title{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("unstratified", "ss", "invar", "mr")
)
}
\arguments{
\item{p_c}{Rate at the control group.}
\item{p_e}{Rate at the experimental group.}
\item{n}{Sample size.}
\item{rd0}{The risk difference under H0.}
\item{ratio}{Experimental:Control randomization ratio.}
\item{weight}{Weighting method, can be \code{"unstratified"}, \code{"ss"},
or \code{"invar"}.}
}
\value{
A tibble with columns as analysis index, sample size,
risk difference, risk difference under null hypothesis, theta1
(standardized treatment effect under alternative hypothesis),
theta0 (standardized treatment effect under null hypothesis),
and statistical information.
}
\description{
Information and effect size under risk difference
}
\examples{
# Example 1 ----
# unstratified case with H0: rd0 = 0
gs_info_rd(
p_c = tibble::tibble(stratum = "All", rate = .15),
p_e = tibble::tibble(stratum = "All", rate = .1),
n = tibble::tibble(stratum = "All", n = c(100, 200, 300), analysis = 1:3),
rd0 = 0,
ratio = 1
)
# Example 2 ----
# unstratified case with H0: rd0 != 0
gs_info_rd(
p_c = tibble::tibble(stratum = "All", rate = .2),
p_e = tibble::tibble(stratum = "All", rate = .15),
n = tibble::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::tibble(stratum = c("S1", "S2", "S3"), rate = c(.15, .2, .25)),
p_e = tibble::tibble(stratum = c("S1", "S2", "S3"), rate = c(.1, .16, .19)),
n = tibble::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::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.15, .2, .25)
),
p_e = tibble::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.1, .16, .19)
),
n = tibble::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 minimal risk weighting and H0: rd0 = 0
gs_info_rd(
p_c = tibble::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.15, .2, .25)
),
p_e = tibble::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.1, .16, .19)
),
n = tibble::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 = "mr"
)
# Example 6 ----
# stratified case under sample size weighting and H0: rd0 != 0
gs_info_rd(
p_c = tibble::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.15, .2, .25)
),
p_e = tibble::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.1, .16, .19)
),
n = tibble::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,
# users can switch to either "invar" or "mr" weighting as well
weight = "ss"
)
# Example 7 ----
# stratified case under inverse variance weighting and H0: rd0 != 0 and
# rd0 difference for different stratum
gs_info_rd(
p_c = tibble::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.15, .2, .25)
),
p_e = tibble::tibble(
stratum = c("S1", "S2", "S3"),
rate = c(.1, .16, .19)
),
n = tibble::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::tibble(
stratum = c("S1", "S2", "S3"),
rd0 = c(0.01, 0.02, 0.03)
),
ratio = 1,
weight = "invar"
)
}