Last data update: 2014.03.03

R: Random scaling used with balls
RRrectangularR Documentation

Random scaling used with balls

Description

Approximates an isotropic decreasing density function by a density function that is isotropic with respect to the l_1 norm.

Usage

RRrectangular(phi, safety, minsteplen, maxsteps, parts, maxit,
             innermin, outermax, mcmc_n, normed, approx, onesided) 

Arguments

phi

a shape function; it is the user's responsability that it is non-negative. See details.

safety, minsteplen, maxsteps, parts, maxit, innermin, outermax, mcmc_n

Technical arguments to run an algorithm to simulate from this distribution. See RFoptions for the default values.

normed

logical. If FALSE then the norming constant c in the Details is set to 1. This affects the values the density function, the probability distribution and the quantile function, but not the simulation of random variables.

approx

logical. Default TRUE. If TRUE the isotropic distribution with respect to the l_1 norm is returned. If FALSE then the exact isotropic distribution with respect to the l_2 norm is simulated. Neither the density function, nor the probability distribution, not the quantile function will be availabe if approx=TRUE.

onesided

logical. Only for used for univariate distributions. if TRUE then the density is assumed to be non-negative only on the positive real axis. Otherwise the density is assumed to be symmetric.

Details

This models defines an isotropic density function $f$ with respect to the l_1 norm. i.e. f(x) = c φ(|x|_{l_1}) with some function φ. Here, s is norming constant so that the integral of f equals one.

In case φ is monotoneously decreasing then rejection sampling is used, else MCMC.

The function φ might have a polynomial pole at the origin and asymptotically decreasing of the form x^β exp(-x^δ).

Value

RRrectangular returns an object of class RMmodel

Author(s)

Martin Schlather, schlather@math.uni-mannheim.de

See Also

RMmodel, RRdistr, RRgauss,

Examples

RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again

# simulation of Gaussian variables (in a not very straight forward way):
distr <- RRrectangular(RMgauss(), approx=FALSE)
z <- RFrdistr(distr, n=1000000)
hist(z, 200, freq=!TRUE)
x <- seq(-10, 10, 0.1)
lines(x, dnorm(x, sd=sqrt(0.5)))


#creation of random variables whose density is proportional
# to the spherical model:
distr <- RRrectangular(RMspheric(), approx=FALSE)
z <- RFrdistr(distr, n=1000000)
hist(z, 200, freq=!TRUE)

x <- seq(-10, 10, 0.01)
lines(x, 4/3 * RFcov(RMspheric(), x))


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/RRrectangular.Rd_%03d_medium.png", width=480, height=480)
> ### Name: RRrectangular
> ### Title: Random scaling used with balls
> ### Aliases: RRrectangular
> ### 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
> ## Don't show: 
> StartExample()
> ## End(Don't show)
> # simulation of Gaussian variables (in a not very straight forward way):
> distr <- RRrectangular(RMgauss(), approx=FALSE)
> z <- RFrdistr(distr, n=1000000)
number of simulations reduced
> hist(z, 200, freq=!TRUE)
> x <- seq(-10, 10, 0.1)
> lines(x, dnorm(x, sd=sqrt(0.5)))
> 
> 
> #creation of random variables whose density is proportional
> # to the spherical model:
> distr <- RRrectangular(RMspheric(), approx=FALSE)
> z <- RFrdistr(distr, n=1000000)
number of simulations reduced
> hist(z, 200, freq=!TRUE)
> ## Don't show: 
> StartExample(reduced=FALSE)
> ## End(Don't show)
> x <- seq(-10, 10, 0.01)
> lines(x, 4/3 * RFcov(RMspheric(), x))
> ## Don't show: 
> FinalizeExample()
> ## End(Don't show)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>