Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Emergency……… QThe dataset we considered here is provided in a R package called ‘

ID: 3357724 • Letter: E

Question

Emergency………
QThe dataset we considered here is provided in a R package called ‘datasets’. It were first taken from a 1974 Motor Trend magazine, which originally records various design and perfor- mance characteristics of 32 cars (1973-74 models). A detailed description can be found in this link: https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/mtcars.html. As in assignment 3, we treat the mpg (miles per gallon) as the response variable and all the others as regressors. (Please treat all the regressors as continuous, though variable such as am(Transmission) can be considered as an Indicator variable)
a) Perform a forward model selection using AIC. Provide the resulting model only with estimated parameters (do not just include your R output) b) Perform a forward model selection using BIC. Provide the resulting model only with estimated parameters (do not just include your R output c) Perform a backward model selection using AIC. Provide the resulting model only with estimated parameters (do not just inchude your R output)odel estimated d) Perform a backward model selection using BIC. Provide the resulting model only with estimated parameters (do not just include your R output) parameters (do not just include your R output) You can load the dataset by running the following R code: install packages 'datasets') library (datasets) data (mtcars) mtcars

Explanation / Answer

mtcars$am = as.factor(mtcars$am)
mtcars$cyl = as.factor(mtcars$cyl)
mtcars$vs = as.factor(mtcars$vs)
mtcars$gear = as.factor(mtcars$gear)

#Dropping dependent variable for calculating Multicollinearity

mtcars_a = subset(mtcars, select = -c(mpg))

#Identifying numeric variables

numericData <- mtcars_a[sapply(mtcars_a, is.numeric)]

# Checking Variables that are highly correlated

highlyCorrelated = findCorrelation(descrCor, cutoff=0.7)

#Identifying Variable Names of Highly Correlated Variables

highlyCorCol = colnames(numericData)[highlyCorrelated]

#Print highly correlated attributes

highlyCorCol

[1] "hp" "disp" "wt"

#Remove highly correlated variables and create a new dataset

dat3 = mtcars[, -which(colnames(mtcars) %in% highlyCorCol)]

(a) step_a <- stepAIC(fit, direction="forward")

(b) step_b <- stepBIC(fit, direction="forward")

(c) step_c <- stepAIC(fit, direction="backward")

(d) step_d <- stepBIC(fit, direction="backward")  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote