Learn R Programming

maxLik (version 0.5-6)

summary.maxim: Summary method for maximisation/minimisation

Description

Summarises the maximisation results

Usage

## S3 method for class 'maxim':
summary( object, hessian=FALSE, unsucc.step=FALSE, ... )

Arguments

object
optimisation result, object of class maxim. See maxNR.
hessian
logical, whether to display Hessian matrix.
unsucc.step
logical, whether to describe last unsuccesful step if code == 3
...
currently not used.

Value

  • Object of class summary.maxim, intended to print with corresponding print method. There are following components:
  • typetype of maximisation.
  • iterationsnumber of iterations.
  • codeexit code (see maxNR.)
  • messagea brief message, explaining code.
  • unsucc.stepdescription of last unsuccessful step, only if requested and code == 3
  • maximumfunction value at maximum
  • estimatematrix with following columns:
    • results:
    {coefficient estimates at maximum} gradient:{estimated gradient at maximum}

item

hessian

See Also

maxNR

Examples

Run this code
## minimize a 2D quadratic function:
f <- function(b) {
  x <- b[1]; y <- b[2];
    val <- (x - 2)^2 + (y - 3)^2
    attr(val, "gradient") <- c(2*x - 4, 2*y - 6)
    attr(val, "hessian") <- matrix(c(2, 0, 0, 2), 2, 2)
    val
}
## Note that NR finds the minimum of a quadratic function with a single
## iteration.  Use c(0,0) as initial value.  
result1 <- maxNR( f, start = c(0,0) ) 
summary( result1 )
## Now use c(1000000, -777777) as initial value and ask for hessian
result2 <- maxNR( f, start = c( 1000000, -777777)) 
summary( result2 )

Run the code above in your browser using DataLab