exactSdMtx {generalCorr} | R Documentation |
Exact stochastic dominance computation from areas above ECDF pillars.
Description
ECDF=empirical cumulative distribution functions. These are sufficient statistics representing probability density functions defined by observable finite data (e.g., stock returns). The exact computation of stochastic dominance orders SD1 to SD4 needs areas between two ECDFs, since such areas represent integrals. Higher-order SDs with continuous variables involve repeated integrals. Our quantification needs areas of ECDFs defined from areas of lower-order ECDFs. We argue that these computations are convenient if there is an ECDF of an imaginary reference minimum (x.ref) return, whose ECDF is a rectangle common for all stock comparisons. A common (x.ref) avoids having to compute all possible pairs of p stocks. Choosing a common reference as SP500 index stock cannot avoid a slower trapezoidal approximation for integrals, since its returns vary over time. We want exact areas of rectangles and fast.
Usage
exactSdMtx(mtx, howManySd = 0.1)
Arguments
mtx |
(n X p) matrix of data. For example, returns on p stocks over n months |
howManySd |
used to define (x.ref)= lowest return number. If the grand minimum of all returns in ‘mtx’ is denoted GrMin, then howManySd equals the number of max(sd) (maximum standard deviation for data columns) below the GrMin used to define (x.ref). Thus, (x.ref)=GrMin-howManySd*max(sd). default howManySd=0.1 |
Details
The exactSdMtx
function inputs ‘mtx’ (n X p) matrix data
(e.g., n monthly returns on p stocks).
Its output has four matrices SD1 to SD4, each with dimension (n X p). They measure
exact dominance areas between empirical CDF for each column to the ECDF of
(x.ref), an artificial stock with minimal return in all time periods. A fifth
output matrix called ‘out’ produced by exactSdMtx
has 4 rows and p columns containing column sums of SD1 to SD4.
We intend that this
‘out’ matrix produced by exactSdMtx
is then input to another
function summaryRank()
in the package designed for practitioners.
For example, it indicates the best and the worst columns
representing (the best stock to buy and best stock to sell)
from the input data ‘mtx’ for investment based on a sophisticated computation
of their ranks.
Value
five matrices. SD1 to SD4 contain four orders of stochastic dominance areas using the ECDF pillars and a common (x.ref). The fifth "out" matrix is another output with 4 rows for SD1 to SD4, and p columns (p=No. of columns in data matrix mtx) having a summary of ranks using all four, SD1 to SD4.
Author(s)
Prof. H. D. Vinod, Economics Dept., Fordham University, NY
Examples
x1=c(2,5,6,9,13,18,21)
x2=c(3,6,9,12,14,19,27)
st1=exactSdMtx(cbind(x1,x2))