File: coef.opm.Rd

package info (click to toggle)
r-cran-optimx 2020-4.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,492 kB
  • sloc: sh: 21; makefile: 5
file content (52 lines) | stat: -rw-r--r-- 1,359 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\name{coef}
\alias{coef<-}
\alias{coef.opm}
\alias{coef<-.opm}
\alias{coef.optimx}
\alias{coef<-.optimx}
\encoding{UTF-8}
\title{Summarize opm object}
\concept{minimization}
\concept{maximization}
\description{
  Summarize an \code{"opm"} object.
}
\usage{
  \method{coef}{opm}(object, ...) 
  \method{coef}{opm}(x) <- value 
}
\arguments{
 \item{object}{Object returned by \code{opm}.}
 \item{\dots}{Further arguments to be passed to the function. Currently not
   used.}
 \item{x}{An \code{opm} object.}
 \item{value}{Set parameters equal to this value.}
}
\value{
  \code{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))


\dontrun{
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)
}

}
\keyword{nonlinear}
\keyword{optimize}