CRAN_Status_Badge Project Status: Active – The project has reached a stable, usable state and is being actively developed. Travis-CI Build Status Build status codecov Total Downloads License

monotonicity is an R package providing several monotonicity tests for asset returns based on portfolio sorts. Its first version is mainly based on the paper Monotonicity in asset returns: New testes with applications to the term structure, the CAPM, and portfolio sorts by Andrew Patton and Allan Timmermann. Please see Andrew Pattons Matlab code page Nr. 8 for the original Matlab code or his Exec&Share profile providing an online executable version of monotonicity tests.

Key Features

Functions for monotonicity tests on asset returns based on portfolio sorts:


# The easiest way to install monotonicity is to download via CRAN

# Alternatively, you can install the development version from GitHub
# install.packages("devtools")


The monotonicity tests provided by this package are mostly based on simulated bootstrap samples. The results may therefore slightly differ for repeated tests.

For an estimation of the variation of the results, we exemplarily run the MR (Monotonic Relationship) Test provided by the function monoRelation 1,000 times with identical input data. We observed the following results for the mean studentised p-value, using the provided R package and in comparison Andrew Pattons original Matlab code:

| Software | Mean | Minimum | Maximum | Standard Deviation | --- | --- | --- | --- | ---| | Matlab | 0.032 | 0.014 | 0.047 | 0.0057 | R | 0.031 | 0.018 | 0.048 | 0.0064

In fact, the observed variation seems to be acceptable and should not affect any decision based on the returning p-value, when using the recommended number of 1,000 bootstrap replications.


Constributions in form of feedback, comments, code, bug reports or pull requests are most welcome. How to contribute:

Please read the contribution guidelines on how to contribute to this R-package.

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

skoestlmeier/monotonicity documentation built on Dec. 11, 2019, 7:14 a.m.