
132 COMPARISONS
Example 3.10:
Input
nsimul <- 500
n1<- 10; n2 <-10
alpha <- 0.01
x<-0
for (i in 1:nsimul) {
if (t.test(exp(rnorm(n1)),exp(rnorm(n2, mean = 1)),
alternative="less",
var.equal = TRUE)$p.value < alpha){
x <- x+1}
}
p <- x/nsimul
cat("estim p", p)
Output
estim p 0.188
Input
prop.test(n = nsimul, x = x)
Output
1-sample proportions test with continuity correction
data: x out of nsimul, null probability 0.5
X-squared = 193.442, df = 1, p-value < 2.2e-16
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
0.1552568 0.2256388
sample estimates:
p
0.188
In library(binom) [8] several tools are provided for a differentiated analysis of