[R] predictions several categories

AURORA GONZALEZ VIDAL aurora.gonzalez2 at um.es
Mon Oct 12 18:39:57 CEST 2015


Hello everybody.

I am using the caret package in order to predict something from some data.
I have "hours" , "days" and "temperature" where "hours" are given in
decimal form, "days" are the days of the week where each observation was
colected and "temperature" is the temperature that a user of air
conditioning inputed in the device.

I have simplified the problem but the thing is I want to predict the
temperature that is going to be choose having the time (hour and day of the
week).

I try to do something like this:

hour <-
c(12,12.5,12.75,13,14,14.5,16,10,11,14,15.71,13,9,10,12,13,18,20,12.2,13)
day <-
c("m","m","t","t","w","w","th","th","f","f","st","st","sn","sn","m","t","w","th","f","st")
temperature <-
c(19,20,21,22,20,23,26,27,26,26,25,23,23,20,24,25,25,22,28,26)
df <- data.frame(hour,day,temperature)

inTrain <- createDataPartition(y=df$temperature, p=0.6,list=F)
training <- df[inTrain,]
testing <- df[-inTrain,]

modelFit <- train(temperature ~ hour+day,data=training, method="glm")
modelFit
predictions <- predict(modelFit, newdata=testing)

but the predictions have decimals, so I don't know how to treate the
temperature variable (because it is only going to be a natural value).
Which model should I use to predict those data? Do you have any advice or
manual that I could check??

Also, I would like to know the correct way of testing the model (usually if
I had just two categories I would use a confusionMatrix but here i dont
have any clue).

Thank you very very much!!


------
Aurora González Vidal

@. aurora.gonzalez2 en um.es
T. 868 88 7866
www.um.es/ae

	[[alternative HTML version deleted]]



More information about the R-help mailing list