University of The People
CS 4407 Data Mining and Machine Learning
Programming Assignment Unit 3
Introduction
In this assignment, we’ll solve some exercises about regression.
a) Calculate the parameter estimates (β0, β1, β2 and σ2), in addition find the usual
95% confidence intervals for β0, β1, and β2.
As we see in the screenshot above, the parameter estimates:
β0 = 0.434
β1 = 1.653
β2 = 0.0039
Error variance estimate is σ2 = 0.112
b) Still using confidence level α = 0.05 reduce the model if appropriate.
In a, wee see in the screenshot that p value for x2 is 0.05, the confidence
So, we can remove x2 to get the model.
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
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?
As we see, it does not seem reasonable that either x1 or x2 can describe the variation in
y.
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?
The parameters are not significantly different from zero on 95% confidence intervals for
both variables across zero.
Conclusion
It was interesting to use R language and Rstudio to solve these exercises about
regression.
Reference:
- James, G., Witten, D., Hastie, T., & Tibshirani, R. (2013). An Introduction to
Statistical Learning with Applications in R. New York, NY: Springer Venables, W.
N., & Smith, D. M. (2012). An Introduction to R. http://cran.r-
project.org/doc/manuals/R-intro.pdf