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.
Functions for monotonicity tests on asset returns based on portfolio sorts:
# The easiest way to install monotonicity is to download via CRAN install.packages("monotonicity") # Alternatively, you can install the development version from GitHub # install.packages("devtools") devtools::install_github("skoestlmeier/monotonicity")
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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.