comp_portfo2 | R Documentation |
Given two vectors of portfolio returns this function calls the internal function wtdpapb to report the simple means of four sophisticated measures of stochastic dominance. as explained in Vinod (2008).
comp_portfo2(xa, xb)
xa |
Data on returns for portfolio A in the form of a T by 1 vector |
xb |
Data on returns for portfolio B in the form of a T by 1 vector |
Returns four numbers which are averages of four sophisticated measures of stochastic dominance measurements called SD1 to SD4.
It is possible to modify this function to report the median or standard
deviation or any other descriptive statistic by changing the line in the
code 'oumean = apply(outb, 2, mean)
' toward the end of this function.
A trimmed mean may be of interest when outliers are suspected.
require(np)
Make sure that functions wtdpapb, bigfp, stochdom2 are in the memory. and options(np.messages=FALSE)
Prof. H. D. Vinod, Economics Dept., Fordham University, NY
Vinod, H. D.", "Hands-On Intermediate Econometrics Using R" (2008) World Scientific Publishers: Hackensack, NJ. (Chapter 4) https://www.worldscientific.com/worldscibooks/10.1142/12831
stochdom2
set.seed(30)
xa=sample(20:30)#generally lower returns
xb=sample(32:40)# higher returns in xb
gp = comp_portfo2(xa, xb)#all Av(sdi) positive means xb dominates
##positive SD1 to SD4 means xb dominates xa as it should
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.