Methods for likelihood profiles
Definition of the mle2 likelihood profile class, and applicable methods
## S4 method for signature 'profile.mle2' plot(x, levels, which=1:p, conf = c(99, 95, 90, 80, 50)/100, plot.confstr = TRUE, confstr = NULL, absVal = TRUE, add = FALSE, col.minval="green", lty.minval=2, col.conf="magenta", lty.conf=2, col.prof="blue", lty.prof=1, xlabs=nm, ylab="z", onepage=TRUE, ask=((prod(par("mfcol")) < length(which)) && dev.interactive() && !onepage), show.points=FALSE, main, xlim, ylim, ...) ## S4 method for signature 'mle2' confint(object, parm, level = 0.95, method, trace=FALSE,quietly=!interactive(), tol.newmin=0.001,...) ## S4 method for signature 'profile.mle2' confint(object, parm, level = 0.95, trace=FALSE, ...)
x |
An object of class |
object |
An object of class |
levels |
levels at which to plot likelihood cutoffs (set by conf by default) |
level |
level at which to compute confidence interval |
which |
(numeric or character) which parameter profiles to plot |
parm |
(numeric or character) which parameter(s) to find confidence intervals for |
method |
(character) "spline", "uniroot", or "quad", for
spline-extrapolation-based (default), root-finding, or quadratic
confidence intervals. By default it uses the value of
|
trace |
trace progress of confidence interval calculation when using ‘uniroot’ method? |
conf |
(1-alpha) levels at which to plot likelihood cutoffs/confidence intervals |
quietly |
(logical) suppress “Profiling ...” message when computing profile to get confidence interval? |
tol.newmin |
see |
plot.confstr |
(logical) plot labels showing confidence levels? |
confstr |
(character) labels for confidence levels (by default, constructed from conf levels) |
absVal |
(logical) plot absolute values of signed square root deviance difference ("V" plot rather than straight-line plot)? |
add |
(logical) add profile to existing graph? |
col.minval |
color for minimum line |
lty.minval |
line type for minimum line |
col.conf |
color for confidence intervals |
lty.conf |
line type for confidence intervals |
col.prof |
color for profile |
lty.prof |
line type for profile |
xlabs |
x labels |
ylab |
y label |
onepage |
(logical) plot all profiles on one page, adjusting par(mfcol) as necessary? |
ask |
(logical) pause for user input between plots? |
show.points |
(logical) show computed profile points as well as interpolated spline? |
main |
(logical) main title |
xlim |
x limits |
ylim |
y limits |
... |
other arguments |
The default confidence interval calculation computes a likelihood
profile and uses the points therein, or uses the computed points in
an existing profile.mle2
object, to construct an interpolation
spline (which by default has three times as many points as were in
the original set of profile points). It then uses linear
interpolation between these interpolated points (!)
Objects can be created by calls of the form new("profile.mle2",
...)
, but most often by invoking profile
on an "mle2" object.
profile
:Object of class "list"
. List of
profiles, one for each requested parameter. Each profile is a data
frame with the first column called z
being the signed square
root of the deviance, and the others being the
parameters with names prefixed by par.vals.
summary
:Object of class "summary.mle2"
. Summary
of object being profiled.
signature(object = "profile.mle2")
: Use profile
to generate approximate confidence intervals for parameters.
signature(x = "profile.mle2", y = "missing")
: Plot
profiles for each parameter.
signature(x = "profile.mle2")
: Plot
profiles for each parameter.
signature(object = "profile.mle2")
: Show object.
x <- 0:10 y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8) d <- data.frame(x,y) ## we have a choice here: (1) don't impose boundaries on the parameters, ## put up with warning messages about NaN values: fit1 <- mle2(y~dpois(lambda=ymax/(1+x/xhalf)), start=list(ymax=1,xhalf=1), data=d) p1 <- suppressWarnings(profile(fit1)) plot(p1,main=c("first","second"), xlab=c(~y[max],~x[1/2]),ylab="Signed square root deviance", show.points=TRUE) suppressWarnings(confint(fit1)) ## recomputes profile confint(p1) ## operates on existing profile suppressWarnings(confint(fit1,method="uniroot")) ## alternatively, we can use box constraints to keep ourselves ## to positive parameter values ... fit2 <- update(fit1,method="L-BFGS-B",lower=c(ymax=0.001,xhalf=0.001)) ## Not run: p2 <- profile(fit2) plot(p2,show.points=TRUE) ## but the fit for ymax is just bad enough that the spline gets wonky confint(p2) ## now we get a warning confint(fit2,method="uniroot") ## bobyqa is a better-behaved bounded optimizer ... ## BUT recent (development, 2012.5.24) versions of ## optimx no longer allow single-parameter fits! if (require(optimx)) { fit3 <- update(fit1, optimizer="optimx", method="bobyqa",lower=c(ymax=0.001,xhalf=0.001)) p3 <- profile(fit3) plot(p3,show.points=TRUE) confint(p3) } ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.