Learn R Programming

RandomFields (version 3.0.62)

RMbernoulli: Covariance Model for binary field based on a Gaussian field

Description

RMbernoulli gives the centered correlation function of a binary field, obtained by thresholding a Gaussian field.

Usage

RMbernoulli(phi, threshold, correlation, centred, var, scale, Aniso, proj)

Arguments

phi
covariance function of class RMmodel.
threshold
real valued threshold, see RPbernoulli. Currently only threshold=0.0 is possible. Default: 0.
correlation
logical. If FALSE the corresponding covariance function is returned

Default: TRUE.

centred
logical. If FALSE the uncentred covariance is returned.

Default: TRUE.

var,scale,Aniso,proj
optional arguments; same meaning for any RMmodel. If not passed, the above covariance function remains unmodified.

Value

Details

This model yields the covariance function of the field that is returned by RPbernoulli

References

Ballani, Schlather

See Also

RPbernoulli RMmodel, RFsimulate,

Examples

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

threshold <- 0
x <- seq(0, 5, if (interactive()) 0.02 else 1)
GaussModel <- RMgneiting()

n <- if (interactive()) 1000 else 2
z <- RFsimulate(RPbernoulli(GaussModel, threshold=threshold), x=x, n=n)
plot(z)

model <- RMbernoulli(RMgauss(), threshold=threshold, correlation=FALSE)
plot(model, xlim=c(0,5))
z <- as.matrix(z)
estim.cov <- apply(z, 1, function(x) cov(x, z[1,]))
points(x, estim.cov, col="red")

FinalizeExample()

Run the code above in your browser using DataLab