Hey everyone,
So I am looking for a way to create a decision tree for a modeling class and
I am not all that familiar with R. I thought I might be able to use RPart,
but I can't get it to work. I want a simple tree with a parent that says the
amount and each child has a percentage of likelyhood and a payback so it
would look something like this...
_____10%/1000
100|_____90%/0
So I tried to do this by creating a table (again remember I am new)
>test <- matrix(c(000000.1,000000.9,1000,0,.1*1000, .9*0), ncol=2,
byrow=TRUE)>colnames(test) <- c("Case A", "Case B")
>rownames(test) <- c("Chance", "Payoff",
"Total")
> test <- as.table(test)
But when I run..>fit <- rpart(Total ~ Chance * Payoff, method="class",
data=test)
I see Error in eval(expr, envir, enclos) : object 'Chance' not found
I try...
fit <- rpart(Kyphosis ~ Age + Number + Start,
method="class", data=kyphosis)
and it works fine.
Am I missing something here?
Thanks
[[alternative HTML version deleted]]