map: Produces a 2D map from a fitted max-stable process

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plots.R

Description

Produces a 2D map from a fitted max-stable process.

Usage

1
2
map(fitted, x, y, covariates = NULL, param = "quant", ret.per = 100, col
= terrain.colors(64), plot.contour = TRUE, ...)

Arguments

fitted

An object of class maxstab. Most often, it will be the output of the function fitmaxstab.

x,y

Numeric vector that gives the coordinates of the grid.

covariates

An array specifying the covariates at each grid point defined by x and y. If NULL, no covariate is needed. See the example to see how to build it.

param

A character string. Must be one of "loc", "scale", "shape" or "quant" for a map of the location, scale, shape parameters or for a map of a specified quantile.

ret.per

A numeric giving the return period for which the quantile map is plotted. It is only required if param = "quant".

col

A list of colors such as that generated by 'rainbow', 'heat.colors', 'topo.colors', 'terrain.colors' or similar functions.

plot.contour

Logical. If TRUE (default), contour lines are added to the plot.

...

Several arguments to be passed to the image function.

Value

A plot. Additionally, a list with the details for plotting the map is returned invisibly.

Author(s)

Mathieu Ribatet

See Also

condmap, filled.contour, heatmap, heat.colors, topo.colors, terrain.colors, rainbow

Examples

 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
##We run an artifical example using the volcano data set as a study
##region
dim <- dim(volcano)
n.x <- dim[1]
n.y <- dim[2]

x <- 10 * 1:n.x
y <- 10 * 1:n.y

n.site <- 15
idx.x <- sample(n.x, n.site)
idx.y <- sample(n.y, n.site)
locations <- cbind(lon = x[idx.x], lat = y[idx.y])
alt <- diag(volcano[idx.x, idx.y])

##Simulate a max-stable process - with unit Frechet margins
data <- rmaxstab(40, locations, cov.mod = "whitmat", nugget = 0, range = 750,
smooth = 1)

##Now define the spatial model for the GEV parameters
param.loc <- -10 - 0.04 * locations[,1] + alt / 5
param.scale <- 5 - locations[,2] / 30 + alt / 4
param.shape <- rep(.2, n.site)

##Transform the unit Frechet margins to GEV
for (i in 1:n.site)
  data[,i] <- frech2gev(data[,i], param.loc[i], param.scale[i],
param.shape[i])

##Define a model for the GEV margins to be fitted
##shape ~ 1 stands for the GEV shape parameter is constant
##over the region
loc.form <- loc ~ lon + alt
scale.form <- scale ~ lat + alt
shape.form <- shape ~ 1

##  1- Fit a max-stable process
schlather <- fitmaxstab(data, locations, "whitmat", loc.form, scale.form,
                        shape.form, marg.cov = cbind(alt = alt), nugget
= 0)

##  2- Produce a map of the pointwise 50-year return level

##Here we have only one covariate i.e. alt
n.cov <- 1
covariates <- array(volcano, dim = c(n.x, n.y, n.cov), dimnames =
list(NULL, NULL, "alt"))

par(mfrow = c(1,2))
image(x, y, volcano, col = terrain.colors(64), main = "Elevation map")
map(schlather, x, y, covariates, ret.per = 50, plot.contour = FALSE,
main = "50-year return level")

Example output

Computing appropriate starting values
Starting values are defined
Starting values are:
       range       smooth    locCoeff1    locCoeff2    locCoeff3  scaleCoeff1 
653.12738591   1.07024762  -2.29088254  -0.05638781   0.24673182   8.55811826 
 scaleCoeff2  scaleCoeff3  shapeCoeff1 
 -0.03856870   0.24801874   0.16074486 

SpatialExtremes documentation built on Sept. 1, 2020, 3:01 a.m.