<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Ridge regressions with weights (proc reg) in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/405097#M21121</link>
    <description>&lt;P&gt;Hello JB1983&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you get standard error or t value in the ridge regression output?&lt;/P&gt;&lt;P&gt;if yes then how?&amp;nbsp;&lt;/P&gt;&lt;P&gt;if no then how will you explain the significance of beta coefficients. Also what about model fit using f value, r square/adj r square.&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rajneesh Ranjan Jha&lt;/P&gt;</description>
    <pubDate>Wed, 18 Oct 2017 04:28:01 GMT</pubDate>
    <dc:creator>Rajneesh_Jha</dc:creator>
    <dc:date>2017-10-18T04:28:01Z</dc:date>
    <item>
      <title>Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397267#M20715</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to match output that SAS produces in weighted ridge regression by doing an optimization routine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I implemented in SAS:&lt;/P&gt;&lt;P&gt;proc reg data=dataset&lt;BR /&gt;outest=b outseb ridge = 0.5;&lt;BR /&gt;OurPick5: model varY = varX1 varX2 varX3;&lt;BR /&gt;weight var5;&lt;BR /&gt;run;&lt;BR /&gt;proc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In doing this in excel through an optimization routine, I am unable to get the output that SAS produces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have learnt the following that is also perplexing to me and would like a betterunderstanding:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. If my weights are constant and 1, I get the same adjusted coeffcieints in the ridge regression (after adjustment of multiplying with the inverse of the standard deviation of the Xs) as I do with a ridge regression with weights that are constant yet notEqualTo 1. I expect this in OLS but didnt expect this in ridge. Can someone explain why please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. When I have a sequence of the weights, whyadjustment do I need to apply to my excel/optimiaztion coefficients to recover the ridge and weighted coefficients that SAS produces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this makes sense, any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 21:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397267#M20715</guid>
      <dc:creator>jb1983</dc:creator>
      <dc:date>2017-09-19T21:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397479#M20724</link>
      <description>&lt;P&gt;As a rule of thumb, weighted regression uses the normal equations X`WX on the left and X`WY on the right. Thus you can get equivalent results by multiplying each observation by the square-root of the weight and using ordinary regression (in Excel, for example). &amp;nbsp;That is, define V = sqrt(W)*X and U = sqrt(W)*Y and perform an ordinary regression of U on V. &amp;nbsp;Notice that if you rescale the vector of weights by any constant, then the results are exactly the same. &amp;nbsp;Some textbooks assume that the weights are often standardized so that sum(W) = 1, which makes some formulas easier to&amp;nbsp;write.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So (1) the answers are the same because you are multiplying the weights by a constant.&lt;/P&gt;
&lt;P&gt;(1) the answers are the same because you are multiplying the weights by a constant.&lt;/P&gt;
&lt;P&gt;(2) I don't know what your Excel computations look like, but try multiplying the X's and Y's by sqrt of the weights. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 15:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397479#M20724</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-20T15:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397486#M20726</link>
      <description>&lt;P&gt;Thanks Rick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the results of SAS if I multiply the weights with the residuals &lt;STRONG&gt;but not&lt;/STRONG&gt; if I multiply the data with the weights (or their sqrt). I find this very puzzling... Im guessing there is some adjustment for the betas that I am missing to replicate what the results of SAS are?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, does SAS do some normalization if the weights dont sum up to one? Because in my case, the weights do not sum to one and I dont want them to (i.e. I dont want to use the reweight command)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 15:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397486#M20726</guid>
      <dc:creator>jb1983</dc:creator>
      <dc:date>2017-09-20T15:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397493#M20727</link>
      <description>&lt;P&gt;I suggest you post your SAS code and results so that we can see what you are talking about.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think that PROC REG explicitly standardizes the weight variable, but as I've indicated the parameter estimates are identical to what you get when the weights are standardized.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 15:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397493#M20727</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-20T15:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397540#M20729</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Here is the SAS code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------------------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc reg data=GlobalRegData
		outest=b outseb ridge = 0.5;
  OurPick5:	model InflationAdj_Log_Ch = InflationAdj_Log_Lag12 GdpRealYoY_Lag12 Yld10yr_Ch_Lag12 GdpRealYoY_Ch_Lag12 InflationAdj_Log_Ch_Lag12;
  weight SqrtGdpwgtNorm;
  where 195001&amp;lt;=Eom&amp;lt;=200512 and CountryID^=100;
run;
proc print data=b;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------&lt;/P&gt;&lt;P&gt;The output from SAS is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;TABLE border="0" cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;The SAS System&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV class="c proctitle"&gt;The REG Procedure&lt;/DIV&gt;&lt;DIV class="c proctitle"&gt;Model: OurPick5&lt;/DIV&gt;&lt;DIV class="c proctitle"&gt;Dependent Variable: InflationAdj_Log_Ch&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Number of Observations Read Number of Observations Used Number of Observations with Missing Values &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;12510&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7209&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5301&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="c proctitle"&gt;Weight: SqrtGdpwgtNorm&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV align="center"&gt;Analysis of Variance Source DF Sum of&lt;BR /&gt;Squares Mean&lt;BR /&gt;Square F Value Pr&amp;nbsp;&amp;gt;&amp;nbsp;F Model Error Corrected Total &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;8.14800&lt;/TD&gt;&lt;TD&gt;1.62960&lt;/TD&gt;&lt;TD&gt;466.74&lt;/TD&gt;&lt;TD&gt;&amp;lt;.0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7203&lt;/TD&gt;&lt;TD&gt;25.14870&lt;/TD&gt;&lt;TD&gt;0.00349&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7208&lt;/TD&gt;&lt;TD&gt;33.29669&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Root MSE R-Square Dependent Mean Adj R-Sq Coeff Var &amp;nbsp; &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;0.05909&lt;/TD&gt;&lt;TD&gt;0.2447&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-0.00886&lt;/TD&gt;&lt;TD&gt;0.2442&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-666.73591&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Parameter Estimates Variable DF Parameter&lt;BR /&gt;Estimate Standard&lt;BR /&gt;Error t&amp;nbsp;Value Pr&amp;nbsp;&amp;gt;&amp;nbsp;|t| Intercept 1 InflationAdj_Log_Lag12 1 GdpRealYoY_Lag12 1 Yld10yr_Ch_Lag12 1 GdpRealYoY_Ch_Lag12 1 InflationAdj_Log_Ch_Lag12 1 &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;-0.53073&lt;/TD&gt;&lt;TD&gt;0.01686&lt;/TD&gt;&lt;TD&gt;-31.49&lt;/TD&gt;&lt;TD&gt;&amp;lt;.0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-0.15417&lt;/TD&gt;&lt;TD&gt;0.00621&lt;/TD&gt;&lt;TD&gt;-24.84&lt;/TD&gt;&lt;TD&gt;&amp;lt;.0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3.63783&lt;/TD&gt;&lt;TD&gt;0.11334&lt;/TD&gt;&lt;TD&gt;32.10&lt;/TD&gt;&lt;TD&gt;&amp;lt;.0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4.43167&lt;/TD&gt;&lt;TD&gt;0.24145&lt;/TD&gt;&lt;TD&gt;18.35&lt;/TD&gt;&lt;TD&gt;&amp;lt;.0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-1.35277&lt;/TD&gt;&lt;TD&gt;0.09557&lt;/TD&gt;&lt;TD&gt;-14.15&lt;/TD&gt;&lt;TD&gt;&amp;lt;.0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-0.19969&lt;/TD&gt;&lt;TD&gt;0.01158&lt;/TD&gt;&lt;TD&gt;-17.24&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;lt;.0001&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Obs _MODEL_ _TYPE_ _DEPVAR_ _RIDGE_ _PCOMIT_ _RMSE_ Intercept InflationAdj_Log_Lag12 GdpRealYoY_Lag12 Yld10yr_Ch_Lag12 GdpRealYoY_Ch_Lag12 InflationAdj_Log_Ch_Lag12 InflationAdj_Log_Ch 1 2 3 4 &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&g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t;TD&gt;-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OurPick5&lt;/TD&gt;&lt;TD&gt;RIDGESEB&lt;/TD&gt;&lt;TD&gt;InflationAdj_Log_Ch&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;0.060758&lt;/TD&gt;&lt;TD&gt;0.01067&lt;/TD&gt;&lt;TD&gt;0.00397&lt;/TD&gt;&lt;TD&gt;0.05857&lt;/TD&gt;&lt;TD&gt;0.15231&lt;/TD&gt;&lt;TD&gt;0.04671&lt;/TD&gt;&lt;TD&gt;0.00678&lt;/TD&gt;&lt;TD&gt;-1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;When I replicate in matlab using weights, where i multiply the weights at the end by multiplying weights with their residual, I get the following results&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Objective function&lt;/TD&gt;&lt;TD&gt;509.574&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Weighted residual sum of squares&lt;/TD&gt;&lt;TD&gt;478.758&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp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T color="#0000FF"&gt;-0.122062167&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#0000FF"&gt;-0.096160888&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice the slight difference: I am sure this is because of weights and ridge together. When I run the corresponding results for no ridge/weights and ridge/no weights, I can match the SAS output to the 6th decimal place.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 Sep 2017 17:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397540#M20729</guid>
      <dc:creator>jb1983</dc:creator>
      <dc:date>2017-09-20T17:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397548#M20730</link>
      <description>&lt;P&gt;Have you read the article about &lt;A href="https://blogs.sas.com/content/iml/2013/03/20/compute-ridge-regression.html" target="_self"&gt;"Understanding ridge regression in SAS"&lt;/A&gt;, including the part about centered and scaling the data? &amp;nbsp;There is a SAS/IML&amp;nbsp;version of ridge regression, which should be similar to your MATLAB version.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 17:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397548#M20730</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-20T17:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397552#M20731</link>
      <description>&lt;P&gt;Yes Rick, I came across this. I de-meaned my data and scaled each variable with its stdev. which is what I read there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didnt see anything in terms of doing anything to weights on the page though...&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 17:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397552#M20731</guid>
      <dc:creator>jb1983</dc:creator>
      <dc:date>2017-09-20T17:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397562#M20732</link>
      <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/01/06/weighted-mean-in-sas.html" target="_self"&gt;Did you use WEIGHTED means&lt;/A&gt; to center the data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following program is from the blog post that I linked to. The only substantive changes are (1) use weighted means to center the data, and (2) use weights in matrix computations. &amp;nbsp;The program gets the same parameter estimates as PROC REG, up to numerical precision.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/* Ridge regression example from PROC REG documentation */
data acetyl;
input x1-x4 @@;
x1x2 = x1 * x2;
x1x1 = x1 * x1;
call streaminit(12345);
w = rand("uniform");
datalines;
1300  7.5 0.012 49   1300  9   0.012  50.2 1300 11 0.0115 50.5
1300 13.5 0.013 48.5 1300 17   0.0135 47.5 1300 23 0.012  44.5
1200  5.3 0.04  28   1200  7.5 0.038  31.5 1200 11 0.032  34.5
1200 13.5 0.026 35   1200 17   0.034  38   1200 23 0.041  38.5
1100  5.3 0.084 15   1100  7.5 0.098  17   1100 11 0.092  20.5
1100 17   0.086 29.5
;
 
proc reg data=acetyl outest=b ridge=0.5 noprint;
   model x4=x1 x2 x3 x1x2 x1x1;
   weight w;
run;
 
proc print data=b(where=(_TYPE_="RIDGE")) noobs;
   var _RIDGE_ Intercept x1 x2 x3 x1x2 x1x1;
run;

/* Ridge regression coefficients computed in SAS/IML */
proc iml;
use acetyl;        
read ALL var {x1 x2 x3 x1x2 x1x1} into X; 
read all var {x4} into y;
read all var {w};
close acetyl;        
 
use b where(_TYPE_="RIDGE");
read all var {_RIDGE_} into k;
read all var {Intercept x1 x2 x3 x1x2 x1x1} into RegB;
close;

start WtMean(x, w);
   m = (x#w)[+,] / sum(w); /* compute weighted mean */
   return( m );
finish;

/* ridge regression */
xBar = WtMean(X,w);       /* save row vector of means */
yBar = WtMean(y,w);       /* save mean of Y */
X = X - xBar;         /* center X and y; do not add intercept */
y = y - yBar;                     

/* include weights for matrix computations */
X = sqrt(w)#X;
y = sqrt(w)#y;                     

D = vecdiag(X`*X);
Z = X / sqrt(D`);     /* Z`Z = corr(X) */
b =  (1/sqrt(D)) # inv(Z`*Z + k*I(ncol(X))) * (Z`*y); /* formula in REG doc */

/* Recover the intercept */
b0 = ybar - xbar * b;
b = b0 || b`;
print b[colname={"Intercept" "x1" "x2" "x3" "x1x2" "x1x1"}];

diff = (RegB-b);
print diff;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 18:24:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397562#M20732</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-20T18:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397584#M20733</link>
      <description>&lt;P&gt;Hi Rick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is very helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One question: I dont understand the computation done in this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token comment"&gt;/* include weights for matrix computations */&lt;/SPAN&gt;
X &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;sqrt&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;w&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;#X&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is the previous de-meaned X being multiplied by its weight?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397584#M20733</guid>
      <dc:creator>jb1983</dc:creator>
      <dc:date>2017-09-20T19:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397599#M20734</link>
      <description>&lt;P&gt;Yes. "#" is the &lt;A href="https://blogs.sas.com/content/iml/2013/05/20/matri-multiplication.html" target="_self"&gt;elementwise multiplication&amp;nbsp;operator.&amp;nbsp;&lt;/A&gt;&amp;nbsp;The line multiplies the i_th row of X by w[i].&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 20:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397599#M20734</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-20T20:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397758#M20739</link>
      <description>&lt;P&gt;Thanks a lot Rick, that worked.&lt;/P&gt;&lt;P&gt;Even SAS user help didnt know all the info to recreate the results from SAS.&lt;/P&gt;&lt;P&gt;They should not just hire you they should make you their client service head &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 13:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397758#M20739</guid>
      <dc:creator>jb1983</dc:creator>
      <dc:date>2017-09-21T13:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397767#M20740</link>
      <description>&lt;P&gt;I know you meant it as a joke/compliment, but I wouldn't be critical of Tech Support. How to generalize an analysis to handle weights is rarely clear or simple. Most textbooks and papers in journals do not describe&amp;nbsp;how an algorithm should be modified for&amp;nbsp;weights, and in this case the SAS documentation&amp;nbsp;does not provide details for the weighted computation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even for a simple statistic like a weighted standard deviation, there is no general consensus about how to compute it, which is why SAS provided the VARDEF= option in many procedures for controlling how variances are computed.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 13:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/397767#M20740</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-21T13:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/398618#M20779</link>
      <description>&lt;P&gt;Thanks Rick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a related question: I implemented your IML code with a small alteration. While yours works perfectly, mine has the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;107 D = vecdiag(X`*X);&lt;BR /&gt;ERROR: (execution) Invalid argument or operand; contains missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The (X`*X) is causing the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code Im running&lt;/P&gt;&lt;PRE&gt;/* Ridge regression example from PROC REG documentation 
data acetyl;
input x1-x4 @@;
x1x2 = x1 * x2;
x1x1 = x1 * x1;
call streaminit(12345);
w = rand("uniform");
datalines;
1300  7.5 0.012 49   1300  9   0.012  50.2 1300 11 0.0115 50.5
1300 13.5 0.013 48.5 1300 17   0.0135 47.5 1300 23 0.012  44.5
1200  5.3 0.04  28   1200  7.5 0.038  31.5 1200 11 0.032  34.5
1200 13.5 0.026 35   1200 17   0.034  38   1200 23 0.041  38.5
1100  5.3 0.084 15   1100  7.5 0.098  17   1100 11 0.092  20.5
1100 17   0.086 29.5
;
 
proc reg data=acetyl outest=b ridge=0.5 noprint;
   model x4=x1 x2 x3 x1x2 x1x1;
   weight w;
run;
 
proc print data=b(where=(_TYPE_="RIDGE")) noobs;
   var _RIDGE_ Intercept x1 x2 x3 x1x2 x1x1;
run;

*/

libname CmeData "\\link\CME_SAS_inputData_differentPeriods";
run;



data GlobalRegData;
  set data_database;
	output GlobalRegData;
run;



/***************************************************************
Global Curvature
****************************************************************/
proc reg data=GlobalRegData
		outest=bb ridge = 0.5;
  OurPick3: 	model Curvature_Ch = Curvature_Lag12 Yld10yr_Ch;
  weight SqrtGdpwgtNorm;
  where 195001&amp;lt;=Eom&amp;lt;=200512 and CountryID^=100;
run;
proc print data=bb;
run;




/* Ridge regression coefficients computed in SAS/IML */
proc iml;
use GlobalRegData;        
read ALL var {Curvature_Lag12 Yld10yr_Ch} into X; 
read all var {Curvature_Ch} into y;
read all var {SqrtGdpwgtNorm};
close GlobalRegData;        
 
/*
use b where(_TYPE_="RIDGE");
read all var {_RIDGE_} into k;
read all var {Intercept x1 x2 x3 x1x2 x1x1} into RegB;
close;
*/

start WtMean(x, w);
   m = (x#w)[+,] / sum(w); /* compute weighted mean */
   return( m );
finish;

w=SqrtGdpwgtNorm;

/* ridge regression */
xBar = WtMean(X,w);       /* save row vector of means */
yBar = WtMean(y,w);       /* save mean of Y */
X = X - xBar;         /* center X and y; do not add intercept */
y = y - yBar;                     
print xBar;



/* include weights for matrix computations */
X = sqrt(w)#X;
y = sqrt(w)#y;                     

D = vecdiag((X`)*X);

print (X`);



Z = X / sqrt(D`);     /* Z`Z = corr(X) */
b =  (1/sqrt(D)) # inv(Z`*Z + k*I(ncol(X))) * (Z`*y); /* formula in REG doc */

&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Sep 2017 17:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/398618#M20779</guid>
      <dc:creator>jb1983</dc:creator>
      <dc:date>2017-09-25T17:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/398624#M20780</link>
      <description>&lt;P&gt;As the error message says, you can't multiply two matrices that have missing values. Imitate PROC REG and &lt;A href="https://blogs.sas.com/content/iml/2015/02/23/complete-cases.html" target="_self"&gt;remove the missing values from the data&lt;/A&gt; before you&amp;nbsp;perform the&amp;nbsp;analysis.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 17:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/398624#M20780</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-25T17:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Ridge regressions with weights (proc reg)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/405097#M21121</link>
      <description>&lt;P&gt;Hello JB1983&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you get standard error or t value in the ridge regression output?&lt;/P&gt;&lt;P&gt;if yes then how?&amp;nbsp;&lt;/P&gt;&lt;P&gt;if no then how will you explain the significance of beta coefficients. Also what about model fit using f value, r square/adj r square.&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rajneesh Ranjan Jha&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 04:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Ridge-regressions-with-weights-proc-reg/m-p/405097#M21121</guid>
      <dc:creator>Rajneesh_Jha</dc:creator>
      <dc:date>2017-10-18T04:28:01Z</dc:date>
    </item>
  </channel>
</rss>

