<?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: Rounding error suspected. Could you help with the solution? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215331#M267631</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia Keshan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for getting back to me with a suggestion. I have not done so yet. Actually, there are many N - T combinations, and the works for most of them expect for few cases. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Aug 2015 01:03:36 GMT</pubDate>
    <dc:creator>manto</dc:creator>
    <dc:date>2015-08-03T01:03:36Z</dc:date>
    <item>
      <title>Rounding error suspected. Could you help with the solution?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215329#M267629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I am doing some simulation work using SAS/IML. Some of my numbers are very small (elements of a Park's type VCV matrix constructed from regression residuals). I use the ROOT function to get the Cholesky decomposition of a matrix that is positive definite by construction (VCV matrix), but it returns the error message that the matrix provided was not positive definite. I suspect a rounding error but I do not know how to solve it. I got the same problem before with Stata (Mata), and SAS/IML helped counter it. But now I am using a new data set, and facing again the problem with SAS.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;The portion of the code up to the Cholesky decomposition is provided below:&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;start program;&lt;/P&gt;&lt;P&gt;use Newdata.AD;&lt;/P&gt;&lt;P&gt;read all var {Germany_aid} into y;&lt;/P&gt;&lt;P&gt;read all var {GDP_per_capita} into x;&lt;/P&gt;&lt;P&gt;read all var ('c1':'c77') into s;&lt;/P&gt;&lt;P&gt;read all var ('t1':'t25') into years;&lt;/P&gt;&lt;P&gt;***THIS SECTION CREATES THE OMEGA MATRIX AND;&lt;/P&gt;&lt;P&gt;***INITIALIZES THE MONTE CARLO PARAMETERS;&lt;/P&gt;&lt;P&gt;n=50;&lt;/P&gt;&lt;P&gt;periods=20;&lt;/P&gt;&lt;P&gt;t=periods;&lt;/P&gt;&lt;P&gt;nt=n*periods;&lt;/P&gt;&lt;P&gt;yi=j(nt,1,0);&lt;/P&gt;&lt;P&gt;xi=j(nt,1,0);&lt;/P&gt;&lt;P&gt;si=j(nt,n,0); &lt;/P&gt;&lt;P&gt;yearsi=j(nt,(periods-1),0);&lt;/P&gt;&lt;P&gt;omega=j(nt,nt,0);&lt;/P&gt;&lt;P&gt;ones=j(nt,1,1);&lt;/P&gt;&lt;P&gt;r2=0;&lt;/P&gt;&lt;P&gt;yy=j(nt,1,0);&lt;/P&gt;&lt;P&gt;xx=j(nt,1,0);&lt;/P&gt;&lt;P&gt;phitotal=j(n,n,0);&lt;/P&gt;&lt;P&gt;rhohattotal=0;&lt;/P&gt;&lt;P&gt;yy=0;&lt;/P&gt;&lt;P&gt;xx=0;&lt;/P&gt;&lt;P&gt;r2=0;&lt;/P&gt;&lt;P&gt;do k=1 to (25-periods+1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do j=1 to n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yi[1+(j-1)*periods:j*periods]=y[k+(j-1)*25:k+(periods-1)+(j-1)*25];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xi[1+(j-1)*periods:j*periods]=x[k+(j-1)*25:k+(periods-1)+(j-1)*25];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; si[1+(j-1)*periods:j*periods,]=s[k+(j-1)*25:k+(periods-1)+(j-1)*25,1:n]; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yearsi[1+(j-1)*periods:j*periods,1:(periods-1)]=years[k+(j-1)*25:k+(periods-1)+(j-1)*25,k+1:k+(periods-1)];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;zi=si||yearsi||xi;&lt;/P&gt;&lt;P&gt;ei=yi-zi*inv(zi`*zi)*zi`*yi;&lt;/P&gt;&lt;P&gt;a=i(nt)-(1/nt)*ones*ones`;&lt;/P&gt;&lt;P&gt;r2i=1-((ei`*ei)/(yi`*a*yi));&lt;/P&gt;&lt;P&gt;eols1=j(n*(periods-1),1,0);&lt;/P&gt;&lt;P&gt;eols2=j(n*(periods-1),1,0); &lt;/P&gt;&lt;P&gt;pp=j(periods,periods,0);&lt;/P&gt;&lt;P&gt;bols=inv(zi`*zi)*zi`*yi;&lt;/P&gt;&lt;P&gt;do i=1 to n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; eols1[1+((i-1)*(periods-1)):(i*(periods-1))]=ei[(2+((i-1)*periods)):i*periods];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; eols2[1+((i-1)*(periods-1)):(i*(periods-1))]=ei[(1+(i-1)*periods):((i*periods)-1)];&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;***NOTE THAT I AM USING A DIFFERENT FORMULA;&lt;/P&gt;&lt;P&gt;***THE GREENE FORMULA;&lt;/P&gt;&lt;P&gt;***TO CALCULATE RHOHAT;&lt;/P&gt;&lt;P&gt;rhohati=(eols1`*eols2)/(ei`*ei); &lt;/P&gt;&lt;P&gt;*rhohat=0; &lt;/P&gt;&lt;P&gt;pp[1,1]=sqrt(1-(rhohati**2));&lt;/P&gt;&lt;P&gt;do i=2 to periods;&lt;/P&gt;&lt;P&gt;pp[i,i]=1;&lt;/P&gt;&lt;P&gt;pp[i,i-1]=-rhohati;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;p=i(n)@pp;&lt;/P&gt;&lt;P&gt;bstep2=inv(zi`*p`*p*zi)*zi`*p`*p*yi;&lt;/P&gt;&lt;P&gt;estep2=p*yi-(p*zi*bstep2);&lt;/P&gt;&lt;P&gt;ee=j(periods,n,0);&lt;/P&gt;&lt;P&gt;do i=1 to n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ee[,i]=estep2[1+(i-1)*periods:i*periods];&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;phii=(ee`*ee)/periods;&lt;/P&gt;&lt;P&gt;*sigmai=phi/(1-(rhohati**2));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****THIS SECTION IS USED TO CALCULATE MEAN OMEGA;&lt;/P&gt;&lt;P&gt;****AND Y AND X VALUES OVER ALL SUBSAMPLES;&amp;nbsp; &lt;/P&gt;&lt;P&gt;phitotal=phitotal+phii; &lt;/P&gt;&lt;P&gt;rhohattotal=rhohattotal+rhohati; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;phibar=phitotal/(25-periods+1);&lt;/P&gt;&lt;P&gt;rhohatbar=rhohattotal/(25-periods+1);&lt;/P&gt;&lt;P&gt;omegabar=j(periods,periods,0);&lt;/P&gt;&lt;P&gt;do i=1 to periods;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do j=1 to periods;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; omegabar[i,j]=rhohatbar**(abs(i-j));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;sigmabar=phibar/(1-(rhohatbar**2));&lt;/P&gt;&lt;P&gt;vbar=sigmabar@omegabar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q=root(vbar);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print Q;&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;run program;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Your help will be highly appreciated.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Mantobaye&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Aug 2015 12:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215329#M267629</guid>
      <dc:creator>manto</dc:creator>
      <dc:date>2015-08-01T12:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error suspected. Could you help with the solution?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215330#M267630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you &lt;/P&gt;&lt;P&gt;Center and scale the data&amp;nbsp; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Aug 2015 11:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215330#M267630</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-08-02T11:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error suspected. Could you help with the solution?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215331#M267631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia Keshan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for getting back to me with a suggestion. I have not done so yet. Actually, there are many N - T combinations, and the works for most of them expect for few cases. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 01:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215331#M267631</guid>
      <dc:creator>manto</dc:creator>
      <dc:date>2015-08-03T01:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error suspected. Could you help with the solution?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215332#M267632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You'd better post it as IML forum since your code is IML code , @Rick is there .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 12:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215332#M267632</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-08-03T12:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error suspected. Could you help with the solution?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215333#M267633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We don't have your data, so seeing your program is not helpful. Could you show us the final&lt;/P&gt;&lt;P&gt;sigmabar and omegabar matrices ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;sigmabar = {...};&lt;/P&gt;&lt;P&gt;omegabar = {...};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 18:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215333#M267633</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-08-03T18:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error suspected. Could you help with the solution?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215334#M267634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am willing to provide the data set as well, but if failed when I tried to upload it with the initial post. Could you possibly contact me at &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:moundigbaye.mantobaye@pg.canterbury.ac.nz"&gt;moundigbaye.mantobaye@pg.canterbury.ac.nz&lt;/A&gt;&lt;SPAN&gt; so I can send it to you? The data is not confidential so I can share it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mantobaye&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 23:07:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-error-suspected-Could-you-help-with-the-solution/m-p/215334#M267634</guid>
      <dc:creator>manto</dc:creator>
      <dc:date>2015-08-03T23:07:41Z</dc:date>
    </item>
  </channel>
</rss>

