# doc-cache created by Octave 11.2.0
# name: cache
# type: cell
# rows: 3
# columns: 5
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
johnsrnd


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1687
statistics: r = johnsrnd ( quantiles )
statistics: r = johnsrnd ( quantiles , m )
statistics: r = johnsrnd ( quantiles , m , n , &hellip;)
statistics: r = johnsrnd ( quantiles , [ m , n , &hellip;])
statistics: [ r , type , coefs ] = johnsrnd (&hellip;)

Random arrays from the Johnson system of distributions.

r = johnsrnd ( quantiles ) returns a random value drawn from
the distribution in the Johnson system that matches the four values in
quantiles . quantiles is a four-element vector of the desired
quantiles at the standard normal quantiles [-1.5, -0.5, 0.5, 1.5] , and
its elements must be strictly increasing. johnsrnd fits the Johnson
curve passing through these four points using the quantile method of Slifker
and Shapiro.

quantiles may also be a 2-by-4 numeric matrix, whose first row holds
four strictly increasing, evenly spaced standard normal quantiles and whose
second row holds the corresponding strictly increasing data quantiles.

johnsrnd ( quantiles , m , n , &hellip;) or
johnsrnd ( quantiles , [ m , n , &hellip;]) returns an
m -by- n -by-&hellip; array of random values, following the size
conventions of randn .

[ r , type , coefs ] = johnsrnd (&hellip;) also returns
the selected member of the Johnson system in type , one of "SN"
(the normal distribution), "SL" (lognormal), "SU"
(unbounded), or "SB" (bounded), and the coefficients coefs =
[ gamma , delta , xi , lambda ] of the transform.
A value r is generated by transforming a standard normal deviate
z as r = xi + lambda * g (( z -
gamma ) / delta ) , where g is the identity, exp ,
sinh , or the logistic function for "SN" , "SL" ,
"SU" , and "SB" , respectively.

See also:
pearsrnd,
random,
randn


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
Random arrays from the Johnson system of distributions.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
mhsample


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2840
statistics: [ smpl , accept ] = mhsample ( start , nsamples , property , value , &hellip;)

Draws nsamples samples from a target stationary distribution pdf
using Metropolis-Hastings algorithm.

Inputs:

start is a nchain by dim matrix of starting points for each
Markov chain. Each row is the starting point of a different chain and each
column corresponds to a different dimension.

nsamples is the number of samples, the length of each Markov chain.

Some property-value pairs can or must be specified, they are:

(Required) One of:

"pdf" pdf : a function handle of the target stationary distribution to
be sampled. The function should accept different locations in each row and
each column corresponds to a different dimension.
or

"logpdf" logpdf : a function handle of the log of the target stationary
distribution to be sampled. The function should accept different locations
in each row and each column corresponds to a different dimension.

In case optional argument symmetric is set to false (the default), one
of:

"proppdf" proppdf : a function handle of the proposal distribution that
is sampled from with proprnd to give the next point in the chain. The
function should accept two inputs, the random variable and the current
location each input should accept different locations in each row and each
column corresponds to a different dimension.
or

"logproppdf" logproppdf : the log of "proppdf".

The following input property/pair values may be needed depending on the
desired output:

"proprnd" proprnd : (Required) a function handle which generates random
numbers from proppdf . The function should accept different locations
in each row and each column corresponds to a different dimension
corresponding with the current location.

"symmetric" symmetric : true or false based on whether proppdf is
a symmetric distribution. If true, proppdf (or logproppdf ) need
not be specified. The default is false.

"burnin" burnin the number of points to discard at the beginning, the
default is 0.

"thin" thin : omits thin -1 of every thin points in the
generated Markov chain. The default is 1.

"nchain" nchain : the number of Markov chains to generate. The default
is 1.

Outputs:

smpl : a nsamples x dim x nchain tensor of random
values drawn from pdf , where the rows are different random values, the
columns correspond to the dimensions of pdf , and the third dimension
corresponds to different Markov chains.

accept is a vector of the acceptance rate for each chain.

Example : Sampling from a normal distribution

start = 1;
nsamples = 1e3;
pdf = @(x) exp (-.5 * x .^ 2) / (pi ^ .5 * 2 ^ .5);
proppdf = @(x,y) 1 / 6;
proprnd = @(x) 6 * (rand (size (x)) - .5) + x;
[smpl, accept] = mhsample (start, nsamples, "pdf", pdf, "proppdf", ...
proppdf, "proprnd", proprnd, "thin", 4);
histfit (smpl);

See also:
rand,
slicesample


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 101
Draws nsamples samples from a target stationary distribution pdf using Metropolis-Hastings algorithm.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
pearsrnd


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1499
statistics: r = pearsrnd ( mu , sigma , skew , kurt )
statistics: r = pearsrnd ( mu , sigma , skew , kurt , m )
statistics: r = pearsrnd ( mu , sigma , skew , kurt , m , n , &hellip;)
statistics: r = pearsrnd ( mu , sigma , skew , kurt , [ m , n , &hellip;])
statistics: [ r , type , coefs ] = pearsrnd (&hellip;)

Random arrays from the Pearson system of distributions.

r = pearsrnd ( mu , sigma , skew , kurt )
returns a random value drawn from the distribution in the Pearson system with
mean mu , standard deviation sigma , skewness skew , and
kurtosis kurt . kurt is the (non-excess) kurtosis, and the
moments must satisfy kurt > skew ^2 + 1 .

pearsrnd ( mu , sigma , skew , kurt , m ,
n , &hellip;) or pearsrnd (&hellip;, [ m , n , &hellip;])
returns an m -by- n -by-&hellip; array of random values, following
the size conventions of randn .

[ r , type , coefs ] = pearsrnd (&hellip;) also returns
the type of the Pearson distribution (an integer 0 to 7 ) in
type , and the three coefficients coefs =
[ c0 , c1 , c2 ] of the denominator quadratic of the
Pearson differential equation for the standardized distribution, so that
f '( x ) / f ( x ) = -( x + c1 ) /
( c0 + c1 x + c2 x ^2) .

The Pearson types are: 0 normal, 1 four-parameter beta,
2 symmetric four-parameter beta, 3 gamma, 4 (not a named
distribution), 5 inverse gamma, 6 beta prime, and 7
Student&rsquo;s t. Type 4 is generated by numerical inversion of its
cumulative distribution function.

See also:
johnsrnd,
random,
randn


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
Random arrays from the Pearson system of distributions.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
qrandn


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 463
statistics: z = qrandn ( q , r , c )
statistics: z = qrandn ( q , [ r , c ])

Returns random deviates drawn from a q-Gaussian distribution.

Parameter q characterizes the q-Gaussian distribution.
The result has the size indicated by s .

Reference:
W. Thistleton, J. A. Marsh, K. Nelson, C. Tsallis (2006)
"Generalized Box-Muller method for generating q-Gaussian random deviates"
arXiv:cond-mat/0605570 http://arxiv.org/abs/cond-mat/0605570

See also:
rand,
randn


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Returns random deviates drawn from a q-Gaussian distribution.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
slicesample


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1756
statistics: [ smpl , neval ] = slicesample ( start , nsamples , property , value , &hellip;)

Draws nsamples samples from a target stationary distribution pdf
using slice sampling of Radford M. Neal.

Input:

start is a 1 by dim vector of the starting point of the
Markov chain. Each column corresponds to a different dimension.

nsamples is the number of samples, the length of the Markov chain.

Next, several property-value pairs can or must be specified, they are:

(Required properties) One of:

"pdf" : the value is a function handle of the target stationary
distribution to be sampled. The function should accept different locations
in each row and each column corresponds to a different dimension.
or

logpdf : the value is a function handle of the log of the target
stationary distribution to be sampled. The function should accept different
locations in each row and each column corresponds to a different dimension.

The following input property/pair values may be needed depending on the
desired output:

"burnin" burnin the number of points to discard at the beginning, the
default is 0.

"thin" thin omits m -1 of every m points in the generated
Markov chain. The default is 1.

"width" width the maximum Manhattan distance between two samples.
The default is 10.

Outputs:

smpl is a nsamples by dim matrix of random
values drawn from pdf where the rows are different random values, the
columns correspond to the dimensions of pdf .

neval is the number of function evaluations per sample.

Example : Sampling from a normal distribution

start = 1;
nsamples = 1e3;
pdf = @(x) exp (-.5 * x .^ 2) / (pi ^ .5 * 2 ^ .5);
[smpl, accept] = slicesample (start, nsamples, "pdf", pdf, "thin", 4);
histfit (smpl);

See also:
rand,
mhsample,
randsample


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 99
Draws nsamples samples from a target stationary distribution pdf using slice sampling of Radford M.





