Description Usage Arguments Details Value Author(s) Examples
This function defines and computes several covariance function either from a fitted “max-stable” model; either by specifying directly the covariance parameters.
1 2 |
fitted |
An object of class “maxstab”. Most often this will be
the output of the |
nugget,sill,range,smooth,smooth2 |
The nugget, sill, scale and smooth parameters
for the covariance function. May be missing if |
cov.mod |
Character string. The name of the covariance
model. Must be one of "whitmat", "cauchy", "powexp", "bessel" or
"caugen" for the Whittle-Matern, Cauchy, Powered Exponential, Bessel
and Generalized Cauchy models. May be missing if |
plot |
Logical. If |
dist |
A numeric vector corresponding to the distance at which the covariance function should be evaluated. May be missing. |
xlab,ylab |
The x-axis and y-axis labels. May be missing. |
col |
The color to be used for the plot. |
... |
Several option to be passed to the |
Currently, four covariance functions are defined: the Whittle-Matern, powered exponential (also known as "stable"), Cauchy and Bessel models. These covariance functions are defined as follows for h > 0
γ(h) = σ 2^(1-κ) / Γ(κ) (h/λ)^κ K_κ(h / λ)
γ(h) = σ exp[-(h/λ)^κ]
γ(h) = σ [1 + (h/λ)^2]^(-κ)
γ(h) = σ (2 λ / h)^(κ) Gamma(κ + 1) J_κ(h / λ)
γ(h) = σ [1 + (h / λ)^κ_2]^(-κ / κ_2)
where σ, λ and κ are the sill, the range and shape parameters, Γ is the gamma function, K_κ and J_κ are both modified Bessel functions of order κ. In addition a nugget effect can be set that is there is a jump at the origin, i.e., γ(o) = ν + σ, where ν is the nugget effect.
This function returns the covariance function. Eventually, if
dist
is given, the covariance function is computed for each
distance given by dist
. If plot = TRUE
, the covariance
function is plotted.
Mathieu Ribatet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## 1- Calling covariance using fixed covariance parameters
covariance(nugget = 0, sill = 1, range = 1, smooth = 0.5, cov.mod = "whitmat")
covariance(nugget = 0, sill = 0.5, range = 1, smooth = 0.5, cov.mod = "whitmat",
dist = seq(0,5, 0.2), plot = FALSE)
## 2- Calling covariance from a fitted model
##Define the coordinate of each location
n.site <- 30
locations <- matrix(runif(2*n.site, 0, 10), ncol = 2)
colnames(locations) <- c("lon", "lat")
##Simulate a max-stable process - with unit Frechet margins
data <- rmaxstab(30, locations, cov.mod = "whitmat", nugget = 0, range =
3, smooth = 1)
##Fit a max-stable model
fitted <- fitmaxstab(data, locations, "whitmat", nugget = 0)
covariance(fitted, ylim = c(0, 1))
covariance(nugget = 0, sill = 1, range = 3, smooth = 1, cov.mod = "whitmat", add =
TRUE, col = 3)
title("Whittle-Matern covariance function")
legend("topright", c("Theo.", "Fitted"), lty = 1, col = c(3,1), inset =
.05)
|
$cov.fun
function (dist)
{
idx <- dist == 0
ans <- rep(nugget + sill, length(dist))
ans[!idx] <- sill * 2^(1 - smooth)/gamma(smooth) * (dist[!idx]/range)^smooth *
besselK(dist[!idx]/range, smooth)
dim(ans) <- dim(dist)
return(ans)
}
<bytecode: 0x39cdee8>
<environment: 0x3968cf8>
$cov.val
[1] 0.500000000 0.409365377 0.335160023 0.274405818 0.224664482 0.183939721
[7] 0.150597106 0.123298482 0.100948259 0.082649444 0.067667642 0.055401579
[13] 0.045358977 0.037136789 0.030405031 0.024893534 0.020381102 0.016686635
[19] 0.013661861 0.011185386 0.009157819 0.007497788 0.006138670 0.005025918
[25] 0.004114874 0.003368973
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.