Homework 2 Due: Thursday, September 13, 2001

1. Reading.

• In RPD (the Rawlings, Pantula and Dickey regression text) you should read through all of chapter 1, on simple regression.

• Work through the two Splus tutorials

– Objects: ‘Objects and Data Types in Splus”

– Programming: “Programming in Splus”

available in many places, for example, at http://www.stat.cmu.edu/~brian/707/S-Tutorial.

You do not have to hand anything in for this question.

2. RPD, p. 30, Ex. 1.3.

3. (a) Show that ∑ Ŷ_{i}e_{i} = 0, where e_{i} = Y_{i} − Ŷ_{i}.

(b) Show that ∑ Y_{i} = ∑ Ŷ_{i}.

(c) Use parts (a) and (b) to prove the ANOVA decomposition of the total sum of squares, S_{Y Y}. That is, demonstrate that S_{Y Y} = SS_{Reg} + RSS.

4. (a) Show that β̂_{1} = r_{XY} · \frac{S_{Y}}{S_{X}}, where where r_{XY} is the sample correlation between the X’s and the Y ’s, S_{Y}^{2} is the sample variance of the Y ’s and S_{X}^{2} is the sample variance of the X’s.

(b) Recall that SS_{Reg} = ∑(Ŷ_{i} − \overline{Y})^{2} = ∑(β̂_{0} + β̂_{1}X_{i} − \overline{Y})^{2}. From this, show that SS_{Reg} = β̂_{1}^{2} ∑(X_{i} − \overline{X})^{2}, and therefore R^{2} = SS_{Reg}/SY Y is equal to (r_{XY})^{2}.

The Angell.dat data set that we used last week came from a study by Angell (1951) on 43 US cities. The variables collected were:

• Moral: An index of “moral” or social integration, combining information on on the incidence of crime with data on social welfare expenditures.

• Ethnic: An index of ethnic heterogeneity, calculated from the proportions of nonwhites and foreign-born whites residing in the cities.

• Geog: An index of geographic mobility, constructed from the proportions of residents moving into and out of the cities.

• Region: Region of the US where the city is: (E)ast, (S)outh, (W)est, or (M)id(W)est.

Angell argues that the moral integration of cities should decrease with ethnic heterogeneity and geographic mobility. In the next several problems we briefly explore the relationship

between Moral and Ethnic.

Homework 2

5. Regress Moral on Ethnic.

(a) Plot the least-squares regression line on a scatterplot of the data, and comment on the results. Examine and interpret the values of β̂_{0}, β̂_{1}, s = \sqrt{RSS/(n − 2)}, and r_{XY} (or R^{2}). You can use commands like

myfit _lm(Moral ~ Ethnic, data = angell)
summary(myfit)
plot(angell$Ethnic,angell$Moral)
abline(myfit)

(b) Examine and comment on the residuals for the regression of Moral on Ethnic (the residuals should be approximately normally distributed, without patterns, outliers, etc.). You can use commands like

plot(angell$Ethnic,residuals(myfit))
abline(h=0) # or abline(0,0)
qqenv(residuals(myfit))

or examine the first plot in each row of par(mfrow=c(2,3)); plot(myfit). We don’t know how to interpret the other diagnostic plots here yet, but you can learn a little more about them by consulting help(plot.lm).

6. Examine Ethnic, and various simple transformations of it, with a histogram and quantilenormal plot. Among the variables Ethnic, sqrt(Ethnic) and log(Ethnic), which exhibits the best symmetry or normality properties? Note: The X variable does not have to be normally distributed in a regression analysis, but skewing in either X or Y may suggest a transformation that improves the regression model.

7. Re-do problem #5 using the best transformation you found in #6.

Note: suppose your transformed Ethnic variable is called NewEthnic. Then you can make either of two plots comparing the regression line to the data:

plot(NewEthnic,Moral)
abline(lm(Moral ~ NewEthnic))

or

plot(Ethnic,Moral)
lines(sort(Ethnic),fitted(lm(Moral ~ NewEthnic))[order(Ethnic)])

Which do you prefer for examining the regression? Which do you prefer for communicating your results to a non-statistical collaborator? A similar decision arises for examining the residuals from this regression.