storedValues.RdRetrieve the objective function value for each iteration if stored during the optimization.
storedValues(x, ...)
# S3 method for class 'maxim'
storedValues(x, ...)
storedParameters(x, ...)
# S3 method for class 'maxim'
storedParameters(x, ...)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.
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.
## 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)
#> [1] -42.59750 -96.30808 -31.13329 -14.79908 -14.76907 -14.72299 -14.70729
#> [8] -14.68940 -14.68172 -14.67447 -14.67085
storedParameters(a)
#> parameter
#> epoch [,1]
#> start 1.000000
#> 1 6.740250
#> 2 3.964125
#> 3 2.227000
#> 4 2.457596
#> 5 2.266864
#> 6 2.418495
#> 7 2.293548
#> 8 2.393855
#> 9 2.311468
#> 10 2.377974