Learn R Programming

monotonicity (version 1.3.1)

wolak: Testing inequality constraints in linear econometric models

Description

wolak implements two tests from Wolak (1989, JoE) of inequality constraints in linear econometric models.

Test 1: \(H0*: d1 >= 0, d2 >= 0, ..., dK >= 0\) vs. \(H1*: (d1, d2, ..., dK) in R^K, (ie: general alternative)\)

Test 2: \(H0**: d1 = d2 = ... = dK = 0\) vs. \(H1**: d1 > 0, d2 > 0, ..., dK > 0.\)

Usage

wolak(data, increasing = TRUE, difference = FALSE, wolakRep = 100, zero_treshold = 1e-6)

Arguments

data

an object of class "matrix" (or one that can be coerced to that class): asset returns or differences in asset returns for the sorting application.

increasing

An object of class "logical": Assume an increasing or a decreasing pattern in monotonicity for the sorted portfolios. If a decreasing pattern is assumed, then \(H0*\) of Test 1 changes to \(H0*: d1 <= 0, d2 <= 0, ..., dK <= 0\) and respectively \(H1**\) of Test 2 changes to \(H1**: d1 < 0, d2 < 0, ..., dK < 0.\)

difference

An object of class "logical": If data is already differences in asset returns, use TRUE. Otherwise data will be transformed to difference returns \(r_p(n+1) - r_p(n)\) between portfolio \(n+1 \) and portfolio \(n\)

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.

Value

wolak returns an object of class "list".

The returning list contains p-values for the following components:

TestOnePvalueWolak:

p-value for \(H0*\) of Test 1.

TestTwoPvalueWolak:

p-value for \(H0**\) of Test 2.

Details

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 \(1e-6\), 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.

References

Wolak, Frank A. (1989): Testing Inequality Constraints in Linear Econometric Models. Journal of Econometrics, 41, p. 205--235. 10.1016/0304-4076(89)90094-8.

Examples

Run this code
# NOT RUN {
## load demo data and apply Wolak tests
# }
# NOT RUN {
data(demo_returns)
tmp <- wolak(demo_returns)
tmp$TestOnePvalueWolak
# }
# NOT RUN {
## transform existing data (asset returns) into difference returns before applying wolak()
## as data is finally in difference returns, appy wolak() with difference = TRUE

# }
# NOT RUN {
data <- demo_returns[, 2:ncol(demo_returns)] - (demo_returns[, 1:(ncol(demo_returns) - 1)])
wolak(data, difference = TRUE)
# }

Run the code above in your browser using DataLab