DOC PREVIEW
UNL STAT 870 - Homework 1

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Chapter 2 homework2.2 Do on your own. 2.5 a) Here is my code and the corresponding output. Note that I edited this code and output after pasting it into Word to make it look nicer. Again, you are expected to do this as well. > ############################################################################> # NAME: Chris Bilder #> # DATE: 7-19-06 #> # PURPOSE: 2.5, 2.14 in KNN #> # #> # NOTES: 1) #> # #> ############################################################################ > #Read in the data> copier<-read.table(file = "C:\\chris\\UNL\\STAT870\\Instructor_CD\\Data Sets\\Chapter 1 Data Sets\\CH01PR20.txt", header = FALSE, col.names = c("minutes", "copiers"), sep = "")> #Check first few observations> head(copier) minutes copiers1 20 22 60 43 46 34 41 25 12 16 137 10 > #Fit the simple linear regression model and save the results in mod.fit> mod.fit<-lm(formula = minutes ~ copiers, data = copier)> sum.fit<-summary(mod.fit)> sum.fit Call:lm(formula = minutes ~ copiers, data = copier)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 freedomMultiple R-Squared: 0.9575, Adjusted R-squared: 0.9565 F-statistic: 968.7 on 1 and 43 DF, p-value: < 2.2e-16 > names(sum.fit) [1] "call" "terms" "residuals" "coefficients" [5] "aliased" "sigma" "df" "r.squared" [9] "adj.r.squared" "fstatistic" "cov.unscaled" > #Here are a couple ways to get the estimated Var(b1):1> # 1.> sum.fit$coefficients #Table from summary(mod.fit) Estimate Std. Error t value Pr(>|t|)(Intercept) -0.5801567 2.8039411 -0.2069076 8.370587e-01copiers 15.0352480 0.4830872 31.1232581 4.009032e-31> sd.b1<-sum.fit$coefficients[2,2] #estimated sqrt(Var(b1))> var.b1<-sum.fit$coefficients[2,2]^2> data.frame(sd.b1, var.b1) sd.b1 var.b11 0.4830872 0.2333733 > # 2. This uses information from Chapter 6 p. 207> sum.fit$cov.unscaled #Estimated covariance matrix for b0 and b1 w/o MSE part (Intercept) copiers(Intercept) 0.09895561 -0.015013055copiers -0.01501305 0.002937337> var.b1<-sum.fit$cov.unscaled[2,2]*sum.fit$sigma^2> sqrt(var.b1)[1] 0.4830872> #Find C.I. for beta1> alpha<-0.1> low<-mod.fit$coefficients[2]-qt(p = 1-alpha/2, df = mod.fit$df.residual) *sqrt(var.b1)> up<- mod.fit$coefficients[2]+qt(p = 1-alpha/2, df = mod.fit$df.residual) *sqrt(var.b1)> data.frame(b1 = mod.fit$coefficients[2], low, up) b1 low upcopiers 15.03525 14.22314 15.84735> #Note that mod.fit$df.residual = nrow(copier)-2 is degrees of freedom> #To remove the "copiers" extra label in the output, use as.numeric()> low<-as.numeric(mod.fit$coefficients[2])-qt(p = 1-alpha/2, df = mod.fit$df.residual)*sqrt(var.b1)> up<- as.numeric(mod.fit$coefficients[2])+qt(p = 1-alpha/2, df = mod.fit$df.residual)*sqrt(var.b1)> data.frame(b1 = as.numeric(mod.fit$coefficients[2]), low, up) b1 low up1 15.03525 14.22314 15.84735 > #Another way to get C.I.> mod.fit$coefficients[2]-qt(p = c(1-alpha/2, alpha/2), df = mod.fit$df.residual) *sqrt(var.b1)[1] 14.22314 15.84735 The 90% C.I. for 1 (change in mean service time when number of copiers increases by 1) is 14.22 < 1 < 15.85 b) Using the output from a), 1) Ho: 1 = 0 vs. Ha: 1  02) P-value is less than 210-163)  = 0.104) Since 210-16 < 0.10, reject Ho25) There is sufficient evidence to indicate a linear relationship between service time and the number of copiers. c) Yes – if we would have used a C.I. for the hypothesis test instead, we would simply check whether or not 0 is in the interval. Obviously, 0 is not in the interval so we would reject Ho.d) Deciding what goes in Ho and Ha is often difficult for students when performing a one-sided (one-tail) hypothesis test. The decision should center around what do you want your type I error to represent because the probability of making this error can be controlled (at  = 0.05 in this case). The copier firm wants to determine here if a standard of <14 minutes is being satisfied. Thus, they would want to control the probability of concluding <14 minutes when in fact the opposite is true. So, with the help of output in part a) and additional output, > t.star<-(as.numeric(mod.fit$coefficients[2]) - 14)/sqrt(var.b1)> p.value<-pt(q = t.star, df = mod.fit$df.residual) #Left tail test> crit.value<-qt(p = 0.05, df = mod.fit$df.residual) #Left tail test> data.frame(t.star, p.value, crit.value, df = mod.fit$df.residual) t.star p.value crit.value df1 2.142984 0.9810923 -1.681071 431) Ho: 1 ≥ 14 vs. Ha: 1 < 142)�1 1*1b 15.0352 14t 2.140.4831 Var(b )- b -= = =3) t(0.05, 43) = -1.68 4) Since 2.14 > -1.68, do not reject Ho5) There is not sufficient evidence to indicate the number of minutes is less than 14 for each one unit increase in the copiers. The p-value is P(T < 2.14) = 0.9811 where T~t(43) (remember this is a left-tail test)The answer key reverses the hypotheses to be 1) Ho: 1 ≤ 14 vs. Ha: 1 > 14Continuing this test produces, 2)�1 1*1b 15.0352 14t 2.140.4831 Var(b )- b -= = =3) t(0.95, 43) = 1.68 4) Since 2.14 > 1.68, reject Ho (p-value = P(T > 2.14) = 0.0189)5) There is sufficient evidence that the number of minutes is greater than 14 for each one unit increase in the copiers. KNN probably decided to do the test this way because one would disprove the manufacturer’s claim (with a probability of 0.05 for incorrectly concluding claim is wrong). I think the problem could be worded better, and I would for a project or test. For example, to do the test that I originally did, I would have


View Full Document

UNL STAT 870 - Homework 1

Download Homework 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?