RRmcmc: Random Sample From The Modulus Of A Function

Description Usage Arguments Value Note See Also Examples

View source: R/RMmodels.R

Description

RRmcmc draws a random sample from the modulus of any given function (provided the integral is finite).

Usage

1
RRmcmc(phi, mcmc_n, sigma, normed, maxdensity, rand.loc, gibbs)

Arguments

phi

an arbitrary integrable function

mcmc_n

positive integer. Every mcmc_nth element of the MCMC chain is returned.

sigma

positive real number. The MCMC update is done by adding a normal variable with standard deviation sigma.

normed

logical. Only used if the value of the density is calculated. If FALSE the unnormed value given by phi is returned.

Default: FALSE.

maxdensity

positive real number. The given density is truncated at maxdensity.

Default: 1000.

rand.loc

logical. Internal. Do not change the value.

Default: FALSE.

gibbs

logical. If TRUE only one component is updated at a time.

Default: FALSE.

Value

RRmcmc returns an object of class RMmodel.

Note

The use of RRmcmc is completely on the risk of the user. There is no way to check whether the integral of the modulus is finite.

See Also

RMmodel, RR, RRdistr, RMuser.

Examples

1
2
3
4
5
6
7
8
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again
## here a model with random scale parameter

## not exponential, but the Laplace distribution as symmetry is assumed
z <- RFrdistr(RRmcmc(RMexp(), sigma=1), n=10000, cores=1)
hist(z, 100, freq=FALSE)
curve(0.5 * exp(-abs(x)), add=TRUE, col="blue") ## Laplace distribution

RandomFields documentation built on Jan. 19, 2022, 1:06 a.m.