9/29/2016

Exercises

Today, I read the book “Applied Predictive Modeling”. I am trying to accomplish all the exercises of Chapter 3. But there are still some problems. For example, I cannot install some packages which are shown in the book. So I cannot finish the following tasks.

Summary

Creating Dummy Variables
1.
Head(carSubset)
Levels(carSubset$Type)
Simplemod=dummyVars( Mileage+Type, data=carSubset, levelsOnly=TRUE)
Simplemod
Predict(simplemod, head(carSubset))

Exercises
1.
> library(mlbench)
> data(Glass)
> Glass
> library(e1071)
> type=grep("Type", names(Glass))
> Glassvalue=Glass[, -type]
> Glassvalue
> skewvalues=apply(Glassvalue, 2, skewness)
> skewvalues
        RI         Na         Mg         Al         Si          K         Ca 
 1.6027151  0.4478343 -1.1364523  0.8946104 -0.7202392  6.4600889  2.0184463 
        Ba         Fe 
 3.3686800  1.7298107
> correlations=cor(Glassvalue)





Tomorrow, I will try to figure the problems out.

3 comments: