lesson: o cockle, where art thou? - university of otago · 2010. 12. 16. · lesson: o cockle,...

14
1 Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location or distance from sea water, using data from the Otago Peninsula. The main hypothesis put forward is whether there is a relationship between the density (weight) and the number of cockles. Other hypotheses to consider are: is cockle biomass (density) affected by the distance from the sea, is there any difference in the cockle biomass between the different harvesters, and are biomass and density correlated? The experiment was set up as follows: A beach on the Otago Peninsula was divided into 3 areas (near, middle, and far) according to the distance from the sea. Within each of these three areas 4 sites or quadrants were randomly chosen, and then each site was divided into 6 equal plots. Each plot within each site was allocated to 1 of 6 groups of harvesters (6 groups who collected the data), resulting in each group harvesting one plot in every quadrant for every area. The diagram below illustrates this layout: 1. To open the data we click on File>Example Data Sets:

Upload: others

Post on 05-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

1

Lesson: O Cockle, Where Art Thou?

This lesson investigates the growth of cockles in relation to the location or distance from sea water, using data from the Otago Peninsula.

The main hypothesis put forward is whether there is a relationship between the density (weight) and the number of cockles. Other hypotheses to consider are: is cockle biomass (density) affected by the distance from the sea, is there any difference in the cockle biomass between the different harvesters, and are biomass and density correlated?

The experiment was set up as follows: A beach on the Otago Peninsula was divided into 3 areas (near, middle, and far) according to the distance from the sea. Within each of these three areas 4 sites or quadrants were randomly chosen, and then each site was divided into 6 equal plots. Each plot within each site was allocated to 1 of 6 groups of harvesters (6 groups who collected the data), resulting in each group harvesting one plot in every quadrant for every area. The diagram below illustrates this layout:

1. To open the data we click on File>Example Data Sets:

Page 2: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

2

This brings up the Example Data Sets dialog shown below. Click on the Filter by topic drop down menu and select the NZ Schools Example Data sets option. Choose the file Cockles.gsh and click on Open data:

This opens a spreadsheet (displayed below) containing data from a study investigating cockle biomass and density in relation to distance from sea water, which was carried out by Austina Clark and Fred Lam (Mathematics and Statistics Department, University of Otago):

In the spreadsheet the data recorded are Area (distance from the channel; N=near, M=middle, F=far), Quadrat (Sampling unit), Group (group of harvesters), Water_level (standardized value giving height relative to water table), Biomass (weight in kgs), and Cockle_No_Density (number of cockles found).

Page 3: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

3

2a. First we want a visual representation of our data. Draw the box and whisker plots for biomass by area for the three locations (F, M, and N). Click on Graphics>Boxplot (as shown below). In the box How are the data organized select Variate(s) with single grouping factor. In the Data variate(s) box enter the variable Biomass and in the Grouping factor box enter the factor Area. Click Run:

Switch to your GenStat Graphics Viewer Window, where you should have a box and whisker plot resembling the one below:

Biomass by Area

Describe what you can see from this plot, and state any tentative conclusions that you make.

Far

3

Mid

1

0

Near

4

2

Page 4: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

4

2b. Draw the histograms of biomass for each of the three areas. To do this, we must isolate each area in the data set before creating the graph. To isolate a particular area click on Spread>Restrict/Filter>To Groups (factor levels):

Select the level Near and click OK (This will select only the data that were classified as ‘Near’).

To plot the histogram click on Graphics>Histogram. In the Data variate(s) box enter Biomass and click Run:

In the GenStat Graphics Viewer Window a histogram will appear. Repeat all of step 2b for the areas ‘middle’ and ‘far’ and comment on your results.

4.0

6

5.01.51.0

5

4

3.0

3

2

2.0

1

4.5

0

2.5 3.5

Biomass

Page 5: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

5

2c. Construct 95% confidence intervals for the three mean biomass levels. Before calculating these we must first remove all restrictions we have set on our data. Click on Spread>Restrict/Filter>Remove All. This restores our data set to its original state. To Construct the confidence intervals for the three mean biomass levels click on Stats>Summary Tables:

In the Variate box enter the variable Biomass, and in the Groups box enter the factor Area. In the Display box tick Means then click on More> tick Standard Error of Mean then click OK then click Run:

Switch to the GenStat Output Window, where you should have a table summarising the means and standard errors for each of the three areas:

Mean s.e.mean Area Near 3.193 0.1830 Mid 1.837 0.0773 Far 0.563 0.0818

Using these results, construct the three 95% confidence intervals for the mean biomass of each area, using 1.96 or 2 as a large-sample value.

What do you conclude from your confidence intervals?

Page 6: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

6

3a. Construct box and whisker plots for the cockle densities per quadrat for the three areas. Click on Graphics>Boxplot. Select variate(s) with combined grouping factors, then enter Cockle_No_Density into the Data variate(s) box and Area and Quadrat into the Grouping factors to combine box. Press Run:

GenStat Graphics Viewer:

What are some features of this graph that stand out? What is the green ‘X’ that you see and how may it affect your data?

Cockle Density per Quadrat160

120

Far 4

80

Far 3

40

Far 2

Far 1

Mid

4

Mid

3

Mid

2

Mid

1

Near

4

140

Near

3

60

Near

2

Near

1

100

20

Coc

kle D

ensi

ty

Quadrat per Area

Page 7: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

7

3b. Construct the 95% confidence intervals for the mean densities at N, M and F for each of the quadrats. First click on Stats>Summary Tables. In the Variate box enter Cockle_No_Density, and in the Groups box enter Quadrat and Area. Under the Display options, tick Means, then click or More and tick Standard Error of Mean. Press Ok. Click on Store, and tick Means and Standard Error of Mean. Store these results with appropriate names, such as Mean_per_Quadrat for Means and SEM_per_Quadrat for Standard Error of Mean. Click OK then click Run:

Switching to the GenStat Output Window you will find the means and standard errors of the means for each of the 12 quadrats. As there are 12 different confidence intervals to calculate we will calculate these within GenStat (the function ‘Store’ saves the results that you get which allows us to use them in further calculations). To calculate the lower confidence limits for each of the 12 quadrats click on Data>Calculations:

Page 8: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

8

Under Available Data tick Tables. In the empty box at the top of this window, enter Mean_per_Quadrat – 1.96*SEM_per_Quadrat (this calculates the lower end of the confidence intervals). Save your result with an appropriate name, such as Lower_CI and tick Print in Output. Click Run:

Switching to your GenStat Output Window, you will see a table with the lower bounds of the confidence intervals for each of the 12 quadrats:

Lower_CI

Area Near Mid Far Quadrat 1 44.30 84.34 1.33 2 87.27 81.08 15.44 3 81.48 79.64 37.08 4 129.64 92.13 58.23

Can you calculate the upper bounds using the same procedure? Report your conclusions from the confidence intervals.

Page 9: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

9

4a. Carry out a one-factor Analysis of Variance (ANOVA) with Biomass as the response and Area as the factor. Click on Stats>Analysis of Variance:

Enter Biomass as the Y-variate and Area as the Treatment. Click Run and switch to the GenStat Output Window:

Analysis of variance Variate: Biomass Source of variation d.f. s.s. m.s. v.r. F pr. Area 2 65.5909 32.7954 84.86 <.001 Residual 60 23.1885 0.3865 Total 62 88.7794

Report your findings from the ANOVA.

Page 10: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

10

4b. Now, carry out one independent samples test (t-test) for one pair of the means. To carry this out we must first select two of the three areas as our samples. Click on Spread>Restrict/Filter>To Groups (factor levels).

In the Factor drop-down box select Area, then click on Near, hold down Ctrl and click on Mid so that both areas are highlighted. Click OK. This restricts your data set to the samples from near and middle areas only.

To perform an independent samples test for the mean biomass of the areas Near and Mid click on Stats>T-tests. In the Test drop-down menu select Two-sample, and in the Data Arrangement box select Group Factor with Variate. Enter Biomass into the Data variate box and Area into the Group factor box, and click Run:

Page 11: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

11

GenStat Output Window:

Summary Standard Standard error Sample Size Mean Variance deviation of mean Near 24 3.193 0.8036 0.8965 0.1830 Mid 24 1.837 0.1435 0.3788 0.0773 Difference of means: 1.356 Standard error of difference: 0.199 95% confidence interval for difference in means: (0.9507, 1.761) Test of null hypothesis that mean of Biomass with Area = Near is equal to mean with Area = Mid Test statistic t = 6.83 on approximately 30.96 d.f. Probability < 0.001

Report your conclusions from this independent samples t-test.

5. Similar to the task in 4a, carry out a two-factor Analysis of Variance (ANOVA) with the factors Group and Area. Make sure to include the interaction between these two factors. Obtain the mean plots and the residual plots for this ANOVA.

Obtaining the mean and residual plots: In the Analysis of Variance dialog box click on Options, then under Graphics Select Residual Plots and Mean Plots:

In the GenStat Output Window your results from this analysis should look as follows:

Analysis of variance Variate: Biomass Source of variation d.f. s.s. m.s. v.r. F pr. Area 1 22.0594 22.0594 44.51 <.001 Group 5 2.9673 0.5935 1.20 0.330 Area.Group 5 0.9744 0.1949 0.39 0.850 Residual 36 17.8416 0.4956 Total 47 43.8426

Page 12: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

12

Report your findings and compare with the one-factor ANOVA results from 4a. Include any comments on your graphs (mean plots and residual plots) in your discussion.

6a. Graph Biomass against Cockle_No_Density as a scatter plot. Click on Graphics>2D Scatter Plot:

Enter Biomass into the Y-variate box and Cockle_No_Density into the X-variate box, then either click Run to plot the graph with default settings, or click on the Options tab to modify the graph (e.g. add a title). Switching to your GenStat Graphics Viewer, you should see a graph similar to the one below:

What pattern can you see in the scatterplot?

6b. Now we want to fit a linear regression, with Biomass as the response variate and Cockle_No_Density as the explanatory variate. First click on Stats>Linear Regression. Enter Biomass into the Response variate (Y) box and Cockle_No_Density into the Explanatory variate (X) box then click on Run:

Biomass against Cockle Density

2.0

1.5

100

2.5

1.0

60 80 140120

4.0

3.0

40

4.5

3.5

160

Cockle_No_Density

Bio

mas

s

Page 13: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

13

Genstat Output Window:

Summary of analysis Source d.f. s.s. m.s. v.r. F pr. Regression 1 16.32 16.3242 27.29 <.001 Residual 46 27.52 0.5982 Total 47 43.84 0.9328 Estimates of parameters Parameter estimate s.e. t(46) t pr. Constant 0.491 0.403 1.22 0.229 Cockle_No_Density 0.01984 0.00380 5.22 <.001

Write out the model, and report your findings from the linear regression performed above.

Note: the question below requires a function that is available in the GenStat Undergraduate Edition but not in the GenStat School Edition. To change from the GenStat School Edition to the GenStat Undergraduate Edition click on Tools>Options and in the GenStat Edition box select Undergraduate Edition. You will have to restart GenStat for this change to take effect.

7. Carry out a multiple regression, with biomass as the response, and density and water level as the predictors. Make sure to include the interaction between density and water level. Before performing this procedure we have to convert water level from a factor to a variate. Right click on the column title Water_Level then click Convert to Variate:

Page 14: Lesson: O Cockle, Where Art Thou? - University of Otago · 2010. 12. 16. · Lesson: O Cockle, Where Art Thou? This lesson investigates the growth of cockles in relation to the location

14

Now click on Stats>Regression>Generalised Linear Models:

In the Response Variate box enter Biomass, and in the Model to be Fitted box enter Cockle_No_Density*Water_level (the * creates the full model with both variates and their interaction). Click Run:

Genstat Output Window:

Summary of analysis Source d.f. s.s. m.s. v.r. F pr. Regression 3 81.007 27.0024 204.98 <.001 Residual 59 7.772 0.1317 Total 62 88.779 1.4319 Estimates of parameters Parameter estimate s.e. t(59) t pr. Constant 0.717 0.237 3.03 0.004 Cockle_No_Density 0.02583 0.00234 11.03 <.001 Water_level -0.01243 0.00542 -2.29 0.025 Cockle_No_Density.Water_level -0.0002373 0.0000623 -3.81 <.001

Write out the model and report your findings.