sk_pars_make: Build a parameter list defining the 2d spatial Kronecker...

View source: R/sk_pars.R

sk_pars_makeR Documentation

Build a parameter list defining the 2d spatial Kronecker covariance model

Description

Constructs a nested list naming the expected covariance parameters for the supplied correlation function names in pars. If pars is already such a list, the function checks that parameter names and lengths are valid and returns a copy containing only the expected parameters, properly named, with NAs assigned to any missing parameters.

Usage

sk_pars_make(pars = "gau")

Arguments

pars

character vector of kernel name(s) or list of parameters (see details)

Details

pars should be a correlation function name accepted by sk_kp ('exp', 'gau','sph', or 'gex', 'mat'), or a vector or list of two of them in the order y, x.

Value

parameter list containing sub-lists 'y', 'x', and scalars 'psill' and 'eps'

See Also

sk_corr

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

Examples

# pass a correlation function name to get 2d version with NAs for all parameters
sk_pars_make('mat')

# pass a vector or list of correlation function names in order y, x (or else specify)
sk_pars_make(c('gau', 'mat'))
sk_pars_make(list(x='gau', y='mat'))

# if the the x definition is missing it is copied from y, and vice versa
sk_pars_make(list(k='exp', kp=c(rho=1)))

# when unnamed, kernel range and shape parameters are assigned expected names
sk_pars_make(list(psill=1, x=list(k='mat', kp=c(1,2))))

# incorrectly named parameters raise errors

sk_pars_make(list(psill=1, x=list(k='exp', kp=c(foo=1))))


# complete parameter definition lists are returned unchanged
k_list = list(k='exp', kp=c(rho=1))
pars = list(y=k_list, x=k_list, eps=0, psill=1)
identical(pars, sk_pars_make(pars))


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