neg2loglikDiagFactory | R Documentation |
A helper function for rapidly exploring the parameter space around the maximum likelihood estimate
neg2loglikDiagFactory(y, X = data.frame(), distmat, covariance, ...)
y |
Dependent variable |
X |
Optional design matrix with covariates |
distmat |
Distance matrix. Can be provided either as a dense matrix or spam object. |
covariance |
Covariance function. |
... |
Other arguments to be passed on. |
Named list of vectors with parameters to be passed to covariance.
list()
)Named list of vectors with arguments to be passed to covariance
list()
)Named list of vectors with arguments to be passed to choleskyFactory
.
Returns a function of the form function(theta_list, cov.args_list = list(), chol.args_list = list())
which returns a data.frame
containing the neg2loglikelihood at all permutations of the provided arguments.
The function manufactured by neg2loglikDiagFactory
in principle also accepts covariance functions generated using covarianceFactory
. However, the function is not yet compatible with the arguments fixed_range_value
and fixed_nugget_value
. For now, these should be left at default when using covarianceFactory
.
Thomas Caspar Fischer
set.seed(63)
n <- 50
range <- 0.7
theta <- c(range, 1, 1, 0, 0)
locs <- data.frame(x = runif(n), y = runif(n))
dmat <- as.matrix(dist(locs))
Sigma <- cov.wendland(h = dmat, theta = theta)
y <- c(spam::rmvnorm(1, Sigma = Sigma))
neg2loglikIterator <- neg2loglikDiagFactory(y = y, distmat = dmat,
covariance = cov.wendland)
theta_list <- list(range = 0.5, sill = 1, kappa = 0, mu = c(0, 0.25, 0.5),
nugget = 0)
cov.args_list <- list(numint.abstol = c(1e-1, 1e-3, 1e-6), numint.reltol = c(1e-3))
results <- neg2loglikIterator(theta_list, cov.args_list = cov.args_list)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.