This function generates another function to be used within optim
to
obtain maximum likelihood estimates of covariance (and possibly mean) parameters.
The function includes options for
(1) maximum likelihood ("ml"
) vs. restricted maximum likelihood
("reml"
),
(2) smoothness (kappa
): models without smoothness vs. estimating the
smoothness vs. using fixed smoothness,
(3) locally isotropic vs. locally anisotropic, and
(4) fixed nugget variance (tausq
): fixed vs. estimated.
make_local_lik(
locations,
cov.model,
data,
Xmat,
nugg2.var = matrix(0, nrow(locations), nrow(locations)),
tausq = 0,
kappa = 0.5,
fixed = rep(FALSE, 6),
method = "reml",
local.aniso = TRUE,
fix.tausq = FALSE,
fix.kappa = FALSE
)
A matrix of locations.
String; the covariance model.
A vector or matrix of data to use in the likelihood calculation.
The design matrix for the mean model.
Fixed values for the variance/covariance of the second nugget term; defaults to a matrix of zeros.
Scalar; fixed value for the nugget variance (when
fix.tausq = TRUE
).
Scalar; fixed value for the smoothness (when fix.kappa = TRUE
).
Logical vector of FALSE
values; length corresponds to the number
of parameters to be estimated.
Indicates the estimation method, either maximum likelihood ("ml"
)
or restricted maximum likelihood ("reml"
).
Logical; indicates if the local covariance should be
anisotropic (TRUE
) or isotropic (FALSE
). Defaults to TRUE
.
Logical; indicates whether the default nugget term
(tau^2) should be fixed (TRUE
) or estimated (FALSE
). Defaults to
FALSE
.
Logical; indicates if the kappa parameter should be
fixed (TRUE
) or estimated (FALSE
). Defaults to FALSE
(only valid for cov.model = "matern"
and cov.model = "cauchy"
).
This function returns another function for use in optim
.
# NOT RUN {
make_local_lik( locations, cov.model, data, Xmat )
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab