search for: yval2

Displaying 10 results from an estimated 10 matches for "yval2".

Did you mean: val2
2008 Oct 27
0
Displaying number of Y/N affected by tree in rule form RE: R question/request on rules from rpart
...{ # The following [,5] is hardwired - needs work! cat("\n") cat(sprintf(" Rule number: %s ", names[i])) cat(sprintf("[yval=%s cover=%d N=%.0f Y=%.0f (%.0f%%) prob=%0.2f]\n", ylevels[frm[i,]$yval], frm[i,]$n, formatC(frm[i,]$yval2[,2], format = "f", digits = 2), formatC(frm[i,]$n-frm[i,]$yval2[,2], format = "f", digits = 2), round(100*frm[i,]$n/ds.size), frm[i,]$yval2[,5])) pth <- path.rpart(model, nodes=as.numeric(names[i]), print.it=FALSE) cat(sprintf(" %s\n&quot...
2012 Jan 08
2
rpart question
We are trying to make a decision tree using rpart and we are continually running into the following error: > fit_rpart=rpart(ENROLL_YN~MINORITY,method="class") > summary(fit_rpart) Call: rpart(formula = ENROLL_YN ~ MINORITY, method = "class") n= 5725 CP nsplit rel error 1 0 0 1 Error in yval[, 1] : incorrect number of dimensions ENROLL_YN is a
2011 Jan 26
1
Inconsistencies in the rpart.object help file?
...of the response at each node, *and splits, a two > column matrix of left and right split labels for each node. * But from looking at the object, for example fit1 <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis) fit1$frame var n wt dev yval complexity ncompete nsurrogate yval2.1 yval2.2 yval2.3 yval2.4 yval2.5 1 Start 81 81 17 1 0.17647059 2 1 1.0000000 64.0000000 17.0000000 0.7901235 0.2098765 2 Start 62 62 6 1 0.01960784 2 2 1.0000000 56.0000000 6.0000000 0.9032258 0.0967742 4 <leaf> 29 29 0 1...
2006 Oct 17
1
Some questions on Rpart algorithm
Hello: I am using rpart and would like more background on how the splits are made and how to interpret results - also how to properly use text(.rpart). I have looked through Venables and Ripley and through the rpart help and still have some questions. If there is a source (say, Breiman et al) on decision trees that would clear this all up, please let me know. The questions below pertain to a
2002 Jan 25
0
rpart subsets
...result when # calculating the probabilities tempx <- matrix(0, nrow=nrow(temp), ncol=ncol(temp)) tempx[which(is.finite(temp))] <- temp[which(is.finite(temp))] temp <- tempx # end of Bob's changes yprob <- temp /apply(temp,1,sum) #necessary with altered priors yval2 <- matrix(rp$dnode[, -(1:3)], ncol=numclass+1) frame$yval2 <- cbind(yval2, yprob) } The frequencies are calculated for each node and the resulting zeros produce NaN's when calculating the probabilities. My clumsy R code simply removes the NaN's from the matrix of probabilities. D...
2002 Jan 28
0
rpart subset fix
...result when # calculating the probabilities tempx <- matrix(0, nrow=nrow(temp), ncol=ncol(temp)) tempx[which(is.finite(temp))] <- temp[which(is.finite(temp))] temp <- tempx # end of Bob's changes yprob <- temp /apply(temp,1,sum) #necessary with altered priors yval2 <- matrix(rp$dnode[, -(1:3)], ncol=numclass+1) frame$yval2 <- cbind(yval2, yprob) } The frequencies are calculated for each node and the resulting zeros produce NaN's when calculating the probabilities. My clumsy R code simply removes the NaN's from the matrix of probabilities. D...
2005 Mar 15
0
need help with plot.rpart and text.rpart
...the frame component of the tree On inspecting fit$frame I noticed that neither "yprob" nor 'specific yval level' are included in the frame. I therefore even tried to create these variable in the frame by using the following fit$frame <- transform(fit$frame, newVar=fit$frame$yval2[,4]) where fit$frame$yval2[,4] are the probabilities of the winning factor level. However, using this I just get the values of "yval" as the labels which I could have got anyway by setting the option label="yval". I would really appreciate any help on this. Thanks in advance....
2005 Jun 14
0
bug in rpart?
...> age <- rep(1:3, c(2, 3, 15)) > eg<- data.frame(rexp(n), rbinom(n,1,prob=.3), age=age) > names(eg) <- c("surv", "status", "age") > rpart(Surv(surv, status)~age, data=eg) Error in "$<-.data.frame"(`*tmp*`, "yval2", value = c(1, 7)) : replacement has 2 rows, data has 1 > > # code 2 > n <- 20 > age <- rep(1:3, c(5, 5, 10)) > eg<- data.frame(rexp(n), rbinom(n,1,prob=.3), age=age) > names(eg) <- c("surv", "status", "ag...
2010 Apr 26
1
mvpart : Printing response values at terminal nodes
I have created a multivariate regression tree using mvpart, with 3-4 responses. Though the plot shows bargraphs for each response, I would like to have the VALUES of the responses printed or indicated (via a scale or something) alongside the bargraph. Is this possible ?? Thanks, Manjunath [[alternative HTML version deleted]]
2005 May 25
0
Error with user defined split function in rpart (PR#7895)
...The program to reproduce the error is below. I am calling rpart with a user-defined split function for a binary response variable and one continuous independent variable. The split function works for some datasets but not others. The error is: Error in "$<-.data.frame"(`*tmp*`, "yval2", value = c(0, 15, 10, 0.6, : replacement has 5 rows, data has 1 # # Test out the "user mode" functions, with a binary response # rm(list=ls(all=TRUE)) options(warn = 1); library(rpart); set.seed(7); nobs <- 25; mydata <- data.frame(indx=1:nobs); mydata[...