HW1

docx

School

American University *

*We aren’t endorsed by this school

Course

415

Subject

Statistics

Date

Jan 9, 2024

Type

docx

Pages

5

Uploaded by DeaconMoonPorcupine36

Report
Regression HW 1 Yin Ting Yanie WOng 9/5/2023, STAT 415 Table of Contents Q.1. (5 pts) ............................................................................................................................................................. 1 Q.2, Problem 1.20 (10 pts) ............................................................................................................................. 1 Q.3. Problem 1.24 (5 pts) ................................................................................................................................ 4 Q.1. (5 pts) I have read Lab 1. I have installed relevant software, and am ready to use software for homework, labs, and data analysis. Q.2, Problem 1.20 (10 pts) # Load data cm <- read.table ( "E:/AU 12 Regression/HW1/CH01PR20-1.txt" , header= F) colnames (cm) <- c ( "time" , "copiers" ) head (cm, 3 ) ## time copiers ## 1 20 2 ## 2 60 4 ## 3 46 3 tail (cm, 2 ) ## time copiers ## 44 61 4 ## 45 77 5 Graphical summary hist (cm $ time)
hist (cm $ copiers) plot (time ~ copiers, data= cm)
The histogram of the variable “time” shows a uniform distribution. There is no obvious outliers. a. Estimated regression function cm.SLR <- lm (time ~ copiers, data = cm) cm.SLR ## ## Call: ## lm(formula = time ~ copiers, data = cm) ## ## Coefficients: ## (Intercept) copiers ## -0.5802 15.0352 The estimated regression line (function) is: ^ time =− 0.5802 + 15.0352 ( copiers ) time_hat = -0.5802 + 15.0352(copiers) b. Plot data with regression line plot (time ~ copiers, data= cm, pch= 20 ) abline (cm.SLR $ coefficients)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Based on the above plot, the estimated regression function (line) appears to fit the data well. Most of the observed data are scattered around the regression line and they are not too far awat from the line. c. Interpret the intercept ^ time =− 0.5802 + 15.0352 ( copiers ) The estimated intercept is -0.5802. This means, when there is NO copier, the mean service time is estimated to be -0.5802. In this context, the negative intercept does NOT provide revelant information. The estimated slope is 15.0352. This means for each copier, the expected service time is 15.0352 minutes. Alternatively, for every additional copier, the mean (or expected) service time is estimated to increase 15.0352 minutes. d. Predict y at x = 5. ^ time =− 0.5802 + 15.0352 ( copiers = 5 ) = 74.5958 Q.3. Problem 1.24 (5 pts) a. Residuals and Sum of the squared residuals head (cm.SLR $ residuals) ## 1 2 3 4 5 6
## -9.4903394 0.4391645 1.4744125 11.5096606 -2.4550914 -12.7723238 sum (cm.SLR $ residuals ^ 2 ) ## [1] 3416.377 Summary, explanation, etc. in the text. b. Estimate σ 2 and σ . s2 <- sum (cm.SLR $ residuals ^ 2 ) / ( 45-2 ) s2 ## [1] 79.45063 s <- sqrt (s2) s ## [1] 8.913508 summary (cm.SLR) ## ## Call: ## lm(formula = time ~ copiers, data = cm) ## ## Residuals: ## Min 1Q Median 3Q Max ## -22.7723 -3.7371 0.3334 6.3334 15.4039 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) -0.5802 2.8039 -0.207 0.837 ## copiers 15.0352 0.4831 31.123 <2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 8.914 on 43 degrees of freedom ## Multiple R-squared: 0.9575, Adjusted R-squared: 0.9565 ## F-statistic: 968.7 on 1 and 43 DF, p-value: < 2.2e-16 The estimate of the variance (sigma^2) is ^ σ 2 = 79.45 The estimate of the standard deviation (sigma) is ^ σ = 8.91 The unit on $\signma$ (and ^ σ ) is “minute”, same as ther response variable.