| plot_loglik | R Documentation |
Fits the model over a fine grid of transformation parameter values and
plots the profile log-likelihood for both the Box-Cox and logarithmic
transformation models in one panel (layout = "joint", default): the
log transformation parameter r to the left and the Box-Cox parameter rho to
the right of a dotted line at zero, where the families meet
(\rho \to 0 is the log model with r = 1, r \to 0 the
Box-Cox model with \rho = 1). layout = "panels" gives two
panels side by side. Curves are natural splines through the grid points. For
competing risks the plot refers to the event coded 1; for another event,
recode the
status and call the function again.
plot_loglik(
formula,
data,
id = "id",
rho_grid = seq(0.01, 1.2, by = 0.01),
r_grid = seq(0.01, 1.2, by = 0.01),
tau = NULL,
mark_points = TRUE,
layout = NULL,
legend = TRUE,
file = NULL,
width = NULL,
height = NULL,
verbose = TRUE,
...
)
formula |
A formula as passed to |
data |
A data frame. |
id |
Name of the subject identifier column. |
rho_grid |
A numeric vector of rho values for the Box-Cox model
(default: |
r_grid |
A numeric vector of r values for the log model
(default: |
tau |
Optional truncation time. If |
mark_points |
Logical; if |
layout |
|
legend |
Logical; add a legend (default |
file |
Optional path to save the plot as a PDF (e.g.
|
width, height |
Size of the PDF in inches; default 3.6 x 2.8 (pointsize
9, as Figure 2 of Bellach and Kosorok, 2026) for |
verbose |
Logical; print progress (default |
... |
Additional arguments passed to |
A data frame of class "wnpmle_profile" with columns
model, param and loglik, invisibly. Save it
(res <- plot_loglik(...)) to redraw the figure with
plot.wnpmle_profile without refitting.
bdata <- bladder_prep()
bdata_clean <- bdata[, c("id", "time", "status", "treat", "num", "size")]
# a coarse grid keeps the example short; use finer grids in practice
plot_loglik(Surv(time, status) ~ treat + num + size,
data = bdata_clean, id = "id",
rho_grid = seq(0.2, 1.2, by = 0.2),
r_grid = seq(0.2, 1.2, by = 0.2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.