R: Tidiers for lists returned from optim

optim_tidiers {broom} | R Documentation

## Tidiers for lists returned from optim

### Description

Tidies objects returned by the `optim` function for general-purpose minimization and maximization.

### Usage

    tidy_optim(x, ...)

    glance_optim(x, ...)

### Arguments

`x` | list returned from `optim`
`...` | extra arguments

### Value

All tidying methods return a data.frame without rownames, whose structure depends on the method chosen.

`tidy` returns a data frame with one row per parameter that was estimated, with columns

`parameter` | name of the parameter, or `parameter1`, `parameter2`... if the input vector is not named
`value` | parameter value that minimizes or maximizes the output

`glance` returns a one-row data frame with the columns

`value` | minimized or maximized output value
`function.count` | number of calls to `fn`
`gradient.count` | number of calls to `gr`
`convergence` | convergence code representing the error state

### See Also

`optim`

### Examples

    func <- function(x) {
        (x[1] - 2)^2 + (x[2] - 3)^2 + (x[3] - 8)^2
    }

    o <- optim(c(1, 1, 1), func)

    tidy(o)
    glance(o)

[Package broom version 0.4.2 Index]