bbmle (version 1.0.23.1)

slice: Calculate likelihood "slices"

Description

Computes cross-section(s) of a multi-dimensional likelihood surface

Usage

slice(x, dim=1, ...)
sliceOld(fitted, which = 1:p, maxsteps = 100,
                       alpha = 0.01, zmax = sqrt(qchisq(1 - alpha/2, p)),
                       del = zmax/5, trace = FALSE,
                       tol.newmin=0.001, …)
slice1D(params,fun,nt=101,lower=-Inf,
                    upper=Inf,verbose=TRUE, tranges=NULL,…)
slice2D(params,fun,nt=31,lower=-Inf,
                    upper=Inf,
                    cutoff=10,verbose=TRUE,
                    tranges=NULL, …)
slicetrans(params, params2, fun, extend=0.1, nt=401,
                       lower=-Inf, upper=Inf)

Arguments

x

a fitted model object of some sort

dim

dimensionality of slices (1 or 2)

params

a named vector of baseline parameter values

params2

a vector of parameter values

fun

an objective function

nt

(integer) number of slice-steps to take

lower

lower bound(s) (stub?)

upper

upper bound(s) (stub?)

cutoff

maximum increase in objective function to allow when computing ranges

extend

(numeric) fraction by which to extend range beyond specified points

verbose

print verbose output?

fitted

A fitted maximum likelihood model of class “mle2”

which

a numeric or character vector describing which parameters to profile (default is to profile all parameters)

maxsteps

maximum number of steps to take looking for an upper value of the negative log-likelihood

alpha

maximum (two-sided) likelihood ratio test confidence level to find

zmax

maximum value of signed square root of deviance difference to find (default value corresponds to a 2-tailed chi-squared test at level alpha)

del

step size for profiling

trace

(logical) produce tracing output?

tol.newmin

tolerance for diagnosing a new minimum below the minimum deviance estimated in initial fit is found

tranges

a two-column matrix giving lower and upper bounds for each parameter

additional arguments (not used)

Value

An object of class slice with

slices

a list of individual parameter (or parameter-pair) slices, each of which is a data frame with elements

var1

name of the first variable

var2

(for 2D slices) name of the second variable

x

parameter values

y

(for 2D slices) parameter values

z

slice values

ranges

a list (?) of the ranges for each parameter

params

vector of baseline parameter values

dim

1 or 2

sliceOld returns instead a list with elements profile and summary (see profile.mle2)

Details

Slices provide a lighter-weight way to explore likelihood surfaces than profiles, since they vary a single parameter rather than optimizing over all but one or two parameters.

slice

is a generic method

slice1D

creates one-dimensional slices, by default of all parameters of a model

slice2D

creates two-dimensional slices, by default of all pairs of parameters in a model. In each panel the closed point represents the parameters given (typically the MLEs), while the open point represents the observed minimum value within the 2D slice. If everything has gone according to plan, these points should coincide (at least up to grid precision).

slicetrans

creates a slice along a transect between two specified points in parameter space (see calcslice in the emdbook package)

See Also

profile

Examples

Run this code
# NOT RUN {
x <- 0:10
y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8)
d <- data.frame(x,y)
fit1 <- mle2(y~dpois(lambda=exp(lymax)/(1+x/exp(lhalf))),
   start=list(lymax=0,lhalf=0),
   data=d)
s1 <- bbmle::slice(fit1,verbose=FALSE)
s2 <- bbmle::slice(fit1,dim=2,verbose=FALSE)
require(lattice)
plot(s1)
plot(s2)
## 'transect' slice, from best-fit values to another point
st <- bbmle::slice(fit1,params2=c(5,0.5))
plot(st)
# }

Run the code above in your browser using DataLab