## Q:

### For this quiz we will be using several R packages. R package versions change over time, the right answers have been checked using the following versions of the packages. AppliedPredictiveModeling: v1.1.6caret: v6.0.47ElemStatLearn: v2012.04-0pgmm: v1.1rpart: v4.1.8gbm: v2.1lubridate: v1.3.3forecast: v5.6e1071: v1.6.4If you aren’t using these versions of the packages, your answers may not exactly match the right answer, but hopefully should be close.Load the vowel.train and vowel.test data sets:library(ElemStatLearn)data(vowel.train)data(vowel.test)Set the variable y to be a factor variable in both the training and test set. Then set the seed to 33833. Fit (1) a random forest predictor relating the factor variable y to the remaining variables and (2) a boosted predictor using the “gbm” method. Fit these both with the train() command in the caret package. What are the accuracies for the two approaches on the test data set? What is the accuracy among the test set samples where the two methods agree?

## Q:

### Load the Alzheimer’s data using the following commands library(caret)library(gbm)set.seed(3433)library(AppliedPredictiveModeling)data(AlzheimerDisease)adData = data.frame(diagnosis,predictors)inTrain = createDataPartition(adData$diagnosis, p = 3/4)[[1]]training = adData[ inTrain,]testing = adData[-inTrain,]Set the seed to 62433 and predict diagnosis with all the other variables using a random forest (“rf”), boosted trees (“gbm”) and linear discriminant analysis (“lda”) model. Stack the predictions together using random forests (“rf”). What is the resulting accuracy on the test set? Is it better or worse than each of the individual predictions?

## Q:

### Load the data on the number of visitors to the instructors blog from here: Using the commands:library(lubridate) # For year() function belowdat = read.csv(“~/Desktop/gaData.csv”)training = dat[year(dat$date) 2011,]tstrain = ts(training$visitsTumblr)Fit a model using the bats() function in the forecast package to the training time series. Then forecast this model for the remaining time points. For how many of the testing points is the true value within the 95% prediction interval bounds?

## Q:

### Load the concrete data with the commands: set.seed(3523)library(AppliedPredictiveModeling)data(concrete)inTrain = createDataPartition(concrete$CompressiveStrength, p = 3/4)[[1]]training = concrete[ inTrain,]testing = concrete[-inTrain,]Set the seed to 325 and fit a support vector machine using the e1071 package to predict Compressive Strength using the default settings. Predict on the testing set. What is the RMSE?

Subscribe

0 Comments

Find Questions in This Page: "

**"***CTRL+F*