nlmax: Nonlinear maximization and minimization

Description Usage Arguments Examples

Description

nlmin and nlmax are thin wrappers around nlm, a non-linear minimizer. nlmax avoids the necessity of modifying the function to construct a minimization problem from a problem that is naturally a maximization problem. The summary method for the resulting objects provides output that is easier for humnans to read.

Usage

1
2
3
4
5
6
7
8
9
nlmax(f, ...)

nlmin(f, ...)

## S3 method for class 'nlmax'
summary(object, nsmall = 4, ...)

## S3 method for class 'nlmin'
summary(object, nsmall = 4, ...)

Arguments

f

a function to optimize

...

additional arguments passed to nlm. Note that p is a required argument for nlm. See the help for nlm for details.

object

an object returned from nlmin or nlmax

nsmall

a numeric passed through to format

Examples

1
summary( nlmax( function(x) 5 - 3*x - 5*x^2, p=0 ) )

Example output

Loading required package: mosaic
Loading required package: dplyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Loading required package: lattice
Loading required package: ggformula
Loading required package: ggplot2
Loading required package: ggstance

Attaching package: 'ggstance'

The following objects are masked from 'package:ggplot2':

    GeomErrorbarh, geom_errorbarh


New to ggformula?  Try the tutorials: 
	learnr::run_tutorial("introduction", package = "ggformula")
	learnr::run_tutorial("refining", package = "ggformula")
Loading required package: mosaicData
Loading required package: Matrix

The 'mosaic' package masks several functions from core packages in order to add 
additional features.  The original behavior of these functions should not be affected by this.

Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.

Attaching package: 'mosaic'

The following object is masked from 'package:Matrix':

    mean

The following object is masked from 'package:ggplot2':

    stat

The following objects are masked from 'package:dplyr':

    count, do, tally

The following objects are masked from 'package:stats':

    IQR, binom.test, cor, cor.test, cov, fivenum, median, prop.test,
    quantile, sd, t.test, var

The following objects are masked from 'package:base':

    max, mean, min, prod, range, sample, sum

Loading required package: mosaicCalc
Loading required package: mosaicCore

Attaching package: 'mosaicCore'

The following objects are masked from 'package:dplyr':

    count, tally


Attaching package: 'mosaicCalc'

The following object is masked from 'package:stats':

    D


Attaching package: 'fastR'

The following object is masked from 'package:graphics':

    panel.smooth


       Maximum: 5.4500
      Estimate:-0.3000005
      Gradient:-8.881784e-10
    Iterations: 1

Relative gradient is close to zero, current iterate is probably an
approximate solution.[Code=1] 

fastR documentation built on May 1, 2019, 11:18 p.m.