Learn R Programming

maxLik (version 0.5-6)

nIter: Return number of iterations for iterative models

Description

Returns the number of iterations for iterative models. The default method assumes presence of a component $iterations in {x}.

Usage

nIter(x, ...)
## S3 method for class 'default':
nIter(x, \dots)

Arguments

x
a statistical model, or a result of maximisation, such as created by maxLik or maxNR
...
further arguments for methods

Value

  • numeric, number of iterations

Details

This is a generic function. The default method returns the component x$iterations.

See Also

maxLik, maxNR

Examples

Run this code
## ML estimation of exponential duration model:
t <- rexp(100, 2)
loglik <- function(theta) sum(log(theta) - theta*t)
## Estimate with numeric gradient and numeric Hessian
a <- maxNR(loglik, start=1)
nIter(a)

Run the code above in your browser using DataLab