Takes a grid of parameter values and the corresponding (profile) log-likelihood and returns the same object structure as curve_lik(), so all of concurve's plotting and tabling functions work on it. This is the bridge between any likelihood-producing tool (optim(), maxLik, bbmle, ProfileLikelihood, hand-coded exact likelihoods) and concurve.

as_curve_lik(values, loglik, table = TRUE)

Arguments

values

A numeric vector of parameter values (the grid).

loglik

A numeric vector of log-likelihood values evaluated at values. Any additive constant is allowed; the function normalizes internally so the maximum relative likelihood is 1.

table

Indicates whether or not a table output with some relevant statistics should be generated. The default is TRUE and generates a table which is included in the list object.

Value

A list with 2 items where the dataframe of values is in the first object, and the table for the values in the second if table = TRUE.

Examples

# exact binomial likelihood for 8 successes in 20 trials
p <- seq(0.001, 0.999, length.out = 2000)
lik <- as_curve_lik(p, 8 * log(p) + 12 * log(1 - p))
ggcurve(lik[[1]], type = "l1")