Prior moving averages

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Prior moving averages

Jignesh Sutar
Prior moving average (as it says on the tin) takes the averages of the previous n spans (excluding current) but is it possible to take into account the current value plus previous 3 if interested in 4 spans? No mention in CSR of this being possible. I could shift the values one down but then I am left with the very last row without a PMA score?


DATA LIST FREE / X PCT.
BEGIN DATA
1 20
2 65
3 15
4 45
5 42
6 23
7 65
8 55
9 75
END DATA.
FORMATS ALL (F2.0).
CREATE  /PCTRoll4=PMA(PCT, 4).
SHIFT VALUES VARIABLE=PCTRoll4 RESULT=PCTRoll4SV LEAD=1.


Thanks in advance,
Jignesh
Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

David Marso
Administrator
Or COMPUTE an appropriately weighted average of the PMA from CREATE and the current value.
;-)

eg SUM(PMA*.75,PCT*.25).

JSutar wrote
Prior moving average (as it says on the tin) takes the averages of the
previous n spans (excluding current) but is it possible to take into
account the current value plus previous 3 if interested in 4 spans? No
mention in CSR of this being possible. I could shift the values one down
but then I am left with the very last row without a PMA score?


DATA LIST FREE / X PCT.
BEGIN DATA
1 20
2 65
3 15
4 45
5 42
6 23
7 65
8 55
9 75
END DATA.
FORMATS ALL (F2.0).
CREATE  /PCTRoll4=PMA(PCT, 4).
SHIFT VALUES VARIABLE=PCTRoll4 RESULT=PCTRoll4SV LEAD=1.


Thanks in advance,
Jignesh
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

Jignesh Sutar
This gets me close (but isn't exact)  ideally I'd like to avoid introducing this source of error due to the calculation for the final end point. I'm surprised PMA doesn't allow the option to allow the current value in its span, is this how moving averages are commonly presented?


On 11 March 2014 12:44, David Marso <[hidden email]> wrote:
Or COMPUTE an appropriately weighted average of the PMA from CREATE and the
current value.
;-)

eg SUM(PMA*.75,PCT*.25).


JSutar wrote
> Prior moving average (as it says on the tin) takes the averages of the
> previous n spans (excluding current) but is it possible to take into
> account the current value plus previous 3 if interested in 4 spans? No
> mention in CSR of this being possible. I could shift the values one down
> but then I am left with the very last row without a PMA score?
>
>
> DATA LIST FREE / X PCT.
> BEGIN DATA
> 1 20
> 2 65
> 3 15
> 4 45
> 5 42
> 6 23
> 7 65
> 8 55
> 9 75
> END DATA.
> FORMATS ALL (F2.0).
> CREATE  /PCTRoll4=PMA(PCT, 4).
> SHIFT VALUES VARIABLE=PCTRoll4 RESULT=PCTRoll4SV LEAD=1.
>
>
> Thanks in advance,
> Jignesh





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

David Marso
Administrator
Please elaborate on 'error due to the calculation for the final end point'.  
PMA Prior moving average.  The word prior sticks out.

DEMO:

CREATE pma3score=PMA(score,3).
DO IF $CASENUM GT 3.
COMPUTE pma3reprod=MEAN(LAG(score,3),LAG(score,2),LAG(score,1)).
COMPUTE pma3LAGscore=MEAN(LAG(score,3),LAG(score,2),LAG(score,1),score).
COMPUTE pma3Compscore=SUM(pma3score*.75,score*.25).
COMPUTE delta=pma3Compscore-pma3LAGscore.
END IF.
FORMATS delta (F20.16).
DESCRIPTIVES delta / STATISTICS MIN MAX MEAN.



JSutar wrote
This gets me close (but isn't exact)  ideally I'd like to avoid introducing
this source of error due to the calculation for the final end point. I'm
surprised PMA doesn't allow the option to allow the current value in its
span, is this how moving averages are commonly presented?


On 11 March 2014 12:44, David Marso <[hidden email]> wrote:

> Or COMPUTE an appropriately weighted average of the PMA from CREATE and the
> current value.
> ;-)
>
> eg SUM(PMA*.75,PCT*.25).
>
>
> JSutar wrote
> > Prior moving average (as it says on the tin) takes the averages of the
> > previous n spans (excluding current) but is it possible to take into
> > account the current value plus previous 3 if interested in 4 spans? No
> > mention in CSR of this being possible. I could shift the values one down
> > but then I am left with the very last row without a PMA score?
> >
> >
> > DATA LIST FREE / X PCT.
> > BEGIN DATA
> > 1 20
> > 2 65
> > 3 15
> > 4 45
> > 5 42
> > 6 23
> > 7 65
> > 8 55
> > 9 75
> > END DATA.
> > FORMATS ALL (F2.0).
> > CREATE  /PCTRoll4=PMA(PCT, 4).
> > SHIFT VALUES VARIABLE=PCTRoll4 RESULT=PCTRoll4SV LEAD=1.
> >
> >
> > Thanks in advance,
> > Jignesh
>
>
>
>
>
> -----
> Please reply to the list and not to my personal email.
> Those desiring my consulting or training services please feel free to
> email me.
> ---
> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
> ne forte conculcent eas pedibus suis."
> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
> abyssum?"
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

Jignesh Sutar
Is it possible for AGGREGATE to return rows in the resulting dataset of empty cells that might occurs from the BREAK definition?

To put into context. I have longitudinal data which I am aggregating by time intervals and then using this to calculate weekly moving averages of a the last n data points i.e. last 4 weeks. However I am coming stuck when certain weeks are empty/zero cells and so for which a row is not generated. I could capture the same data using CTABLES and EMPTY=INCLUDE but just wanted to gauge if there may be a better solution before I resorted to this.


Thanks in advance.
Jignesh



On 11 March 2014 20:01, David Marso <[hidden email]> wrote:
Please elaborate on 'error due to the calculation for the final end point'.
PMA Prior moving average.  The word prior sticks out.

DEMO:

CREATE pma3score=PMA(score,3).
DO IF $CASENUM GT 3.
COMPUTE pma3reprod=MEAN(LAG(score,3),LAG(score,2),LAG(score,1)).
COMPUTE pma3LAGscore=MEAN(LAG(score,3),LAG(score,2),LAG(score,1),score).
COMPUTE pma3Compscore=SUM(pma3score*.75,score*.25).
COMPUTE delta=pma3Compscore-pma3LAGscore.
END IF.
FORMATS delta (F20.16).
DESCRIPTIVES delta / STATISTICS MIN MAX MEAN.




JSutar wrote
> This gets me close (but isn't exact)  ideally I'd like to avoid
> introducing
> this source of error due to the calculation for the final end point. I'm
> surprised PMA doesn't allow the option to allow the current value in its
> span, is this how moving averages are commonly presented?
>
>
> On 11 March 2014 12:44, David Marso &lt;

> david.marso@

> &gt; wrote:
>
>> Or COMPUTE an appropriately weighted average of the PMA from CREATE and
>> the
>> current value.
>> ;-)
>>
>> eg SUM(PMA*.75,PCT*.25).
>>
>>
>> JSutar wrote
>> > Prior moving average (as it says on the tin) takes the averages of the
>> > previous n spans (excluding current) but is it possible to take into
>> > account the current value plus previous 3 if interested in 4 spans? No
>> > mention in CSR of this being possible. I could shift the values one
>> down
>> > but then I am left with the very last row without a PMA score?
>> >
>> >
>> > DATA LIST FREE / X PCT.
>> > BEGIN DATA
>> > 1 20
>> > 2 65
>> > 3 15
>> > 4 45
>> > 5 42
>> > 6 23
>> > 7 65
>> > 8 55
>> > 9 75
>> > END DATA.
>> > FORMATS ALL (F2.0).
>> > CREATE  /PCTRoll4=PMA(PCT, 4).
>> > SHIFT VALUES VARIABLE=PCTRoll4 RESULT=PCTRoll4SV LEAD=1.
>> >
>> >
>> > Thanks in advance,
>> > Jignesh
>>
>>
>>
>>
>>
>> -----
>> Please reply to the list and not to my personal email.
>> Those desiring my consulting or training services please feel free to
>> email me.
>> ---
>> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante
>> porcos
>> ne forte conculcent eas pedibus suis."
>> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff
>> in
>> abyssum?"
>> --
>> View this message in context:
>> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html
>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>>

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
>> command. To leave the list, send the command
>> SIGNOFF SPSSX-L
>> For a list of commands to manage subscriptions, send the command
>> INFO REFCARD
>>





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724829.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

Art Kendall
Some time ago Jon Peck posted the syntax below.
Use use something like to create a dataset of whatever intervals you are interested in.
Use the match files procedure to make sure that all intervals are in your data.

(see "date and time functions" in <help>  to use something other than days.)

* from Jon Peck.
* create list of days in a range.
input program.
   loop #date = date.dmy(1, 3, 2009) TO date.dmy(31, 3, 2009) BY time.days
      (1).
      * Whatever date expressions are needed.
      compute x = #date.
      end case.
   end loop.
   end file.
end input program.
format x(adate12).
exec.




Art Kendall
Social Research Consultants
On 3/31/2014 5:44 PM, JSutar [via SPSSX Discussion] wrote:
Is it possible for AGGREGATE to return rows in the resulting dataset of empty cells that might occurs from the BREAK definition?

To put into context. I have longitudinal data which I am aggregating by time intervals and then using this to calculate weekly moving averages of a the last n data points i.e. last 4 weeks. However I am coming stuck when certain weeks are empty/zero cells and so for which a row is not generated. I could capture the same data using CTABLES and EMPTY=INCLUDE but just wanted to gauge if there may be a better solution before I resorted to this.


Thanks in advance.
Jignesh



On 11 March 2014 20:01, David Marso <[hidden email]> wrote:
Please elaborate on 'error due to the calculation for the final end point'.
PMA Prior moving average.  The word prior sticks out.

DEMO:

CREATE pma3score=PMA(score,3).
DO IF $CASENUM GT 3.
COMPUTE pma3reprod=MEAN(LAG(score,3),LAG(score,2),LAG(score,1)).
COMPUTE pma3LAGscore=MEAN(LAG(score,3),LAG(score,2),LAG(score,1),score).
COMPUTE pma3Compscore=SUM(pma3score*.75,score*.25).
COMPUTE delta=pma3Compscore-pma3LAGscore.
END IF.
FORMATS delta (F20.16).
DESCRIPTIVES delta / STATISTICS MIN MAX MEAN.




JSutar wrote
> This gets me close (but isn't exact)  ideally I'd like to avoid
> introducing
> this source of error due to the calculation for the final end point. I'm
> surprised PMA doesn't allow the option to allow the current value in its
> span, is this how moving averages are commonly presented?
>
>
> On 11 March 2014 12:44, David Marso &lt;

> david.marso@

> &gt; wrote:
>
>> Or COMPUTE an appropriately weighted average of the PMA from CREATE and
>> the
>> current value.
>> ;-)
>>
>> eg SUM(PMA*.75,PCT*.25).
>>
>>
>> JSutar wrote
>> > Prior moving average (as it says on the tin) takes the averages of the
>> > previous n spans (excluding current) but is it possible to take into
>> > account the current value plus previous 3 if interested in 4 spans? No
>> > mention in CSR of this being possible. I could shift the values one
>> down
>> > but then I am left with the very last row without a PMA score?
>> >
>> >
>> > DATA LIST FREE / X PCT.
>> > BEGIN DATA
>> > 1 20
>> > 2 65
>> > 3 15
>> > 4 45
>> > 5 42
>> > 6 23
>> > 7 65
>> > 8 55
>> > 9 75
>> > END DATA.
>> > FORMATS ALL (F2.0).
>> > CREATE  /PCTRoll4=PMA(PCT, 4).
>> > SHIFT VALUES VARIABLE=PCTRoll4 RESULT=PCTRoll4SV LEAD=1.
>> >
>> >
>> > Thanks in advance,
>> > Jignesh
>>
>>
>>
>>
>>
>> -----
>> Please reply to the list and not to my personal email.
>> Those desiring my consulting or training services please feel free to
>> email me.
>> ---
>> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante
>> porcos
>> ne forte conculcent eas pedibus suis."
>> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff
>> in
>> abyssum?"
>> --
>> View this message in context:
>> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html
>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>>

> [hidden email]

>  (not to SPSSX-L), with no body text except the
>> command. To leave the list, send the command
>> SIGNOFF SPSSX-L
>> For a list of commands to manage subscriptions, send the command
>> INFO REFCARD
>>





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724829.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD




If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5725133.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

David Marso
Administrator
Here's another similar path using MATRIX (this builds a fill from first date to last date by week).
DATA LIST LIST / DATE (ADATE) other_stuff (F1).
BEGIN DATA
01/01/2014 1
06/22/2014 2
08/23/2014 3
12/31/2014 4
END DATA.
DATASET NAME raw.
LIST.

DATASET DECLARE fill.
MATRIX .
GET D / FILE * / VARIABLES DATE.
SAVE (T({D(1):D(NROW(D)):(86400*7)}))/OUTFILE fill /VARIABLES Date.
END MATRIX.

MATCH FILES / FILE * / FILE Fill / BY date.
DATASET CLOSE fill.
EXECUTE.
DATASET ACTIVATE raw.


Art Kendall wrote
Some time ago Jon Peck
        posted the syntax below.
        Use use something like to create a dataset of whatever intervals
        you are interested in.
        Use the match files procedure to make sure that all intervals
        are in your data.
       
        (see "date and time functions" in <help>  to use something
        other than days.)
       
      * from Jon Peck.
          * create list of days in a range.
          input program.
             loop #date = date.dmy(1, 3, 2009) TO date.dmy(31, 3, 2009)
          BY time.days
                (1).
                * Whatever date expressions are needed.
                compute x = #date.
                end case.
             end loop.
             end file.
          end input program.
          format x(adate12).
          exec.
     
       
       
     
      Art Kendall
Social Research Consultants
      On 3/31/2014 5:44 PM, JSutar [via SPSSX Discussion] wrote:
   
   
      Is it possible for AGGREGATE to return rows in the
        resulting dataset of empty cells that might occurs from the
        BREAK definition?
       
       
        To put into context. I have longitudinal data which I am
          aggregating by time intervals and then using this to calculate
          weekly moving averages of a the last n data points i.e. last 4
          weeks. However I am coming stuck when certain weeks are
          empty/zero cells and so for which a row is not generated. I
          could capture the same data using CTABLES and EMPTY=INCLUDE
          but just wanted to gauge if there may be a better solution
          before I resorted to this.
       
       
       
       
        Thanks in advance.
        Jignesh
       
       
       
         
          On 11 March 2014 20:01, David Marso < [hidden
                email] > wrote:
            Please elaborate on 'error due to
              the calculation for the final end point'.
              PMA Prior moving average.  The word prior sticks out.
             
              DEMO:
             
              CREATE pma3score=PMA(score,3).
              DO IF $CASENUM GT 3.
              COMPUTE
              pma3reprod=MEAN(LAG(score,3),LAG(score,2),LAG(score,1)).
              COMPUTE
              pma3LAGscore=MEAN(LAG(score,3),LAG(score,2),LAG(score,1),score).
              COMPUTE pma3Compscore=SUM(pma3score*.75,score*.25).
              COMPUTE delta=pma3Compscore-pma3LAGscore.
              END IF.
              FORMATS delta (F20.16).
              DESCRIPTIVES delta / STATISTICS MIN MAX MEAN.
             
             
             
             
              JSutar wrote
              > This gets me close (but isn't exact)  ideally
                I'd like to avoid
                > introducing
                > this source of error due to the calculation for the
                final end point. I'm
                > surprised PMA doesn't allow the option to allow the
                current value in its
                > span, is this how moving averages are commonly
                presented?
                >
                >
             
              > On 11 March 2014 12:44, David Marso &lt;
             
              > david.marso@
             
               
                  > &gt; wrote:
                  >
                  >> Or COMPUTE an appropriately weighted average
                  of the PMA from CREATE and
                  >> the
                  >> current value.
                  >> ;-)
                  >>
                  >> eg SUM(PMA*.75,PCT*.25).
                  >>
                  >>
                  >> JSutar wrote
                  >> > Prior moving average (as it says on the
                  tin) takes the averages of the
                  >> > previous n spans (excluding current) but
                  is it possible to take into
                  >> > account the current value plus previous
                  3 if interested in 4 spans? No
                  >> > mention in CSR of this being possible. I
                  could shift the values one
                  >> down
                  >> > but then I am left with the very last
                  row without a PMA score?
                  >> >
                  >> >
                  >> > DATA LIST FREE / X PCT.
                  >> > BEGIN DATA
                  >> > 1 20
                  >> > 2 65
                  >> > 3 15
                  >> > 4 45
                  >> > 5 42
                  >> > 6 23
                  >> > 7 65
                  >> > 8 55
                  >> > 9 75
                  >> > END DATA.
                  >> > FORMATS ALL (F2.0).
                  >> > CREATE  /PCTRoll4=PMA(PCT, 4).
                  >> > SHIFT VALUES VARIABLE=PCTRoll4
                  RESULT=PCTRoll4SV LEAD=1.
                  >> >
                  >> >
                  >> > Thanks in advance,
                  >> > Jignesh
                  >>
                  >>
                  >>
                  >>
                  >>
                  >> -----
                  >> Please reply to the list and not to my
                  personal email.
                  >> Those desiring my consulting or training
                  services please feel free to
                  >> email me.
                  >> ---
                  >> "Nolite dare sanctum canibus neque mittatis
                  margaritas vestras ante
                  >> porcos
                  >> ne forte conculcent eas pedibus suis."
                  >> Cum es damnatorum possederunt porcos iens ut
                  salire off sanguinum cliff
                  >> in
                  >> abyssum?"
                  >> --
                  >> View this message in context:
                  >> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html 
                  >> Sent from the SPSSX Discussion mailing list
                  archive at Nabble.com.
                  >>
                  >> =====================
                  >> To manage your subscription to SPSSX-L, send
                  a message to
                  >>
                 
               
             
              > LISTSERV@.UGA
             
                >  (not to SPSSX-L), with no body text except the
                >> command. To leave the list, send the command
                >> SIGNOFF SPSSX-L
                >> For a list of commands to manage subscriptions,
                send the command
                >> INFO REFCARD
                >>
               
               
               
               
               
             
              -----
                Please reply to the list and not to my personal email.
                Those desiring my consulting or training services please
                feel free to email me.
                ---
                "Nolite dare sanctum canibus neque mittatis margaritas
                vestras ante porcos ne forte conculcent eas pedibus
                suis."
                Cum es damnatorum possederunt porcos iens ut salire off
                sanguinum cliff in abyssum?"
                --
             
              View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724829.html 
             
                Sent from the SPSSX Discussion mailing list archive
                  at Nabble.com.
                 
                  =====================
                  To manage your subscription to SPSSX-L, send a message
                  to
                  [hidden
                    email]  (not to SPSSX-L), with no body text
                  except the
                  command. To leave the list, send the command
                  SIGNOFF SPSSX-L
                  For a list of commands to manage subscriptions, send
                  the command
                  INFO REFCARD
               
             
           
         
         
       
     
     
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5725133.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

Jignesh Sutar-3
I don't necessarily have data in date format but simply a consecutive number to indicate previous 100+ weeks (past couple of years). It's not the weeks that are missing in the raw data but when I aggregate to get scores per week that certain weeks are lost at the aggregated level. I think I understand conceptually what both codes are trying to do. I'm not sure how they will help me if not having date information. 

On Tuesday, 1 April 2014, David Marso <[hidden email]> wrote:
Here's another similar path using MATRIX (this builds a fill from first date
to last date by week).
DATA LIST LIST / DATE (ADATE) other_stuff (F1).
BEGIN DATA
01/01/2014 1
06/22/2014 2
08/23/2014 3
12/31/2014 4
END DATA.
DATASET NAME raw.
LIST.

DATASET DECLARE fill.
MATRIX .
GET D / FILE * / VARIABLES DATE.
SAVE (T({D(1):D(NROW(D)):(86400*7)}))/OUTFILE fill /VARIABLES Date.
END MATRIX.

MATCH FILES / FILE * / FILE Fill / BY date.
DATASET CLOSE fill.
EXECUTE.
DATASET ACTIVATE raw.



Art Kendall wrote
> Some time ago Jon Peck
>         posted the syntax below.
>         Use use something like to create a dataset of whatever intervals
>         you are interested in.
>         Use the match files procedure to make sure that all intervals
>         are in your data.
>
>         (see "date and time functions" in &lt;help&gt;Â  to use something
>         other than days.)
>
>       * from Jon Peck.
>           * create list of days in a range.
>           input program.
>           Â Â  loop #date = date.dmy(1, 3, 2009) TO date.dmy(31, 3, 2009)
>           BY time.days
>           Â Â Â Â Â  (1).
>           Â Â Â Â Â  * Whatever date expressions are needed.
>           Â Â Â Â Â  compute x = #date.
>           Â Â Â Â Â  end case.
>           Â Â  end loop.
>           Â Â  end file.
>           end input program.
>           format x(adate12).
>           exec.
>
>
>
>
>       Art Kendall
> Social Research Consultants
>       On 3/31/2014 5:44 PM, JSutar [via SPSSX Discussion] wrote:
>
>
>       Is it possible for AGGREGATE to return rows in the
>         resulting dataset of empty cells that might occurs from the
>         BREAK definition?
>
>
>         To put into context. I have longitudinal data which I am
>           aggregating by time intervals and then using this to calculate
>           weekly moving averages of a the last n data points i.e. last 4
>           weeks. However I am coming stuck when certain weeks are
>           empty/zero cells and so for which a row is not generated. I
>           could capture the same data using CTABLES and EMPTY=INCLUDE
>           but just wanted to gauge if there may be a better solution
>           before I resorted to this.
>
>
>
>
>         Thanks in advance.
>         Jignesh
>
>
>
>
>           On 11 March 2014 20:01, David Marso &lt; [hidden
>                 email] &gt; wrote:
>             Please elaborate on 'error due to
>               the calculation for the final end point'.
>               PMA Prior moving average. Â The word prior sticks out.
>
>               DEMO:
>
>               CREATE pma3score=PMA(score,3).
>               DO IF $CASENUM GT 3.
>               COMPUTE
>               pma3reprod=MEAN(LAG(score,3),LAG(score,2),LAG(score,1)).
>               COMPUTE
>
> pma3LAGscore=MEAN(LAG(score,3),LAG(score,2),LAG(score,1),score).
>               COMPUTE pma3Compscore=SUM(pma3score*.75,score*.25).
>               COMPUTE delta=pma3Compscore-pma3LAGscore.
>               END IF.
>               FORMATS delta (F20.16).
>               DESCRIPTIVES delta / STATISTICS MIN MAX MEAN.
>
>
>
>
>               JSutar wrote
>               &gt; This gets me close (but isn't exact) Â ideally
>                 I'd like to avoid
>                 &gt; introducing
>                 &gt; this source of error due to the calculation for the
>                 final end point. I'm
>                 &gt; surprised PMA doesn't allow the option to allow the
>                 current value in its
>                 &gt; span, is this how moving averages are commonly
>                 presented?
>                 &gt;
>                 &gt;
>
>               &gt; On 11 March 2014 12:44, David Marso &amp;lt;
>
>               &gt; david.marso@
>
>
>                   &gt; &amp;gt; wrote:
>                   &gt;
>                   &gt;&gt; Or COMPUTE an appropriately weighted average
>                   of the PMA from CREATE and
>                   &gt;&gt; the
>                   &gt;&gt; current value.
>                   &gt;&gt; ;-)
>                   &gt;&gt;
>                   &gt;&gt; eg SUM(PMA*.75,PCT*.25).
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt; JSutar wrote
>                   &gt;&gt; &gt; Prior moving average (as it says on the
>                   tin) takes the averages of the
>                   &gt;&gt; &gt; previous n spans (excluding current) but
>                   is it possible to take into
>                   &gt;&gt; &gt; account the current value plus previous
>                   3 if interested in 4 spans? No
>                   &gt;&gt; &gt; mention in CSR of this being possible. I
>                   could shift the values one
>                   &gt;&gt; down
>                   &gt;&gt; &gt; but then I am left with the very last
>                   row without a PMA score?
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt; DATA LIST FREE / X PCT.
>                   &gt;&gt; &gt; BEGIN DATA
>                   &gt;&gt; &gt; 1 20
>                   &gt;&gt; &gt; 2 65
>                   &gt;&gt; &gt; 3 15
>                   &gt;&gt; &gt; 4 45
>                   &gt;&gt; &gt; 5 42
>                   &gt;&gt; &gt; 6 23
>                   &gt;&gt; &gt; 7 65
>                   &gt;&gt; &gt; 8 55
>                   &gt;&gt; &gt; 9 75
>                   &gt;&gt; &gt; END DATA.
>                   &gt;&gt; &gt; FORMATS ALL (F2.0).
>                   &gt;&gt; &gt; CREATE Â /PCTRoll4=PMA(PCT, 4).
>                   &gt;&gt; &gt; SHIFT VALUES VARIABLE=PCTRoll4
>                   RESULT=PCTRoll4SV LEAD=1.
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt; Thanks in advance,
>                   &gt;&gt; &gt; Jignesh
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt; -----
>                   &gt;&gt; Please reply to the list and not to my
>                   personal email.
>                   &gt;&gt; Those desiring my consulting or training
>                   services please feel free to
>                   &gt;&gt; email me.
>                   &gt;&gt; ---
>                   &gt;&gt; "Nolite dare sanctum canibus neque mittatis
>                   margaritas vestras ante
>                   &gt;&gt; porcos
>                   &gt;&gt; ne forte conculcent eas pedibus suis."
>                   &gt;&gt; Cum es damnatorum possederunt porcos iens ut
>                   salire off sanguinum cliff
>                   &gt;&gt; in
>                   &gt;&gt; abyssum?"
>                   &gt;&gt; --
>                   &gt;&gt; View this message in context:
>                   &gt;&gt;
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html
>                   &gt;&gt; Sent from the SPSSX Discussion mailing list
>                   archive at Nabble.com.
>                   &gt;&gt;
>                   &gt;&gt; =====================
>                   &gt;&gt; To manage your subscription to SPSSX-L, send
>                   a message to
>                   &gt;&gt;
>
>
>
>               &gt; LISTSERV@.UGA
>
>                 &gt; Â (not to SPSSX-L), with no body text except the
>                 &gt;&gt; command. To leave the list, send the command
>                 &gt;&gt; SIGNOFF SPSSX-L
>                 &gt;&gt; For a list of commands to manage subscriptions,
>                 send the command
>                 &gt;&gt; INFO REFCARD
>                 &gt;&gt;
>
>
>
>
>
>
>               -----
>                 Please reply to the list and not to my personal email.
>                 Those desiring my consulting or training services please
>                 feel free to email me.
>                 ---
>                 "Nolite dare sanctum canibus neque mittatis margaritas
>                 vestras ante porcos ne forte conculcent eas pedibus
>                 suis."
>                 Cum es damnatorum possederunt porcos iens ut salire off
>                 sanguinum cliff in abyssum?"
>                 --
>
>               View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724829.html
>
>                 Sent from the SPSSX Discussion mailing list archive
>                   at Nabble.com.
>
>                   =====================
>                   To manage your subscription to SPSSX-L, send a message
>                   to
>                   [hidden
>                     email]  (not to SPSSX-L), with no body text
>                   except the
>                   command. To leave the list, send the command
>                   SIGNOFF SPSSX-L
>                   For a list of commands to manage subscriptions, send
>                   the command
>                   INFO REFCARD
>
>
>
>
>
>
>
>
>
>
>
>         If you reply to this email, your
>           message will be added to the discussion below:
>
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5725133.html
>
>
>         To start a new topic under SPSSX Discussion, email
>

> ml-node+s1045642n1068821h68@.nabble

>
>         To unsubscribe from SPSSX Discussion, click
>           here .
>         NAML





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-Sentnn
Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

David Marso
Administrator
Maybe time to start from scratch and detail why/what the exact problem is so we don't waste any more time cobbling solutions predicated on incomplete information!~!!


On Wed, Apr 2, 2014 at 1:19 PM, Jignesh Sutar [via SPSSX Discussion] <[hidden email]> wrote:
I don't necessarily have data in date format but simply a consecutive number to indicate previous 100+ weeks (past couple of years). It's not the weeks that are missing in the raw data but when I aggregate to get scores per week that certain weeks are lost at the aggregated level. I think I understand conceptually what both codes are trying to do. I'm not sure how they will help me if not having date information. 


On Tuesday, 1 April 2014, David Marso <[hidden email]> wrote:
Here's another similar path using MATRIX (this builds a fill from first date
to last date by week).
DATA LIST LIST / DATE (ADATE) other_stuff (F1).
BEGIN DATA
01/01/2014 1
06/22/2014 2
08/23/2014 3
12/31/2014 4
END DATA.
DATASET NAME raw.
LIST.

DATASET DECLARE fill.
MATRIX .
GET D / FILE * / VARIABLES DATE.
SAVE (T({D(1):D(NROW(D)):(86400*7)}))/OUTFILE fill /VARIABLES Date.
END MATRIX.

MATCH FILES / FILE * / FILE Fill / BY date.
DATASET CLOSE fill.
EXECUTE.
DATASET ACTIVATE raw.



Art Kendall wrote
> Some time ago Jon Peck
>         posted the syntax below.
>         Use use something like to create a dataset of whatever intervals
>         you are interested in.
>         Use the match files procedure to make sure that all intervals
>         are in your data.
>
>         (see "date and time functions" in &lt;help&gt;Â  to use something

>         other than days.)
>
>       * from Jon Peck.
>           * create list of days in a range.
>           input program.
>           Â Â  loop #date = date.dmy(1, 3, 2009) TO date.dmy(31, 3, 2009)
>           BY time.days
>           Â Â Â Â Â  (1).
>           Â Â Â Â Â  * Whatever date expressions are needed.
>           Â Â Â Â Â  compute x = #date.
>           Â Â Â Â Â  end case.
>           Â Â  end loop.
>           Â Â  end file.

>           end input program.
>           format x(adate12).
>           exec.
>
>
>
>
>       Art Kendall
> Social Research Consultants
>       On 3/31/2014 5:44 PM, JSutar [via SPSSX Discussion] wrote:
>
>
>       Is it possible for AGGREGATE to return rows in the
>         resulting dataset of empty cells that might occurs from the
>         BREAK definition?
>
>
>         To put into context. I have longitudinal data which I am
>           aggregating by time intervals and then using this to calculate
>           weekly moving averages of a the last n data points i.e. last 4
>           weeks. However I am coming stuck when certain weeks are
>           empty/zero cells and so for which a row is not generated. I
>           could capture the same data using CTABLES and EMPTY=INCLUDE
>           but just wanted to gauge if there may be a better solution
>           before I resorted to this.
>
>
>
>
>         Thanks in advance.
>         Jignesh
>
>
>
>
>           On 11 March 2014 20:01, David Marso &lt; [hidden

>                 email] &gt; wrote:
>             Please elaborate on 'error due to
>               the calculation for the final end point'.
>               PMA Prior moving average. Â The word prior sticks out.

>
>               DEMO:
>
>               CREATE pma3score=PMA(score,3).
>               DO IF $CASENUM GT 3.
>               COMPUTE
>               pma3reprod=MEAN(LAG(score,3),LAG(score,2),LAG(score,1)).
>               COMPUTE
>
> pma3LAGscore=MEAN(LAG(score,3),LAG(score,2),LAG(score,1),score).
>               COMPUTE pma3Compscore=SUM(pma3score*.75,score*.25).
>               COMPUTE delta=pma3Compscore-pma3LAGscore.
>               END IF.
>               FORMATS delta (F20.16).
>               DESCRIPTIVES delta / STATISTICS MIN MAX MEAN.
>
>
>
>
>               JSutar wrote
>               &gt; This gets me close (but isn't exact) Â ideally

>                 I'd like to avoid
>                 &gt; introducing
>                 &gt; this source of error due to the calculation for the

>                 final end point. I'm
>                 &gt; surprised PMA doesn't allow the option to allow the
>                 current value in its
>                 &gt; span, is this how moving averages are commonly
>                 presented?
>                 &gt;
>                 &gt;
>
>               &gt; On 11 March 2014 12:44, David Marso &amp;lt;
>
>               &gt; david.marso@
>
>
>                   &gt; &amp;gt; wrote:
>                   &gt;
>                   &gt;&gt; Or COMPUTE an appropriately weighted average

>                   of the PMA from CREATE and
>                   &gt;&gt; the
>                   &gt;&gt; current value.
>                   &gt;&gt; ;-)
>                   &gt;&gt;
>                   &gt;&gt; eg SUM(PMA*.75,PCT*.25).
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt; JSutar wrote
>                   &gt;&gt; &gt; Prior moving average (as it says on the

>                   tin) takes the averages of the
>                   &gt;&gt; &gt; previous n spans (excluding current) but

>                   is it possible to take into
>                   &gt;&gt; &gt; account the current value plus previous

>                   3 if interested in 4 spans? No
>                   &gt;&gt; &gt; mention in CSR of this being possible. I

>                   could shift the values one
>                   &gt;&gt; down
>                   &gt;&gt; &gt; but then I am left with the very last

>                   row without a PMA score?
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt; DATA LIST FREE / X PCT.
>                   &gt;&gt; &gt; BEGIN DATA
>                   &gt;&gt; &gt; 1 20
>                   &gt;&gt; &gt; 2 65
>                   &gt;&gt; &gt; 3 15
>                   &gt;&gt; &gt; 4 45
>                   &gt;&gt; &gt; 5 42
>                   &gt;&gt; &gt; 6 23
>                   &gt;&gt; &gt; 7 65
>                   &gt;&gt; &gt; 8 55
>                   &gt;&gt; &gt; 9 75
>                   &gt;&gt; &gt; END DATA.
>                   &gt;&gt; &gt; FORMATS ALL (F2.0).
>                   &gt;&gt; &gt; CREATE Â /PCTRoll4=PMA(PCT, 4).
>                   &gt;&gt; &gt; SHIFT VALUES VARIABLE=PCTRoll4
>                   RESULT=PCTRoll4SV LEAD=1.
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt; Thanks in advance,
>                   &gt;&gt; &gt; Jignesh
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt; -----
>                   &gt;&gt; Please reply to the list and not to my
>                   personal email.
>                   &gt;&gt; Those desiring my consulting or training

>                   services please feel free to
>                   &gt;&gt; email me.
>                   &gt;&gt; ---
>                   &gt;&gt; "Nolite dare sanctum canibus neque mittatis
>                   margaritas vestras ante
>                   &gt;&gt; porcos
>                   &gt;&gt; ne forte conculcent eas pedibus suis."
>                   &gt;&gt; Cum es damnatorum possederunt porcos iens ut
>                   salire off sanguinum cliff
>                   &gt;&gt; in
>                   &gt;&gt; abyssum?"
>                   &gt;&gt; --
>                   &gt;&gt; View this message in context:
>                   &gt;&gt;
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html
>                   &gt;&gt; Sent from the SPSSX Discussion mailing list
>                   archive at Nabble.com.
>                   &gt;&gt;
>                   &gt;&gt; =====================
>                   &gt;&gt; To manage your subscription to SPSSX-L, send
>                   a message to
>                   &gt;&gt;
>
>
>
>               &gt; LISTSERV@.UGA
>
>                 &gt; Â (not to SPSSX-L), with no body text except the
>                 &gt;&gt; command. To leave the list, send the command
>                 &gt;&gt; SIGNOFF SPSSX-L
>                 &gt;&gt; For a list of commands to manage subscriptions,
>                 send the command
>                 &gt;&gt; INFO REFCARD
>                 &gt;&gt;

>
>
>
>
>
>
>               -----
>                 Please reply to the list and not to my personal email.
>                 Those desiring my consulting or training services please
>                 feel free to email me.
>                 ---
>                 "Nolite dare sanctum canibus neque mittatis margaritas
>                 vestras ante porcos ne forte conculcent eas pedibus
>                 suis."
>                 Cum es damnatorum possederunt porcos iens ut salire off
>                 sanguinum cliff in abyssum?"
>                 --
>
>               View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724829.html
>
>                 Sent from the SPSSX Discussion mailing list archive
>                   at Nabble.com.
>
>                   =====================
>                   To manage your subscription to SPSSX-L, send a message
>                   to
>                   [hidden
>                     email]  (not to SPSSX-L), with no body text
>                   except the
>                   command. To leave the list, send the command
>                   SIGNOFF SPSSX-L
>                   For a list of commands to manage subscriptions, send
>                   the command
>                   INFO REFCARD
>
>
>
>
>
>
>
>
>
>
>
>         If you reply to this email, your
>           message will be added to the discussion below:
>
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5725133.html
>
>
>         To start a new topic under SPSSX Discussion, email
>

> ml-node+s1045642n1068821h68@.nabble


>
>         To unsubscribe from SPSSX Discussion, click
>           here .
>         NAML





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-Sentnn



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5725181.html
To unsubscribe from Prior moving averages, click here.
NAML

Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Prior moving averages

David Marso
Administrator
In reply to this post by Jignesh Sutar-3
Please direct all replies to the list rather than to my email! 
I believe my signature is quite clear in that regard.


On Wed, Apr 2, 2014 at 1:56 PM, David Marso <[hidden email]> wrote:
Maybe time to start from scratch and detail why/what the exact problem is so we don't waste any more time cobbling solutions predicated on incomplete information!~!!


On Wed, Apr 2, 2014 at 1:19 PM, Jignesh Sutar [via SPSSX Discussion] <[hidden email]> wrote:
I don't necessarily have data in date format but simply a consecutive number to indicate previous 100+ weeks (past couple of years). It's not the weeks that are missing in the raw data but when I aggregate to get scores per week that certain weeks are lost at the aggregated level. I think I understand conceptually what both codes are trying to do. I'm not sure how they will help me if not having date information. 


On Tuesday, 1 April 2014, David Marso <[hidden email]> wrote:
Here's another similar path using MATRIX (this builds a fill from first date
to last date by week).
DATA LIST LIST / DATE (ADATE) other_stuff (F1).
BEGIN DATA
01/01/2014 1
06/22/2014 2
08/23/2014 3
12/31/2014 4
END DATA.
DATASET NAME raw.
LIST.

DATASET DECLARE fill.
MATRIX .
GET D / FILE * / VARIABLES DATE.
SAVE (T({D(1):D(NROW(D)):(86400*7)}))/OUTFILE fill /VARIABLES Date.
END MATRIX.

MATCH FILES / FILE * / FILE Fill / BY date.
DATASET CLOSE fill.
EXECUTE.
DATASET ACTIVATE raw.



Art Kendall wrote
> Some time ago Jon Peck
>         posted the syntax below.
>         Use use something like to create a dataset of whatever intervals
>         you are interested in.
>         Use the match files procedure to make sure that all intervals
>         are in your data.
>
>         (see "date and time functions" in &lt;help&gt;Â  to use something

>         other than days.)
>
>       * from Jon Peck.
>           * create list of days in a range.
>           input program.
>           Â Â  loop #date = date.dmy(1, 3, 2009) TO date.dmy(31, 3, 2009)
>           BY time.days
>           Â Â Â Â Â  (1).
>           Â Â Â Â Â  * Whatever date expressions are needed.
>           Â Â Â Â Â  compute x = #date.
>           Â Â Â Â Â  end case.
>           Â Â  end loop.
>           Â Â  end file.

>           end input program.
>           format x(adate12).
>           exec.
>
>
>
>
>       Art Kendall
> Social Research Consultants
>       On 3/31/2014 5:44 PM, JSutar [via SPSSX Discussion] wrote:
>
>
>       Is it possible for AGGREGATE to return rows in the
>         resulting dataset of empty cells that might occurs from the
>         BREAK definition?
>
>
>         To put into context. I have longitudinal data which I am
>           aggregating by time intervals and then using this to calculate
>           weekly moving averages of a the last n data points i.e. last 4
>           weeks. However I am coming stuck when certain weeks are
>           empty/zero cells and so for which a row is not generated. I
>           could capture the same data using CTABLES and EMPTY=INCLUDE
>           but just wanted to gauge if there may be a better solution
>           before I resorted to this.
>
>
>
>
>         Thanks in advance.
>         Jignesh
>
>
>
>
>           On 11 March 2014 20:01, David Marso &lt; [hidden

>                 email] &gt; wrote:
>             Please elaborate on 'error due to
>               the calculation for the final end point'.
>               PMA Prior moving average. Â The word prior sticks out.

>
>               DEMO:
>
>               CREATE pma3score=PMA(score,3).
>               DO IF $CASENUM GT 3.
>               COMPUTE
>               pma3reprod=MEAN(LAG(score,3),LAG(score,2),LAG(score,1)).
>               COMPUTE
>
> pma3LAGscore=MEAN(LAG(score,3),LAG(score,2),LAG(score,1),score).
>               COMPUTE pma3Compscore=SUM(pma3score*.75,score*.25).
>               COMPUTE delta=pma3Compscore-pma3LAGscore.
>               END IF.
>               FORMATS delta (F20.16).
>               DESCRIPTIVES delta / STATISTICS MIN MAX MEAN.
>
>
>
>
>               JSutar wrote
>               &gt; This gets me close (but isn't exact) Â ideally

>                 I'd like to avoid
>                 &gt; introducing
>                 &gt; this source of error due to the calculation for the

>                 final end point. I'm
>                 &gt; surprised PMA doesn't allow the option to allow the
>                 current value in its
>                 &gt; span, is this how moving averages are commonly
>                 presented?
>                 &gt;
>                 &gt;
>
>               &gt; On 11 March 2014 12:44, David Marso &amp;lt;
>
>               &gt; david.marso@
>
>
>                   &gt; &amp;gt; wrote:
>                   &gt;
>                   &gt;&gt; Or COMPUTE an appropriately weighted average

>                   of the PMA from CREATE and
>                   &gt;&gt; the
>                   &gt;&gt; current value.
>                   &gt;&gt; ;-)
>                   &gt;&gt;
>                   &gt;&gt; eg SUM(PMA*.75,PCT*.25).
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt; JSutar wrote
>                   &gt;&gt; &gt; Prior moving average (as it says on the

>                   tin) takes the averages of the
>                   &gt;&gt; &gt; previous n spans (excluding current) but

>                   is it possible to take into
>                   &gt;&gt; &gt; account the current value plus previous

>                   3 if interested in 4 spans? No
>                   &gt;&gt; &gt; mention in CSR of this being possible. I

>                   could shift the values one
>                   &gt;&gt; down
>                   &gt;&gt; &gt; but then I am left with the very last

>                   row without a PMA score?
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt; DATA LIST FREE / X PCT.
>                   &gt;&gt; &gt; BEGIN DATA
>                   &gt;&gt; &gt; 1 20
>                   &gt;&gt; &gt; 2 65
>                   &gt;&gt; &gt; 3 15
>                   &gt;&gt; &gt; 4 45
>                   &gt;&gt; &gt; 5 42
>                   &gt;&gt; &gt; 6 23
>                   &gt;&gt; &gt; 7 65
>                   &gt;&gt; &gt; 8 55
>                   &gt;&gt; &gt; 9 75
>                   &gt;&gt; &gt; END DATA.
>                   &gt;&gt; &gt; FORMATS ALL (F2.0).
>                   &gt;&gt; &gt; CREATE Â /PCTRoll4=PMA(PCT, 4).
>                   &gt;&gt; &gt; SHIFT VALUES VARIABLE=PCTRoll4
>                   RESULT=PCTRoll4SV LEAD=1.
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt;
>                   &gt;&gt; &gt; Thanks in advance,
>                   &gt;&gt; &gt; Jignesh
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt;
>                   &gt;&gt; -----
>                   &gt;&gt; Please reply to the list and not to my
>                   personal email.
>                   &gt;&gt; Those desiring my consulting or training

>                   services please feel free to
>                   &gt;&gt; email me.
>                   &gt;&gt; ---
>                   &gt;&gt; "Nolite dare sanctum canibus neque mittatis
>                   margaritas vestras ante
>                   &gt;&gt; porcos
>                   &gt;&gt; ne forte conculcent eas pedibus suis."
>                   &gt;&gt; Cum es damnatorum possederunt porcos iens ut
>                   salire off sanguinum cliff
>                   &gt;&gt; in
>                   &gt;&gt; abyssum?"
>                   &gt;&gt; --
>                   &gt;&gt; View this message in context:
>                   &gt;&gt;
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724821.html
>                   &gt;&gt; Sent from the SPSSX Discussion mailing list
>                   archive at Nabble.com.
>                   &gt;&gt;
>                   &gt;&gt; =====================
>                   &gt;&gt; To manage your subscription to SPSSX-L, send
>                   a message to
>                   &gt;&gt;
>
>
>
>               &gt; LISTSERV@.UGA
>
>                 &gt; Â (not to SPSSX-L), with no body text except the
>                 &gt;&gt; command. To leave the list, send the command
>                 &gt;&gt; SIGNOFF SPSSX-L
>                 &gt;&gt; For a list of commands to manage subscriptions,
>                 send the command
>                 &gt;&gt; INFO REFCARD
>                 &gt;&gt;

>
>
>
>
>
>
>               -----
>                 Please reply to the list and not to my personal email.
>                 Those desiring my consulting or training services please
>                 feel free to email me.
>                 ---
>                 "Nolite dare sanctum canibus neque mittatis margaritas
>                 vestras ante porcos ne forte conculcent eas pedibus
>                 suis."
>                 Cum es damnatorum possederunt porcos iens ut salire off
>                 sanguinum cliff in abyssum?"
>                 --
>
>               View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5724829.html
>
>                 Sent from the SPSSX Discussion mailing list archive
>                   at Nabble.com.
>
>                   =====================
>                   To manage your subscription to SPSSX-L, send a message
>                   to
>                   [hidden
>                     email]  (not to SPSSX-L), with no body text
>                   except the
>                   command. To leave the list, send the command
>                   SIGNOFF SPSSX-L
>                   For a list of commands to manage subscriptions, send
>                   the command
>                   INFO REFCARD
>
>
>
>
>
>
>
>
>
>
>
>         If you reply to this email, your
>           message will be added to the discussion below:
>
> http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5725133.html
>
>
>         To start a new topic under SPSSX Discussion, email
>

> ml-node+s1045642n1068821h68@.nabble


>
>         To unsubscribe from SPSSX Discussion, click
>           here .
>         NAML





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-Sentnn



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/Prior-moving-averages-tp5724819p5725181.html
To unsubscribe from Prior moving averages, click here.
NAML


Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"