Displaying 1 result from an estimated 1 matches for "ysum".
Did you mean:
sum
2005 Aug 26
1
Help in Compliling user -defined functions in Rpart
...abs(lci)*(1-abs(lci)) #deviance for left side
devrci<-abs(rci)*(1-abs(rci)) #deviance for right side
goodness<-devci-(lw/sum(wt))*devlci-(rw/sum(wt))*devrci
list(goodness=goodness, direction=sign(lci))
}
else {
ux<-sort(unique(x))
wtsum<-tapply(wt,x,sum)
ysum<-tapply(wt*y,x,sum)
means<-ysum/wtsum
ord<-order(means)
n<-length(ord)
lss<-cumsum(ysum[ord])[-n]
rss<-sum(ysum)-lss
lw<-cumsum(wtsum[ord])[-n]
rw<-sum(wtsum)-lw
lm<-lss/lw
rm<-rss/rw
lysum<-tapply(wt*(y-lm)*(r-0.5),x,sum)
lcss<-c...