简体   繁体   中英

Does R have something similar to TransformedDistribution in Mathematica?

I have a random variable X and a transformation f and I would like to know the probability distribution function of f(X) , at least approximately. In Mathematica there is TransformedDistribution, but I could not find something similar in R. As I said, some kind of approximative solution would be fine, too.

You can check the distr package. For instance, say that y = x^2+2x+1 , where x is normally distributed with mean 2 and standard deviation 5. You can:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM