identify cycle

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

identify cycle

Javier Meneses
GDP s (idcycle)
0 1
0 1
0 1
0 1
0 1
0 1
0 1
1 1
0 0
0 0
-1 0
0 1
0 1
0 1

Hi, I need generate a variable to idetify cycles GDP like in the above example. Put 1 when GDP was growing  (0-1) including the point break, and 0 when GDP was decreasing (0-(1)).

Any ideas?? 

   Javier.
===================== 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: identify cycle

Maguin, Eugene

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of javier meneses
Sent: Friday, May 22, 2015 12:56 PM
To: [hidden email]
Subject: identify cycle

 

GDP    s (idcycle)

0          1     ---

0          1      |  why is this set of gdp=0 coded as ‘1’

0          1      |

0          1      |

0          1      |

0          1      |

0          1     --

1          1

0          0      |    but this set of gdp=0 coded as ‘0’

0          0      |

-1         0

0          1     --

0          1      |   and this set is now coded as ‘1’

0          1     --

 

Does gdp=0 have multiple meanings? It’d seem like gdp=1 would mean a period to period increase greater than ‘x’; gdp=0 would mean a period to period change of +/- ‘x’ and gdp=-1 would mean a period to period decrease greater than ‘x’.

 

Gene Maguin

 

 

 

 

Hi, I need generate a variable to idetify cycles GDP like in the above example. Put 1 when GDP was growing  (0-1) including the point break, and 0 when GDP was decreasing (0-(1)).

 

Any ideas?? 

 

   Javier.

===================== 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

===================== 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: identify cycle

Javier Meneses
Eugene, from GDP=0 to GDP=1 means it has been growing , then I want to s=1. And from GDP=0 to GDP=-1 it has been declining, then I want to s=0. Then GDP began  to grow again to the next point (GDP=1).
Therefore s will values 0 and 1 indicating the expansionary and recessionary periods. 

Javier 


Enviado desde Mailbox


On Fri, May 22, 2015 at 2:50 PM, Maguin, Eugene <[hidden email]> wrote:

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of javier meneses
Sent: Friday, May 22, 2015 12:56 PM
To: [hidden email]
Subject: identify cycle

 

GDP    s (idcycle)

0          1     ---

0          1      |  why is this set of gdp=0 coded as ‘1’

0          1      |

0          1      |

0          1      |

0          1      |

0          1     --

1          1

0          0      |    but this set of gdp=0 coded as ‘0’

0          0      |

-1         0

0          1     --

0          1      |   and this set is now coded as ‘1’

0          1     --

 

Does gdp=0 have multiple meanings? It’d seem like gdp=1 would mean a period to period increase greater than ‘x’; gdp=0 would mean a period to period change of +/- ‘x’ and gdp=-1 would mean a period to period decrease greater than ‘x’.

 

Gene Maguin

 

 

 

 

Hi, I need generate a variable to idetify cycles GDP like in the above example. Put 1 when GDP was growing  (0-1) including the point break, and 0 when GDP was decreasing (0-(1)).

 

Any ideas?? 

 

   Javier.

===================== 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

===================== 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


===================== 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: identify cycle

Bruce Weaver
Administrator
In reply to this post by Javier Meneses
The following will produce the output you want for the example you provided.  I don't know if it will work more generally, because I'm not sure I've completely understood what you are trying to do.

DATA LIST free / GDP (F2.0).
BEGIN DATA
0 0 0 0 0 0 0
1
0 0
-1
0 0 0
END DATA.

NUMERIC idcycle(F1).

* Where GDP changes, set idcycle = 1 if it
* increases, and idcycle = 0 if it decreases.

DO IF GDP GT LAG(GDP).
. COMPUTE idcycle = 1.
ELSE IF GDP LT LAG(GDP).
. COMPUTE idcycle = 0.
END IF.
* Where idcycle is missing, replace it with the preceding value.
IF MISSING(idcycle) idcycle = LAG(idcycle).
* Where idcycle is still missing, sort cases in reverse order,
* then replace SYSMIS with the preceding value.
COMPUTE Case = $Casenum.
SORT CASES by Case(D).
IF MISSING(idcycle) idcycle = LAG(idcycle).
* Restore original order of the cases.
SORT CASES by Case(A).
LIST GDP idcycle.

OUTPUT:

GDP idcycle
 
  0    1
  0    1
  0    1
  0    1
  0    1
  0    1
  0    1
  1    1
  0    0
  0    0
 -1    0
  0    1
  0    1
  0    1


Javier Meneses wrote
GDP s (idcycle)
0 1
0 1
0 1
0 1
0 1
0 1
0 1
1 1
0 0
0 0
-1 0
0 1
0 1
0 1

Hi, I need generate a variable to idetify cycles GDP like in the above
example. Put 1 when GDP was growing  (0-1) including the point break, and 0
when GDP was decreasing (0-(1)).

Any ideas??

   Javier.

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: identify cycle

Art Kendall
In reply to this post by Javier Meneses
it looks like GDP can have 3 values. 0,1,-1.  If this is correct then it seems that it is possible to have
9 situations

so one approach would be to have something like this (untested) fill in the blanks
If $casenum eq 1 s = -9.
do if $casenum gt 1.
if GDP eq -1 and lag(GDP) eq -1 s= ____.
if GDP eq -1 and lag(GDP) eq  0 s= ____.
if GDP eq -1and lag(GDP) eq  1 s= ____.
if GDP eq  0 and lag(GDP) eq -1 s= ____.
if GDP eq  0 and lag(GDP) eq  0 s= ____.
if GDP eq  0 and lag(GDP) eq  1 s= ____.
if GDP eq  1 and lag(GDP) eq -1 s= ____.
if GDP eq  1 and lag(GDP) eq  0 s= ____.
if GDP eq  1 and lag(GDP) eq  1 s= ____.
end if.
Missing vlaues s (-9).

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

Re: identify cycle

Javier Meneses
 thank you all for your invaluable help!

javier

2015-05-22 18:07 GMT-04:00 Art Kendall <[hidden email]>:
it looks like GDP can have 3 values. 0,1,-1.  If this is correct then it
seems that it is possible to have
9 situations

so one approach would be to have something like this (untested) fill in the
blanks
If $casenum eq 1 s = -9.
do if $casenum gt 1.
if GDP eq -1 and lag(GDP) eq -1 s= ____.
if GDP eq -1 and lag(GDP) eq  0 s= ____.
if GDP eq -1and lag(GDP) eq  1 s= ____.
if GDP eq  0 and lag(GDP) eq -1 s= ____.
if GDP eq  0 and lag(GDP) eq  0 s= ____.
if GDP eq  0 and lag(GDP) eq  1 s= ____.
if GDP eq  1 and lag(GDP) eq -1 s= ____.
if GDP eq  1 and lag(GDP) eq  0 s= ____.
if GDP eq  1 and lag(GDP) eq  1 s= ____.
end if.
Missing vlaues s (-9).





-----
Art Kendall
Social Research Consultants
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/identify-cycle-tp5729596p5729601.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

===================== 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: identify cycle

Bruce Weaver
Administrator
Javier, I think many of us were not entirely clear on what "rule" you were trying to implement.  What was the final solution that worked for you?  Please post your syntax.   Thanks.


Javier Meneses wrote
thank you all for your invaluable help!

javier

2015-05-22 18:07 GMT-04:00 Art Kendall <[hidden email]>:

> it looks like GDP can have 3 values. 0,1,-1.  If this is correct then it
> seems that it is possible to have
> 9 situations
>
> so one approach would be to have something like this (untested) fill in the
> blanks
> If $casenum eq 1 s = -9.
> do if $casenum gt 1.
> if GDP eq -1 and lag(GDP) eq -1 s= ____.
> if GDP eq -1 and lag(GDP) eq  0 s= ____.
> if GDP eq -1and lag(GDP) eq  1 s= ____.
> if GDP eq  0 and lag(GDP) eq -1 s= ____.
> if GDP eq  0 and lag(GDP) eq  0 s= ____.
> if GDP eq  0 and lag(GDP) eq  1 s= ____.
> if GDP eq  1 and lag(GDP) eq -1 s= ____.
> if GDP eq  1 and lag(GDP) eq  0 s= ____.
> if GDP eq  1 and lag(GDP) eq  1 s= ____.
> end if.
> Missing vlaues s (-9).
>
>
>
>
>
> -----
> Art Kendall
> Social Research Consultants
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/identify-cycle-tp5729596p5729601.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
>

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: identify cycle

Javier Meneses
Hi, I thought it was clear my problem. To make it even clearer , I had forgotten to point out that it was to data panel. It has series of quarterly GDP by country and variable identifying changing trends . 1 ends cycle of increasing and -1 ends cycle decreasing. The idea was to create a variable that identifies the cycle from initiating the growth period to completion with 1, and conversely since period decay begins to completion with 0.

i=country q=quarter t=trend break GDP i q tp pib Argentina 1993q1 0 18.51328 Argentina 1993q2 0 18.54036 Argentina 1993q3 0 18.56262 Argentina 1993q4 0 18.57188 Argentina 1994q1 0 18.58643 Argentina 1994q2 0 18.60348 Argentina 1994q3 0 18.60693 Argentina 1994q4 1 18.62007 Argentina 1995q1 0 18.60672 Argentina 1995q2 0 18.56648 Argentina 1995q3 -1 18.56221 Argentina 1995q4 0 18.56961
I usethe solution proposed Bruce. (with spli file by i q)  Javier. (Excuse my English!!)

2015-05-25 11:28 GMT-04:00 Bruce Weaver <[hidden email]>:
Javier, I think many of us were not entirely clear on what "rule" you were
trying to implement.  What was the final solution that worked for you?
Please post your syntax.   Thanks.



Javier Meneses wrote
> thank you all for your invaluable help!
>
> javier
>
> 2015-05-22 18:07 GMT-04:00 Art Kendall <

> Art@

> >:
>
>> it looks like GDP can have 3 values. 0,1,-1.  If this is correct then it
>> seems that it is possible to have
>> 9 situations
>>
>> so one approach would be to have something like this (untested) fill in
>> the
>> blanks
>> If $casenum eq 1 s = -9.
>> do if $casenum gt 1.
>> if GDP eq -1 and lag(GDP) eq -1 s= ____.
>> if GDP eq -1 and lag(GDP) eq  0 s= ____.
>> if GDP eq -1and lag(GDP) eq  1 s= ____.
>> if GDP eq  0 and lag(GDP) eq -1 s= ____.
>> if GDP eq  0 and lag(GDP) eq  0 s= ____.
>> if GDP eq  0 and lag(GDP) eq  1 s= ____.
>> if GDP eq  1 and lag(GDP) eq -1 s= ____.
>> if GDP eq  1 and lag(GDP) eq  0 s= ____.
>> if GDP eq  1 and lag(GDP) eq  1 s= ____.
>> end if.
>> Missing vlaues s (-9).
>>
>>
>>
>>
>>
>> -----
>> Art Kendall
>> Social Research Consultants
>> --
>> View this message in context:
>> http://spssx-discussion.1045642.n5.nabble.com/identify-cycle-tp5729596p5729601.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
>>
>
> =====================
> 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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/identify-cycle-tp5729596p5729617.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

===================== 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