<?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 Generating normal variable  50 times in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Generating-normal-variable-50-times/m-p/45027#M246</link>
    <description>The following code is used to generate 50 vectors of size n and each vector is variable (E) having normal distribution with mean 0 and variance equals 1, so how  can I generate this variable  50 times but when the variable (E) follows normal distribution with mean 0 and variance equals 4 ?&lt;BR /&gt;
&lt;BR /&gt;
Do j=1 to 50;&lt;BR /&gt;
E= normal(repeat(-1,n));&lt;BR /&gt;
end;</description>
    <pubDate>Wed, 06 Apr 2011 14:13:21 GMT</pubDate>
    <dc:creator>aya123</dc:creator>
    <dc:date>2011-04-06T14:13:21Z</dc:date>
    <item>
      <title>Generating normal variable  50 times</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Generating-normal-variable-50-times/m-p/45027#M246</link>
      <description>The following code is used to generate 50 vectors of size n and each vector is variable (E) having normal distribution with mean 0 and variance equals 1, so how  can I generate this variable  50 times but when the variable (E) follows normal distribution with mean 0 and variance equals 4 ?&lt;BR /&gt;
&lt;BR /&gt;
Do j=1 to 50;&lt;BR /&gt;
E= normal(repeat(-1,n));&lt;BR /&gt;
end;</description>
      <pubDate>Wed, 06 Apr 2011 14:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Generating-normal-variable-50-times/m-p/45027#M246</guid>
      <dc:creator>aya123</dc:creator>
      <dc:date>2011-04-06T14:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generating normal variable  50 times</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Generating-normal-variable-50-times/m-p/45028#M247</link>
      <description>You just multiply E by the square root of the variance, i.e. E=2#normal(repeat(-1,n));&lt;BR /&gt;
&lt;BR /&gt;
A linear transformation aX+b of a normal variable X is again normally distributed with mean equal to a*mean(X) + b and variance equal to a^2*var(X)</description>
      <pubDate>Wed, 06 Apr 2011 14:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Generating-normal-variable-50-times/m-p/45028#M247</guid>
      <dc:creator>nicolas_</dc:creator>
      <dc:date>2011-04-06T14:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Generating normal variable  50 times</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Generating-normal-variable-50-times/m-p/45029#M248</link>
      <description>You can use the RANDGEN call, which includes optional arguments for the mean and Std Dev.  You first need to allocate a vector to store the data:&lt;BR /&gt;
proc iml;&lt;BR /&gt;
n=10;&lt;BR /&gt;
E = j(n,1);&lt;BR /&gt;
do i = 1 to 50;&lt;BR /&gt;
   call randgen(E, "Normal", 0, 4);&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
You can also get all 50 variables at once. Each column of the following matrix contains a sample from N(0, 4).&lt;BR /&gt;
&lt;BR /&gt;
E = j(n,50);&lt;BR /&gt;
call randgen(E, "Normal", 0, 4);&lt;BR /&gt;
&lt;BR /&gt;
For comments on generating random vectors efficiently, see&lt;BR /&gt;
&lt;A href="http://blogs.sas.com/iml/index.php?/archives/9-Efficient-Sampling.html" target="_blank"&gt;http://blogs.sas.com/iml/index.php?/archives/9-Efficient-Sampling.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
For a description of how to generate 50 variables that each have a different distribution, see  &lt;BR /&gt;
&lt;A href="http://blogs.sas.com/iml/index.php?/archives/117-How-to-Sample-from-Independent-Normal-Distributions.html" target="_blank"&gt;http://blogs.sas.com/iml/index.php?/archives/117-How-to-Sample-from-Independent-Normal-Distributions.html&lt;/A&gt;</description>
      <pubDate>Wed, 06 Apr 2011 15:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Generating-normal-variable-50-times/m-p/45029#M248</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2011-04-06T15:13:11Z</dc:date>
    </item>
  </channel>
</rss>

