# SOCR Activity ANOVA FlignerKilleen MeatConsumption

(Difference between revisions)
 Revision as of 23:19, 21 February 2013 (view source)IvoDinov (Talk | contribs) (→Conclusions)← Older edit Current revision as of 23:21, 21 February 2013 (view source)IvoDinov (Talk | contribs) (→ANOVA) Line 219: Line 219: : Model: : Model: : Degrees of Freedom = 6 : Degrees of Freedom = 6 - : Residual Sum of Squares = 668292765.4285718000 + : Residual Sum of Squares = 668292765.43 - : Mean Square Error = 111382127.5714286400 + : Mean Square Error = 111382127.57 : Error: : Error: : Degrees of Freedom = 42 : Degrees of Freedom = 42 - : Residual Sum of Squares = 5204240.5714285690 + : Residual Sum of Squares = 5204240.57 - : Mean Square Error = 123910.4897959183 + : Mean Square Error = 123910.49 : Corrected Total: : Corrected Total: : Degrees of Freedom = 48 : Degrees of Freedom = 48 - : Residual Sum of Squares = 673497006.0000004000 + : Residual Sum of Squares = 673497006.00 - : F-Value = 898.8918351858 + : F-Value = 898.89 : P-Value =  < 1E-15 : P-Value =  < 1E-15 - : R-Square = 0.9922728082 + : R-Square = 0.99 ===Fligner-Killeen Analysis=== ===Fligner-Killeen Analysis===

## Motivation and Goals

In many developed countries, when people imagine their next meal, they focus on one specific part: the meat. That choice of meat, however, varies from country to country due to the popularity and availability of various domesticated animals. Furthermore, the amount of meat eaten has a surprising degree of variability across time, cultures and geographic regions.

The following activity will study the effects of that variance on the statistical analyses. Specifically, we will consider how deviations from homoscedasticity (also known as equivalence of variance or variance homogeneity) can lead to making some incomplete or even incorrect conclusions. To do so, we will employ the Fligner-Killeen method to analyze some real meet consumption data.

## Summary

This activity uses a reduced version of the open-source meat-consumption dataset. All data comes from the US Census Bureau.

This dataset summarizes the meat consumption, by animal type, of various countries (the European Union (EU) is being treated as a single country in this case). For simplicity, records from countries that did provide consumption measures for all meat types and all years were removed from the data set.

## Data

### Data Description

• Number of cases: 147
• Variables
• Country: The country or world region in question
• Brazil
• China
• European Union
• Japan
• Mexico
• Russia
• United States
• Meat: The type of meat
• Beef
• Pork
• Poultry
• Years Represented (2000 – 2006)
• Values are in thousands of metric tons

### Data Summaries

#### Chicken/Poultry

YearBrazilChinaEuropeJapanMexicoRussiaUnitedStatesYearAverageYearSD
2000511093936934177221631320114745452.2863990.459
2001534192377359179723111588115585598.7143942.57
2002587395567417183024241697122705866.7144134.211
2003574299637312184126271680125405957.8574234.565
2004599299317280171327131675130806054.8574379.591
20056612100887596188028712139134306373.7144388.111
20066853103717380190830052382137546521.8574448.974
Country_Average5931.8579791.2867325.4291820.1432587.714178312586.57
Country_SD629.6543407.0908200.482666.03895304.2404357.6777886.5564

#### Pork

YearBrazilChinaEuropeJapanMexicoRussiaUnitedStatesYearAverageYearSD
200018274037819242222812522019845510771.5714570.99
200119194182919317226812982076838911013.7115049.33
200219754323819746237713492453868511403.2915502.7
200319574505420043237314232420881611726.5716145.49
200419794664819773256215562337881711953.1416648.16
200519494970319768250715562476866912375.4317714.83
200621915180920015245015802637864012760.2918438.64
Country_Average197145522.7119700.5723951430.5712345.4298638.714
Country_SD1104159.521312.355121.3013135.3808223.0148164.5121

#### Beef

YearBrazilChinaEuropeJapanMexicoRussiaUnitedStatesYearAverageYearSD
2000610252848106158523092246125025447.7143922.316
2001619154347658141923412400123515399.1433835.093
2002643758188187131924092450127375622.4294016.753
2003627362748315136623082378123405607.7143933.847
2004640067038292118223682308126675702.8574077.861
2005677470268194120024192503126635825.5714056.693
2006693973958270117325092370128305926.5714148.408
Country_Average6445.1436276.28681461320.5712380.4292379.28612584.29
Country_SD307.1685806.2036226.9295151.213871.7538885.31259190.4396

### Raw Dataset

CountryMeat2000200120022003200420052006
BrazilBeef6102619164376273640067746939
BrazilPork1827191919751957197919492191
BrazilPoultry5110534158735742599266126853
ChinaBeef5284543458186274670370267395
ChinaPork40378418294323845054466484970351809
ChinaPoultry939392379556996399311008810371
EuropeanUnionBeef8106765881878315829281948270
EuropeanUnionPork19242193171974620043197731976820015
EuropeanUnionPoultry6934735974177312728075967380
JapanBeef1585141913191366118212001173
JapanPork2228226823772373256225072450
JapanPoultry1772179718301841171318801908
MexicoBeef2309234124092308236824192509
MexicoPork1252129813491423155615561580
MexicoPoultry2163231124242627271328713005
RussiaBeef2246240024502378230825032370
RussiaPork2019207624532420233724762637
RussiaPoultry1320158816971680167521392382
UnitedStatesBeef12502123511273712340126671266312830
UnitedStatesPork8455838986858816881786698640
UnitedStatesPoultry11474115581227012540130801343013754

## Exploratory data analyses (EDA)

In the following analysis, we will aim to perform an analysis of variance (ANOVA) to compare the meat consumption amounts between different countries and/or across time. Note that the data points for each country-meat type combination are from the various years. Typically, we would expect the amount not to change between the years (especially in this 7-year timespan). Even if it did, in assuming homoscedasticity, we are making the assumption that any increase or decrease is constant between countries. Applying the Fligner-Killeen test will help us decide if this assumption is valid. Look at the bar graphs listed below and note which of them seem to vary more than the others between the years.

## Quantitative data analysis (QDA)

### ANOVA

Open the SOCR ANOVA-Two Way applet (requires Java-enabled browser). For the following analyses, we will focus on the data for Beef consumption. Let us test to see if different countries eat different amounts of beef. Usually when we compare a set of groups as this one, we would use a one-way ANOVA (comparing the seven countries). To run this test, open up the one-way ANOVA analysis in the SOCR Analyses Applet in a java-enabled browser. It should be the default setting when you open up the page:

Now, prepare your dataset (it will be the Beef table from the above summary tables). We will be treating the yearly results as being our sample’s data points, attempting to capture the overall population consumption. This seems reasonable; the average meet consumption of a country should not change that much in a seven-year timespan.

Once you have rearranged your dataset for use in the ANOVA applet (if you do not know what it should look like, try considering one of the SOCR ANOVA tutorials). It should look like this in the applet data screen:

Click on the mapping tab, and assign your independent and dependent variables appropriately:

Set your precision to all, then click calculate:

The following results should appear in the Results tab:

Sample Size = 49
Independent Variable = Country
Dependent Variable = Consumption
Results of One-Way Analysis of Variance:
Standard 1-Way ANOVA Table
TreatmentEffect(B/w_Groups)6668292765.43111382127.57898.89< 1E-15
Error425204240.57123910.48
Total48673497006.00
Model:
Degrees of Freedom = 6
Residual Sum of Squares = 668292765.43
Mean Square Error = 111382127.57
Error:
Degrees of Freedom = 42
Residual Sum of Squares = 5204240.57
Mean Square Error = 123910.49
Corrected Total:
Degrees of Freedom = 48
Residual Sum of Squares = 673497006.00
F-Value = 898.89
P-Value = < 1E-15
R-Square = 0.99

### Fligner-Killeen Analysis

Note our extremely low p-value. The results of our one-way ANOVA reject the null hypothesis that these countries do not differ in terms of beef consumption. This shouldn’t surprise anyone. Even a third grader could have made that decision after looking at the summary table, or the earlier EDA graphs. Besides, the data represents total volume of meat consumption, whereas the populations of these countries are vastly different, and a per-capita meat consumption analysis may be more appropriate in this case.

However, let’s say that you find a book that claims, using the results of your ANOVA as proof, that “China consumes more beef than any country other than the United States”. That book is saying that these populations are significantly different in terms of their beef consumption. Is this claim justified by the ANOVA analysis above? Going through the assumptions of the ANOVA test, remember that the different levels must follow homoscedasticity (equivalence of variance). If two populations are significantly far from this assumption, then they should be compared using ANOVA. An alternative statistical test needs to be applied (e.g., Kruskal-Wallis test).

To test for homoscedacity, we will use the Fligner-Killeen test, which is a non-parametric test that doesn’t assume normality. This is important, considering that we have a rather limited data set (only seven points, one for each year) and the data may not be normally distributed. Use the tab to find the Fligner-Killeen analysis in the SOCR Analyses Applet in a java-enabled browser:

Next, copy and paste your data into the spreadsheet using the paste button built into the applet. The data copied here is from the Beef summary table (excluding the marginal means). Note that we are treating the cases within each country (one for each year) as the data points. When trends take many years to happen, we can assume that, within a short timespan (such as the 7 years captured here), each year serves as estimates of a generally unchanging population value for that country.

Re-name the data headers to the country names, our levels for this comparison.

Click on the mapping tap and add all of the country names to the next tab.

Finally, select the precision setting “All.” This will display the maximum number of decimal numbers. Afterwards, click “CALCULATE”:

The following results text should appear on the screen:

Group Brazil
median = 6400.0
Group China
median = 6274.0
Group Europe
median = 8194.0
Group Japan
median = 1319.0
Group Mexico
median = 2368.0
Group Russia
median = 2378.0
Group United States
median = 12663.0
Total Size = 49
Total Mean Score = .784
Total Variance = .323
Degrees of Freedom = 6
Chi-Square Statistic = 19.421
P-Value = .004

The result from the Fligner-Killeen test (for variance homogeneity) yields a rather small p-value (0.004). Assuming α = 0.05, we would rejects the null hypothesis of equal variances between countries. Therefore, we should be wary of continuing with a standard (parametric) Analysis of Variance (ANOVA). Looking back at the data, it is easy to see why.

## Conclusions

Note, for example, that in the data for the Chinese consumption of beef, the values are steadily rising between the years. In our ANOVA, we had made an assumption, that the overall consumption would not follow a set pattern between the years, allowing us to treat them as sample points. This results in a much different variance between the groups. Therefore, it would be incorrect to use our previous conclusion from the ANOVA that “these countries have different population values for meat consumption” without a qualifier of the date range that we were sampling within. Note that without this analysis, you might have missed the trend in Chinese beef consumption—which might be worth studying in its own right.

We can also think about this from a more mathematical perspective. This brings up the fundamental definition of Analysis of Variance, in which we are trying to keep constant the within-group variance of each of our levels (in this case, countries). If we ignore homoscedasticity, from the viewpoint of the algebra involved, we are essentially comparing completely unrelated populations.

Just because the assumptions of ANOVA are not satisfied, we should not give up on this data set. Without the results of the Fligner-Killeen, we may have missed the effects of time on meat consumption, an effect that warrants is own investigation. In such situations, the use of non-parametric alternatives to ANOVA may be appropriate (e.g., Kruskal-Wallis test).

## Practice problems

• Run this same analysis for the pork and poultry datasets. Interpret any conclusions as shown above.
• Practice running a one-way ANOVA, excluding the data from China and Japan.
• “Turn” the beef data set around, and run this Fligner-Killeen test between the year groups. Interpret the conclusion you find. Why is this same/different to the result from the above example?