Loading...
 
{RR()}
####################################################
### Examples borrowed from:
### http://www.statmethods.net/stats/power.html
### You can also look at: 
### http://www.ats.ucla.edu/stat/R/dae/t_test_power.htm
if(!require(pwr)){
	install.packages("pwr", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/")
#	install.packages("pwr", lib="/home/tuusuario/R/x86_64-pc-linux-gnu-library/2.15", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/")
}
#require(pwr, lib="/home/tuusuario/R/x86_64-pc-linux-gnu-library/2.15" )
require(pwr)

# What is the power of a one-tailed t-test, with a
# significance level of 0.01, 25 people in each group, 
# and an effect size equal to 0.75?

pwr.t.test(n=25,d=0.75,sig.level=.01,alternative="greater")
cat("</br></br>")

# Using a two-tailed test proportions, and assuming a
# significance level of 0.01 and a common sample size of 
# 30 for each proportion, what effect size can be detected 
# with a power of .75? 

pwr.2p.test(n=30,sig.level=0.01,power=0.75)
cat("</br></br>")

# For a one-way ANOVA comparing 5 groups, calculate the
# sample size needed in each group to obtain a power of
# 0.80, when the effect size is moderate (0.25) and a
# significance level of 0.05 is employed.

pwr.anova.test(k=5,f=.25,sig.level=.05,power=.8)
cat("</br></br>")

################################################
{RR}



     Two-sample t test power calculation 

              n = 25
              d = 0.75
      sig.level = 0.01
          power = 0.5988572
    alternative = greater

NOTE: n is number in *each* group



Difference of proportion power calculation for binomial distribution (arcsine transformation) h = 0.8392269 n = 30 sig.level = 0.01 power = 0.75 alternative = two.sided NOTE: same sample sizes

Balanced one-way analysis of variance power calculation k = 5 n = 39.1534 f = 0.25 sig.level = 0.05 power = 0.8 NOTE: n is number in each group





Show php error messages