How to generate data from noninformative prior?

76 Views Asked by At

If we have $$x|\lambda \sim \frac{1}{\lambda}e^{-\frac{x}{\lambda}}$$ with Jeffereys prior $$\lambda \sim \frac{1}{\lambda}$$ How could we generate data $x_1, \cdots, x_n$ from this mixture distribution? I know that if we have an informative prior we could generate $\lambda$ from that prior first then use the $\lambda$ we just got to generate data $x_1, \cdots, x_n$ . How about the noninformative ones?

Thanks~

1

There are 1 best solutions below

0
On BEST ANSWER

Your prior is more than uninformative, it is improper on the positive reals so it cannot be proportional to an actual probability density

But if you put limits on $\lambda$ (e.g. $[10^{-6},10^6]$ or something equally arbitrary) then the distribution would become proper and then, as you say, it would be easy enough to generate values, for example with this R code

upperlimit <- 10^6
lowerlimit <- 10^(-6)
numberoflambdas <- 10
numberofxs <- 5
set.seed(1)
lambdas <- lowerlimit * (upperlimit / lowerlimit) ^ 
           runif(numberoflambdas)
simdat  <- matrix(-log(runif(numberoflambdas*numberofxs)) * lambdas,
                  ncol=numberofxs)

which would produce ten simulated $\lambda$s

> lambdas 
 [1] 1.534984e-03 2.920699e-02 7.485837e+00 7.915776e+04 2.631378e-04
 [6] 6.034985e+04 2.168219e+05 8.503026e+01 3.542979e+01 5.513600e-06

and for each $\lambda$, five $x_i$s

> simdat 
              [,1]         [,2]         [,3]         [,4]         [,5]
 [1,] 2.425279e-03 1.036484e-04 1.119994e-03 3.028487e-04 1.134262e-03
 [2,] 5.064822e-02 4.528535e-02 1.494082e-02 1.271427e-02 4.364036e-03
 [3,] 2.810091e+00 3.205519e+00 5.286114e+00 1.831848e+00 6.178171e+00
 [4,] 7.574152e+04 1.642532e+05 1.330515e+05 4.688764e+04 1.114007e+05
 [5,] 6.882914e-05 3.472578e-04 4.986441e-05 1.671997e-04 6.972114e-04
 [6,] 4.210967e+04 5.743027e+04 2.430703e+04 1.427501e+04 1.392837e+05
 [7,] 7.194524e+04 9.352012e+05 4.994922e+04 8.148090e+05 2.495954e+05
 [8,] 6.910272e-01 8.174126e+01 1.892898e+02 6.290170e+01 5.582716e+01
 [9,] 3.427801e+01 4.946617e+00 1.145669e+01 1.103802e+01 1.461415e+01
[10,] 1.388005e-06 5.942468e-06 4.898804e-06 2.024113e-06 4.958708e-06