search for: yprob

Displaying 20 results from an estimated 29 matches for "yprob".

Did you mean: prob
2007 Feb 20
1
text.rpart for the "class" method doesn't act on label="yprob"
Hello All, Am I misreading the documentation? The text.rpart documentation says: "label a column name of x$frame; values of this will label the nodes. For the "class" method, label="yval" results in the factor levels being used, "yprob" results in the probability of the winning factor level being used, and ?specific yval level? results in the probability of that factor level." However, yprob doesn't seem to do this: > pred = rep(letters[1:6],5) > resp = rep(letters[1:3],10) > ex.rp <- rpart(resp~pred) &...
2005 Mar 15
0
need help with plot.rpart and text.rpart
...cation tree using rpart. In order to plot the reults I use the plot function and the text function to label the plot of the tree dendrogram with text. The documentation of text.rpart says : "For the "class" method, label="yval" results in the factor levels being used, "yprob" results in the probability of the winning factor level being used, and 'specific yval level' results in the probability of that factor level" . However, neither the label="yprob" option nor the label='specific yval level' option works for me. I have copied a s...
2008 Jan 29
2
Using Predict and GLM
...ate W1 W2=rnorm(n0,mean=3,sd=8) #Use rnorm to generate W1 Aprob=matrix(.2, nrow=n0, ncol=1) #generating the probability of A #generating probability of A dependant on W1 for(i in 1:n0){ if (W1[i]>1.5) {Aprob[i]=0.4} } A=matrix(rbinom(n0, 1, Aprob), nrow=n0, ncol=1) #generating the 0/1 exposure Yprob=1/(1+exp(-(10*A-5*(W1)^2+2*W2))) Y=matrix(rbinom(n0, 1, Yprob), nrow=n0, ncol=1) #generating the 0/1 exposure zero=data.frame(rep(0, n0)) Q=glm(cbind(Y, 1-Y) ~ A + W1 + W2, family='binomial') QA=predict(Q, newdata=as.data.frame(A)) Q0=predict(Q,newdata=(A=zero)) I've tried many var...
2002 Mar 13
0
rpart error with 0-frequency factor levels (with partial fix) (PR#1378)
...; t1.rpart <- rpart(V1 ~ V2 + V3, data = t1, method = "class") > t2.rpart <- rpart(V1 ~ V2 + V3, data = t2, method = "class") > t3.rpart <- rpart(V1 ~ V2 + V3, data = t3, method = "class") > > print(t1.rpart) n= 100 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 100 49 A (0.5100000 0.4900000) 2) V3< 0.319873 33 13 A (0.6060606 0.3939394) 4) V3>=0.0740043 26 8 A (0.6923077 0.3076923) * 5) V3< 0.0740043 7 2 B (0.2857143 0.7142857) * 3) V3>=0.319873 67 31 B (0.4626866 0.5373134)...
2009 Jul 26
3
Question about rpart decision trees (being used to predict customer churn)
...)) > cancel <- as.factor(c(rep("no",85), rep("yes",5), rep("no",5), rep("yes",5))) > table(experience, cancel) cancel experience no yes bad 5 5 good 85 5 > rpart(cancel ~ experience) n= 100 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 100 10 no (0.9000000 0.1000000) * I tried the following commands with no success. rpart(cancel ~ experience, control=rpart.control(cp=.0001)) rpart(cancel ~ experience, parms=list(split='information')) rpart(cancel ~ experience, parms=list(split='...
2010 Dec 13
2
rpart.object help
Hi, Suppose i have generated an object using the following : fit <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis) And when i print fit, i get the following : n= 81 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 81 17 absent (0.7901235 0.2098765) 2) Start>=8.5 62 6 absent (0.9032258 0.0967742) 4) Start>=14.5 29 0 absent (1.0000000 0.0000000) * 5) Start< 14.5 33 6 absent (0.8181818 0.1818182) 10) Age< 55 12 0 absent (1.0000000...
2007 Jun 15
2
method of rpart when response variable is binary?
...ange it to a factor before calling glm(y~x,data=dat,family=binomail). I try to use rpart. As y is binary, I use "class" method and get the following result. > rpart(y~x,data=dat,method="class") n=778 (22 observations deleted due to missingness) node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 778 67 0 (0.91388175 0.08611825) * If with the default method, I get such a result. > rpart(y~x,data=dat) n=778 (22 observations deleted due to missingness) node), split, n, deviance, yval * denotes terminal node 1) root 778 61.230080 0.08611825...
2009 Mar 21
2
limiting simulated animal movement
Hi, I am trying to simulate animal movement in a gridded landscape made up of cells. At each time step (iteration), the animal moves from one cell to another in a random fashion. This is how I am simulating movement, where a and b are the x,y co-ordinates of the animal at the previous time step: for (i in 1:no.of.steps){ direction <- sample(1:8, 1) if(direction == 1){ a <- a b <- b -
2003 Mar 10
1
rpart returning only 1 node
...rs" "district" "cargroup" [11] "car.age" "adclms" "days" > rating.r1 <- rpart(adclms ~ ., data = rating.adclms, + method = "class") > rating.r1 n= 140602 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 140602 3792 0 (9.730303e-01 2.506365e-02 1.834967e-03 7.112274e-05) * ########################################################## Should I set the costs in rpart()? I'm kind of surprised to see it only return 1 node for the tree. -- Cheers, Kevin -...
2005 Sep 24
1
rpart Error in yval[, 1] : incorrect number of dimensions
...hreads did not make it clear how to fix the problem. > currwh.rpart<-rpart(formula = CURRWHEE~EA17_6_1 + EA17_9_1 + X087 + X148 + X260 + MOTHERSA + GESTATIO,method="class") > > currwh.rpart n=6783 (2283 observations deleted due to missing) node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 6783 720 3 (0.1060002949 0.8938522778 0.0001474274) * > > summary(currwh.rpart) Call: rpart(formula = CURRWHEE ~ EA17_6_1 + EA17_9_1 + X087 + X148 + X260 + MOTHERSA + GESTATIO, method = "class") n=6783 (2283 observations deleted due to miss...
2005 Dec 07
0
Are minbucket and minsplit rpart options working as expected?
Dear r-list: I am using rpart to build a tree on a dataset. First I obtain a perhaps too large tree: > arbol.bsvg.02 <- rpart(formula, data = bsvg, subset=grp.entr, control=rpart.control(cp=0.001)) > arbol.bsvg.02 n= 100000 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 100000 6657 0 (0.93343000 0.06657000) 2) meses_antiguedad_svg>=10.5 73899 3658 0 (0.95050001 0.04949999) 4) eor_n1_gns< 1.5 63968 2807 0 (0.95611868 0.04388132) 8) tarifa_gas=31,32,33,34 63842 2771 0 (0.95659597 0.04340403) *...
2011 Mar 23
1
Corrupt trees
...it the data into training and test 2. Call tree() to generate a tree object 3. Returns the indices of the training, test in the data as well as the tree object The function gen.predictions() does the following: 1. Call predict() with the tree object from run.tree() and the test data 2. Returns the yprob values and other information about the predictions Any help would be greatly appreciated. Osei
2012 May 15
2
rpart - predict terminal nodes for new observations
...an AM of 5, I would like to link it to the terminal node 2. My searches led to http://tolstoy.newcastle.edu.au/R/e4/help/08/07/17702.html but I do not seem to be able to operationalize Professor Ripley's suggestions. Many thanks. Tudor > tree.prune n= 2400 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 2400 779 0 (0.6754167 0.3245833) 2) AM< 6.5 1428 254 0 (0.8221289 0.1778711) * 3) AM>=6.5 972 447 1 (0.4598765 0.5401235) 6) P>=10.39666 390 86 0 (0.7794872 0.2205128) * 7) P< 10.39666 582 143 1 (0.2457045 0.7542955) * -- View t...
2006 Apr 17
0
Problem getting R's decision tree for Quinlan's golf exam ple data [Broadcast]
See ?rpart.control. I get: > golf.rp = rpart(Outlook ~ ., golf, control=rpart.control(minsplit=1)) > golf.rp n= 14 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 14 9 rain (0.2857143 0.3571429 0.3571429) 2) Temperature< 71.5 6 2 rain (0.1666667 0.6666667 0.1666667) 4) Temperature< 64.5 1 0 overcast (1.0000000 0.0000000 0.0000000) * 5) Temperature>=64.5 5 1 rain (0.0000000 0.8000000 0.2000000)...
2004 Jun 11
1
Error when I try to build / plot a tree using rpart()
...etails are: > summary(nhg3.rp) Call: rpart(formula = profitresp ~ ., data = nhg3, method = "class") n= 8063 CP nsplit rel error 1 0.009451796 0 1 Error in yval[, 1] : incorrect number of dimensions > print(nhg3.rp) n= 8063 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 8063 3703 1 (0.4592583 0.5407417) * > printcp(nhg3.rp) Classification tree: rpart(formula = profitresp ~ ., data = nhg3, method = "class") Variables actually used in tree construction: character(0) Root node error: 3703/8063 = 0.45926 n= 80...
2003 Apr 10
1
Classification problem - rpart
...ee -0.6994629,0,0,18.30121,0.0320744,66,tree I've run rpart on similar data without an issue but when I try it on this data as follows: tree <- rpart(class ~ curvegrid + slope + tci10, method="class") I get the following output: > tree n= 4966 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 4966 2483 dw (0.500000000 0.500000000) 2) slope=0.3206026,0.5159777,0.679302,0.7163697,1.1324.......... 2574 94 dw (0.963480963 0.036519037) * 3) slope=0,0.1011371,0.1013844,0.2027681,0.2267014,0.32......... MISSING 2392 3 random (0.001254181 0.998...
2007 May 25
1
Problem with rpart
...k I need to do this so the variables are identified when I write the regression equation >dispvol.ctree <- rpart (disperser~ P3.70 +P4.29 +P5.05 +... +P30.99 +P32.25 +TotArea, >data= dispvol.df, method='class') and I get the following output: n= 28 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 28 15 non (0.036 0.32 0.071 0.11 0.46) 2) P10.01>=1.185 10 4 bat (0.1 0.6 0.2 0 0.1) * 3) P10.01< 1.185 18 6 non (0 0.17 0 0.17 0.67) * There is nothing special about P10.01 that I can see in my data and I don't know why it chooses that var...
2002 Jan 25
0
rpart subsets
...counts)/init$counts) # Bob's clumsy attempt to remove the NaN's that 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 cl...
2002 Jan 28
0
rpart subset fix
...counts)/init$counts) # Bob's clumsy attempt to remove the NaN's that 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 cl...
2001 Jul 24
0
bug in residuals.rpart?
...t)/yhat, " [2] " deviance = -2 * log(yhat))" [[3]] [1] "residuals.rpart(tr, \"deviance\")" [[4]] [1] "residuals(tr, \"deviance\")" The problem is that tr$frame does not contain a field called 'yprob'. I created the dat matrix above as follows set.seed(123) Nvars <- 4; Nsamples <- 1000; N <- Nvars*Nsamples; dat <- matrix(sample(1:2, N, c(0.5,0.5), replace=TRUE), Nsamples, Nvars) #dat <- sample.bnet(bnet, 30) dat <- as.data.frame(dat) for (i in 1:Nvars) { dat[,i]<-...