[R-es] modelling with a decision tree in Rpart

Jose Bustos Melo
Fri, 26 Aug 2011 15:20:17 -0000

Hello everyone,

I working in a public helath project and we have created a Decision Tree for
categorical variables usign the package rpart. Our goal is to develop a model in
order to predict presence/ausent of a diabetes and get a better understanding
of what are the important factors in a particular chilean population.  There are
some importants variable that we have found.  Now we want to apply this model
over a dataset in order to determinate a possible outcome (probability of
getting the deseasse), but we only have the combination of predictive variables
for a particular person (we have thousands).

We have created this code:

library(rpart)
fit1 <- rpart(sickness~ distancetothesource+gse+age+sex,
method="class", data=data)
prediccion<-predict(fit1 , type="prob")
predictionsyes<-prediccion[,2]
pred <- prediction(predictionsyes, datos$sickness)


My question is. How do I put the people's conditions in this model and get
the proability of getting the desease?

Hope someone can help.
Best Regards,

José Bustos
Escuela de Enfermeria
Pontificia Universidad Católica de Chile
Proyecto FONIS 2010
Celular 95939144






	[[alternative HTML version deleted]]