On Fri, Dec 25, 2009 at 8:07 AM, <khazaei@ceremade.dauphine.fr> wrote:

> Hello all
> how can sample from f(x)~x^(a-1)*ind(0,min(b,-log(u)) in R?
> where a and b is positive constand and   0<u<1
>

If the idea is that X is a random variable, then you need to decide what
kind of random variable it is.  For example, if you wanted to assume that it
was a random uniform variable roughly on the interval of -infinity to
infinity, you can do something like:

runif(10000, -1e100, 1e+100)^(a-1)*ind(0,min(b,-log(u)))

(I'm not sure whether my limits are a good stand-in for -infinity to
+infinity.)

There are a number of functions that all start with r that sample from
various distributions -- rnorm(), runif(), rexp(), ...  Once you decide what
X is, it is pretty straightforward.

I was going to look at your function, but I don't know what ind() is, so I
was stuck.

Michael

	[[alternative HTML version deleted]]


