Plot the likelihood approximation
plotLikelihoodFit(
approximation,
cyclopsFit,
parameter = "x",
logScale = TRUE,
xLabel = "Hazard Ratio",
limits = c(0.1, 10),
fileName = NULL
)
An approximation of the likelihood function as fitted using the
approximateLikelihood()
function.
A model fitted using the Cyclops::fitCyclopsModel()
function.
The parameter in the cyclopsFit
object to profile.
Show the y-axis on the log scale?
The title of the x-axis.
The limits on the x-axis.
Name of the file where the plot should be saved, for example 'plot.png'. See the function ggplot2::ggsave in the ggplot2 package for supported file formats.
A Ggplot object. Use the ggplot2::ggsave function to save to file.
Plots the (log) likelihood and the approximation of the likelihood. Allows for reviewing the approximation.
# Simulate a single database population:
population <- simulatePopulations(createSimulationSettings(nSites = 1))[[1]]
# Approximate the likelihood:
cyclopsData <- Cyclops::createCyclopsData(Surv(time, y) ~ x + strata(stratumId),
data = population,
modelType = "cox"
)
cyclopsFit <- Cyclops::fitCyclopsModel(cyclopsData)
approximation <- approximateLikelihood(cyclopsFit, parameter = "x", approximation = "custom")
plotLikelihoodFit(approximation, cyclopsFit, parameter = "x")
#> Detected data following custom parameric distribution