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: Re: Analyzing time series data on prices by districts & markets


From   Chris Parker <[email protected]>
To   [email protected]
Subject   Re: st: Re: Analyzing time series data on prices by districts & markets
Date   Mon, 13 Jun 2011 15:47:02 +0100

Sorry, that last bit should be:

egen statetag = tag(state)
egen numstates = total(statetag)
bysort date: egen stateswithprices = total(statetag)
gen percentstateswithprices = stateswithprices/numstates


Chris

Chris Parker

________________________________

PhD Candidate | Management Science & Operations
London Business School | Regent's Park | London NW1 4SA | United Kingdom
Direct line +44 (0)20 7000 8816 | Email [email protected]

On Mon, Jun 13, 2011 at 3:45 PM, Chris Parker
<[email protected]> wrote:
>
> Hi Partho,
>
> It looks like you want to do something like this:
>
> > 1.      For each date, the total number of markets (over all states and
> > districts) for which a price is reported, and
>
> bysort date: gen nummarkets = _N
>
> > 2.      The maximum number of markets for which a price is reported for any
> > date in the datasets
>
> Are you wanting a variable with a constant equal to the maximum number
> of mandis open on each day? If so:
>
> egen maxmarkets = max(nummarkets)
>
> > In addition, to do a geographical analysis, I would like to record,
> > for each date
> >
> > 1.      The number of reporting markets in each district versus the total
> > no. of markets in that district,
>
> egen markettag = tag(market)
> bysort state district: egen marketsindistrict = total(markettag)
> bysort state district date: gen marketsopen = _N
> gen percentmarketsopen = marketsopen/marketsindistrict
>
> > 2.      The number of districts in each state for which prices are
> > reported, versus the total no. of districts in that state
>
> egen districttag = tag(district)
> bysort state: egen numdistricts = total(districttag)
> bysort state date: egen districtswithprices = total(districttag)
> gen percentdistrictswithprices = districtswithprices/numdistricts
>
> > 3.      Similarly, the number of states for which prices are reported,
> > versus the total no. of state s where a price is ever reported
>
> egen statetag = tag(state)
> bysort state: egen numstates = total(statetag)
> bysort state date: egen stateswithprices = total(statetag)
> gen percentstateswithprices = stateswithprices/numstates
>
>
> Chris
>
> Chris Parker
>
> ________________________________
>
> PhD Candidate | Management Science & Operations
> London Business School | Regent's Park | London NW1 4SA | United Kingdom
> Direct line +44 (0)20 7000 8816 | Email [email protected]
>
> On Mon, Jun 13, 2011 at 3:30 PM, Partho Sarkar <[email protected]> wrote:
> >
> > Dear Dr, Cox,
> >
> > Many thanks for the prompt reply.  I am replying to you directly
> > partly because I am not sure how to post a follow-up (please excuse me
> > if this is inappropriate)
> >
> > The data looks like this:
> >
> > date    state   mkt     dist    price
> > 1       Asm     Ca      ach     1700
> > 1       Asm     Ka      ari     1450
> > 1       Jha     Du      umk     1185
> > 1       Jha     Pa      aka     2400
> > 2       Asm     Ka      ari     1750
> > 2       Ker     Ch      hir     2000
> > 2       Ker     Ch      hir     2400
> >
> > And the first step of the answers for this example would be
> >
> > #mkts= 5        #dist=6 #states=3
> >
> >
> > Best regards,
> >
> > Partha S. Sarkar
> > Consultant Econometrician
> > Indicus Analytics Pvt. Ltd (www.indicus.net)
> > New Delhi, India
> >
> > You wrote:
> >
> > From      Nick Cox <[email protected]>
> > To        "'[email protected]'" <[email protected]>
> > Subject           st: RE: Analyzing time series data on prices by districts & markets
> > Date      Mon, 13 Jun 2011 14:27:55 +0100
> >
> > The list's guidelines preclude attachments but certainly do not
> > preclude ASCII text within a posting showing part of your data.
> >
> > Nick
> > [email protected]
> >
> > In reply to my question:
> >
> >
> >
> >
> >
> > On Mon, Jun 13, 2011 at 6:21 PM, Partho Sarkar <[email protected]> wrote:
> > > Hello all,
> > >
> > > I am quite new to Stata (and this list), and trying hard to quickly
> > > pick up the skills while on the job.  Would really appreciate some
> > > help with this task, and please excuse if this seems too elementary!
> > >
> > > Problem:
> > >
> > > I have a large dataset which gives prices of a commodity at each date
> > > for different markets across the country.  The markets are classified
> > > by State, District & Market (names).  (The commodity is only traded in
> > > some markets, in some districts, and some states).   I need to get an
> > > idea of the periods/dates for which the data are “sparse”, i.e., there
> > > are too few of the Markets reporting a price.
> > >
> > > So I need,
> > >
> > > 1.      For each date, the total number of markets (over all states and
> > > districts) for which a price is reported, and
> > > 2.      The maximum number of markets for which a price is reported for any
> > > date in the dataset
> > >
> > > In addition, to do a geographical analysis, I would like to record,
> > > for each date
> > >
> > > 1.      The number of reporting markets in each district versus the total
> > > no. of markets in that district,
> > > 2.      The number of districts in each state for which prices are
> > > reported, versus the total no. of districts in that state
> > > 3.      Similarly, the number of states for which prices are reported,
> > > versus the total no. of state s where a price is ever reported
> > >
> > > I hope this is clear, as I think the List rules prevent me from
> > > including a preview/sample of my data.
> > >
> > > Thank you
> > >
> > > P. Sarkar
> > > Consultant Econometrician
> > > India
> > >
> >
> > *
> > *   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/
> >
> > ______________________________________________________________________
> >
> > This email has been scanned by the MessageLabs Email Security System
> > on behalf of the London Business School community.
> > For more information please visit http://www.messagelabs.com/email
> > ______________________________________________________________________

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