slice | R Documentation |
Computes cross-section(s) of a multi-dimensional likelihood surface
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,
fun_args = 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)
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 |
fun_args |
additional arguments to pass to |
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) |
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.
is a generic method
creates one-dimensional slices, by default of all parameters of a model
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).
creates a slice along a transect between two specified
points in parameter space (see calcslice
in the emdbook
package)
An object of class slice
with
a list of individual parameter (or parameter-pair) slices, each of which is a data frame with elements
name of the first variable
(for 2D slices) name of the second variable
parameter values
(for 2D slices) parameter values
slice values
a list (?) of the ranges for each parameter
vector of baseline parameter values
1 or 2
sliceOld
returns instead a list with elements profile
and summary
(see profile.mle2
)
Ben Bolker
profile
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.