WEIGHT

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

WEIGHT

DEBOER
Hi guys!

Im using create function and PMA to calculate a moving sum.
 create v2=PMA(v1,3).
compute v2=v2*3.
 v2 is the moving sum of v1.


I want to weight v1 in v3 how can I do so?

ex

v1    v2    v3

1
2
3
4     6      (1*1+2*2+3*3)=8
5     9      (2*1+3*2+4*3)=20
6     12    (3*1+4*2+5*3)=26
7     15    and so on
8     18
9     21


v3 is a moving weigtning of v1 for that last 3 cases

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

Re: WEIGHT

David Marso
Administrator
Please consult the documentation for the LAG function.
--
DEBOER wrote
Hi guys!

Im using create function and PMA to calculate a moving sum.
 create v2=PMA(v1,3).
compute v2=v2*3.
 v2 is the moving sum of v1.


I want to weight v1 in v3 how can I do so?

ex

v1    v2    v3

1
2
3
4     6      (1*1+2*2+3*3)=8
5     9      (2*1+3*2+4*3)=20
6     12    (3*1+4*2+5*3)=26
7     15    and so on
8     18
9     21


v3 is a moving weigtning of v1 for that last 3 cases

Thanks in advance
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: WEIGHT

David Marso
Administrator
"v2 is the moving sum of v1."
Not exactly, Moving SUM includes the current value.  PMA stands for Prior Moving Average so what you have would probably be called a Prior Moving Sum.
Anyhow Try:

IF ($CASENUM GE 3)
               PMS_3=
               SUM(Lag(v1,1)*3,
                       Lag(V1,2)*2,
                       Lag(V1,3)*1
                      ).

HTH, David
David Marso wrote
Please consult the documentation for the LAG function.
--
DEBOER wrote
Hi guys!

Im using create function and PMA to calculate a moving sum.
 create v2=PMA(v1,3).
compute v2=v2*3.
 v2 is the moving sum of v1.


I want to weight v1 in v3 how can I do so?

ex

v1    v2    v3

1
2
3
4     6      (1*1+2*2+3*3)=8
5     9      (2*1+3*2+4*3)=20
6     12    (3*1+4*2+5*3)=26
7     15    and so on
8     18
9     21


v3 is a moving weigtning of v1 for that last 3 cases

Thanks in advance
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
|

Automatic reply: WEIGHT

Mikki Haegle

I am off enjoying my vacation this week.

I will return on July 6th and will respond to message once I get back.

 

~M

 

 

 

 

Mikki Haegle

Psychology Lab Coordinator

700 E 7th Street, NM-L202

St Paul, MN 55106

651.793.1354