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

coef.opm

Summarize opm object


Description

Summarize an "opm" object.

Usage

## S3 method for class 'opm'
coef(object, ...) 
  ## S3 replacement method for class 'opm'
coef(x) <- value

Arguments

object

Object returned by opm.

...

Further arguments to be passed to the function. Currently not used.

x

An opm object.

value

Set parameters equal to this value.

Value

coef.opm returns the best parameters found by each method that returned such parameters. The returned coefficients are in the form of a matrix with the rows named by the relevant methods and the columns named according to parameter names provided by the user in the vector of starting values, or else by "p1", "p2", ..., if names are not provided.

Examples

ans <- opm(fn = function(x) sum(x*x), par = 1:2, method="ALL", control=list(trace=0))
print(coef(ans))

ansx <- optimx(fn = function(x) sum(x*x), par = 1:2, control=list(all.methods=TRUE, trace=0))
print(coef(ansx))


## Not run: 
proj <- function(x) x/sum(x)
f <- function(x) -prod(proj(x))
ans <- opm(1:2, f)
print(ans)
coef(ans) <- apply(coef(ans), 1, proj)
print(ans)

## End(Not run)

optimx

Expanded Replacement and Extension of the 'optim' Function

v2020-4.2
GPL-2
Authors
John C Nash [aut, cre], Ravi Varadhan [aut], Gabor Grothendieck [ctb]
Initial release
2020-04-02

We don't support your browser anymore

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