Hello,
I have a dataset consisting of quarterly returns of a portfolio and of some market indexes over a period of time. I am trying to fit a regression model that looks like this:
portfolio returns = coef1 * index_returns1 + coef2 * index_returns2 + ... + intercept sum of coefficients should be 1 all coefficients should be positive or equal to 0
I tried to used the following piece of code, inspired from http://support.sas.com/kb/22/642.html:
proc model data=work.temp3; parameters a b c d e f g; bounds a>=0, b>=0, c>=0, d>=0, e>=0, f>=0; restrict a+b+c+d+e+f=1; qret=a*growth_WILLLRGCAPGR + b*growth_WILLLRGCAPVAL + c*growth_WILLMIDCAPGR + d*growth_WILLMIDCAPVAL + e*growth_WILLSMLCAPGR + f*growth_WILLSMLCAPVAL + g; fit qret; quit;
But the results are very very strange and they don't even respect the constraints. What would be the right approach?
I also uploaded the dataset if you need it.
Thanks!
@littlewho wrote:
Hello,
I have a dataset consisting of quarterly returns of a portfolio and of some market indexes over a period of time. I am trying to fit a regression model that looks like this:
portfolio returns = coef1 * index_returns1 + coef2 * index_returns2 + ... + intercept sum of coefficients should be 1 all coefficients should be positive or equal to 0I tried to used the following piece of code, inspired from http://support.sas.com/kb/22/642.html:
proc model data=work.temp3; parameters a b c d e f g; bounds a>=0, b>=0, c>=0, d>=0, e>=0, f>=0; restrict a+b+c+d+e+f=1; qret=a*growth_WILLLRGCAPGR + b*growth_WILLLRGCAPVAL + c*growth_WILLMIDCAPGR + d*growth_WILLMIDCAPVAL + e*growth_WILLSMLCAPGR + f*growth_WILLSMLCAPVAL + g; fit qret; quit;
But the results are very very strange and they don't even respect the constraints. What would be the right approach?
I also uploaded the dataset if you need it.
Thanks!
Note that the Bounds you set allow for a, b, c etc to be between 0 and 1 since the bound was >= 0.
And the values like 1.54E-33 are so small that for most calculations they are essentially 0. You might find that 1 for B was actually something like 0.999999999999 that is displayed in a format that forced rounding to 0. I suggest generating an output data set of the estimates and looking at the values with a wider format. And then use that data set to sum the value for a - f and see what SAS shows there.
I might also suggest looking at the range of values of your other variables. It may be that the range of values is such that your "model" is dominated by one or two variables. Do the diagnostics tell that a number of records were dropped? If one or more of your growth variables is missing from a portfolio it is very likely that record was not used in the model. So the remaining records may be "odd" from your perspective.
@Rick_SAS Wrote a blog about it . some PROC like proc reg/hpglm/genmod can do that.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.