2
我尝试在perl中完成我在R中成功完成的任务,但很难与我的下游需求相结合。perl中的随机二项式分布式数据集
R中我做了以下
library("MASS")
d <- rnegbin(100000, mu = 250, theta = 2)
hist(d, breaks=1000, xlim=c(0,1000))
产生很好的图形,我需要有一个峰值一轮180-200和尾部右侧。
有人能帮助我的代码中使用数学::随机
我试过,但没有得到正确的形状perl的等效
use Math::Random qw(random_negative_binomial);
# random_negative_binomial($n, $ne, $p)
# When called in an array context, returns an array of $n outcomes
# generated from the negative binomial distribution with number of
# events $ne and probability of an event in each trial $p.
# When called in a scalar context, generates and returns only one
# such outcome as a scalar, regardless of the value of $n.
# Argument restrictions: $ne is rounded using int(), the result must be positive.
# $p must be between 0 and 1 exclusive.
# I tried different variable values but never got the right shape
my @dist = random_negative_binomial($n, $ne, $p);
什么样的价值观,我需要模仿R结果? 我需要在同一范围内的X和总体形状相同
感谢您的帮助值,我没有找到那个包的说明例子
斯特凡