Learn R Programming

Numerical Methods and Optimisation in Finance

Functions, examples and data from the first and the second edition of "Numerical Methods and Optimization in Finance" by M. Gilli, D. Maringer and E. Schumann (2019, ISBN:978-0128150658). The package provides implementations of optimisation heuristics (Differential Evolution, Genetic Algorithms, Particle Swarm Optimisation, Simulated Annealing and Threshold Accepting), and other optimisation tools, such as grid search and greedy search. There are also functions for the valuation of financial instruments, such as bonds and options, and functions that help with stochastic simulations.

Installing the package

The latest build of the package is always available from https://enricoschumann.net/R/packages/NMOF/. A stable version is available from CRAN.

To install the package from within an R session, type:

install.packages('NMOF')  ## CRAN version
install.packages('NMOF',  ## development version
                 repos = c('https://enricoschumann.net/R',
                           getOption('repos')))

News, feedback and discussion

New package releases and other news related to the book or the package are announced on the NMOF-news mailing list.

An RSS feed of the package NEWS file is also available.

Applications, as long as they are finance-related, should be discussed on the R-SIG-Finance mailing list.

Please send bug reports or suggestions directly to the package maintainer, for instance by using =bug.report=.

library("utils")
bug.report("[NMOF] Unexpected behaviour in function XXX",
           maintainer("NMOF"), package = "NMOF")

References

Manfred Gilli, Dietmar Maringer and Enrico Schumann. Numerical Methods and Optimization in Finance. Academic Press, 2019.

Copy Link

Version

Install

install.packages('NMOF')

Monthly Downloads

1,590

Version

2.10-0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Enrico Schumann

Last Published

October 20th, 2024

Functions in NMOF (2.10-0)

EuropeanCall

Computing Prices of European Calls with a Binomial Tree
CPPI

Constant-Proportion Portfolio Insurance
NMOF-internal

Internal NMOF functions
LS.info

Local-Search Information
GAopt

Optimisation with a Genetic Algorithm
NMOF-package

Numerical Methods and Optimization in Finance
TA.info

Threshold-Accepting Information
Shiller

Download Robert Shiller's Data
French

Download Datasets from Kenneth French's Data Library
LSopt

Stochastic Local Search
NSf

Factor Loadings for Nelson--Siegel and Nelson--Siegel--Svensson
NS

Zero Rates for Nelson--Siegel--Svensson Model
DEopt

Optimisation with Differential Evolution
MA

Simple Moving Average
approxBondReturn

Approximate Total Return of Bond
SA.info

Simulated-Annealing Information
bundData

German Government Bond Data
TAopt

Optimisation with Threshold Accepting
Ritter

Download Jay Ritter's IPO Data
vanillaBond

Pricing Plain-Vanilla Bonds
minCVaR

Minimum Conditional-Value-at-Risk (CVaR) Portfolios
bracketing

Zero-Bracketing
PSopt

Particle Swarm Optimisation
drawdown

Drawdown
divRatio

Diversification Ratio
mvFrontier

Computing Mean--Variance Efficient Portfolios
SAopt

Optimisation with Simulated Annealing
bundFuture

Theoretical Valuation of Euro Bund Future
mc

Option Pricing via Monte-Carlo Simulation
callMerton

Price of a European Call under Merton's Jump--Diffusion Model
maxSharpe

Maximum-Sharpe-Ratio/Tangency Portfolio
callCF

Price a Plain-Vanilla Call with the Characteristic Function
optionData

Option Data
gridSearch

Grid Search
vanillaOptionEuropean

Pricing Plain-Vanilla (European and American) and Barrier Options (European)
callHestoncf

Price of a European Call under the Heston Model
minMAD

Compute Minimum Mean--Absolute-Deviation Portfolios
greedySearch

Greedy Search
colSubset

Full-rank Column Subset
fundData

Mutual Fund Returns
minvar

Minimum-Variance Portfolios
qTable

Prepare LaTeX Table with Quartile Plots
resampleC

Resample with Specified Rank Correlation
restartOpt

Restart an Optimisation Algorithm
putCallParity

Put-Call Parity
xtContractValue

Contract Value of Australian Government Bond Future
repairMatrix

Repair an Indefinite Correlation Matrix
randomReturns

Create a Random Returns
testFunctions

Classical Test Functions for Unconstrained Optimisation
trackingPortfolio

Compute a Tracking Portfolio
showExample

Display Code Examples
xwGauss

Integration of Gauss-type
pm

Partial Moments