Learn R Programming

maxLik (version 1.6-10)

tidy.maxLik: tidy and glance methods for maxLik objects

Description

These methods return quick summary information about the estimated model, either one parameter per row (tibble), or on a single row (glance). Both require the tibble package to be installed.

Usage

# S3 method for maxim
tidy(x,  ...)
# S3 method for maxLik
tidy(x,  ...)
# S3 method for maxim
glance(x, ...)
# S3 method for maxLik
glance(x, ...)

Value

tidy() for 'maxLik' objects returns a tibble (data frame) with one row per parameter, and with the following columns:

term

The name of the estimated parameter (parameters are sequentially numbered if names missing).

estimate

The estimated parameter.

std.error

The standard error of the estimate.

statistic

The \(z\)-statistic of the estimate.

p.value

The \(p\)-value.

This is essentially the same table as summary-method prints, just in form of a tibble (data frame).

For 'maxim' objects, the corresponding tibble contains

term

The name of the estimated parameter (parameters are sequentially numbered if names missing).

estimate

The estimated parameter.

gradient

The corresponding gradient value.

glance() for 'maxLik' objects returns an one-row tibble with columns:

df

The degrees of freedom of the model.

logLik

The log-likelihood of the model.

AIC

Akaike's Information Criterion for the model.

nobs

The number of observations, if this is available, otherwise NA.

For 'maxim' objects the tibble contains

value

The function value at optimum.

iterations

The number of iterations spent (what exactly is “iteration” depends on the optimizer).

gradient

Norm of gradient at the optimum.

code

optimizer return code (see returnCode).

Arguments

x

object of class 'maxLik' or 'maxim'.

...

Not used.

Author

David Hugh-Jones

See Also

The functions tidy and glance in package generics, and summary to display the “standard” summary information.

Examples

Run this code
## Example with a single parameter
t <- rexp(100, 2)
loglik <- function(theta) log(theta) - theta*t
a <- maxLik(loglik, start=2)
tidy(a)
glance(a)
## Example with a parameter vector
x <- rnorm(100)
loglik <- function(theta) {
   dnorm(x, mean=theta[1], sd=theta[2], log=TRUE)
}
a <- maxLik(loglik, start=c(mu=0, sd=1))
tidy(a)
glance(a)

Run the code above in your browser using DataLab