optim_tidiers {broom} | R Documentation |
Tidies objects returned by the optim
function for
general-purpose minimization and maximization.
tidy_optim(x, ...) glance_optim(x, ...)
x |
list returned from |
... |
extra arguments |
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 |
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 |
gradient.count |
number of calls to |
convergence |
convergence code representing the error state |
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)