Documentation Center |
Slice sampler
rnd = slicesample(initial,nsamples,'pdf',pdf)
rnd = slicesample(initial,nsamples,'logpdf',logpdf)
[rnd,neval]
= slicesample(initial,...)
[rnd,neval]
= slicesample(initial,...,Name,Value)
rnd = slicesample(initial,nsamples,'pdf',pdf) generates nsamples random samples using the slice sampling method (see Algorithms). pdf gives the target probability density function (pdf). initial is a row vector or scalar containing the initial value of the random sample sequences.
rnd = slicesample(initial,nsamples,'logpdf',logpdf) generates samples using the logarithm of the pdf.
[rnd,neval] = slicesample(initial,...) returns the average number of function evaluations that occurred in the slice sampling.
[rnd,neval] = slicesample(initial,...,Name,Value) generates random samples with additional options specified by one or more Name,Value pair arguments.
initial |
Initial point, a scalar or row vector. Set initial so pdf(initial) is a strictly positive scalar. length(initial) is the number of dimensions of each sample. |
nsamples |
Positive integer, the number of samples that slicesample generates. |
Handle to a function that generates the probability density function, specified with @. pdf can be unnormalized, meaning it need not integrate to 1. |
logpdf |
Handle to a function that generates the logarithm of the probability density function, specified with @. logpdf can be the logarithm of an unnormalized pdf. |
Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
rnd |
nsamples-by-length(initial) matrix, where each row is one sample. |
[1] Neal, Radford M. Slice Sampling. Ann. Stat. Vol. 31, No. 3, pp. 705–767, 2003. Available at Project Euclid.
mhsample | rand | randsample