Question: Use the code below to check your results, and report the first 10 observations. > data.frame(Duncan, type.dummy1, type.dummy2) Fit a linear regression of prestige on

Use the code below to check your results, and report the first 10 observations.
> data.frame(Duncan, type.dummy1, type.dummy2)
Fit a linear regression of prestige on three predictors: education, type.dummy1, and type.dummy2. Provide summary output.
The Duncan data set in the car library contains data on the prestige and other characteristics of 45 U. S. occupations in 1950. 1. Fit a simple linear regression of prestige on education. Provide summary output. Is education a significant predicator for prestige Support your answer with appropriate p-value 2. (a) Examine the variable "type": 1) Is "type" numeric or a factor in R by default? 2) How many categories (levels) does "type" have? 3) What are the names of the "type" categories and their meanings? Hint: check the data description. attach (Duncan) check numeric or factor by default in R is numeric (type) is factor (type) check levels unique (type) (b) Provide the scatterplot of prestige against education and label the points by type. label points by type plots (education, prestige, pch as .numeric (type), col-as.numeric (type)) add a legend legend (8,95, levels (type), pch 1:3, col 1:3) Superimpose the above simple linear regression fitted line to this scatterplot. From this plot, does it look like that the linear relationships between prestige and education differ for different type categories? If they seem to differ, do they seem to differ only by intercepts, or only by slopes, or both? Compare and explain. 3. Inclusion of type in the regression model to fit a main effects model (without interaction): (a) Create two dummy variables to represent the three types of occupation by using the dummy variable coding: "type .dummy1" is lif the type is prof, and 0 otherwise; "type. dummy2 is 1 if the type is wc, and 0 otherwise. To create the first dummy variable for type: first set the type.dummyi to be all zeroes type dummy1 rep Co, nrow(Duncan)) then place 1's if type is prof type dummy1Ctype- prof"]-1 The Duncan data set in the car library contains data on the prestige and other characteristics of 45 U. S. occupations in 1950. 1. Fit a simple linear regression of prestige on education. Provide summary output. Is education a significant predicator for prestige Support your answer with appropriate p-value 2. (a) Examine the variable "type": 1) Is "type" numeric or a factor in R by default? 2) How many categories (levels) does "type" have? 3) What are the names of the "type" categories and their meanings? Hint: check the data description. attach (Duncan) check numeric or factor by default in R is numeric (type) is factor (type) check levels unique (type) (b) Provide the scatterplot of prestige against education and label the points by type. label points by type plots (education, prestige, pch as .numeric (type), col-as.numeric (type)) add a legend legend (8,95, levels (type), pch 1:3, col 1:3) Superimpose the above simple linear regression fitted line to this scatterplot. From this plot, does it look like that the linear relationships between prestige and education differ for different type categories? If they seem to differ, do they seem to differ only by intercepts, or only by slopes, or both? Compare and explain. 3. Inclusion of type in the regression model to fit a main effects model (without interaction): (a) Create two dummy variables to represent the three types of occupation by using the dummy variable coding: "type .dummy1" is lif the type is prof, and 0 otherwise; "type. dummy2 is 1 if the type is wc, and 0 otherwise. To create the first dummy variable for type: first set the type.dummyi to be all zeroes type dummy1 rep Co, nrow(Duncan)) then place 1's if type is prof type dummy1Ctype- prof"]-1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
