nIter: Return number of iterations for iterative models

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/nIter.R

Description

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

Usage

1
2
3
nIter(x, ...)
## Default S3 method:
nIter(x, ...)

Arguments

x

a statistical model, or a result of maximisation, created by maxLik, maxNR or another optimizer.

...

further arguments for methods

Details

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

Value

numeric, number of iterations. Note that ‘iteration’ may mean different things for different optimizers.

Author(s)

Ott Toomet

See Also

maxLik, maxNR

Examples

1
2
3
4
5
6
## Estimate the exponential distribution parameter:
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)

Example output

Loading required package: miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/
[1] 5

maxLik documentation built on Nov. 25, 2020, 3 a.m.