R/tool_block_ratio.R

Defines functions .block_ratio

.block_ratio <- function(data, colname, levels) {
  
  # 计算ABC所需的摘要统计量: 每个block中latent和simulation的比率
  counts <- tabulate(match(data[[colname]], levels), length(levels))
  ratio <- counts / sum(counts)
  
  return(ratio)
}

Try the multiRL package in your browser

Any scripts or data that you put into this service are public.

multiRL documentation built on March 31, 2026, 5:06 p.m.