R/construct_likelihood.R, R/plot.likelihood_function.R
plot.likelihood_function.RdPlot a likelihood function showing relative likelihood or deviance, with optional confidence intervals and reference lines.
# S3 method for class 'likelihood_function'
plot(x, parameter = NULL,
type = c("likelihood", "deviance", "both"), n_points = 200,
interval = NULL, add_ci = TRUE, ci_level = 0.95, add_mle = TRUE,
relative = TRUE, main = NULL, xlab = NULL, ylab = NULL,
col = "black", lwd = 2, ...)
# S3 method for class 'likelihood_function'
plot(x, parameter = NULL,
type = c("likelihood", "deviance", "both"), n_points = 200,
interval = NULL, add_ci = TRUE, ci_level = 0.95, add_mle = TRUE,
relative = TRUE, main = NULL, xlab = NULL, ylab = NULL,
col = "black", lwd = 2, ...)A likelihood_function object
Name of the parameter to plot. If NULL, plots the first parameter
and displays a message.
Type of plot: "likelihood" (relative likelihood), "deviance"
(profile deviance), or "both" (two-panel plot)
Number of parameter values at which to evaluate the profile likelihood
A length-2 numeric vector specifying the range of parameter values
to plot. If NULL, automatically determined as ±5 standard errors from the MLE.
Logical; if TRUE, adds confidence interval bounds to the plot
Confidence level for the intervals (default: 0.95)
Logical; if TRUE, adds a vertical line at the MLE
Logical; if TRUE, plots relative likelihood; if FALSE,
plots absolute likelihood. Only applies to likelihood plots.
Main title for the plot. If NULL, automatically generated.
X-axis label. If NULL, uses the parameter name.
Y-axis label. If NULL, automatically determined by plot type.
Color for the main likelihood/deviance curve
Line width for the main curve
Additional arguments passed to plot
Invisibly returns the profile likelihood data frame
Creates publication-quality plots of likelihood and deviance functions. Includes optional confidence intervals and reference lines. For two-panel plots, the layout is automatically managed.
ggplot_likelihood for ggplot2 version,
plotly_likelihood for interactive plots