20/07/05 13:11:55.13 rpUuAKzr.net
>672のデータ
URLリンク(www.researchsquare.com)
From the empirical offspring distribution and
fitted negative binomial distribution shown in Figure 2B,
we estimated an observed reproductive number (R) of 0.58 (95% CI: 0.45 - 0.71)
and dispersion parameter (k) of 0.45 (95% CI: 0.31 - 0.76).
を使って乱数発生させてシミュレーションしてみた。
mu=0.58
size=0.45
(prob = size/(size+mu))
Rt=rnbinom(1e5,size=size,mu=mu) # reproductive number
hist(Rt,breaks = 'scott',freq=F,ann=F)
sim <- function(n=10){
infector=sample(1:n,1) # how many infectors?
infectee=sum(sample(Rt,infector)) # how many infectees?
if(infectee==n) return(infector) # is the number of infectees n?
else return(NA)
}
s=replicate(1e6,sim())
spreader=s[!is.na(s)]
hist(spreader,freq=F,ylab='',axes=F,breaks='scott') ; axis(1)
BEST::plotPost(spreader,xlim=c(0,1