Learn R Programming

georob (version 0.3-5)

profilelogLik: Profile Likelihood

Description

The function profilelogLik computes for an array of fixed variogram parameters the profile log-likelihood by maximizing the (restricted) log-likelihood with respect to the remaining variogram parameters, the fixed and random effects.

Usage

profilelogLik(object, values, use.fitted = TRUE, verbose = 0, 
    ncores = min(detectCores(), NROW(values)))

Arguments

object

an object of class "georob" (mandatory argument), see georobObject.

values

a data.frame or a matrix with the values of the variogram and anisotropy parameters that should be kept fixed (mandatory argument, see georob and georobIntro for information about the parametrization of variogram models). The names of the columns of values must match the names of variogram and anisotropy parameters.

use.fitted

logical scalar controlling whether the fitted variogram parameters of object should be used as initial values (default TRUE) when maximizing the profile log-likelihood or the initial values used to generate object.

verbose

positive integer controlling logging of diagnostic messages to the console during model fitting, see georob.

ncores

positive integer controlling how many cores are used for parallelized computations, see Details.

Value

A data.frame with the columns of values, a column loglik (contains the maximized [restricted] log-likelihood), columns with the estimated variogram and fixed effect parameters, columns with the gradient of the (restricted) log-likelihood (or the roots of the estimating equations) and a column converged, indicating whether convergence has occurred converged ==1 when fitting the respective model.

Details

For robust REML fits profilelogLik returns (possibly with a warning) the log-likelihood of the Gaussian (RE)ML fit of the equivalent Gaussian spatial linear model with heteroscedastic nugget.

Note that the data frame passed as data argument to georob must exist in the user workspace when calling profilelogLik.

profilelogLik uses the package parallel for parallelized computation of the profile likelihood. By default, the function uses NROW(values) CPUs but not more than are physically available (as returned by detectCores).

profilelogLik uses the function update to re-estimated the model with partly fixed variogram parameters. Therefore, any argument accepted by georob except data can be changed when re-fitting the model. Some of them (e.g. verbose) are explicit arguments of profilelogLik, but also the remaining ones can be passed by to the function.

See Also

georob for (robust) fitting of spatial linear models.

Examples

Run this code
# NOT RUN {
data(meuse)

r.logzn.ml <- georob(log(zinc)~sqrt(dist), data=meuse, locations=~x+y,
    variogram.model="RMexp", param=c(variance=0.15, nugget=0.05, scale=200),
    tuning.psi=1000, control=control.georob(ml.method="ML"))
  
r.prflik <- profilelogLik(r.logzn.ml, values=expand.grid(scale=seq(75, 600, by=25)))
plot(loglik~scale, r.prflik, type="l")
abline(v=r.logzn.ml$variogram.object[[1]]$param["scale"], lty="dotted")
abline(h=r.logzn.ml$loglik-0.5*qchisq(0.95, 1), lty="dotted")
  
# }

Run the code above in your browser using DataLab