Home > Output
Chapter 3: Writing a research protocol using R
Figure 3.2
Figure 3.2 Code
Click here to show code with comments.
# The power.prop.test() function can calulate a sample size estimate for a
# chi-square of two in dependent proportions.
power.prop.test(p1 = .67, # first proportion
p2 = .56, # second proportion
power = .9 # desired power
)
# Load the clinfun package to get access to the fe.ssize() function. fe.ssize()
# can be used to estimate a sample size for Fisher's exact test of proportions.
# See chapter 2 for information on the library() function.
library(clinfun)
fe.ssize(.67, # first proportion
.56, # alternative proportion
power = 0.9 # desired power
)
Color coding created by Pretty R at inside-R.org
Figure 3.3
Figure 3.3 Code
Click here to show code with comments.