Skip to contents

Performs likelihood ratio tests comparing nested models. When given a single model, reports the log-likelihood and degrees of freedom. When given multiple models, performs sequential likelihood ratio tests.

Usage

# S3 method for class 'femtofit'
anova(object, ...)

Arguments

object

A femtofit object.

...

Additional femtofit objects to compare (must be nested).

Value

An anova.femtofit object containing the comparison table.

Details

Models should be provided in order from simplest (fewest parameters) to most complex. The likelihood ratio test compares each model to the previous one.

See also

compare for AIC-based comparison, lrt for explicit likelihood ratio tests

Examples

if (FALSE) { # \dontrun{
# Compare nested models
m1 <- fit(function(mu) loglik_normal(mu, 1, x), c(mu = 0))
m2 <- fit(function(mu, sigma) loglik_normal(mu, sigma, x), c(mu = 0, sigma = 1))

anova(m1, m2)  # LRT comparing m1 vs m2
} # }