confint
Confidence intervals and profile likelihoods for parameters in cumulative link models
Computes confidence intervals from the profiled likelihood for one or more parameters in a cumulative link model, or plots the profile likelihood.
- Keywords
- models
Usage
# S3 method for clm
confint(object, parm, level = 0.95,
type = c("profile", "Wald"), trace = FALSE, ...)# S3 method for profile.clm
confint(object, parm = seq_len(nprofiles),
level = 0.95, ...)
# S3 method for clm
profile(fitted, which.beta = seq_len(nbeta),
which.zeta = seq_len(nzeta), alpha = 0.001,
max.steps = 50, nsteps = 8, trace = FALSE, step.warn = 5,
control = list(), ...)
# S3 method for profile.clm
plot(x, which.par = seq_len(nprofiles),
level = c(0.95, 0.99), Log = FALSE, relative = TRUE, root =
FALSE, fig = TRUE, approx = root, n = 1e3,
ask = prod(par("mfcol")) < length(which.par) && dev.interactive(),
..., ylim = NULL)
Arguments
- object, fitted, x
a fitted
clm
object or aprofile.clm
object.- parm, which.par, which.beta, which.zeta
a numeric or character vector indicating which regression coefficients should be profiled. By default all coefficients are profiled. Ignored for
confint.clm
where all parameters are considered.- level
the confidence level. For the
plot
method a vector of levels for which horizontal lines should be drawn.- type
the type of confidence interval.
- trace
if
trace
isTRUE
or positive, information about progress is printed.- Log
should the profile likelihood be plotted on the log-scale?
- relative
should the relative or the absolute likelihood be plotted?
- root
should the (approximately linear) likelihood root statistic be plotted?
- approx
should the Gaussian or quadratic approximation to the (log) likelihood be included?
- fig
should the profile likelihood be plotted?
- ask
logical; if
TRUE
, the user is asked before each plot, seepar
(ask=.)
.- n
the no. points used in the spline interpolation of the profile likelihood.
- ylim
overrules default y-limits on the plot of the profile likelihood.
- alpha
the likelihood is profiled in the 100*(1-alpha)% confidence region as determined by the profile likelihood.
- control
a list of control parameters for
clm
. Possibly useclm.control
to set these.- max.steps
the maximum number of profiling steps in each direction for each parameter.
- nsteps
the (approximate) number of steps to take in each direction of the profile for each parameter. The step length is determined accordingly assuming a quadratic approximation to the log-likelihood function. The actual number of steps will often be close to
nsteps
, but will deviate when the log-likelihood functions is irregular.- step.warn
a warning is issued if the number of steps in each direction (up or down) for a parameter is less than
step.warn
. If few steps are taken, the profile will be unreliable and derived confidence intervals will be inaccurate.- …
additional arguments to be parsed on to methods.
Details
These confint
methods call
the appropriate profile method, then finds the
confidence intervals by interpolation of the profile traces.
If the profile object is already available, this should be used as the
main argument rather than the fitted model object itself.
Value
confint
:
A matrix with columns giving lower and upper confidence
limits for each parameter. These will be labelled as (1-level)/2 and
1 - (1-level)/2 in % (by default 2.5% and 97.5%).
plot.profile.clm
invisibly returns the profile object, i.e., a
list of data.frame
s with an lroot
component for
the likelihood root statistic and a matrix par.vals
with
values of the parameters.
See Also
Examples
# NOT RUN {
## Accurate profile likelihood confidence intervals compared to the
## conventional Wald intervals:
fm1 <- clm(rating ~ temp * contact, data = wine)
confint(fm1) ## type = "profile"
confint(fm1, type = "Wald")
pr1 <- profile(fm1)
confint(pr1)
## plotting the profiles:
par(mfrow = c(2, 2))
plot(pr1, root = TRUE) ## check for linearity
par(mfrow = c(2, 2))
plot(pr1)
par(mfrow = c(2, 2))
plot(pr1, approx = TRUE)
par(mfrow = c(2, 2))
plot(pr1, Log = TRUE)
par(mfrow = c(2, 2))
plot(pr1, Log = TRUE, relative = FALSE)
## Not likely to be useful but allowed for completeness:
par(mfrow = c(2, 2))
plot(pr1, Log = FALSE, relative = FALSE)
## Example from polr in package MASS:
## Fit model from polr example:
if(require(MASS)) {
fm1 <- clm(Sat ~ Infl + Type + Cont, weights = Freq,
data = housing)
pr1 <- profile(fm1)
confint(pr1)
par(mfrow=c(2,2))
plot(pr1)
}
# }