slice: Plot slices of the synthetic log-likelihood.

Description Usage Arguments Value Author(s) Examples

View source: R/slice_synlik.R

Description

Plot slices of the synthetic log-likelihood.

Usage

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

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.

Value

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

Author(s)

Matteo Fasiolo <matteo.fasiolo@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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)
            
## Not run: 
# 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)   

## End(Not run)                     

synlik documentation built on May 25, 2021, 5:09 p.m.