# GR5205 p51-p66 teaching.pdf - 2.9 Binary Predictor Consider...

• Notes
• 18
• 100% (1) 1 out of 1 people found this document helpful

This preview shows page 1 - 5 out of 18 pages.

2.9Binary PredictorConsider splitting the response valuesy1, . . . , yninto two groups with respective sample sizesn1andn2. Define thedummyvariablexi=(1if group one0if group two(2.17)What will the estimated linear regression model be?
2.9Consider the simple linear regression model(2.1)using independent variabledefined by(2.17). Then the least squares estimators areˆβ1= ¯y1-¯y2andˆβ0= ¯y2,where¯y1and¯y2are the respective sample means of each group.PROOF:HomeworkWhat will the test statistic look like when testingβ1?
Example 6To investigate the maternal behavior of laboratory rats, we move the rat pup a fixed distancefrom the mother and record the time (in seconds) required for the mother to retrieve the pup tothe nest. We run the study with 5- and 20-day old pups. Note: These are not the same pupsbeing measured twice.5 Days20 Days153010152520152520231820Use regression techniques with a dummy variable to test if the retrieval time differs per group.Response (Y)Covariate (x)15110125115120118130015020025023020052
TheRcode follows:# two groupsy1 <- c(15,10,25,15,20,18)y2 <- c(30,15,20,25,23,20)# responsey <- c(y1,y2)# dummy variablex <- c(rep(1,6),rep(0,6))# multiple boxplotboxplot(y x)# testsummary(lm(y x))t.test(y1,y2,var.equal = TRUE)TheRoutput follows:Coefficients:Estimate Std. Error t value Pr(>|t|)(Intercept)22.1672.08810.615 9.18e-07***x-5.0002.953-1.6930.121---Residual standard error: 5.115 on 10 degrees of freedomMultiple R-squared:0.2228,Adjusted R-squared:0.145F-statistic: 2.866 on 1 and 10 DF,p-value: 0.1213TheRoutput follows:Two Sample t-testdata:y1 and y2t = -1.693, df = 10, p-value = 0.1213alternative hypothesis: true difference in means is not equal to 095 percent confidence interval:-11.5804541.580454sample estimates:mean of x mean of y17.1666722.1666753
• • • 