slice | R Documentation |
Slice likelihood and plot the slice. This is usefull for illustrating the likelihood surface around the MLE (maximum likelihood estimate) and provides graphics to substantiate (non-)convergence of a model fit. Also, the closeness of a quadratic approximation to the log-likelihood function can be inspected for relevant parameters. A slice is considerably less computationally demanding than a profile.
slice(object, ...)
## S3 method for class 'clm'
slice(object, parm = seq_along(par), lambda = 3,
grid = 100, quad.approx = TRUE, ...)
## S3 method for class 'slice.clm'
plot(x, parm = seq_along(x),
type = c("quadratic", "linear"), plot.mle = TRUE,
ask = prod(par("mfcol")) < length(parm) && dev.interactive(), ...)
object |
for the |
x |
a |
parm |
for |
lambda |
the number of curvature units on each side of the MLE the slice should cover. |
grid |
the number of values at which to compute the log-likelihood for each parameter. |
quad.approx |
compute and include the quadratic approximation to the log-likelihood function? |
type |
|
plot.mle |
include a vertical line at the MLE (maximum likelihood estimate)
when |
ask |
logical; if |
... |
further arguments to |
The slice
method returns a list of data.frame
s with one
data.frame
for each parameter slice. Each data.frame
contains in the first column the values of the parameter and in the
second column the values of the (positive) log-likelihood
"logLik"
. A third column is present if quad.approx = TRUE
and contains the corresponding quadratic approximation to the
log-likelihood. The original model fit is included as the attribute
"original.fit"
.
The plot
method produces a plot of the likelihood slice for
each parameter.
Rune Haubo B Christensen
## fit model:
fm1 <- clm(rating ~ contact + temp, data = wine)
## slice the likelihood:
sl1 <- slice(fm1)
## three different ways to plot the slices:
par(mfrow = c(2,3))
plot(sl1)
plot(sl1, type = "quadratic", plot.mle = FALSE)
plot(sl1, type = "linear")
## Verify convergence to the optimum:
sl2 <- slice(fm1, lambda = 1e-5, quad.approx = FALSE)
plot(sl2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.