pengchy 回复 第2楼 的 remember, discover, invent: 是有这种感觉。但是实际上有这个需要,呵呵。 有一组数据的分布是如图所示的。但是,我们想在随机的情况下,也有这种分布,对后面的分析结果有什么影响。所以需要这种模拟。 我用了这种方法,通过不断调整prob参数,基本上能满足要求。 aa <- sample(0:10000,1000,prob=c(seq(0.99,0.98,101),seq(0.1,0.05,900),seq(0.001,0.000001,9000))
yangyuancn 1.If you have known the mass function of the Poisson random variable,then you can sample such a random sample by letting "prob" equals mass function. 2.If you don't known the mass function,you just have a such a random sample,then you can directly sample from the existing sample.(The idea of Bootstrap)