pkern_cmean | R Documentation |
Evaluates the ordinary kriging equations in section 3 of Cressie (1993) over the
grid defined in g_obs
. These are the predicted values minimizing mean squared
prediction error under the covariance model specified by pars
.
pkern_cmean(
g_obs,
pars,
X = NA,
fac = NULL,
out = "p",
fac_method = "chol",
quiet = FALSE
)
g_obs |
list of form returned by |
pars |
list of form returned by |
X |
numeric, vector, matrix, or NA: the mean, or its linear predictors |
fac |
(optional) pre-computed factorization of covariance matrix scaled by partial sill |
out |
character, the return value, one of 'predictor', 'variance', or 'm' |
quiet |
logical indicating to suppress console output |
Set makev=TRUE
to return the pointwise kriging variance. This takes approximately
n_obs times longer to evaluate than makev=FALSE
. A progress bar will be printed to
console unless quiet=TRUE
.
The covariance factorization fac
can be pre-computed using pkern_var(..., scaled=TRUE)
to speed up repeated calls where only the observed data values change (ie same covariance
structure pars
, and same NA structure in the data). Note that the kriging variance does
not change in this case and only needs to be computed once.
numeric matrix, the predicted values (or their variance)
# make example grid and data
n = 25^2
n_obs = 10
g_obs = pkern_grid(sqrt(n))
idx_obs = sample.int(n, n_obs)
g_obs$gval[idx_obs] = rnorm(n_obs)
pars = pkern_pars('gau', g_obs)
g_pred = pkern_cmean(g_obs, pars)
g_var = pkern_cmean(g_obs, pars, makev=TRUE, quiet=TRUE)
#g_obs |> pkern_plot()
#g_obs |> modifyList(list(gval=g_pred)) |> pkern_plot()
#g_obs |> modifyList(list(gval=g_var)) |> pkern_plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.