i具有随机变量X
和一个转换f
,我想知道f(X)
的概率分布函数至少大约。在Mathematica中有变换,但是我在R中找不到类似的东西。正如我所说,某种近似解决方案也可以。
您可以检查distr
软件包。例如,假设y = x^2+2x+1
,其中x
正态分为平均值2和标准偏差5。您可以:
require(distr)
x<-Norm(2,5)
y<-x^2+2*x+1
#y@r gives random samples. We make an histogram.
hist(y@r(10000))
#y@d and y@p are the density and the cumulative functions
y@d(80)
#[1] 0.002452403
y@p(80)
#[1] 0.8891796