<?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 Initialize data across multiple columns at once in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/601726#M80512</link>
    <description>&lt;P&gt;I am interested in initializing data across multiple columns in the same manner all at once.&amp;nbsp; For example, I want to create M number of columns with random-normal data (mean = x, stdev = y), through N rows.&amp;nbsp; &amp;nbsp;Any help is appreciated.&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2023 16:35:22 GMT</pubDate>
    <dc:creator>ashwint27</dc:creator>
    <dc:date>2023-06-08T16:35:22Z</dc:date>
    <item>
      <title>Initialize data across multiple columns at once</title>
      <link>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/601726#M80512</link>
      <description>&lt;P&gt;I am interested in initializing data across multiple columns in the same manner all at once.&amp;nbsp; For example, I want to create M number of columns with random-normal data (mean = x, stdev = y), through N rows.&amp;nbsp; &amp;nbsp;Any help is appreciated.&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:35:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/601726#M80512</guid>
      <dc:creator>ashwint27</dc:creator>
      <dc:date>2023-06-08T16:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize data across multiple columns at once</title>
      <link>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602017#M80545</link>
      <description>&lt;P&gt;Based on the limited information provided, this script proves the concept.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

M = 10;
N = 30;

data = J( N, M, Random Normal() );

As Table( data );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Feb 2023 15:23:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602017#M80545</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-02-16T15:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize data across multiple columns at once</title>
      <link>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602759#M80611</link>
      <description>&lt;P&gt;Adding to what Mark supplied: Random Normal ( ) can be used without arguments, or with 2 arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without arguments, you get N( mean == 0, stddev == 1) data. So Mark's code will give you an MxN table of N(0,1) data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using arguments, Random Normal ( x, y ) gives you N( mean == x, stddev == y) data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your post mentions a mean of x and a stddev of y, you could use the following, if x is not 0 and/or y is not 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Table ( J ( N, M, Random Normal ( x, y ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 20:01:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602759#M80611</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2023-02-17T20:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize data across multiple columns at once</title>
      <link>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602769#M80613</link>
      <description>&lt;P&gt;Here's a funny thing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might save a little bit of time using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;y * J ( M, N, randomNormal () ) + x&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;J( M, N, randomnormal (x, y) ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason is that the J function is really a loop...&amp;nbsp; so in the J( M, N, randomnormal (x, y) ) example, each time through the loop a standard random normal is chosen, multiplied by y and added to x to produce a random N(x, y).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the y * J ( M, N, randomNormal () ) + x example, all of the standard random normals are generated, and afterward the entire matrix is multiplied by y and added to a dimensionally similar x matrix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not a huge difference, but in the 1000x1000 matrices I was investigating, the 2nd approach ran in about 3/4 the time of the first.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 20:26:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602769#M80613</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2023-02-17T20:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize data across multiple columns at once</title>
      <link>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602783#M80615</link>
      <description>&lt;P&gt;The extra time is spent looking up the values of x and y 999,999 extra times, not in the actual multiply which has to be done anyway. You can use numbers in place of x,y and get a between time because the number evaluates with no lookup in the namespace. The baseline case below does not include the multiply and add which would likely get an answer closer to the 3/4 you described.&lt;/P&gt;
&lt;PRE&gt;q=j(size,size,randomnormal());    // 1.0
q=j(size,size,randomnormal(0,1)); // 1.1
q=j(size,size,randomnormal(x,y)); // 1.4&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 00:18:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Initialize-data-across-multiple-columns-at-once/m-p/602783#M80615</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-02-18T00:18:35Z</dc:date>
    </item>
  </channel>
</rss>

