plotPower: Make a power curve

Description Usage Arguments Examples

Description

Make a power curve

Usage

1
2
plotPower(ts, a1, b1, a2, b2, a = a1, b = b1, pi0 = 0.5, pi1 = 1 -
  pi0, c = 1, family = c("binomial", "poisson"), ylim = 0:1)

Arguments

ts

vector specifying x-range

a1

alpha, the hyperparameter of the gamma distribution of the first poisson rate

b1

beta, the hyperparameter of the gamma distribution of the first poisson rate

a2

alpha, the hyperparameter of the gamma distribution of the second poisson rate

b2

beta, the hyperparameter of the gamma distribution of the second poisson rate

a

alpha, the hyperparameter of the gamma distribution under the null

b

beta, the hyperparameter of the gamma distribution under the null

pi0

the prior probability of the null hypothesis

pi1

the prior probability of the alternative hypothesis

c

relative loss constant (loss due to type II error divided by loss due to type I error)

family

"binomial" or "poisson", depending on test

ylim

y limits

Examples

 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
## Not run: 

a1 <- 2; b1 <- 6
a2 <- 3; b2 <- 3
plotPower(ts = c(0,250), a1, b1, a2, b2)
plotPower(ts = c(0,1000), a1, b1, a2, b2)
plotPower(ts = c(0,100), a1, b1, a2, b2)
plotPower(ts = 0:300, a1, b1, a2, b2, method = 'exact')
# this last plot shows that the approximation is not quite exact for small values
# but decent for larger ones

# styling, all ggplot2 styling works
plotPower(t = c(0,1000), a1, b1, a2, b2) +
  theme_bw() + opts(title = 'My Power Plot')



a1 <- 4; b1 <- 4
a2 <- 8; b2 <- 4
plotPower(t = c(0,200), a1, b1, a2, b2, family = "poisson") +
  geom_hline(yintercept = .80)







a1 <- 4; b1 <- 2
a2 <- 6; b2 <- 2
plotPower(t = c(0,1000), a1, b1, a2, b2)
plotPower(t = c(0,25), a1, b1, a2, b2)
plotPower(t = 0:25, a1, b1, a2, b2, method = 'exact')




a1 <- c(2,4); b1 <- c(6,2);
a2 <- c(3,6); b2 <- c(3,2);
plotPower(t = c(0,1000), a1, b1, a2, b2)

library(ggplot2)
last_plot() + theme_bw()




 
## End(Not run)

dkahle/bayesRates documentation built on May 15, 2019, 9:07 a.m.