Sentry Page Protection
Coding Exercise (Answer)
Exercise 1
Answer:
proc ttest data=wolf H0=6500 Sided=L;
Var esti;
Run;
H0: µ≥6500
H1: µ<6500
The p-value is 0.0074. This rejects the null hypothesis that the wolf population is above 6500.
Reduced hunting quota may be needed.
Exercise 2
Exercise 1
Answer:
proc ttest data=wolf H0=6500 Sided=L;
Var esti;
Run;
H0: µ≥6500
H1: µ<6500
The p-value is 0.0074. This rejects the null hypothesis that the wolf population is above 6500.
Reduced hunting quota may be needed.
Exercise 2
Answer:
Proc ttest data=coffee H0=7;
var caffeine;
by brand;
run;
H0: µ=7
H1: µ≠7
The p-values from the hypothesis testings on Brand A and C are 0.6421 and 0.9761, respectively.
There is not sufficient evidence to suggest their caffeine concentration is not 7 mg per serving.
Brand B, on the other hand, shows a p-value of <0.0001.
The mean caffeine concentration is 13.99 mg per serving.
Despite being labeled as decaffeinated coffee, Brand B's coffee has a significantly higher caffeine concentration than normal.
Exercise 3
Answer:
Proc ttest data=poker;
class time;
var results;
run;
H0: μ1 - μ2 = 0
H1: μ1 - μ2 ≠ d
The mean difference before and after the course is $558.4.
Tom loses, on average, $558.4 less on each visit to the casino.
Both the Pooled and Satterthwaite method show a p-value less than 0.0001.
There is sufficient evidence to suggest that Tom plays significantly better after the course.
However, Tom still loses on an average of $67.96 on each of his visit to the casino.
He might want to reconsider his plan to become professional poker player.
Exercise 4
Answer:
proc ttest data=wine;
paired rate1*rate2;
run;
H0: d = 0
H1: d ≠ 0
where d = µ1 - µ2
On average, the first bottle of wine is rated 7 points lower than the second bottle of wine, despite the fact that the two wines are exactly the same.
The p-value is less than 0.0001. There is sufficient evidence to suggest that the label has a significant effect on the wine tasting score.
Proc ttest data=coffee H0=7;
var caffeine;
by brand;
run;
H0: µ=7
H1: µ≠7
The p-values from the hypothesis testings on Brand A and C are 0.6421 and 0.9761, respectively.
There is not sufficient evidence to suggest their caffeine concentration is not 7 mg per serving.
Brand B, on the other hand, shows a p-value of <0.0001.
The mean caffeine concentration is 13.99 mg per serving.
Despite being labeled as decaffeinated coffee, Brand B's coffee has a significantly higher caffeine concentration than normal.
Exercise 3
Answer:
Proc ttest data=poker;
class time;
var results;
run;
H0: μ1 - μ2 = 0
H1: μ1 - μ2 ≠ d
The mean difference before and after the course is $558.4.
Tom loses, on average, $558.4 less on each visit to the casino.
Both the Pooled and Satterthwaite method show a p-value less than 0.0001.
There is sufficient evidence to suggest that Tom plays significantly better after the course.
However, Tom still loses on an average of $67.96 on each of his visit to the casino.
He might want to reconsider his plan to become professional poker player.
Exercise 4
Answer:
proc ttest data=wine;
paired rate1*rate2;
run;
H0: d = 0
H1: d ≠ 0
where d = µ1 - µ2
On average, the first bottle of wine is rated 7 points lower than the second bottle of wine, despite the fact that the two wines are exactly the same.
The p-value is less than 0.0001. There is sufficient evidence to suggest that the label has a significant effect on the wine tasting score.