Rstudio代写-STA258
时间:2021-04-19
STA258
Week 9 Practicum
1
Global Climate Change
2
Table below shows the distribution of people (by region) of 1496 Canadians who responded “Yes” to the July 2013
Forum Research poll question “As far as you know, is Earth’s climate changing?
Global Climate Change
3
Table below shows the percentage of Canadian Population lives in the specified region:
Global Climate Change
4
Do people in some regions believe more in global climate change than people in other region?
Test whether the observed distribution of climate change believers fits the distribution of Canadian population.
Global Climate Change
5
0: 1 = 0.07, 2 = 0.24, 3 = 0.38, 4 = 0.07, 5 = 0.11, 6 = 0.13
: Not all s are as stated in 0 ( = 1, 2, 3, 4, 5, 6)
Observed and Expected Frequencies for Region
Region Observed (O)
Count
Expected (E) Count
Assume 0 is true
( − )2
Maritime 141 1 = 1 =
Quebec 362 2 = 2 =
Ontario 549 3 = 3 =
Manitoba/Saskatoon 107 4 = 4 =
Alberta/Territories 142 5 = 5 =
BC 195 6 = 6 =
Sum (O) = 1496 Sum (E) = 1496 2 = Sum
( −)2
=
2 = with df = K – 1 =
Global Climate Change
6
0: 1 = 0.07, 2 = 0.24, 3 = 0.38, 4 = 0.07, 5 = 0.11, 6 = 0.13
: Not all s are as stated in 0 ( = 1, 2, 3, 4, 5, 6)
Observed and Expected Frequencies for Region
Region Observed (O)
Count
Expected (E) Count
Assume 0 is true
( − )2
Maritime 141 1 = 1 = 1496 x 0.07 = 104.72 (141 − 104.72)
2/104.72 = 12.57
Quebec 362 2 = 2 = 1496 x 0.24 = 359.04 (362 − 359.04)
2/359.04 = 0.02
Ontario 549 3 = 3 = 1496 x 0.38 = 568.48 (549 − 568.48)
2/568.48 = 0.67
Manitoba/Saskatoon 107 4 = 4 = 1496 x 0.07 = 104.72 (107 − 104.72)
2/104.72 = 0.05
Alberta/Territories 142 5 = 5 = 1496 x 0.11 = 164.56 (142 − 164.56)
2/164.56 = 3.09
BC 195 6 = 6 = 1496 x 0.13 = 194.48 (195 − 194.48)
2/194.48 = 0.00
Sum (O) = 1496 Sum (E) = 1496 2 = Sum
( −)2
=
12.57 + 0.02 + 0.67 + 0.05 + 3.09
+ 0.00 = 16.4
2 = 16.4 with df = K – 1 = 6 – 1 = 5
All Steps: Goodness-of-Fit Test
7
Conclusion:
We Reject Ho since -value = 0.0058 is less than = 0.05
We have evidence to conclude Ha.
We have strong evidence to indicate that the distribution of climate change believers is not the same as the
distribution of the general population among regions.
-value is: P((=5)
2 > 16.4) =
0: 1 = 0.07, 2 = 0.24, 3 = 0.38, 4 = 0.07, 5 = 0.11, 6 = 0.13
: Not all s are as stated in 0 ( = 1, 2, 3, 4, 5, 6)
2 = 16.4 with df = K – 1 = 6 – 1 = 5
Goodness-of-Fit Test in R
8
Taste Choice
9
Can a package design of a food product influence how the consumer will rate the taste of the product?
A team of experimental psychologists reported on a study that examined how rounded or angular package shapes and high- or
low-pitched sounds can convey information about the taste (sweetness and sourness) of a product (Food Quality and Preference,
June 2014). Study participants were presented with one of two types of packaging displayed on a computer screen monitor:
rounded shapes with low-pitched sound or angular shape with a high-pitched sound. Assume that half of the participants viewed
the rounded packaging and half viewed the angular packaging. After viewing the product, each participant rated whether the
packaging was more appropriate for either a sweet- or a sour-tasting food product.
A summary of the results (number of participants) for a sample of 80 participants is shown in the following contingency table.
Taste Choice
10
Describe Marginal Proportions of Taste Choice
11
Describe Marginal Proportions of Taste Choice
12
The percent sweet ratings (52.5%) is higher than the sour ratings (47.5%).
That is, controlling for the type of package design, consumers were more likely to rate packages
for sweet food product.
Describe Conditional Proportions of Taste Choice for Different Type of Design
13
Describe Conditional Proportions of Taste Choice for Different Type of Design
14
Any of the following:
• The percent sweet ratings for angular package design (87.5%) was higher than the round package
design products (17.5%).
• Angular package designs were more likely (87.5%) to viewed for sweet food products than the
round package designs (17.5%).
Chi-Square Test of Independence
15
Suppose we wish to test whether the package design and sound pitch combination contribute to consumer’s
opinion on the product taste.
1. Specify the null and alternative hypotheses.
2. Find the value of the test-statistic.
3. Find the p-value of the observed test statistic.
4. In plain, non-statistical language, give a conclusion, if at all, from this analysis.
5. Comment on the validity of the statistical result.
Step 1. Specify the Null and the Alternative Hypotheses
16
Ho: There is no association between package design and consumer’s opinion on the product taste.
Ha: There is an association between package design and consumer’s opinion on the product taste.
Step 2. Observed Chi-Square Test Statistic
17
2 = σ=1
σ=1
(−)
2
: observed count for each cell
: Expected cell count for each cell is
=
Step 2. Observed Chi-Square Test Statistic
18
2 = σ=1
σ=1
(−)
2
: observed count for each cell
: Expected cell count for each
cell is
=
11=
40 42
80
= 21, 12=
40 38
80
= 19, 21=
40 42
80
= 21, 22=
40 38
80
= 19
2 =
(35−21)2
21
+
(5−19)2
19
+
(7−21)2
21
+
(33−19)2
19
= 39.298
= (2-1) x (2-1) = 1 x 1 = 1
Step 3. P-value of Observed Chi-Square Test Statistic
19
(1
2> 39.298) < 0.0001
= (2-1) x (2-1) = 1 x 1 = 1
1
2 = 39.298
(1
2> 39.298)
Steps 1 to 3 in R
20
Step 4. Non-Statistical Language Conclusion
21
(1
2> 39.298) < 0.0001
-value < 0.05
Conclusion:
We can reject Ho and conclude Ha. (Note that this is a technical language conclusion)
We have strong evidence to indicate that there is an association between package design and consumer’s opinion
on the product taste.
Step 5. Comment on the Validity of Statistical Results
22
This is an experimental design study. Thus, it is reasonable to assume that the sample of n = 80 was randomly
selected and that half of the participants were randomly assigned to view the rounded packaging and half were
assigned to view the angular packaging. The random sample is large enough.
The expected cell counts are all greater than 5. ≥ 5
Thus, the statistical results and the inference made here are valid.
Detect the Pattern of Association: Adjusted Standardized Residuals
23
Detect the Pattern of Association: Adjusted Standardized Residuals
24
Consumers who viewed angular shaped design packages, more often than we would expect if the variables were
truly independent, rated the packaging was appropriate for sweet food product.
95% CI for Difference Between Two Population Proportions
25
95% CI for Difference Between Two Population Proportions
26
We are 95% confident the percent sweet rating for angular design packages are between 54.4% and 85.6%
higher than the sweet ratings for round design packages.