Last data update: 2014.03.03

R: RRmcmc
RRmcmcR Documentation

RRmcmc

Description

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

Usage

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

Arguments

phi

an arbitrary integrable function

mcmc_n

positve 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 the 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

Details

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.

Author(s)

Martin Schlather, schlather@math.uni-mannheim.de http://ms.math.uni-mannheim.de/de/publications/software

See Also

RMmodel, RR, RRdistr RMuser

Examples

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 dstribution as symmetry is assumed
z <- RFrdistr(RRmcmc(RMexp(), sigma=1), n=10000)
hist(z, 100, freq=FALSE)
curve(0.5 * exp(-abs(x)), add=TRUE, col="blue") ## Laplace distribution


Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RandomFields)
Loading required package: sp
Loading required package: RandomFieldsUtils
This is RandomFieldsUtils Version: 0.2.1
This is RandomFields Version: 3.1.16

Attaching package: 'RandomFields'

The following object is masked from 'package:RandomFieldsUtils':

    RFoptions

The following objects are masked from 'package:base':

    abs, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp, expm1,
    floor, gamma, lgamma, log, log1p, log2, logb, max, min, round, sin,
    sinh, sqrt, tan, tanh, trunc

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RandomFields/RRmcmc.Rd_%03d_medium.png", width=480, height=480)
> ### Name: RRmcmc
> ### Title: RRmcmc
> ### Aliases: RRmcmc
> ### Keywords: spatial models
> 
> ### ** Examples
> 
> 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
> ## Don't show: 
> StartExample()
> ## End(Don't show)
> ## not exponential, but the Laplace dstribution as symmetry is assumed
> z <- RFrdistr(RRmcmc(RMexp(), sigma=1), n=10000)
number of simulations reduced
> hist(z, 100, freq=FALSE)
> curve(0.5 * exp(-abs(x)), add=TRUE, col="blue") ## Laplace distribution
> 
> ## Don't show: 
> FinalizeExample()
> ## End(Don't show)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>