EXERCISES: Multiple Linear Regression
The following measurements have been obtained in a study:
It is expected that the response variable y can be described by the independent variables x1 and x2.
This implies that the parameters of the following model should be estimated and tested.
Yi = β0 + β1x1 + β2x2 + εi, εi~N(0,σ2)
a) Calculate the parameter estimates (β0, β1, β2, and σ2), in addition to finding the usual 95% confidence intervals for β0, β1, and β2.
You can copy the following lines to R to load the data:
D <- data.frame(
x1=c(0.58, 0.86, 0.29, 0.20, 0.56, 0.28, 0.08, 0.41, 0.22, 0.35,
0.59, 0.22, 0.26, 0.12, 0.65, 0.70, 0.30, 0.70, 0.39, 0.72,
0.45, 0.81, 0.04, 0.20, 0.95),
x2=c(0.71, 0.13, 0.79, 0.20, 0.56, 0.92, 0.01, 0.60, 0.70, 0.73,
0.13, 0.96, 0.27, 0.21, 0.88, 0.30, 0.15, 0.09, 0.17, 0.25,
0.30, 0.32, 0.82, 0.98, 0.00),
y=c(1.45, 1.93, 0.81, 0.61, 1.55, 0.95, 0.45, 1.14, 0.74, 0.98,
1.41, 0.81, 0.89, 0.68, 1.39, 1.53, 0.91, 1.49, 1.38, 1.73,
1.11, 1.68, 0.66, 0.69, 1.98)
)
b) Still using a confidence level α = 0.05, reduce the model if appropriate.
c) Carry out a residual analysis to check that the model assumptions are fulfilled.
d) Make a plot of the fitted line and 95% confidence and prediction intervals of the line for x1 ε [0, 1] (it is assumed that the model was reduced above).
MLR simulation exercise
The following measurements have been obtained in a study:
a) Plot the observed values of y as a function of x1 and x2. Does it seem reasonable that either x1 or x2 can describe the variation in y?
You may copy the following lines into R to load the data:
D <- data.frame(
y=c(9.29,12.67,12.42,0.38,20.77,9.52,2.38,7.46),
x1=c(1.00,2.00,3.00,4.00,5.00,6.00,7.00,8.00),
x2=c(4.00,12.00,16.00,8.00,32.00,24.00,20.00,28.00)
)
b) Estimate the parameters for the two models:
Yi = β0 + β1x1,i + εi, εi~N(0,σ2)
And
Yi = β0 + β1x2,i + εi, εi~N(0,σ2)
and report the 95% confidence intervals for the parameters. Are any of the parameters significantly different from zero on a 95% confidence level?