Hi R'ers:
I am seeking the attachment.
Any help is greatly appreciated.
Thanks.
Bruce
----
**** Code ***
yhat     <- seq(1, 0.05, length.out = 20)
Response <-c(1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0)
cum_R    <- cumsum(Response)
sam_size <- length(Response)
cum_n    <- seq(1:1,length=20)
cum_wt       <- seq(1:1,by=0,length=20)

dec      <- (cum_n/sam_size)
decc     <- floor((cum_n*10)/(sam_size+1))
dec_mean <- aggregate(Response, by=list(decc), mean)
d <- data.frame(yhat, Response, cum_R, sam_size, cum_wt, cum_n, decc, dec_mean)
d
# decc=0
decc_0      <- subset(d, decc ==0)
mean_decc_0 <- colMeans(decc_0, 2)
mean_decc_0 <- mean_decc_0[c(2:4,7)]
mean_decc_0

decc_0      <- subset(d, decc ==0)
sum_decc_0  <- colSums(d, 2)
sum_decc_0
sum_decc_0  <- sum_decc_0[c(5)]
sum_decc_0
add_decc_0  <- cbind(mean_decc_0, sum_decc_0)
add_decc_0

--
Bruce
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to