Nothing
mleFactory <- function(covariance, cov.args = list(), chol.args = list(),
optim.args = list(), hessian = FALSE,
optimParallel.args = list()){
covarianceFunction <- covarianceFactory(covariance = covariance,
cov.args = cov.args)
optimFunction <- optimFactory(optim.args = optim.args, hessian = hessian,
optimParallel.args = optimParallel.args)
mleFunction <- function(y, X = data.frame(), distmat, beta0 = NULL, init_parameters,
theta_llim, theta_ulim){
cholFunction <- choleskyFactory(chol.args=chol.args, Rstruct=Rstruct)
theta <- init_parameters
if (is.null(beta0) || ncol(X) != length(beta0)) {
beta <- numeric(ncol(X))
} else {
beta <- beta0
}
Rstruct <- NULL
neg2loglikFunction <- neg2loglikFactory(y = y, X = X, distmat = distmat,
covarianceFunction = covarianceFunction, choleskyFunction = cholFunction)
# Workaround for lazy evaluation behaviour.
# neg2loglikFunction <- function(parameters) {
# return(neg2loglikFunction0(parameters))
# }
init <- c(beta, theta)
lower <- c(rep(-Inf, ncol(X)), theta_llim)
upper <- c(rep( Inf, ncol(X)), theta_ulim)
######################################################################
# Run maximum likelihood estimation
#----------------------------------------------------------------------
result <- optimFunction(par = init, fn = neg2loglikFunction, gr = NULL,
lower = lower, upper = upper)
return(result)
}
return(mleFunction)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.