University of California - Statistics 100 Homework 6
University of California, Los Angeles
Department of Statistics
Statistics 100C Instructor: Nicolas Christou
Homework 6
Exercise 1
Please refer to homework 5, exercise 4.
a <- read.table("http://www.stat.ucla.edu/~nchristo/statistics100C/
restaurant.txt", header=TRUE)
Consider the multiple regression model:costi=0+1foodi+2decoti+3seri+i, or in matrix form
y=X+, withE() =0andcov() =2I. Suppose we want to estimate the vector= (0; 1; 2; 3)0
subject to the following three constraints:
0+ 51+ 202+3= 0
0+1+2+3=????25
0????31????2+3=????40
Answer the following questions:
a. Find the constrained least squares estimate of the vector. The set of the three constraint above can
be expressed in matrix form asC????d=0. Please show all the steps.
b. UseRto nd the constrained least squares estimate of the vector. To check your answer, the vector
^must satisfy the three constraints.
Exercise 2
An exercise on centering and scaling. Access the data inRas follows:
a <- read.table("http://www.stat.ucla.edu/~nchristo/statistics_c173_c273/jura.txt",
header=TRUE)
These Jura data were collected by the Swiss Federal Institute of Technology at Lausanne. See Goovaerts,
P. 1997, \Geostatistics for Natural Resources Evaluation", Oxford University Press, New-York, 483 p. for
more details. Data were recorded at 359 locations scattered in space (see gure below).
1 2 3 4 5
1 2 3 4 5
The Jura data set
x
y
Concentrations of seven heavy metals (cadmium, cobalt, chromium, copper, nickel, lead, and zinc) in the
topsoil were measured at each location. The type of land use and rock type was also recorded for each
location. The data can be accessed here:
> names(a)
[1] "x" "y" "Landuse" "Rock" "Cd"
[6] "Co" "Cr" "Cu" "Ni" "Pb"
[11] "Zn"
The variablesx; yare the coordinates. Landuse and Rock represent type of land use (forest, pasture, meadow,
tillage) and rock type (Argovian, Kimmeridgian, Sequanina, Portlandian, and Quaternary). The other vari-
ables are concerntrations in ppm of the following chemical elements:
Cd: Cadmium
Co: Cobalt
Cr: Chromium
Cu: Copper
Ni: Nickel
Pb: Lead
Zn: Zinc
UseCdas your response variable. UseCo,Cr,Cu,Ni,Pb,Znas your predictors to answer the following
questions.
a. Run the multiple regression ofCdonCo,Cr,Cu,Ni,Pb,Zn. Print the R output.
b. Center and scale the predictors and run the multiple regression ofCdon the centered and scaled
versions ofCo,Cr,Cu,Ni,Pb,Zn.
c. Compute the variance covariance matrix of ^of the model of question (a).
d. Using the variance covariance matrix of ^nd the variance covariance matrix of ^of the model of
question (b).
e. Compute the correlation matrix of the predictors.
f. ComputeV IF1(corresponds to Co).
-
Rating:
/5
Solution: University of California - Statistics 100 Homework 6 Solution