If you have a dominating density, ie another density, say g, such that cg(x)<f(x) for
some c<oo and all x, then you can easily do this by rejection.  See, e.g. Luc Devroye's
Springer book, which is the bible on this sort of thing....


url:    www.econ.uiuc.edu       Roger Koenker           Dept. of Economics UCL,
email   [EMAIL PROTECTED]       Department of Economics Drayton House,
vox:    217-333-4558            University of Illinois  30 Gorden St,
fax:    217-244-6678            Champaign, IL 61820     London,WC1H 0AX, UK
                                                        vox:    020-7679-5838

On Wed, 29 Jan 2003, Duncan Murdoch wrote:

> On Tue, 28 Jan 2003 16:01:06 +0000, you wrote in message
> <[EMAIL PROTECTED]>:
>
> >
> >Dear R ers, if some can tel me how I can generate a sample from a given
> >density. I have a complex  2D density function en I want to genearte
> >a sample from it? Any package?

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to