Docsity

Poisson Regression - Applied Linear Regression - Homework 9 | 22S 152, Assignments of Statistics

Toggle sidebar
bg1
22s:152
Homework 9
Assigned Friday, November 21
Due Wednesday, December 3
Poisson Regression
Turn-in homework with hand-written or typed responses and include any relevant plots
which you are describing.
1. An experiment was conducted on the effect of toxicity on the number of offspring
produced by the aquatic animal C. dubia (water flea). The data set called ‘offspring’
is available at our class website.
animal -- ID for each C. dubia (water flea) tested
offspring -- count of young produced
conc -- concentration of pollutant, 5 levels (micro grams/L)
(a) Fit a Poisson regression to the data (you can leave ‘conc’ as a continuous vari-
able). Provide the summary output. ∗Don’t forget to use family =poisson in
your glm() statement.
(b) Is there evidence that increasing pollutant decreases the mean offspring count?
Provide a test statistic and p-value.
(c) Interpret the ‘conc’ coefficient.
(d) Provide the estimated mean number of offspring for each of the 5 concentration
levels (0, 80, 160, 235, 310).
2. For this problem, we have data on the number of plant species on plots of land that
have different biomass (a continuous explanatory variable) and different soil pH (a
categorical variable with three levels: high, mid, and low).
The data is available as a .txt file on the website called species.
From Crawley, M.J., (2007). The R Book. West Sussex, England: John Wiley & Sons Ltd.
1
pf2

Partial preview of the text

Download Poisson Regression - Applied Linear Regression - Homework 9 | 22S 152 and more Assignments Statistics in PDF only on Docsity!

22s: Homework 9

Assigned Friday, November 21 Due Wednesday, December 3

Poisson Regression

Turn-in homework with hand-written or typed responses and include any relevant plots which you are describing.

  1. An experiment was conducted on the effect of toxicity on the number of offspring produced by the aquatic animal C. dubia (water flea). The data set called ‘offspring’ is available at our class website.

animal -- ID for each C. dubia (water flea) tested offspring -- count of young produced conc -- concentration of pollutant, 5 levels (micro grams/L)

(a) Fit a Poisson regression to the data (you can leave ‘conc’ as a continuous vari- able). Provide the summary output. ∗^ Don’t forget to use f amily = poisson in your glm() statement.

(b) Is there evidence that increasing pollutant decreases the mean offspring count? Provide a test statistic and p-value.

(c) Interpret the ‘conc’ coefficient.

(d) Provide the estimated mean number of offspring for each of the 5 concentration levels (0, 80, 160, 235, 310).

  1. For this problem, we have data on the number of plant species on plots of land that have different biomass (a continuous explanatory variable) and different soil pH (a categorical variable with three levels: high, mid, and low).

The data is available as a .txt file on the website called species.

From Crawley, M.J., (2007). The R Book. West Sussex, England: John Wiley & Sons Ltd.

The response variable is Species.

(a) Read-in the species.txt file using the following R code:

spec.data=read.delim("species.txt")

(b) Plot Species vs. Biomass and use a different color and character for each of the three pH levels. (Species will be on the y-axis.)

(c) Fit a Poisson regression model for predicting the expected number of Species that includes interaction, and perform the test for interaction. Provide the Anova output, give the p-value for interaction, and give your conclusion to the test. ∗ (^) Don’t forget to use f amily = poisson in your glm() statement.

(d) The model we have fit is an ANCOVA in the Poisson regression framework. We have one quantitative covariate and one categorical covariate. Recall in ordinary regression, we can plot an ANCOVA model using parallel lines if there is no in- teraction, and intersecting lines if interaction exists.

ADD THE MEAN STRUCTURE TO YOUR PLOT:

We want to include the fitted mean structure for each group to the plot. First, we will create a vector of biomass values that covers the range of Biomass values in the data set, and we will use the predict() function to do the predicting.

After you have created the plot in (b) above, use the following code to add the fitted mean structure for the ”high” pH group.

Biomass.values=seq(0,10,0.1) nvalues=length(Biomass.values) fitted.values.high=predict(glm.out,data.frame(Biomass=Biomass.values, pH=rep("high",nvalues)),type="response") lines(Biomass.values,fitted.values.high,col=1)

Edit the above code to also include the fitted mean structure for the ”mid” and ”low” groups.

(e) Use the > contrasts(pH) command to report which group is the baseline group.

(f) What is the expected number of species at a plot of land with a “low” pH level and a Biomass of 5 units? [HINT: look at > coef (glm.out).]