Title: | 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. |
Authors: | Antonio Jesús Pérez-Luque [cre, aut, cph] |
Maintainer: | Antonio Jesús Pérez-Luque <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.0 |
Built: | 2024-11-04 16:18:09 UTC |
Source: | https://github.com/ajpelu/likelihoodTools |
Extract and format results from Simulated Annealing (Maximum Likelihood Estimation)
mle_format(x, yvar)
mle_format(x, yvar)
x |
List with the results of the simulated annealing algorithm for Maximum
Likelihood Estimation. See |
yvar |
The name of the column that contains the dependent variable
(the “observed” value). This column must be present in the |
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()
):
max_likeli
The maximum likelihood value of the model
n_params
The number of the estimated parameters
aic_corr
The value of Akaike's Information Criterion “corrected” for
small sample size. See the "Simulated Annealing Algorithm" help
page of the likelihood package for more information.
aic
The value of Akaike's Information Criterion. See the
"Simulated Annealing Algorithm" help page of the likelihood
package for more information.
slope
Slope of observed values linearly regressed on those predicted by
model, using the parameter maximum likelihood estimates. The intercept is
forced at zero.
R2
Proportion of variance explained by the model relative to that explained
by the simple mean of the data.
rmse
Root Mean Square Error, i.e. the standard deviation of the residuals.
It is computed as:
# 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")
# 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 values vs. predicted values. The predicted values are obtained from the model with the parameters values estimated by maximum likelihood estimation using simulated annealing.
mle_plot_observed( x, yvar, annotate = TRUE, lab_x = "Observed", lab_y = "Predicted", ... )
mle_plot_observed( x, yvar, annotate = TRUE, lab_x = "Observed", lab_y = "Predicted", ... )
x |
List with the results of the simulated annealing algorithm for Maximum
Likelihood Estimation. See |
yvar |
The name of the column that contains the dependent variable
(the “observed” value). This column must be present in the |
annotate |
logical (default to TRUE), display the values of |
lab_x |
The text for the x-axis lab |
lab_y |
The text for the y-axis lab |
... |
other ggplot2 parameters |
A ggplot
object displaying the observed vs. predicted values,
with optional annotations for and regression slope.
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.
mle_plot_residuals( x, yvar, lab_residuals = "Residuals", lab_predicted = "Predicted", ... )
mle_plot_residuals( x, yvar, lab_residuals = "Residuals", lab_predicted = "Predicted", ... )
x |
List with the results of the simulated annealing algorithm for Maximum
Likelihood Estimation. See |
yvar |
The name of the column that contains the dependent variable
(the “observed” value). This column must be present in the |
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 |
A ggplot
object displaying the residuals vs. predicted values,
with a horizontal line at zero.