Hypothesis Testing

  • Shapiro Wilks
  • One Sample T-Test
  • Calculating Power
  • Hypothesis Testing
  • Sample Size Determination
  weight      feed
1    179 horsebean
2    160 horsebean
3    136 horsebean
4    227 horsebean
5    217 horsebean
6    168 horsebean


    Shapiro-Wilk normality test

data:  chickwts$weight
W = 0.97674, p-value = 0.2101
[1] 261.3099

How does the sample mean compare to a hypothesis test that the true mean is < 260? What is the power of the test?

\[H_0: \mu \ge 260, H_a: \mu \lt 260\]

Population Fail to Reject Reject \(H_0\)
\(H_0\) is True Correct Type I Error
\(H_a\) is True Type II Error Correct

    One Sample t-test

data:  chickwts$weight
t = 1.2206, df = 70, p-value = 0.8868
alternative hypothesis: true mean is less than 250
95 percent confidence interval:
     -Inf 276.7549
sample estimates:
mean of x 
 261.3099 
[1] 1.220623
[1] 0.8868377

    One Sample t-test

data:  chickwts$weight
t = 1.7603, df = 70, p-value = 0.04137
alternative hypothesis: true mean is greater than 245
95 percent confidence interval:
 245.8648      Inf
sample estimates:
mean of x 
 261.3099 
[1] 1.760251
[1] 0.04136678

     One-sample t test power calculation 

              n = 71
          delta = 16.30986
             sd = 78.0737
      sig.level = 0.05
          power = 0.5391727
    alternative = one.sided

     One-sample t test power calculation 

              n = 143.0323
          delta = 16.30986
             sd = 78.0737
      sig.level = 0.05
          power = 0.8
    alternative = one.sided
[1] 141.6698