pkern_bds: Set default parameter covariance parameter bounds

View source: R/pkern_pars.R

pkern_bdsR Documentation

Set default parameter covariance parameter bounds

Description

Returns a data-frame of initial values and upper/lower bounds on covariance parameters for the kernel names in pars.

Usage

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

Arguments

pars

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

g

list, a pkern grid definition (or object accepted by pkern_grid)

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 * g$gdim. Ranges are initialized to the geometric mean of the upper and lower bounds.

Variance bounds centered around var_obs, which by default is set to the sample variance of the data in g$gval. 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

Examples

gdim = c(10, 15)
z = prod(gdim) |> rnorm()
g = pkern_grid(gdim) |> modifyList(list(gval=z))
pkern_bds('mat', g)
pkern_bds('mat', g, lower=0)
pkern_bds('mat', g, rows=c('eps', 'psill'), lower=c(0, 0.5))

deankoch/pkern documentation built on Oct. 26, 2023, 8:54 p.m.