Assignment 8

Due Date

Friday, November 2, 2012

Data Source

The data for this assignment is Stirrett.txt, a tab-delimited text file.

Background

These data are taken from Skirrett et al. (1937) and are reproduced in Beall (1940) and Evans (1953). The object is to determine the effect of fungus (Beauveria Bassiana) spore treatment on the control of European corn borer, Pyrausta nubilalis. The four different treatment that were used are described below. The reported applications of fungal spores are in grams per acre.

Table 1   Characterization of the four treatments
Treatment Application on July 8 Application on July 19
1
0
0
2
0
40
3
40
0
4
40
40

The first treatment occurred at the beginning of the period of oviposition while the second treatment was administered at the height of the period of oviposition. Eggs were allowed to hatch and the larva allowed to grow to full size. What is recorded are the number of borers that were found on a unit area occupied by a hill of corn. For each treatment 120 hills of corn were examined. The table below records the number of hills exhibiting different levels of infestation (first column) under the the four different treatment regimes (columns 2 through 5).

Table 2   Frequency of borers under four treatment regimes
Number of borers per hill of corn Frequency
Treatment 1 Treatment 2 Treatment 3 Treatment 4
0
19
24
43
47
1
12
16
35
23
2
18
16
17
27
3
18
18
11
9
4
11
15
5
7
5
12
9
4
3
6
7
6
1
1
7
8
5
2
1
8
4
3
2
0
9
4
4
0
10
1
3
1
11
0
0
1
12
1
1
13
1
15
1
17
1
19
1
26
1

Questions

  1. Fit a model or models appropriate for these data that allow you to test for the effect and the timing of the fungal spore treatment on borer populations. Find the simplest model that is supported by the data.
  2. Carry out both a graphical and an analytical goodness of fit test for the most parsimonious model that you found for these data.
  3. Graphically compare the fit of the model in Question 2 to the fit of a second model that allows each treatment to have an unconstrained mean.

Hints

Notice that after count category 13 there are gaps in the observed frequencies for Treatment 1. You will need to deal with these gaps when constructing the goodness of fit test. Here's a "clever" way to introduce 0 values into a sequence of integers with gaps. To illustrate it I begin by generating some data in which the count category variable x has gaps. The values x = 8, 11, 13, and 14 were not recorded.

set.seed(10)
mydata <- data.frame(x=c(0:7,9,10,12,15), y=rnbinom(12,mu=5,size=1))
mydata
    x  y
1   0  2
2   1  3
3   2  0
4   3  2
5   4  3
6   5  3
7   6  9
8   7  0
9   9 11
10 10  8
11 12  1
12 15  1

I next create a data frame with a single column. The column is given the name x, the same name as the count category variable in the data frame mydata. Unlike mydata$x this x has all of the intermediate values from 0 through 15.

junk <- data.frame(x=0:15)

Next I merge this new data frame with mydata using the all=T argument. This option causes all observations from both data frames to be included in the merge even those observations that do not match. The matching is carried out using variables with have same namse in the two data frames, in this case the variable x.

mydata2 <- merge(mydata, junk, all=T)

When we examine the merged data frame we see it contains all the values of x from 0 to 15. The variable y from mydata has missing values for the new observations.

mydata2
    x  y
1   0  2
2   1  3
3   2  0
4   3  2
5   4  3
6   5  3
7   6  9
8   7  0
9   8 NA
10  9 11
11 10  8
12 11 NA
13 12  1
14 13 NA
15 14 NA
16 15  1

Finally I assign zeros to the values of y that are missing.

mydata2$y <- ifelse(is.na(mydata2$y), 0, mydata2$y)
mydata2
    x  y
1   0  2
2   1  3
3   2  0
4   3  2
5   4  3
6   5  3
7   6  9
8   7  0
9   8  0
10  9 11
11 10  8
12 11  0
13 12  1
14 13  0
15 14  0
16 15  1

Cited references

Course Home Page


Jack Weiss
Phone: (919) 962-5930
E-Mail: jack_weiss@unc.edu
Address: Curriculum in Ecology, Box 3275, University of North Carolina, Chapel Hill, 27599
Copyright © 2012
Last Revised--October 25, 2012
URL: https://sakai.unc.edu/access/content/group/3d1eb92e-7848-4f55-90c3-7c72a54e7e43/public/docs/assignments/assign8.htm