sk_bds: Set default parameter covariance parameter bounds for a...

View source: R/sk_pars.R

sk_bdsR Documentation

Set default parameter covariance parameter bounds for a Kronecker covariance model

Description

Returns a data-frame of initial values and upper/lower bounds on covariance parameters for the Kronecker covariance model defined by the correlation function names in pars.

Usage

sk_bds(pars, g, var_obs = NULL, var_mult = 2)

Arguments

pars

list or character vector of 1-2 kernel names (see sk_pars)

g

a sk grid (or any object accepted by sk)

var_obs

positive numeric, the sample variance of data g$gval

var_mult

numeric > 1, constant to multiply by var_obs to get upper bounds

Details

Range parameters (y.rho and x.rho) are bounded by the shortest and longest inter-point distances along the corresponding dimension (y or x). This is computed by taking the element-wise product of dimensions and resolution, ie g$gres * dim(g). Ranges are initialized to the geometric mean of the upper and lower bounds.

Variance bounds are centered around var_obs, which by default is set to the sample variance of the data in g. eps (measurement variance) and psill (partial sill) are both initialized to one half of var_obs, bounded above by var_obs times var_mult, and bounded below by a small positive number (1e-6). Note that while eps=0 produces valid models in theory, in practice eps>0 is often necessary for numerical stability.

Shape parameter bounds are hard-coded, and are set conservatively to avoid problems with numerical precision in functions like exp and gamma when evaluating very large or small distances.

Value

a data frame of initial values and lower/upper bounds for the parameters in pars

See Also

sk

Other parameter managers: sk_fit(), sk_kp(), sk_pars_make(), sk_pars_update(), sk_pars(), sk_to_string()

Examples

gdim = c(10, 15)
g = sk(gdim)
g[] = stats::rnorm(length(g))
sk_bds('mat', g)

# same result by passing in observed variance
sk_bds('mat', g, stats::var(g[]))

# a less conservative bound for variance (only eps and psill affected)
sk_bds('mat', g, var_mult=1)

snapKrig documentation built on May 31, 2023, 6:34 p.m.