STAT 331 Winter 2015 midterm 2 solutions - University of...

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

University of WaterlooSTAT 331: Midterm IITerm: WinterYear: 2015Student Name (Print):UW Student ID Number:UW Student Userid:Course Abbreviation and Number:STAT 331Course Title:Applied Linear ModelsSection(s):001Sections Combined Course(s):SYDE 334Section Numbers of Combined Course(s):001Instructor(s):Martin LysyDate of Exam:March 19, 2015Time Period:Start time:1:30pmEnd Time:2:20pmDuration of Exam:50 minutesNumber of Exam Pages (incl. cover sheet):6Exam Type:Closed BookAdditional Materials Allowed:CalculatorInstructions:Read all questions before you start.Not all questions and parts are equally difficult.The exam is single-sided.Use the backs of pages if you need extra space.Show all your workto receive full marks.You may tear offthe formula sheet on the last page (page 6).Marking Scheme:Question:123TotalPoints:20101545Score:
Question 1. (20 pts)The datasetiowatest.txtcontains the following measurements on 133 schools in the state of Iowa:Test: The school’s score on a standardized testPoor: A poverty index (the proportion of students on a subsidized meal plan)City: A categorical covariate with six levels:CedarRapids,Davenport,DesMoines,IowaCity,SiouxCity,Waterloo.Consider the followingRcode:iowa<-read.csv("iowatest.txt", sep ="\t")# load the data# fit the following modelsM0<-lm(Test ~ Poverty, data = iowa)M1<-lm(Test ~ Poverty + City, data = iowa)# display unbiased estimates of sigma^2 for each modelround(c(sigma2.hat.M0 = summary(M0)$sigma^2,sigma2.hat.M1 = summary(M1)$sigma^2), 2)sigma2.hat.M0 sigma2.hat.M176.8471.32# coefficients for M1round(coef(M1), 2)(Intercept)Poverty CityDavenport CityDesMoines CityIowaCity74.75-50.75-7.20-0.801.10CitySiouxCity CityWaterloo1.57-3.30# selected elements of (X’X)^{-1} for M1signif(solve(crossprod(model.matrix(M1))), 2)[1:3,1:3](Intercept) Poverty CityDavenport(Intercept)0.067 -0.058-0.039Poverty-0.0580.170-0.027CityDavenport-0.039 -0.0270.097(a) (6 pts) Calculate the value of theF-statistic to test whether each city has a separate interceptin the presence of a common slope for the poverty index.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture