BookmarkSubscribeRSS Feed
iank131
Quartz | Level 8

Proc Univariate provides three tests of location: t, signed, and ranked sign. These test results are provided if your analysis variable is equally weighted, i.e. when no WEIGHT option is used.

However, when the  WEIGHT option is used, the results for sign and ranked sign tests are not provided, while only those of the t test are. I can understand why they are not provided for the sign test, because the results should in principle be the same as when no weight option is used. But I would like to get the ranked sign results of a weighted analysis variable. Does any body know how to do this in a SAS with an in-built procedure?

FYI, my analysis variable is excess bond returns (difference between actual bond return and an index return) , so the interval to calculate the ranks is well defined. However, I want to calculate the value of a portfolio of excess returns (for an event study) on each trading day. I want to weight the excess returns of each bond issue in the portfolio according to market value. In other words, the excess return ranking will be based not only size of the excess return, but also on the weight of the issue.

I provide a sample data set. The main analysis variable is abret11 (excess or abnormal returns of bonds). The weight variable is pfmv_bdo. The by variables are bindx_cat evttime. Using proc univariate and assuming equally weighted excess returns, the code I would use is:

proc univariate data=sample100 ;

  by bindx_cat evttime; var abret11;

  ods output testsforlocation = test1;   /* This contains the p-values */

  ods output moments = test1a;         /* This contains the descriptive data */

  run;

What I would like to do, if it were possible, is add the option: WEIGHT pfmv_bdo; and also get results for the Ranked Sign test. The question is HOW???

Thanks for any help provided.

Ian.

6 REPLIES 6
SteveDenham
Jade | Level 19

This looks like a "roll your own" situation.  Rosner et al (2011) http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3119759/ gives formulae for the variance using cluster sizes as weights,  The approach is non-trivial.  You might be able to check on R packages, of which it looks like there may be one or two.

Steve Denham

iank131
Quartz | Level 8

Thank you Steve for your reply. I looked at the web site you suggested, but I think it is more complicated than what I am trying to achieve.

I was thinking about doing the following and I would like to know what you think. My bond return data is not normally distributed. I need to use a non-parametric test, such as Wilcoxon Ranked Sign. I want to know if my portfolio of bonds has an excess return statistically different to zero on each trading day. However, the bond portfolio is market value weighted, so not all excess returns are equally valued, which is what proc univariate for the ranked sign test assumes. What I am thinking of doing is: multiply my excess returns (analysis variable) by the market values of the bonds (my weights, where sum of weights = 1) and then use proc univariate with the weighted excess returns. This means the calculated ranks of weighted excess returns will change based not only on the interval differences (as they do with the equally weighted excess return) but also on the weights. This means, for example, an originally highly ranked excess return with low weight will be more lowly ranked, while a lowly ranked excess return with heavy weight will be more highly ranked. The rankings now reflect the portfolio weights.

Does this strategy make sense to you if all I want to know is if my portfolio of bonds has an excess return statistically different to zero?

Thanks very much! I appreciate your help.

Ian.

SteveDenham
Jade | Level 19

Ian,

This seems to make sense to me.  I just erased a long discussion on a different weighting scheme but came to the conclusion that so long as the scheme was monotonic, it wouldn't make any difference since the interest is on the ranked values.

Steve Denham

iank131
Quartz | Level 8

Steve

I really appreciate your help!

Ian.

1zmm
Quartz | Level 8

If you create the signed ranks by yourself, and if you then run these signed ranks through PROC SURVEYMEANS, then you can obtain a weighted signed rank test and its significance probability (using the t-test comparison to a mean of zero).  The significance probability of the t-test for such created signed ranks equals the significance probability of the signed rank test for these signed ranks as well as the significance test for the signed rank test on the original values.

To create signed ranks from the original values,

  1. use the ABS(x) function in a DATA step to create the absolute values of the original values;

  2. use the SIGN(x) function in a DATA step to extract the signs of the original values;

  3. use PROC RANK to rank the absolute values of the original values; and

  4. use a DATA step to create signed ranks by multiplying the signs of the original values times the ranks of the absolute values

        of  the original values.

Then use these signed ranks and the weights for each value in PROC SURVEYMEANS.

iank131
Quartz | Level 8

1zmm, thanks for the suggestion. I'll try it over the next few days and get back to you.

Ian.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 3150 views
  • 5 likes
  • 3 in conversation