[R] assistance is greatly needed

BR_email br at dmstat1.com
Mon Mar 27 18:50:20 CEST 2017


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
  



More information about the R-help mailing list