Load the olive oil data using the commands:
library(pgmm)
data(olive)
olive = olive[,-1]
(NOTE: If you have trouble installing the pgmm package, you can download the -code-olive-/code- dataset here: olive_data.zip. After unzipping the archive, you can load the file using the -code-load()-/code- function in R.) These data contain information on 572 different Italian olive oils from multiple regions in Italy. Fit a classification tree where Area is the outcome variable. Then predict the value of area for the following data frame using the tree command with all defaults
newdata = as.data.frame(t(colMeans(olive)))
What is the resulting prediction? Is the resulting prediction strange? Why or why not?

Practice More Questions From: Quiz 3

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.8If 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 cell segmentation data from the AppliedPredictiveModeling package using the commands: library(AppliedPredictiveModeling)data(segmentationOriginal)library(caret)1. Subset the data to a training set and testing set based on the Case variable in the data set. 2. Set the seed to 125 and fit a CART model with the rpart method using all predictor variables and default caret settings. 3. In the final model what would be the final model prediction for cases with the following variable values:a. TotalIntench2 = 23,000; FiberWidthCh1 = 10; PerimStatusCh1=2 b. TotalIntench2 = 50,000; FiberWidthCh1 = 10;VarIntenCh4 = 100 c. TotalIntench2 = 57,000; FiberWidthCh1 = 8;VarIntenCh4 = 100 d. FiberWidthCh1 = 8;VarIntenCh4 = 100; PerimStatusCh1=2

Q:

If K is small in a K-fold cross validation is the bias in the estimate of out-of-sample (test set) accuracy smaller or bigger? If K is small is the variance in the estimate of out-of-sample (test set) accuracy smaller or bigger. Is K large or small in leave one out cross validation?

Q:

Load the olive oil data using the commands: library(pgmm)data(olive)olive = olive[,-1](NOTE: If you have trouble installing the pgmm package, you can download the -code-olive-/code- dataset here: olive_data.zip. After unzipping the archive, you can load the file using the -code-load()-/code- function in R.)These data contain information on 572 different Italian olive oils from multiple regions in Italy. Fit a classification tree where Area is the outcome variable. Then predict the value of area for the following data frame using the tree command with all defaultsnewdata = as.data.frame(t(colMeans(olive)))What is the resulting prediction? Is the resulting prediction strange? Why or why not?

Q:

Load the South Africa Heart Disease Data and create training and test sets with the following code: library(ElemStatLearn)data(SAheart)set.seed(8484)train = sample(1:dim(SAheart)[1],size=dim(SAheart)[1]/2,replace=F)trainSA = SAheart[train,]testSA = SAheart[-train,]Then set the seed to 13234 and fit a logistic regression model (method=”glm”, be sure to specify family=”binomial”) with Coronary Heart Disease (chd) as the outcome and age at onset, current alcohol consumption, obesity levels, cumulative tabacco, type-A behavior, and low density lipoprotein cholesterol as predictors. Calculate the misclassification rate for your model using this function and a prediction on the “response” scale:missClass = function(values,prediction){sum(((prediction > 0.5)*1) != values)/length(values)}What is the misclassification rate on the training set? What is the misclassification rate on the test set?

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments