Description Usage Arguments Details Value See Also Examples
The dens.grid.* function family is used to compute the
likelihood at several points on a grid. *
must be one of the following: "maxstable", "excess" or
"simultoccur".
1 2 3 |
... |
see details. |
dens.grid specific arguments are the following:
dataa matrix representing the data.
paramsa vector giving the arguments to be passed to the
likelihood function; NA indicates that the coordinate has
to be replaced by multiple values on a grid (there must be two NA's
in the vector).
seqx,seqyvectors giving the values to be used to compute the
likelihood for the two coordinates that are set to NA in the
params vector.
lnlogical. If TRUE log-density is computed.
parallellogical. If TRUE a parallel computation of the log-likelihood
function is performed, using the snowfall package (sfInit must be
called before).
Other arguments are passed to the likelihood function.
returns a list l including parameters used in the call
(l$params, l$seqx, l$seqy), and a matrix for the
computed values of the log-likelihood: l$dens.
maxstable.l.clusters, excess.l, simultoccur.l for the likelihood functions;
plot3d.densgrid for a 3D visualisation of the computed values of the log-likelihood.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # Log density of the Max-stable distribution of the Schlather process
# with the Whittle Matern correlation function
# Use larger values for n.site and n.obs for better results
n.site<-3
n.obs<-2
xy<-matrix(runif(2*n.site,0,2),ncol=2)
param<-c(0.5,1.5)
library(SpatialExtremes)
data<-t(rmaxstab(n.obs, xy, "whitmat",
nugget = 0, range = param[1], smooth = param[2]))
cl<-build.clusters.spatial(xy)
d<-dens.grid.maxstable(data,c(NA,NA),seq(0.1,1,length=5),seq(1,2,length=5),
category="normal",
spatial=list(sites=xy,family=spatialWhittleMatern),
parallel=FALSE,
clusters=cl)
plot3d.densgrid(d)
# Log density of the Max-stable distribution of the Brown Resnick process
# Use larger values for n.site and n.obs for better results
n.site<-4
n.obs<-3
xy<-matrix(runif(2 * n.site, 0, 2), ncol = 2)
param<-c(0.5,1)
library(SpatialExtremes)
data<-t(rmaxstab(n.obs, xy, cov.mod = "brown", range = param[1], smooth = param[2]))
cl<-build.clusters.spatial(xy)
library(snowfall)
sfInit(parallel=TRUE,cpus=4)
sfLibrary(HiDimMaxStable)
d<-dens.grid.maxstable(data,c(NA,NA),seq(0.1,1,length=5),seq(0.1,1.8,length=5),
category="lnormal",
spatial=list(sites=xy,family=spatialPower),
parallel=TRUE,
clusters=cl)
sfStop()
plot3d.densgrid(d)
# Log density of the distribution of the vector of excesses for an
# homogeneous clustered max-stable distribution
# Use larger values for n and dimensions for better results
raw.data<-rCMS(copulas=c(copClayton,copGumbel),
margins=c(marginLnorm,marginFrechet),
classes=c(rep(1,4),rep(2,4)),
params=c(0.5,1,1.5,1.7),n=10)
data<-excess.censor(raw.data)
library(snowfall)
sfInit(parallel=TRUE,cpus=4)
sfLibrary(HiDimMaxStable)
sfLibrary(VGAM)
d<-dens.grid.excess(data,c(NA,1,NA,1.7),
seq(0.1,1,length=5),seq(1,2,length=5),
category="copula",
copulas=c(copClayton,copGumbel),
margins=c(marginLnorm,marginFrechet),
parallel=TRUE,
classes=c(rep(1,4),rep(2,4)))
sfStop()
plot3d.densgrid(d)
# Log density of the distribution of the componentwise maxima
# with occurences for an homogeneous clustered max-stable distribution
# Use larger values for n and dimensions for better results
raw.data<-rCMS(copulas=c(copClayton,copGumbel),
margins=c(marginLnorm,marginFrechet),
classes=c(rep(1,2),rep(2,2)),
params=c(0.5,1,1.5,1.7),n=10)
data<-maxblocks(raw.data,n.blocks=2)
library(snowfall)
sfInit(parallel=TRUE,cpus=4)
sfLibrary(HiDimMaxStable)
sfLibrary(VGAM)
d<-dens.grid.simultoccur(data$normalized.max,occur=data$classes.max,
c(NA,1,NA,1.7),
seq(0.1,1,length=5),seq(1,2,length=5),
category="copula",
copulas=c(copClayton,copGumbel),
margins=c(marginLnorm,marginFrechet),
classes=c(rep(1,2),rep(2,2)),
parallel=TRUE)
sfStop()
plot3d.densgrid(d)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.