Description Usage Arguments Details Value Examples
Generates plot of log-likelihood vs. one parameter of interest while other parameters are held fixed at certain values (e.g. MLEs). This is not a profile likelihood, and is mainly intended for use with a Shiny app.
1 2 3 |
start |
See |
objective |
See |
lower |
See |
upper |
See |
xaxis_param |
Integer value specifying which parameter should be plotted on the x-axis. |
xaxis_range |
Numeric vector specifying x-axis range over which to vary the parameter of interest. Only values with likelihood ratio > 0.01 are ultimately plotted. |
param_values |
Numeric vector of values to use for other parameters in
model, in case you want an additional curve for log-likelihood function vs.
parameter of interest at certain non-MLE values for other parameters. For
example, if there are 3 parameters and |
mles |
Numeric vector of previously obtained maximum likelihood estimates. |
return_info |
Logical value for whether to return the estimated MLEs and 99.99% confidence intervals for parameters rather than create the plot. |
Note that objective
should be the negative log-likelihood function,
since internal optimization uses (nlminb
), which does
minimization.
Plot of log-likelihood vs. value of parameter of interest, generated
by ggplot
.
1 2 3 4 5 6 7 | # Generate normal data, define log-likelihood function, and plot likelihood
set.seed(123)
x <- rnorm(100, mean = 0.5, sd = sqrt(0.25))
ll.f <- function(theta) {
return(-sum(dnorm(x, log = TRUE, mean = theta[1], sd = sqrt(theta[2]))))
}
plot_ll(start = c(0, 1), objective = ll.f, lower = c(-Inf, 1e-6))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.