Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: question on data analysis in Stata


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
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, rado645-bg@yahoo.de
<rado645-bg@yahoo.de> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index