[R] User-defined random variable
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Sat Apr 30 17:17:49 CEST 2005
Paul Smith <phhs80 at gmail.com> writes:
> Dear All
>
> I would like to know whether it is possible with R to define a
> discrete random variable different from the ones already defined
> inside R and generate random numbers from that user-defined
> distribution.
Yes. One generic way is to specify the quantile function (as in
qpois() etc.) and do qfun(runif(N)).
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list