Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: tsspell--end to include an event.


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: tsspell--end to include an event.
Date   Fri, 19 Apr 2013 17:47:34 +0100

Sorry; I meant -fcond()-.

The help does explain -fcond()- as a way of defining a spell by its start.
Nick
[email protected]


On 19 April 2013 17:42, Steven Archambault <[email protected]> wrote:
> Thanks for the reply. The issue with the suggested code is that it
> only considers a spell if harvest>0. I want the spell to include all
> the non-harvest leading up to the harvest event.
>
> And sorry for not mentioning the source: -tsspell- from SSC. It is a
> great, and very useful, user written program.
>
> Regards,
> Steve
>
>
>
>
>
> On Fri, Apr 19, 2013 at 10:20 AM, Nick Cox <[email protected]> wrote:
>> -tsspell- is from SSC. Please remember the longstanding and explicit
>> request to explain _where_ user-written programs you refer to come
>> from.
>>
>> For this I would reverse time temporarily.
>>
>> gen negdate = -date
>> tsset negdate
>> tsspell, pcond(harvest)
>> tsset date
>>
>> However, it seems that you have gaps in your data. In which case
>>
>> sort date
>> gen negtime = - _n
>> tsset negtime
>>
>> may work better for you.
>>
>> Nick
>> [email protected]
>>
>>
>> On 19 April 2013 17:10, Steven Archambault <[email protected]> wrote:
>>> Hi all,
>>>
>>> I am learning to use -tsspell-. My hope is to have the spell include 0
>>> events, and end with the first positive event. However, I want that
>>> positive event (a harvest) to be included in the spell. How do I make
>>> a rule for that?
>>>
>>> Example
>>>
>>> date            harvest    spell
>>> 10sep2010   0             1
>>> 11sep2010   0              1
>>> 12sep2010   0              1
>>> 15sep2010   0              1
>>> 17sep2010   20             1
>>> 20sep2010    0               2
>>> 23sep2010    10            2
>>> 25sep2010     0              3
>>>
>>> Any help is appreciated!
>>>
>>> Thanks,
>>> Steve
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>>> *   http://www.ats.ucla.edu/stat/stata/
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index