Learn R Programming

synlik (version 0.1.6)

slice: Plot slices of the synthetic log-likelihood.

Description

Plot slices of the synthetic log-likelihood.

Usage

slice(object, ranges, nsim, param = object@param, pairs = FALSE,
  draw = TRUE, trans = NULL, multicore = FALSE, ncores = detectCores() -
  1, cluster = NULL, ...)

Value

Either a vector or matrix of log-synthetic likelihood estimates, depending on whether length(parNames) == 1 or 2. These are returned invisibly.

Arguments

object

synlik object.

ranges

ranges of values along which we want the slices. If length(parName) == 1 than range has a vector, while if length(parName) == 2 it have to be a named list of 2 vectors (ex: list("alpha" = 1:10, "beta" = 10:1)).

nsim

Number of simulations used to evaluate the synthetic likelihood at each location.

param

Named vector containing the value of the ALL parameters (including the sliced one). Parameters that are not in parName will be fixed to the values in param.

pairs

if TRUE the function will produce a 2D slice for every pair of parameters in ranges. FALSE by default.

draw

If TRUE the slice will be plotted.

trans

Named vector or list of transformations to be applied to the parameters in parName before plotting ex: trans = c(s = "exp", d = "exp")/

multicore

If TRUE the object@simulator and object@summaries functions will be executed in parallel. That is the nsim simulations will be divided in multiple cores.

ncores

Number of cores to use if multicore == TRUE.

cluster

An object of class c("SOCKcluster", "cluster"). This allowes the user to pass her own cluster, which will be used if multicore == TRUE. The user has to remember to stop the cluster.

...

additional arguments to be passed to slik(), see slik.

Author

Matteo Fasiolo <matteo.fasiolo@gmail.com>

Examples

Run this code
data(ricker_sl)

# Plotting slices of the logLikelihood
slice(object = ricker_sl, 
     ranges = list("logR" = seq(3.5, 3.9, by = 0.01),
                   "logPhi" = seq(2, 2.6, by = 0.01),
                    "logSigma" = seq(-2, -0.5, by = 0.01)), 
     param = c(logR = 3.8, logSigma = log(0.3), logPhi = log(10)), 
     nsim = 500)
            
if (FALSE) {
# Plotting a contour of the logLikelihood
slice(object = ricker_sl, 
     ranges = list("logR" = seq(3.5, 3.9, by = 0.01),
                   "logPhi" = seq(2, 2.6, by = 0.01),
                   "logSigma" = seq(-2, -0.5, by = 0.04)), 
     pairs = TRUE,
     param = c(logR = 3.8, logSigma = log(0.3), logPhi = log(10)), 
     nsim = 500, multicore = TRUE)   
}                     

Run the code above in your browser using DataLab