Title: Managing Results from Maximum Likelihood Estimation
Version: 1.0.0
Description: Managing and exploring parameter estimation results derived from Maximum Likelihood Estimation (MLE) using the 'likelihood' package. It provides functions for organizing, visualizing, and summarizing MLE outcomes, streamlining statistical analysis workflows. By improving interpretation and facilitating model evaluation, it helps users gain deeper insights into parameter estimation and model fitting, making MLE result exploration more efficient and accessible. See Goffe et al. (1994) <doi:10.1016/0304-4076(94)90038-8> for details on MLE, and Canham and Uriarte (2006) <doi:10.1890/04-0657> for application of MLE using 'likelihood'.
License: GPL (≥ 3)
Encoding: UTF-8
URL: https://github.com/ajpelu/likelihoodTools, https://ajpelu.github.io/likelihoodTools/
BugReports: https://github.com/ajpelu/likelihoodTools/issues
Depends: R (≥ 4.1.0)
RoxygenNote: 7.3.2
Imports: dplyr, ggplot2, rlang
Suggests: testthat (≥ 3.0.0), likelihood, kableExtra, MASS, patchwork, spelling
Config/testthat/edition: 3
Config/Needs/website: rmarkdown
Language: en-US
NeedsCompilation: no
Packaged: 2025-02-28 14:53:55 UTC; ajpelu
Author: Antonio Jesus Perez-Luque ORCID iD [cre, aut, cph]
Maintainer: Antonio Jesus Perez-Luque <ajpelu@gmail.com>
Repository: CRAN
Date/Publication: 2025-03-04 12:40:02 UTC

likelihoodTools: Tools for managing results from maximum likelihood estimation

Description

Tools for managing and exploring parameter estimation results derived from Maximum Likelihood Estimation (MLE) using the 'likelihood' package.

Author(s)

Maintainer: Antonio Jesús Pérez-Luque ajpelu@gmail.com (ORCID) [copyright holder]

See Also

Useful links:


Extract and format results from Simulated Annealing (Maximum Likelihood Estimation)

Description

Extract and format results from Simulated Annealing (Maximum Likelihood Estimation)

Usage

mle_format(x, yvar)

Arguments

x

List with the results of the simulated annealing algorithm for Maximum Likelihood Estimation. See likelihood::anneal()

yvar

The name of the column that contains the dependent variable (the “observed” value). This column must be present in the source_data of the x (results) list

Value

A dataframe with outputs from the results of the simulated annealing maximum parameter estimation. This dataframe contains the following columns (see help in likelihood::anneal()):

RMSE=\sqrt{ \frac{\sum_{i=1}^{N}(obs_i - exp_i)^2}{n -1}}

Examples


# Get the results of the maximum likelihood estimation from the example in
# the anneal function of the likelihood pkg.

library(likelihood)
data(crown_rad)
dataset <- crown_rad

# Create our model function
modelfun <- function (a, b, DBH) {a + b * DBH}

# Compute the MLE of the parameters
results <- anneal(model = modelfun,
  par = list(a = 0, b = 0),
  var = list(DBH = "DBH", x = "Radius", mean = "predicted",
             sd = 0.815585, log = TRUE),
  source_data = dataset,
  par_lo = list(a = 0, b = 0),
  par_hi = list(a = 50, b = 50),
  pdf = dnorm,
  dep_var = "Radius",
  max_iter = 20000,
  show_display = FALSE)

# Format the results
mle_format(results, yvar = "DBH")


Plots Observed vs. Predicted MLE

Description

Plots observed values vs. predicted values. The predicted values are obtained from the model with the parameters values estimated by maximum likelihood estimation using simulated annealing.

Usage

mle_plot_observed(
  x,
  yvar,
  annotate = TRUE,
  lab_x = "Observed",
  lab_y = "Predicted",
  ...
)

Arguments

x

List with the results of the simulated annealing algorithm for Maximum Likelihood Estimation. See likelihood::anneal()

yvar

The name of the column that contains the dependent variable (the “observed” value). This column must be present in the source_data of the x (results) list

annotate

logical (default to TRUE), display the values of R^2 and slope of the regression of the observed on predicted values. See likelihood::Simulated Annealing Algorithm

lab_x

The text for the x-axis lab

lab_y

The text for the y-axis lab

...

other ggplot2 parameters

Value

A ggplot object displaying the observed vs. predicted values, with optional annotations for R^2 and regression slope.


Plots Residuals vs. Predicted MLE

Description

Plots residuals (observed - residuals) values vs. predicted values. The predicted values are obtained from the model with the parameters values estimated by maximum likelihood estimation using simulated annealing.

Usage

mle_plot_residuals(
  x,
  yvar,
  lab_residuals = "Residuals",
  lab_predicted = "Predicted",
  ...
)

Arguments

x

List with the results of the simulated annealing algorithm for Maximum Likelihood Estimation. See likelihood::anneal()

yvar

The name of the column that contains the dependent variable (the “observed” value). This column must be present in the source_data of the x (results) list

lab_residuals

The text for the residual axis lab (y-axis)

lab_predicted

The text for the predicted axis lab (x-axis)

...

other ggplot2 parameters

Value

A ggplot object displaying the residuals vs. predicted values, with a horizontal line at zero.