<?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: Moving average and EWMA in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381351#M63183</link>
    <description>&lt;P&gt;Hi Jim&amp;nbsp; w is not dependent on the number of column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp; Felice&lt;/P&gt;</description>
    <pubDate>Fri, 30 Apr 2021 15:28:40 GMT</pubDate>
    <dc:creator>FR60</dc:creator>
    <dc:date>2021-04-30T15:28:40Z</dc:date>
    <item>
      <title>Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381181#M63171</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Given a column with numerical values I would like to calculate the MA in this way:&lt;/P&gt;&lt;P&gt;MAi=1/N*SUM(j=i-1 to j=i-w) Xj&lt;/P&gt;&lt;P&gt;where w is the window width, i-1 the starting element and i-w the last one. Les't do an example with w=2 &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&lt;/P&gt;&lt;P&gt;-------------&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x1&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x2&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; …..&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MA=(X3+X2)/2&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MA=(X4+X3)/2&lt;/P&gt;&lt;P&gt;6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; …..&lt;/P&gt;&lt;P&gt;7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By using the New formula column--&amp;gt;Row feature&lt;/P&gt;&lt;P&gt;I set the Weighting to "equal". What about the Items Before and Items after to obtain what I reported before?&lt;/P&gt;&lt;P&gt;Same question if I want to use the Exponential weight.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 295px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32462i6D2511871FF07551/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp; Felice&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:29:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381181#M63171</guid>
      <dc:creator>FR60</dc:creator>
      <dc:date>2023-06-10T23:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381274#M63176</link>
      <description>Is the value of w equal to the number of columns in the data table, or is w equal to the number of the columns displayed on the screen, regardless of the number of columns in the data table?&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Apr 2021 13:06:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381274#M63176</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-04-30T13:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381351#M63183</link>
      <description>&lt;P&gt;Hi Jim&amp;nbsp; w is not dependent on the number of column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp; Felice&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 15:28:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381351#M63183</guid>
      <dc:creator>FR60</dc:creator>
      <dc:date>2021-04-30T15:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381862#M63246</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if it is a simple moving average, you can easily compute it by using the Lag() function in Formula Editor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here below an example on how to calculate the moving average of previous 3 rows for Dissolution column in Tablet Production sample data table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Open Data Table: Tablet Production.jmp
// → Data Table( "Tablet Production" )
Open( "$SAMPLE_DATA/Tablet Production.jmp" );


// New column: Dissolution_MA3
Data Table( "Tablet Production" ) &amp;lt;&amp;lt; New Column( "Dissolution_MA3",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula(
		(Lag( :Dissolution, 1 ) + Lag( :Dissolution, 2 ) + Lag( :Dissolution, 3 ))
		 / 3
	)
);


// Report snapshot: Tablet Production - Graph Builder
Data Table( "Tablet Production" ) &amp;lt;&amp;lt; Graph Builder(
	Size( 799, 452 ),
	Show Control Panel( 0 ),
	Variables( Y( :Dissolution ), Y( :Dissolution_MA3, Position( 1 ) ) ),
	Elements( Line( Y( 1 ), Y( 2 ), Legend( 6 ), Row order( 1 ) ) )
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Cheers, Massimo&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 09:03:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/381862#M63246</guid>
      <dc:creator>MassimoMartucci</dc:creator>
      <dc:date>2021-05-03T09:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382251#M63298</link>
      <description>&lt;P&gt;See this function in the documentation and Scripting Index:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ma.PNG" style="width: 804px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32590iE35A84154A92B33E/image-size/large?v=v2&amp;amp;px=999" role="button" title="ma.PNG" alt="ma.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 15:31:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382251#M63298</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-05-04T15:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382432#M63306</link>
      <description>&lt;P&gt;It looks like you want equal weighting with 1 row before and 0 after.&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 12:27:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382432#M63306</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-05-05T12:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382438#M63308</link>
      <description>&lt;P&gt;Let&amp;nbsp;me do an example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's suppose to have the sequence 1 2 3 4 5 6 7 8 9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Starting from 5 I would like to do do the average of previous w rows. For w=3&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(2+3+4)/3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and not&lt;/P&gt;&lt;P&gt;(3+4+5)/3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rgds&amp;nbsp; Felice&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 12:42:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382438#M63308</guid>
      <dc:creator>FR60</dc:creator>
      <dc:date>2021-05-05T12:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and EWMA</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382460#M63310</link>
      <description>&lt;DIV&gt;Ah, sorry I missed that detail.&amp;nbsp; You can add a Lag formula around the Col Moving Average to accomplish this:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_0-1620221585125.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32609iD38D6FBB865410C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_0-1620221585125.png" alt="ih_0-1620221585125.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "MA Example",
	Add Rows( 10 ),
	New Column( "Data",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] )
	),
	New Column( "MA",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Lag( Col Moving Average( :Data, 1, 2, 0 ) ) )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Gives the expected result:&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_1-1620221625678.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32611iE962D60CA03955F7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_1-1620221625678.png" alt="ih_1-1620221625678.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 May 2021 13:34:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-EWMA/m-p/382460#M63310</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-05-05T13:34:15Z</dc:date>
    </item>
  </channel>
</rss>

