Answers:
这本质上是优惠券收集者问题的变体。
如果总共有项目,并且您抽样了个样本并进行了替换,那么识别出唯一项目的概率为 其中给出第二类斯特林数s u P r (U = u | n ,s )= S 2(s ,u )n ! S2(s,u)
现在,您需要的是的先验分布,应用贝叶斯定理,并获得的后验分布。N
我已经根据第二类斯特林数和贝叶斯方法给出了建议。
对于那些发现斯特林数太大或贝叶斯方法太困难的人,可以使用更粗略的方法
然后使用数值方法反算。
例如,以GaBorgulya的 且观察到的为例 ,这可能为我们提供了的估计值。
如果那是人口总数,那么它会给我们带来大约25的方差,而265两侧的任意两个标准差将分别为255和275(如我所说,这是一种粗略的方法)。255将给我们大约895的估计值,而275将给我们大约1692的估计值。示例的1000恰好在此间隔内。
您可以使用capture-recapture方法,该方法也作为Rcapture R包实现。
N = 1000; population = 1:N # create a population of the integers from 1 to 1000
n = 300 # number of requests
set.seed(20110406)
observation = as.numeric(factor(sample(population, size=n,
  replace=TRUE))) # a random sample from the population, renumbered
table(observation) # a table useful to see, not discussed
k = length(unique(observation)) # number of unique items seen
(t = table(table(observation)))
仿真的结果是
  1   2   3 
234  27   4 
因此,在300个请求中,有4个项目被查看了3次,27个项目被查看了两次,234个项目仅被查看了一次。
现在从该样本中估计N:
require(Rcapture)
X = data.frame(t)
X[,1]=as.numeric(X[,1])
desc=descriptive(X, dfreq=TRUE, dtype="nbcap", t=300)
desc # useful to see, not discussed
plot(desc) # useful to see, not discussed
cp=closedp.0(X, dfreq=TRUE, dtype="nbcap", t=300, trace=TRUE)
cp
结果:
Number of captured units: 265 
Abundance estimations and model fits:
                  abundance       stderr      deviance   df           AIC
M0**                  265.0          0.0  2.297787e+39  298  2.297787e+39
Mh Chao              1262.7        232.5  7.840000e-01    9  5.984840e+02
Mh Poisson2**         265.0          0.0  2.977883e+38  297  2.977883e+38
Mh Darroch**          553.9         37.1  7.299900e+01  297  9.469900e+01
Mh Gamma3.5**  5644623606.6  375581044.0  5.821861e+05  297  5.822078e+05
 ** : The M0 model did not converge
 ** : The Mh Poisson2 model did not converge
 ** : The Mh Darroch model did not converge
 ** : The Mh Gamma3.5 model did not converge
Note: 9 eta parameters has been set to zero in the Mh Chao model
因此,只有Mh Chao模型收敛,它估计 = 1262.7。
> round(quantile(Nhat, c(0, 0.025, 0.25, 0.50, 0.75, 0.975, 1)), 1)
    0%   2.5%    25%    50%    75%  97.5%   100% 
 657.2  794.6  941.1 1034.0 1144.8 1445.2 2162.0 
> mean(Nhat)
[1] 1055.855
> sd(Nhat)
[1] 166.8352