R - Errors and Power
Jump to navigation
Jump to search
Type I and Type II errors
Real World Null Hypothesis True False Accept Correct Decision Type II Error (β) Reject Type I Error (α) Correct Decision
Power
Power is the probability of correctly rejecting a false null hypothesis
- E.g. the probability that:
- given there is a difference between the population means
- the sample means will be significantly different
- The probability of failing to reject a false null hypothesis is β
Power = 1 - β
When designing an experiment you know the chance of finding a significant effect.
Questions
Power is:
- The probability that the null hypothesis is true
- The probability that the null hypothesis is false
- The probability a false null hypothesis will be rejected
- The probability a true null hypothesis will be rejected
If the power of an experiment is low then:
- The experiment will likely be inconclusive
- Any significant findings obtained are suspect
- The results are skewed.
power.* function
# Find the sample size power.t.test(power=0.9,sd=2,sig.level=0.05,delta=3)
# Find the power of the test power.t.test(n=2,sd=2,sig.level=0.05,delta=3)
PWR package
- pwr.p.test: test for one proportion (ES=h)
- pwr.2p.test: test for two proportions (ES=h)
- pwr.t.test: one sample and two samples (equal sizes) t tests for means (ES=d)
- pwr.t2n.test: two samples (different sizes) t test for means (ES=d)
- pwr.anova.test: test for one-way balanced anova (ES=f)
- pwr.r.test: correlation test (ES=r)
- pwr.f2.test: test for the general linear model
....
Pwr package
install.packages("pwr")
library("pwr")