You are on page 1of 2

Homework 1

Data sets
Example: Computer repair data
Questions

Create a R markdown document to include your R codes and results. Submit both R markdown and
rendered PDF documents to Blackboard.
If “Knit to HTML” works, but “Knit to PDF” doesn’t, then the problem may be caused by non-standard
characters including mathematical symbols, Greek letters, etc.
Show all your work to receive full credit for a problem. However, you should not include the code chunks
and results that are irrelevant to your answers. An unnecessarily lengthy solution will be penalized.

Data sets
library(data.table)
marr_path = "http://www.stat.tamu.edu/~sheather/book/docs/datasets/"
rae_path = "http://www1.aucegypt.edu/faculty/hadi/RABE5/Data5/"
cw_path = "https://elearn.uta.edu/bbcswebdav/courses/2182-REGRESSION-ANALYSIS-3
0192-001/MATH5358/doc/data/"

Example: Computer repair data


df = fread(paste0(rae_path, "P031.txt"), data.table=F)

Y: length of service calls


X: number of units repaired

Consider a simple linear regression: Y = β0 + β1 X + ϵ .

Questions
1. Using Computer repair data , calculate the following quantities directly without using lm() .
1. n: sample size
2. ȳ , x̄ , SYY, SXX, SXY
3. β̂0 , β̂1
2. (Continued) Based on the quantities you found above, answer the following questions.
1. Construct the ANOVA table for a simple linear regression of Y on X.
2
2. Find σ ̂ , the unbiased estimate of Var(Y|X) .
3. Find R2 , the coe!icients of determination.
3. (Continued) Based on some quantities in (1) and (2),answer the following questions.
1. Find se(β̂1 ) , the standard error of β̂1 .
2. Find the t-statistic for testing H0 : β1 = 0 vs H1 : β1 ≠ 0 . Calculate the p-value. At 0.05
significance level, do you conclude that there is the linear association between X and Y?
4. (Continued) Based on some quantities in (1) and (2), provide the following quantities.
1. Find the 95% confidence interval of β1 .
2. Find the 99% prediction interval of Y given X = 5.
5. Review the syllabus (../math5358-syllabus.html) (find one in this link. Do not use the hard copy you
received during the first day) and Lecture 1 to answer the following questions.
1. Suppose a student earned 240 points for the homework assignment, 85 (out of 100) for Midterm
1, 95 (out of 100) for Midterm 2, 95 (out of 100) for the final project. What will be the final grade of
this student?
2. Suppose a student earned 320 points for the homework assignment, 77 (out of 100) for Midterm
1, 87 (out of 100) for Midterm 2, 82 (out of 100) for the final project. What will be the final grade of
this student?
3. What should be the file name of this assignment?
4. If the instructor fails to “Knit” your rmd file, how much points will you receive?
5. If you do not upload either rmd or pdf , how much points will you receive?
6. (Written) Do Exercise 2.4.

7. (Written) Do Exercise 2.6.

c = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script); })();

You might also like