Title: | Test for Monotonicity in Expected Asset Returns, Sorted by Portfolios |
---|---|
Description: | Test for monotonicity in financial variables sorted by portfolios. It is conventional practice in empirical research to form portfolios of assets ranked by a certain sort variable. A t-test is then used to consider the mean return spread between the portfolios with the highest and lowest values of the sort variable. Yet comparing only the average returns on the top and bottom portfolios does not provide a sufficient way to test for a monotonic relation between expected returns and the sort variable. This package provides nonparametric tests for the full set of monotonic patterns by Patton, A. and Timmermann, A. (2010) <doi:10.1016/j.jfineco.2010.06.006> and compares the proposed results with extant alternatives such as t-tests, Bonferroni bounds, and multivariate inequality tests through empirical applications and simulations. |
Authors: | Siegfried Köstlmeier [aut, cre, trl] |
Maintainer: | Siegfried Köstlmeier <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 1.3.1 |
Built: | 2024-11-25 03:37:58 UTC |
Source: | https://github.com/skoestlmeier/monotonicity |
demo_returns
is a sample of asset returns from July 1963 to December 2001 of all stocks listed on the NYSE and is computed as follows: at the begiinig of each month, tocks are sorted into deciles using estimates of beta based on the past year of daily returns, and value-weighted portfolios are formed. two tests from Wolak (1989, JoE) of inequality constraints in linear econometric models.
data(demo_returns)
data(demo_returns)
Patton, A. and Timmermann, A. (2010): Monotonicity in asset returns: New testes with applications to the term structure, the CAPM, and portfolio sorts. Journal of Financial Economics, 98, No. 3, p. 605–625. doi:10.1016/j.jfineco.2010.06.006.
Ang, A., Chen, J. and Xing, Y. (2006): Downside Risk. Review of Financial Studies, 19, No. 4, p. 1191–1239. doi:10.1093/rfs/hhj035.
## load demo data data(demo_returns) ## calculate the mean difference return between the top and bottom portfolio mean(demo_returns[, ncol(demo_returns)] - demo_returns[, 1])
## load demo data data(demo_returns) ## calculate the mean difference return between the top and bottom portfolio mean(demo_returns[, ncol(demo_returns)] - demo_returns[, 1])
monoBonferroni
implements the test of weak monotonicity using Bonferroni bounds described in Patton & Timmermann (2010, JFE):
Test 1:
vs.
Test 2:
vs.
monoBonferroni(data, difference = FALSE)
monoBonferroni(data, difference = FALSE)
data |
an object of class |
difference |
An object of class |
monoBonferroni
returns an object of class
"list"
The returning list contains p-values (see Note) using Bonferroni-bounds for the two statistical tests described above:
TestOnePvalBonferroni: |
p-value for |
TestTwoPvalBonferroni: |
p-value for |
The "Bonferroni p-values" are in the sense that we reject the null hypothesis if
they are less than the size of the test. NOTE of course that unlike usual
p-valuess these won't be uniformly distributed between and
under the null hypothesis. In fact, they do not even
have to lie in [0,1] - they could be lesser than 0 or greater than 1. In such a case,
monoBonferroni
returns min(pvalBonferroni, 1)
if and
max(pvalBonferroni, 0)
if .
Patton, A. and Timmermann, A. (2010): Monotonicity in asset returns: New testes with applications to the term structure, the CAPM, and portfolio sorts. Journal of Financial Economics, 98, No. 3, p. 605–625. doi:10.1016/j.jfineco.2010.06.006.
Bonferroni, Carlo E. (1936): Teoria statistica delle classi e calcolo delle probabillita. [Statistical Class Theory and Calculation of Probability]Pubbl. d. R. Ist. Super. di Sci. Econom. e Commerciali di Firenze, 8, p. 1–62.
## load non-difference return data and calculate the p-value for H0* of Test 1. data(demo_returns) tmp <- monoBonferroni(demo_returns, difference = FALSE) tmp$TestOnePvalBonferroni
## load non-difference return data and calculate the p-value for H0* of Test 1. data(demo_returns) tmp <- monoBonferroni(demo_returns, difference = FALSE) tmp$TestOnePvalBonferroni
monoRelation
implements the 'monotonic relationship' tests from Patton & Timmermann (2010, JFE). We define and test
vs.
monoRelation(data, bootstrapRep = 1000, increasing = TRUE, difference = FALSE, block_length)
monoRelation(data, bootstrapRep = 1000, increasing = TRUE, difference = FALSE, block_length)
data |
an object of class |
bootstrapRep |
A numeric scalar: the number of used bootstrap samples. |
increasing |
An object of class |
difference |
An object of class |
block_length |
A numeric scalar: The average length of the block to usefor the stationary bootstrap. This parameter is related to how much serial correlation is in your data. Use 10/6/3/2 as the block length if data is measured in daily/monthly/quarterly/annual returns. |
monoRelation
returns an object of class
"matrix"
.
The returning matrix consists of the following components:
matrix |
a 4x2 matrix. The values of the first column are non-studentised, the values of the second column are studentised.
Row (1): the t-statistic associated with a t-test that |
Patton, A. and Timmermann, A. (2010): Monotonicity in asset returns: New testes with applications to the term structure, the CAPM, and portfolio sorts. Journal of Financial Economics, 98, No. 3, p. 605–625. doi:10.1016/j.jfineco.2010.06.006.
## load non-difference return data and apply test with daily returns. data(demo_returns) monoRelation(demo_returns, block_length = 10)
## load non-difference return data and apply test with daily returns. data(demo_returns) monoRelation(demo_returns, block_length = 10)
monoSummary
implements the test for monotonicity in asset returns, based on portfolio sorts in (JoE, 2010)
monoSummary(data, bootstrapRep = 1000, wolakRep = 100, increasing = TRUE, difference = FALSE, plot = FALSE, block_length, zero_treshold = 1e-6)
monoSummary(data, bootstrapRep = 1000, wolakRep = 100, increasing = TRUE, difference = FALSE, plot = FALSE, block_length, zero_treshold = 1e-6)
data |
an object of class |
bootstrapRep |
A numeric scalar: the number of bootstrap samples. |
wolakRep |
A numeric scalar, stating the number of simulations to use to estimate the weight function in the weighted-sum of chi-square variables. |
increasing |
An object of class |
difference |
An object of class |
plot |
An object of class |
block_length |
A numeric scalar: The average length of the block to usefor the stationary bootstrap. This parameter is related to how much serial correlation is in your data. Use 10/6/3/2 as the block length if data is measured in daily/monthly/quarterly/annual returns. |
zero_treshold |
A numeric scalar, being the treshold for comparing solution values of a non-linear optimization in the Wolak (1989, JoE) test against zero. See section DETAILS for further information. |
Internally, a non-linear optimization using "constrOptim"
is used for the Monte-Carlo simulation within the Wolak (1989, JoE) test. The resulting values of the solution are close to zero, but due to the used machine precision numerically differnt from zero. For this reason, we suggest a treshold value close to zero. The default value is , so all resulting solutions smaller than the treshold value are treated as being zero. The default treshold value is consistent with the data-set and results of Patton and Timmermann (JoE, 2010). Of course, the appropriate treshold value can differ across applications (e.g. run the code on one set of data, and then the same data/100).
monoSummary
returns an object of class
"data.frame"
.
The returning value of "monoSummary"
is a "data.frame"
containing the
following components:
TopMinusBottom |
Mean difference return between top and bottom portfolio. |
t_stat |
the residuals, that is response minus fitted values. |
t_pval |
the fitted mean values. |
MR_pval |
the numeric rank of the fitted linear model. |
MRall_pval |
the numeric rank of the fitted linear model. |
UP_pval |
studentized p-value from Patton and Timmermanns (JoE, 2010) "Up and Down" test for assumed increasing monotonicity pattern and using absolute difference returns. |
DOWN_pval |
studentized p-value from Patton and Timmermanns (JoE, 2010) "Up and Down" test for assumed decreasing monotonicity pattern and using absolute difference returns. |
Wolak_pval |
p-value "TestOnePvalueWolak" for |
Bonferroni_pval |
p-value for |
Patton, A. and Timmermann, A. (2010): Monotonicity in asset returns: New testes with applications to the term structure, the CAPM, and portfolio sorts. Journal of Financial Economics, 98, No. 3, p. 605–625. doi:10.1016/j.jfineco.2010.06.006.
Wolak, Frank A. (1989): Testing Inequality Constraints in Linear Econometric Models. Journal of Econometrics, 41, p. 205–235. doi:10.1016/0304-4076(89)90094-8.
monoRelation
,
monoUpDown
,
wolak
.
## load daily non-difference return data. ## test an increasing pattern of monotonicity data(demo_returns) monoSummary(demo_returns, increasing = TRUE, block_length = 10)
## load daily non-difference return data. ## test an increasing pattern of monotonicity data(demo_returns) monoSummary(demo_returns, increasing = TRUE, block_length = 10)
monoUpDown
implements the 'Up and Down' tests from Patton & Timmermann (2010, JFE) based on:
(1) sum of squared differences for positive diffs and negative diffs, (2) sum of absolute differences for positive diffs and negative diffs,
and uses the stationary bootstrap method from Politis & Romano (1994, JASA).
monoUpDown(data, difference = FALSE, bootstrapRep = 1000, block_length)
monoUpDown(data, difference = FALSE, bootstrapRep = 1000, block_length)
data |
an object of class |
difference |
An object of class |
bootstrapRep |
A numeric scalar: the number of bootstrap samples. |
block_length |
A numeric scalar: The average length of the block to usefor the stationary bootstrap. This parameter is related to how much serial correlation is in your data. Use 10/6/3/2 as the block length if data is measured in daily/monthly/quarterly/annual returns. |
monoUpDown
returns an object of class
"matrix"
:
"matrix": |
A named 4x2 matrix with the bootstrap p-values from a test for a monotonic relationship. The first row contains p-values for squared diffs in an assumed increasing monotonic pattern, the second row respectively for a decreasing pattern. The third row contains p-values for absolute differences in an assumed increasing monotonic pattern, the fourth row respectively for a decreasing pattern. The first column gives p-values which are not studentised, the second column the equivalent studentised p-values. |
Patton, A. and Timmermann, A. (2010): Monotonicity in asset returns: New testes with applications to the term structure, the CAPM, and portfolio sorts. Journal of Financial Economics, 98, No. 3, p. 605–625. doi:10.1016/j.jfineco.2010.06.006.
Wolak, Frank A. (1989): Testing Inequality Constraints in Linear Econometric Models. Journal of Econometrics, 41, p. 205–235. doi:10.1016/0304-4076(89)90094-8.
## load demo data and apply monoUpDown with daily data, which are not yet in differences data(demo_returns) test <- monoUpDown(demo_returns,block_length = 10)
## load demo data and apply monoUpDown with daily data, which are not yet in differences data(demo_returns) test <- monoUpDown(demo_returns,block_length = 10)
statBootstrap
implements the stationary bootstrap method from Politis & Romano (1994, JASA). This function generates bootstrap samples of the matrix data and returns the time indices for each sample.
statBootstrap(T, bootstrapRep = 1000, block_length)
statBootstrap(T, bootstrapRep = 1000, block_length)
T |
A scalar, the number of time series observations to generate. |
bootstrapRep |
A numeric scalar: the number of used bootstrap samples. |
block_length |
A numeric scalar: The average length of the block to usefor the stationary bootstrap. This parameter is related to how much serial correlation is in your data. Use 10/6/3/2 as the block length if data is measured in daily/monthly/quarterly/annual returns. |
statBootstrap
returns an object of class
"matrix"
:
"matrix": |
A "T x bootstrapRep" matrix of time indices for each bootstrap sample. |
Politis, Dimitris N. & Romano, Joseph P. (1994): The Stationary Bootstrap. Journal of The American Statistical Association, 89, No. 428, p. 1303–1313. doi:10.1080/01621459.1994.10476870.
## Assuming daily return data for 100 time series observations. ## The returning matrix for default settings contains 1,000 bootstrap samples. bootstrap_sample <- statBootstrap(T = 100, block_length = 10) ## 200 bootstrap samples using monthly return data with 250 time series observations. bootstrap_sample <- statBootstrap(T = 250, bootstrapRep = 200, block_length = 6)
## Assuming daily return data for 100 time series observations. ## The returning matrix for default settings contains 1,000 bootstrap samples. bootstrap_sample <- statBootstrap(T = 100, block_length = 10) ## 200 bootstrap samples using monthly return data with 250 time series observations. bootstrap_sample <- statBootstrap(T = 250, bootstrapRep = 200, block_length = 6)
wolak
implements two tests from Wolak (1989, JoE) of inequality constraints in linear econometric models.
Test 1:
vs.
Test 2:
vs.
wolak(data, increasing = TRUE, difference = FALSE, wolakRep = 100, zero_treshold = 1e-6)
wolak(data, increasing = TRUE, difference = FALSE, wolakRep = 100, zero_treshold = 1e-6)
data |
an object of class |
increasing |
An object of class |
difference |
An object of class |
wolakRep |
A numeric scalar, stating the number of simulations to use to estimate the weight function in the weighted-sum of chi-square variables. |
zero_treshold |
A numeric scalar, being the treshold for comparing solution values of a non-linear optimization against zero. See section DETAILS for further information. |
Currently supported as input type of data
are classes "matrix"
,
"data.frame"
, ts
, xts
and zoo
.
Using demo data shows for wolakRep
, that results do not change much at all for 100 or 1000 simulations, but the running time dramatically increases with the number of simulations. However, for robust results a minimum of 100 runs is highly recommended.
Internally, a non-linear optimization using "constrOptim"
is used for the Monte-Carlo simulation. The resulting values of the solution are close to zero, but due to the used machine precision numerically differnt from zero. For this reason, we suggest a treshold value close to zero. The default value is , so all resulting solutions smaller than the treshold value are treated as being zero. The default treshold value is consistent with the data-set and results of Patton and Timmermann (JoE, 2010). Of course, the appropriate treshold value can differ across applications (e.g. run the code on one set of data, and then the same data/100).
The HAC estimator of the covariance matrix of follows the adjustment of Newey-West (1987, 1994).
The kernel used is "Bartlett". See NeweyWest
for further information.
wolak
returns an object of class
"list"
.
The returning list contains p-values for the following components:
TestOnePvalueWolak: |
p-value for |
TestTwoPvalueWolak: |
p-value for |
Wolak, Frank A. (1989): Testing Inequality Constraints in Linear Econometric Models. Journal of Econometrics, 41, p. 205–235. doi:10.1016/0304-4076(89)90094-8.
## load demo data and apply Wolak tests data(demo_returns) tmp <- wolak(demo_returns) tmp$TestOnePvalueWolak ## transform existing data (asset returns) into difference returns before applying wolak() ## as data is finally in difference returns, appy wolak() with difference = TRUE data <- demo_returns[, 2:ncol(demo_returns)] - (demo_returns[, 1:(ncol(demo_returns) - 1)]) wolak(data, difference = TRUE)
## load demo data and apply Wolak tests data(demo_returns) tmp <- wolak(demo_returns) tmp$TestOnePvalueWolak ## transform existing data (asset returns) into difference returns before applying wolak() ## as data is finally in difference returns, appy wolak() with difference = TRUE data <- demo_returns[, 2:ncol(demo_returns)] - (demo_returns[, 1:(ncol(demo_returns) - 1)]) wolak(data, difference = TRUE)