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]

st: compare a variable within groups of observations


From   Giancarlo Musto <[email protected]>
To   [email protected]
Subject   st: compare a variable within groups of observations
Date   Mon, 3 May 2010 19:51:40 +0200

Hi everybody,

I have a dataset on children's daily arrival time at school over a
period of 4 years. To be more precise for each kid ("child") I have
1460 observations - one for each day - of the variable "arrival_time"
that tells me the arrival time at school in each given day and takes
value "." if the child did not go to school in a specific day.
Moreover, the dataset contains for each kid its 9-digit zip code
("zip").

What I would like to do is to create peer groups on the basis of the
arrival times and of the zip codes. To be precise, I would like to do
what it follows:


1) define a time period from "$starting_date" to "$end_date"

2) look within the groups of kids with the same 9-digit zip code

3) count the number of days in which the kids in each groups arrive in
the same time interval (for istance, "arrival_time" of one of them
plus or minus a minute)

4) define kids as belonging to the peer group if they arrived at
school in the same interval for a given for a given numbers of days,
say a threshold ("$threshold") that can be thought as a certain
percentage of the number of school days of the kids that went less
days to school.


Clearly, if there were only two children in each zip code group it
would be quite easy to do this. Nevertheless, this is not the case and
I don't know how to deal with several comparisons within the same zip
code group. Indeed, I need to compare kids within the groups in
pairwaise.

I hope you can solve my problem, or at least give me some good advices.

Thanks,
Giancarlo Musto
*
*   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