<?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: Plotting the underlying DGP in a scatterplot of simulated data in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640195#M19752</link>
    <description>&lt;P&gt;2 y values such as&lt;/P&gt;
&lt;PRE&gt;data ex;
call streaminit(12345);
do i = 1 to 250;
x = rand('lognormal',0.6,0.5);
y1 = 3*sin(x/2)+1 + rand('normal',0,0.5);
y2 =   3*sin(x/2)+1;
output;
end;
run;&lt;/PRE&gt;
&lt;P&gt;In SGPLOT have two scatter statments using the two y values. Use a plot option to make the markers different color/shape/size. An appropriate label for the Y variables would be a good idea for the legend.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Apr 2020 19:06:55 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-04-15T19:06:55Z</dc:date>
    <item>
      <title>Plotting the underlying DGP in a scatterplot of simulated data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640136#M19750</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to illustrate the effects of different local regressions. To do it, i generated some random data like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ex;
call streaminit(12345);
do i = 1 to 250;
x = rand('lognormal',0.6,0.5);
y = 3*sin(x/2)+1 + rand('normal',0,0.5);
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So, the data points simulated are pairs of (x,y), where the underlying DGP is given by y. The reason i draw x from a lognormal is just because i want only a few observations in one part and many observations in another part of the x-axis (relevant for the context i am using the plot in).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, my problem is:&lt;/P&gt;&lt;P&gt;I would like to make a scatterplot with the generated observations, and at the same time plot the deterministic part of the underlying DGP [name it z = 3*sin(x/2)+1]. Is it possible to do this in for example a proc sgplot without having to simulate a lot of (x,z) pairs?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 16:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640136#M19750</guid>
      <dc:creator>marotta</dc:creator>
      <dc:date>2020-04-15T16:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting the underlying DGP in a scatterplot of simulated data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640195#M19752</link>
      <description>&lt;P&gt;2 y values such as&lt;/P&gt;
&lt;PRE&gt;data ex;
call streaminit(12345);
do i = 1 to 250;
x = rand('lognormal',0.6,0.5);
y1 = 3*sin(x/2)+1 + rand('normal',0,0.5);
y2 =   3*sin(x/2)+1;
output;
end;
run;&lt;/PRE&gt;
&lt;P&gt;In SGPLOT have two scatter statments using the two y values. Use a plot option to make the markers different color/shape/size. An appropriate label for the Y variables would be a good idea for the legend.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 19:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640195#M19752</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-15T19:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting the underlying DGP in a scatterplot of simulated data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640208#M19753</link>
      <description>&lt;P&gt;I don't think you can plot a curve without simulating the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; has a great &lt;A href="https://blogs.sas.com/content/iml/2020/04/15/diagonal-lines-sas-lineparm-vector.html" target="_self"&gt;blog post&lt;/A&gt; out today on the LINEPARM&amp;nbsp; statement which allows you to to draw a line without simulating data (you specify slope and intercept), but I think to draw y&lt;SPAN&gt;&amp;nbsp;= 3*sin(x/2)+1 without simulating the data, you would need some sort of CURVEPARM statement (FUNCTIONPARM?) that allows you to specify an arbitrary function like you would on a graphing calculator.&amp;nbsp; I don't think that exists in SGPLOT, SGANNO, or GTL.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I also have had times when I wanted to just overlay a function without simulating the data myself. So I'd be happy if I'm wrong.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 20:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640208#M19753</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2020-04-15T20:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting the underlying DGP in a scatterplot of simulated data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640224#M19754</link>
      <description>&lt;P&gt;To build on Ballardw's response, you can sort the data by X and then overlay the SERIES statement to plot the underlying deterministic model. Alternatively, generate an evenly spaced set of points in a separate data set and concatenate the two data sets, as shown in the article &lt;A href="https://blogs.sas.com/content/iml/2013/04/22/overlay-custom-curves.html" target="_self"&gt;"How to overlay custom curves with PROC SGPLOT."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 21:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-the-underlying-DGP-in-a-scatterplot-of-simulated-data/m-p/640224#M19754</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-04-15T21:04:39Z</dc:date>
    </item>
  </channel>
</rss>

