Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

storedValues

Return the stored values of optimization


Description

Retrieve the objective function value for each iteration if stored during the optimization.

Usage

storedValues(x, ...)
## S3 method for class 'maxim'
storedValues(x, ...)
storedParameters(x, ...)
## S3 method for class 'maxim'
storedParameters(x, ...)

Arguments

x

a result of maximization, created by maxLik, maxSGA or another optimizer.

...

further arguments for other methods

Details

These is a generic method. If asked by control parameter storeValues=TRUE or storeParameters=TRUE, certain optimization methods store the objective function value and the parameter value at each epoch. These methods retrieves the stored values.

Value

  • storedValues: a numeric vector, one value for each iteration

  • storedParameters: a numeric matrix with rows corresponding to the iterations and columns to the parameter components.

In both cases, the first value stored corresponds to the initial parameter.

Author(s)

Ott Toomet

See Also

Examples

## Estimate the exponential distribution parameter
t <- rexp(100, 2)
loglik <- function(theta, index) sum(log(theta) - theta*t[index])
## Estimate with numeric gradient and numeric Hessian
a <- maxSGA(loglik, start=1,
            control=list(storeValues=TRUE, storeParameters=TRUE, iterlim=10),
            nObs=100)
storedValues(a)
storedParameters(a)

maxLik

Maximum Likelihood Estimation and Related Tools

v1.4-8
GPL (>= 2)
Authors
Ott Toomet <otoomet@gmail.com>, Arne Henningsen <arne.henningsen@gmail.com>, with contributions from Spencer Graves and Yves Croissant
Initial release
2021-03-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.