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: question on data analysis in Stata


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: question on data analysis in Stata
Date   Wed, 20 Jun 2012 12:25:33 +0100

I am surprised to infer that you think that this might be too
difficult for Stata. There are many ways to get at this: here is one.

If you calculate the change

bysort id (date) : gen change = var - var[_n-1]

Then you can summarize that by -id-

egen minch = min(change) , by(id)

Then you can tag each -id- once

egen tag = tag(id)

Now you can do things like

count if minch >0  & tag
count if minch >= 0 & tag

"continuous increase" might be held to allow occasional change of zero.

You can then get indicators, e.g.

gen increased = minch > 0

tab increased if tag

Nick
On Wed, Jun 20, 2012 at 12:10 PM, [email protected]
<[email protected]> wrote:

> I have to analyze how the values of a given variable varies over a period of 100 days for 55 objects.
>
>
> I would like to investigate what fraction x out of these 55 objects saw a continuous increase in this variable over these 100 days.
>
>
> Is it possible for Stata to deliver such answer?

> The data set looks as this: (the var values are random here;just for illustration)
>
>
> object id day value
> id date var
> 1 100 51
> 1 99 200
> 1 98 192
> 2 100 147
> 2 99 231
> 2 98 171
> 3 100 285
> 3 99 1
> 3 98 35
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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