# GR5205+p124-p134+Annotated.pdf - Figure 10 Scatter plot of...

• 11

This preview shows page 1 - 4 out of 11 pages.

Figure 10: Scatter plot of the raw data with the group means.2468102.02.53.03.5F-lack of Fit TestxyGroup MeansRaw DataExample 18x <- c(2,2,2,4,4,5,5,5,8,10,10,10,10)y <- c(1.9,2.1,2.2,2.4,3,3.1,3.6,3.5,3.5,2.3,2.3,3.3,3)n <- length(y)c <- 5sse.R <- anova(lm(yx))[]fac.x <- factor(x)sse.F <- anova(lm(yfac.x))[]f.calc <- ((sse.R-sse.F)/(c-2))/(sse.F/(n-c))1-pf(f.calc,c-2,n-c)Table 8:Routput for the reduced model.DfSum SqMean SqF valuePr(>F)x10.450.451.280.2825Residuals113.900.35Table 9:Routput for the full model.DfSum SqMean SqF valuePr(>F)fac.x43.220.815.680.0182Residuals81.130.14H0:E[Y] =β0+β1xversusHA:E[Y]6=β0+β1x.fcalc= 6.512and P-value=0.0154RejectH0and conclude that linearity is not satisfied for this data set.124
4.3Tests for Normality and Homogeneity of VarianceThere are many different testing procedures to assess normality of the errors. A few techniquesfollow below:Break up the residuals into bins (bins of a histogram) and use a“chi-square goodness-of-fit"test to compare the observed frequencies verses the theoretical frequencies of anormal distribution.Run a hypothesis test on the correlation coefficient between the sample quantiles and thetheoretical quantiles from the normal distribution. (Run a correlation test on the QQ-plot.)The Kolmogorov-Smirnov test is a popular method used to assess normality of a data set.Note: All three methods can be used to assess the goodness-of-fit of any probability distribution.Inspecting the QQ-plot is recommended in practice.125
Levene’s test for homogeneity of varianceThere are many techniques to check homogeneity of variance of the regression model. For thisclass, we only consider Levene’s test.Note: Levenes’s test requires repeat observations of one or morexlevels.Note: The lack-of-fit test, also requires repeat observations of one or morexlevels.Note: I am skipping the technical details of Levene’s test.The null alternative pair:H0:σ21=σ22=· · ·=σ2cversusHA:At least oneσ2i6=σ2jfor somei6=j.TheRcode for simple linear regression follows:library(car)leveneTest(yfactor(x))Inspecting the residual plots for homogeneity of variance is recommended in practice.Testing temporal dependenceTo assess the presence of serial correlation, we can apply the Durbin-Watson test on the resid-uals. We will skip this test for now and revisit the Durbin-Watson procedure at the end of thesemester.
• • • 