Question: 6. With the data frame edu containing the education data of Exercise 3, define indicator variables R1, R2, and R3 to represent the four levels
6. With the data frame edu containing the education data of Exercise 3, define indicator variables R1, R2, and R3 to represent the four levels of the variable
“Region” according to the contrast coding of
(12.4.3). For example, the following commands define R1: R1=rep(0, length(edu$R)); R1[which(edu$R==1)]=1;
R1[which(edu$R==4)]=-1. (Note that edu$R is an accepted abbreviation of edu$Region.) Use WLS analysis to test the significance of the variable “Region” at level of significance 0.1. (Hint. Use the steps outlined in Section 12.4.1 to estimate the weights for the WLS analysis, using covariates X1, X2, X3, R1, R2, and R3. Let fitFw and fitRw be the output objects from fitting the full and the reduced (i.e., without R1, R2, and R3) models;
for example fitFw = lm(Y∼X1+X2+X3+R1+R2+R3, weights=w, data=edu). Then use anova(fitFw, fitRw) to test the joint significance of R1, R2, and R3.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
