Skip to content
Prev 19279 / 20628 Next

Model specification/family for a continuous/proportional, response with many zeros

Dear Thierry,

Sorry, I didn't realise I was sending everything in HTML mode. I have
enabled plain text mode so hopefully it has worked this time (code
below). Thanks for the suggestion and link - comparing the
observed-expected density looks a lot better than just comparing the
means like I did. I'll have a go!

Thanks,
Mike

bins <- seq(from = 0, to = 1, by = 0.01)

sim_seq <- c()
for(i in bins){
  a <- mean(unlist(lapply(sim_beta_glmm, function(x){ length(which(x>i
& x <= i+0.01))/length(x)}), use.names = FALSE))
  sim_seq <- c(sim_seq,a)
}

real_seq <- c()
for(i in bins){
  a <- print(mean(unlist(lapply(glmm_zone_data$prop_time, function(x){
length(which(x>i & x <= i+0.01))/length(x)}), use.names = FALSE)))
  real_seq <- c(real_seq,a)
}

barplot(rbind(sim_seq,real_seq),col=c("green","red"),beside = TRUE,
legend.text = c("simulated","real"))

cbind(bins,sim_seq,real_seq)

bins         sim_seq    real_seq
  [1,] 0.00 0.2199795081967 0.232240437
  [2,] 0.01 0.1021612021858 0.166666667
  [3,] 0.02 0.0750964480874 0.103825137
  [4,] 0.03 0.0592128415301 0.073770492
  [5,] 0.04 0.0478316939891 0.038251366
  [6,] 0.05 0.0397267759563 0.030054645
  [7,] 0.06 0.0331961748634 0.016393443
  [8,] 0.07 0.0279322404372 0.013661202
  [9,] 0.08 0.0238013661202 0.024590164
 [10,] 0.09 0.0201101092896 0.010928962
On Thu, 20 May 2021 at 10:08, Thierry Onkelinx <thierry.onkelinx at inbo.be> wrote: