likelihood_space {alien} | R Documentation |
Calculate log-likelihood space for a given time series and data
Description
This function allows to calculate the log-likelihood values for a given set of parameter values.
It can be used for diagnostics of the likelihood space and check - among others - for parameter contribution to log-likelihood.
passing FALSE
for the calculate
argument allows to experiment with different parameter values sets before calculating their log-likelihoods.
Please note: This functions may take a lot of time, depending on the number of parameters, and steps!
Usage
likelihood_space(
y,
mu = NULL,
pi = NULL,
data = NULL,
growth = TRUE,
type = "exponential",
centers,
ranges,
steps_from_centers,
calculate = TRUE
)
Arguments
y |
either a vector describing the number of discovered alien and invasive species (IAS) over a given time period, or the name (quoted or unquoted) of the corresponding column in the provided data. |
mu |
a formula defining the predictors for |
pi |
a formula defining the predictors for |
data |
a data frame containing the variables in the model(s). |
growth |
logical. Should the population growth parameter |
type |
Define whether the mu function should be on "linear" or "exponential" scale. Defaults to "exponential". |
centers |
the values used as the center-points for the parameter values. Usually the maximum likelihood estimation from a call to |
ranges |
the range of the parameter values in term of the center. The values will be withing |
steps_from_centers |
How many values in the range between |
calculate |
Whether to calculate the log-likelihoods (TRUE) or just view the parameter values (FALSE). |
Value
A data frame containing the parameter values, and if calculate = TRUE
including the log-likelihood values for each parameter combination.
Examples
if (FALSE){ # this takes a while...
example_model <- snc(sfestuary)
estimates <- example_model$coefficients$Estimate
likelihood_space <- likelihood_space(y = sfestuary, centers = estimates,
ranges = 1.5, steps_from_center = 10,
calculate = TRUE)
# with specified formula:
example_buba <- snc(y = aliens, pi = ~ natives, data = medfish)
estimates <- example_buba$coefficients$Estimate
likelihood_space <- likelihood_space(y = aliens, pi = ~ natives,
data = medfish, centers = estimates,
ranges = 1.5, steps_from_center = 10,
calculate = TRUE)
}