Learn R Programming

carat (version 2.2.1)

compPower: Comparison of Powers for Different Tests under Different Randomization methods

Description

Compares the power of tests under different randomization methods and treatment effects through matrices and plots.

Usage

compPower(powers, diffs, testname)

Value

This function returns a list. The first element is a matrix consisting of powers of chosen tests under different values of treatment effects. The second element of the list is a plot of powers. diffs forms the vertical axis of the plot.

Arguments

powers

a list. Each argument consists the power generated by evalPower() in this package or by other sources. The length of each argument must match.

diffs

a vector. It contains values of group treatment effect differences. The length of this argument and the length of each argument of powers must match.

testname

a vector. Each element is the name of test and the randomization method used. For example, when applying rand.test and corr.test under HuHuCAR, it can be c("HH.rand","HH.corr"). The length of this argument must match the length of diffs.

Examples

Run this code
##settings
set.seed(100)
n = 1000
cov_num = 5
level_num = c(2,2,2,2,2)
pr = rep(0.5,10)
beta = c(1,4,3,2,5,5,4,3,2,1)
di = seq(0,0.5,0.1)
sigma = 1
type = "linear"
p=0.85
Iternum = 10 #<

Run the code above in your browser using DataLab