|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.knowceans.arms.ArmSampler
public abstract class ArmSampler
ArmSampler implements an adaptive rejection Metropolis sampler (ARMS) that can sample from virtually any univariate distribution. The method performs best if a log-concave density is being sampled from, but it also works for other densities, for which an additional Metropolis step is inserted. The greater the difference to log-concave shape, the more Metropolis rejections must be expected.
This implementation is a port of the original c / fortran implementation by Wally Gilks available at http://www.mrc-bsu.cam.ac.uk/BSUsite/Research/ars.shtml.
Please acknowledge this work by referencing the relevant scientific literature and program code (Web: http://www.arbylon.net/projects).
References:
Gilks, W. R. (1992) Derivative-free adaptive rejection sampling for Gibbs sampling. Bayesian Statistics 4, (eds. Bernardo, J., Berger, J., Dawid, A. P., and Smith, A. F. M.) Oxford University Press.
Gilks, W. R., Best, N. G. and Tan, K. K. C. (1995) Adaptive rejection Metropolis sampling. Applied Statistics, 44, 455-472.
Gilks, W. R. and Wild, P. (1992) Adaptive rejection sampling for Gibbs sampling. Applied Statistics 41, pp 337-348.
Field Summary | |
---|---|
static int |
DEREF
dereference for ported c pointers |
static double |
EYEPS
critical relative exp(y) difference |
static double |
XEPS
critical relative x-value difference |
static double |
YCEIL
maximum y avoiding overflow in exp(y) |
static double |
YEPS
critical y-value difference |
Constructor Summary | |
---|---|
ArmSampler()
init (nothing to do) |
Method Summary | |
---|---|
double[] |
arms(java.lang.Object params,
double[] xinit,
int ninit,
double[] xl,
double[] xr,
double[] convex,
int npoint,
boolean dometrop,
double[] xprev,
double[] xsamp,
int nsamp,
double[] qcent,
double[] xcent,
int ncent,
int[] neval)
to perform derivative-free adaptive rejection sampling with metropolis step |
double |
armsSimple(java.lang.Object params,
int ninit,
double[] xl,
double[] xr,
boolean dometrop,
double[] xprev)
adaptive rejection metropolis sampling - simplified argument list |
abstract double |
logpdf(double x,
java.lang.Object params)
Abstract function to implement the log pdf. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEREF
public static final double XEPS
public static final double YEPS
public static final double EYEPS
public static final double YCEIL
Constructor Detail |
---|
public ArmSampler()
Method Detail |
---|
public abstract double logpdf(double x, java.lang.Object params)
x
- params
-
public double armsSimple(java.lang.Object params, int ninit, double[] xl, double[] xr, boolean dometrop, double[] xprev) throws java.lang.Exception
params[]
- parameters of the pdf to be sampledninit
- : number of starting values to be usedxl[]
- : left bound ([] for pointer)xr[]
- : right bound ([] for pointer)dometrop
- : whether metropolis step is requiredxprev[]
- : current value from markov chain ([] for pointer)
java.lang.Exception
public double[] arms(java.lang.Object params, double[] xinit, int ninit, double[] xl, double[] xr, double[] convex, int npoint, boolean dometrop, double[] xprev, double[] xsamp, int nsamp, double[] qcent, double[] xcent, int ncent, int[] neval) throws java.lang.Exception
params
- parameters of the pdf to be sampledxinit[]
- : starting values for x in ascending orderninit
- : number of starting values suppliedxl[]
- : left bound ([] for pointer)xr[]
- : right bound ([] for pointer)convex[]
- : adjustment for convexity ([] for pointer)npoint
- : maximum number of envelope pointsdometrop
- : whether metropolis step is requiredxprev[]
- : previous value from markov chain ([] for pointer)xsamp[]
- : to store sampled valuesnsamp
- : number of sampled values to be obtainedqcent[]
- : percentages for envelope centilesxcent[]
- : to store requested centilesncent
- : number of centiles requestedneval[]
- : on exit, the number of function evaluations performed
([] for pointer)
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |