<?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 Weighted moving average on a data set in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37384#M21937</link>
    <description>&lt;P&gt;Using a formula to define the values of a column is an essential part of JMP. &amp;nbsp;It is well documented in the JMP book called "Using JMP". &amp;nbsp;I suggest you read that book. &amp;nbsp;It was installed on your computer when you installed JMP. &amp;nbsp;You get to it under the Help pulldown menu&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Help==&amp;gt;Books==&amp;gt;Using JMP&lt;/P&gt;
&lt;P&gt;Regardless, here is how to use the formula that I provided you, create a new column in your data table and then right click on the column header and select "Formula"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 1.PNG" style="width: 753px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5656i3EC878484E78C73E/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 1.PNG" alt="moving average 1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see in my example, I named the new column "Moving Average"&lt;/P&gt;
&lt;P&gt;The next window that will open up, is the Formula Editor&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 2.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5657iD2755B38717583A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 2.PNG" alt="moving average 2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It allows you to point and click and create whatever formulas you want. &amp;nbsp;However, you can also double click in the blue outlined box that has the wording "no formula" and the editor will come up&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 3.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5658i934FC3AD2C23E326/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 3.PNG" alt="moving average 3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As seen in the above window, I just typed in the formula, or it can be pasted into the window. &amp;nbsp;Then when you click on the "OK" button, you will see the graphical form of the formula&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 4.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5659i9D4AD5EF584A162F/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 4.PNG" alt="moving average 4.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then when you click on the "OK" button, or the "Apply" button the formula will be run for the new column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 5.PNG" style="width: 537px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5660i23B74A5519438530/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 5.PNG" alt="moving average 5.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Mar 2017 01:39:01 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2017-03-21T01:39:01Z</dc:date>
    <item>
      <title>Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37369#M21929</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a moving average and a weighted moving average on the data set that I have posted below.&lt;/P&gt;&lt;P&gt;I want to do a moving average to the 'Mean' column.&lt;/P&gt;&lt;P&gt;Also can I repeat this formula by the 'Sample' group in my data set&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 19:59:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37369#M21929</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-20T19:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37370#M21930</link>
      <description>&lt;P&gt;Here is a moving average formula&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Mean( Lag( :Points, 1 ),
	 Lag( :Points, 2 ), 
	 Lag( :Points, 3 ), 
	 Lag( :Points, 4 ), 
	 Lag( :Points, 5 ) 
 )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and a weighted moving average&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Mean(
	Lag( :points, 1 ) * :mean,
	Lag( :points, 2 ) * :mean,
	Lag( :points, 3 ) * :mean,
	Lag( :points, 4 ) * :mean,
	Lag( :points, 5 ) * :mean
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2017 20:22:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37370#M21930</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-20T20:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37378#M21936</link>
      <description>&lt;P&gt;Hi txnelson,&lt;/P&gt;&lt;P&gt;Is the below formula you suggested moving average for &amp;nbsp;the 'Points' column?And you are using the Mean() formula?&lt;/P&gt;&lt;P&gt;How can I put this in a for loop to do it over all the rows?&lt;/P&gt;&lt;P&gt;Also I want to do this By Group&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 01:12:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37378#M21936</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-21T01:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37384#M21937</link>
      <description>&lt;P&gt;Using a formula to define the values of a column is an essential part of JMP. &amp;nbsp;It is well documented in the JMP book called "Using JMP". &amp;nbsp;I suggest you read that book. &amp;nbsp;It was installed on your computer when you installed JMP. &amp;nbsp;You get to it under the Help pulldown menu&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Help==&amp;gt;Books==&amp;gt;Using JMP&lt;/P&gt;
&lt;P&gt;Regardless, here is how to use the formula that I provided you, create a new column in your data table and then right click on the column header and select "Formula"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 1.PNG" style="width: 753px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5656i3EC878484E78C73E/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 1.PNG" alt="moving average 1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see in my example, I named the new column "Moving Average"&lt;/P&gt;
&lt;P&gt;The next window that will open up, is the Formula Editor&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 2.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5657iD2755B38717583A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 2.PNG" alt="moving average 2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It allows you to point and click and create whatever formulas you want. &amp;nbsp;However, you can also double click in the blue outlined box that has the wording "no formula" and the editor will come up&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 3.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5658i934FC3AD2C23E326/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 3.PNG" alt="moving average 3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As seen in the above window, I just typed in the formula, or it can be pasted into the window. &amp;nbsp;Then when you click on the "OK" button, you will see the graphical form of the formula&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 4.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5659i9D4AD5EF584A162F/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 4.PNG" alt="moving average 4.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then when you click on the "OK" button, or the "Apply" button the formula will be run for the new column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="moving average 5.PNG" style="width: 537px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5660i23B74A5519438530/image-size/large?v=v2&amp;amp;px=999" role="button" title="moving average 5.PNG" alt="moving average 5.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 01:39:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37384#M21937</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-21T01:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37385#M21938</link>
      <description>&lt;P&gt;I was able to get the 3 point &amp;nbsp;Moving Average using.I was able to apply the formula as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"If( Row() &amp;lt; 3,&lt;BR /&gt;Mean( :Mean1[Index( 1, Row() )] ),&lt;BR /&gt;Mean( :Mean1[Index( Row() - (3 - 1), Row() )] )&lt;BR /&gt;)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ho can I do this By Group for the Column "Sample"?&lt;/P&gt;&lt;P&gt;For each value of Sample I want a moving average for the &amp;nbsp;"Mean1" values and I have 239 Sample values.&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 01:44:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37385#M21938</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-21T01:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37386#M21939</link>
      <description>&lt;P&gt;It's just a simple extension of your formula. &amp;nbsp;You just have to keep track of when the :Sample changes, and then start the calculations from scratch&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :sample != Lag( :sample, 1 ) | Row() == 1,
	counter = 0;
	startrow = Row();
);
counter = counter + 1;
If( counter &amp;lt; 3,
	Mean( :Mean1[Index( startrow, Row() )] ),
	Mean( :Mean1[Index( Row() - (3 - 1), Row() )] )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2017 02:14:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37386#M21939</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-21T02:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37387#M21940</link>
      <description>&lt;P&gt;Thank you for your prompt replies.It worked for my data set&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 03:24:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37387#M21940</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-21T03:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37414#M21959</link>
      <description>&lt;P&gt;How can I do a weighted moving average with the above formula with the coefficients 1,4,6,4,1 ?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 20:36:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37414#M21959</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-21T20:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37416#M21961</link>
      <description>&lt;P&gt;See the note at the bottom of this reply&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;The formula that is using the index() function isn't going to work for a weighted calculation. &amp;nbsp;What I assume you want to do is illustrated by the following formula&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;&lt;CODE class=" language-jsl"&gt;Mean(
	Lag( ::Mean1, 1 ) *  1,
	Lag( ::Mean1, 1 ) *  4,
	Lag( ::Mean1, 1 ) *  6,
	Lag( ::Mean1, 1 ) *  4,
	Lag( ::Mean1, 1 ) *  1
);&lt;/CODE&gt;&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRIKE&gt;This structure doesn't allow the simple 2 level calculation, so it has to be expanded, but is is basically the same logic&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;&lt;CODE class=" language-jsl"&gt;If( :sample != Lag( :sample, 1 ) | Row() == 1,
	counter = 0;
);
counter = counter + 1;
If( counter == 1,
	:Mean1,
	counter ==2,
		Mean(
			Lag( ::Mean1, 1 ) *  1,
			Lag( ::Mean1, 1 ) *  4
		),
	counter ==3,
		Mean(
			Lag( ::Mean1, 1 ) *  1,
			Lag( ::Mean1, 1 ) *  4,
			Lag( ::Mean1, 1 ) *  6
		),
	counter ==4,
		Mean(
			Lag( ::Mean1, 1 ) *  1,
			Lag( ::Mean1, 1 ) *  4,
			Lag( ::Mean1, 1 ) *  6,
			Lag( ::Mean1, 1 ) *  4
		),
	Mean(
		Lag( ::Mean1, 1 ) *  1,
		Lag( ::Mean1, 1 ) *  4,
		Lag( ::Mean1, 1 ) *  6,
		Lag( ::Mean1, 1 ) *  4,
		Lag( ::Mean1, 1 ) *  1
	)
);&lt;/CODE&gt;&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;And after all of this, I found the Col Moving Average() function. &amp;nbsp;So don't do anything above that I suggested, instead, go to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Help==&amp;gt;Scripting Index==&amp;gt;Col Moving Average&lt;/P&gt;
&lt;P&gt;and you will get a single function that will do everything you have asked for&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:37:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37416#M21961</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-21T21:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37417#M21962</link>
      <description>&lt;P&gt;Will this formula divide the weighted mean by the weights sum &amp;nbsp;that is 16?&lt;/P&gt;&lt;P&gt;I am not getting the expected answer using the formula&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:48:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37417#M21962</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-21T21:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37418#M21963</link>
      <description>&lt;P&gt;I am not seeing the Col Moving Average function in JMP 12&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:56:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37418#M21963</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-21T21:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37420#M21965</link>
      <description>&lt;P&gt;I dont see the Col Moving Average function in JMP 12&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 22:00:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37420#M21965</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-21T22:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37428#M21971</link>
      <description>&lt;P&gt;The Col Moving Average() function was added in JMP 13. &amp;nbsp;So, for JMP 12 you will need to used the code I provided. &amp;nbsp;And all you need to do, is to add the division by 16 to the code. &amp;nbsp;Make sure you divide the 1,2,3,4 lag subsets with the appropriate subset the the 16&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 03:09:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37428#M21971</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-22T03:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37446#M21972</link>
      <description>&lt;P&gt;If( :sample != Lag( :sample, 1 ) | Row() == 1,&lt;BR /&gt;counter = 0&lt;BR /&gt;);&lt;BR /&gt;counter = counter + 1;&lt;BR /&gt;If(&lt;BR /&gt;counter == 1, :Mean1,&lt;BR /&gt;counter == 2, Mean( Lag( ::Mean1, 1 ) * 1, Lag( ::Mean1, 1 ) * 4 ) / 16,&lt;BR /&gt;counter == 3,&lt;BR /&gt;Mean( Lag( ::Mean1, 1 ) * 1, Lag( ::Mean1, 1 ) * 4, Lag( ::Mean1, 1 ) * 6 )&lt;BR /&gt;/ 16,&lt;BR /&gt;counter == 4,&lt;BR /&gt;Mean(&lt;BR /&gt;Lag( ::Mean1, 1 ) * 1,&lt;BR /&gt;Lag( ::Mean1, 1 ) * 4,&lt;BR /&gt;Lag( ::Mean1, 1 ) * 6,&lt;BR /&gt;Lag( ::Mean1, 1 ) * 4&lt;BR /&gt;) / 16,&lt;BR /&gt;Mean(&lt;BR /&gt;Lag( ::Mean1, 1 ) * 1,&lt;BR /&gt;Lag( ::Mean1, 1 ) * 4,&lt;BR /&gt;Lag( ::Mean1, 1 ) * 6,&lt;BR /&gt;Lag( ::Mean1, 1 ) * 4,&lt;BR /&gt;Lag( ::Mean1, 1 ) * 1&lt;BR /&gt;) / 16&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will the formula look like this or I have to divide the Lag of weights 1 and 4 by 5 and so on?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:01:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37446#M21972</guid>
      <dc:creator>anandk</dc:creator>
      <dc:date>2017-03-22T15:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average and Weighted moving average on a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37449#M21974</link>
      <description>&lt;P&gt;For the cases where "Counter" is less than 5, you need to adjust the divisor down to the sum of the weights for each of those levels, so the code should look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :sample != Lag( :sample, 1 ) | Row() == 1,
	counter = 0
);
counter = counter + 1;
If(
	counter == 1, :Mean1,
	counter == 2, Mean( Lag( ::Mean1, 1 ) * 1, Lag( ::Mean1, 1 ) * 4 ) / 5,
	counter == 3, Mean( Lag( ::Mean1, 1 ) * 1, Lag( ::Mean1, 1 ) * 4, Lag( ::Mean1, 1 ) * 6 ) / 11,
	counter == 4,
		Mean( Lag( ::Mean1, 1 ) * 1, Lag( ::Mean1, 1 ) * 4, Lag( ::Mean1, 1 ) * 6, Lag( ::Mean1, 1 ) * 4 ) /
		15,
	Mean(
		Lag( ::Mean1, 1 ) * 1,
		Lag( ::Mean1, 1 ) * 4,
		Lag( ::Mean1, 1 ) * 6,
		Lag( ::Mean1, 1 ) * 4,
		Lag( ::Mean1, 1 ) * 1
	) / 16
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:27:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Moving-average-and-Weighted-moving-average-on-a-data-set/m-p/37449#M21974</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-22T15:27:45Z</dc:date>
    </item>
  </channel>
</rss>

