0% found this document useful (0 votes)
107 views6 pages

Programming Assignment Unit 3

This document discusses regression exercises in R, including: 1) Calculating parameter estimates and confidence intervals for a regression model with variables x1, x2, and error variance. 2) Checking if the model can be reduced by removing insignificant variables. 3) Performing residual analysis to check model assumptions. 4) Plotting the fitted line with confidence and prediction intervals. It also examines whether single variables x1 or x2 can describe variation in y, and estimates parameters for models with each single variable, checking if parameters are significantly different from zero.

Uploaded by

Mahmoud Heretani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views6 pages

Programming Assignment Unit 3

This document discusses regression exercises in R, including: 1) Calculating parameter estimates and confidence intervals for a regression model with variables x1, x2, and error variance. 2) Checking if the model can be reduced by removing insignificant variables. 3) Performing residual analysis to check model assumptions. 4) Plotting the fitted line with confidence and prediction intervals. It also examines whether single variables x1 or x2 can describe variation in y, and estimates parameters for models with each single variable, checking if parameters are significantly different from zero.

Uploaded by

Mahmoud Heretani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

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

You might also like