# [R] Trends for many units

s-luppescu@uchicago.edu s-luppescu at uchicago.edu
Fri Jan 5 23:24:15 CET 2001

```On 05-Jan-2001 Prof Brian D Ripley wrote:
> On Fri, 5 Jan 2001 s-luppescu at uchicago.edu wrote:
>
>> I have data on every grade in all elementary schools in Chicago over 5
>> years. I
>> would like to estimate a trend over time for each grade in each school.
>> There
>> are 17,600 data all together (about 460 schools, nearly 8 grades each, over
>> 5
>> years). Is there a not-so-hard way to do this in R (I was thinking of using
>> rlm)?
>
> And the statistical model is?  5 years is a short series, and I would have
> thought a multilevel model was appropriate (and in R that means using lme).
> I'l leave it to someone who understands the terms (grades are a response
> in my terminology) to suggest a model.

Yes, there may be some ambiguity in the terminology. ``Grade'' refers to the
year in school (as in, ``first grade'', ``second grade'', etc.). Here is a small
portion of the data set:

Unit     Year      Grade     Pct.Excl
2010      1996         1       0.0789
2010      1997         1       0.0000
2010      1998         1       0.1034
2010      1999         1       0.0286
2010      2000         1       0.0000
2010      1996         2       0.1471
2010      1997         2       0.1282
2010      1998         2       0.0250
2010      1999         2       0.0800
2010      2000         2       0.0588
2010      1996         3       0.0938
2010      1997         3       0.2188
2010      1998         3       0.2000
2010      1999         3       0.1020
2010      2000         3       0.1000

Unit is the school number. Basically, I want to do something like:
rlm(Pct.Excl ~ Year) for each Unit-Grade combination.

> rlm and friends assume independent errors, which looks dubious here.

I chose rlm because with the small number of data points (max of 5 per
school-grade) a single outlier can have a very large influence. I don't know
why errors shouldn't be independent here, but I'm willing to be convinced.
______________________________________________________________________
Stuart Luppescu         -=-=-  University of Chicago
\$(B:MJ8\$HCRF`H~\$NIc(B        -=-=-  s-luppescu at uchicago.edu
http://www.consortium-chicago.org/people/sl.html
Finger sl70 at musuko.uchicago.edu forPGP Public Key
ICQ #21172047  AIM: psycho7070
If computers take over (which seems to be their natural tendency), it will
serve us right.
-- Alistair Cooke
>> Sent on 05-Jan-2001 at 16:16:53 with xfmail
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```