I'm kind of ignorant on the topic so it might be a simple mistake, but I have used cutpoints and then i'm trying to print a table with the sum of elements in each bracket, but one has zero in it and it just disappears. I've seen similar problems solved with "factor", but I don't know how to make it work with cutpoints. This is the full code:
nrep<-100000
lambda<-1/6
m<-1/lambda
set.seed(229985)
x<-rexp(nrep,1/m)
brk<-seq(0,80,8)
xx <- cutpoints(x,brk, destra = TRUE)
#
c(mean(x),m)
c(var(x),m^2)
c(median(x),m*log(2))
c(min(x),max(x))
#
fo<-table(xx)
sum(fo)
fo
#
p<-pexp(brk,lambda)
fa<-diff(p)*nrep
sum(fa)
cbind(fo,round(fa,1))
chi2(fo,fa)
Thank you in advance, Riccardo