Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this question, we will predict the number of applications received using the other variables in the College data set. First, we split the data

In this question, we will predict the number of applications received using the other variables in the College data set.

First, we split the data set into a training set and a test set by using the following command lines.

library(ISLR)

data("College")

set.seed(20)

train <- sample(nrow(College), 600)

College.train <- College[train, ]

College.test <- College[-train, ]

(a) Fit a linear model using least squares on the training set, and report the test error obtained.

(b) Fit a ridge regression model on the training set, with chosen by cross-validation. Report the test error obtained.

(c) Fit a lasso model on the training set, with chosen by crossvalidation. Report the test error obtained, along with the number of non-zero coefficient

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Business Mathematics In Canada

Authors: F. Ernest Jerome, Jackie Shemko

3rd Edition

1259370151, 978-1259370151

More Books

Students also viewed these Mathematics questions