Statistics 222,   Education 351A  Spring 2012
    Statistical Methods for Longitudinal Research


David Rogosa Sequoia 224,   rag{AT}stat{DOT}stanford{DOT}edu   Office hours: Thursday 2:10-3
Course web page: http://www-stat.stanford.edu/~rag/stat222/

Registrar's information
STATS 222 (Same as EDUC 351A): Statistical Methods for Longitudinal Research
Class Number  55136 
Lecture
Units: 2-3
NEW LOCATION: Mo 3:15PM - 5:05PM  GSB Littlefield 107
Room: 50-52H (Quad, 2nd floor)
Schedule: Monday 3:15-5:05pm
Grading Basis: Letter or Credit/No Credit

Course Description:
Research designs and statistical procedures for time-ordered (repeated-measures) data.
The analysis of longitudinal panel data is central to empirical research on
learning and development. Topics: measurement of change, growth curve models,
analysis of durations including survival analysis, experimental and non-experimental group 
comparisons, reciprocal effects, stability.
Prerequisite: intermediate statistical methods. 


Preliminary Course Outline
Week 1. Overview of Panel Data and Research Questions
Week 2. Time-1, Time-2 Data; Traditional Measurement of Change Methods
Week 3. Data Analysis Methods for Individual Change and Collections of Growth Curves
Week 4. Further topics for growth curve models: non-linear models, resampling methods for assessing uncertainty
Week 5. Assessing Group Growth: Repeated Measures Analysis of Variance and Related Methods
Week 6. Further Topics in group comparisons: Observational studies, Dichotomous outcomes, Cohort Designs, Cross-over Designs
Week 7. Analysis of Durations: Introduction to Survival Analysis
Week 8. Further topics in analysis of durations: Behavioral Observations, Series of Events (renewal processes)
Week 9. Special Topics: Assessments of Stability (including Tracking), Reciprocal Effects, (mis)Applications of Structural Equation Models

Some Relevant Texts and Resources (reserves in Math/CompSci library)
1. Garrett M. Fitzmaurice Nan M. Laird James H. Ware Applied Longitudinal Analysis (Wiley Series in Probability and Statistics)
  Text Website   Text lecture slides   
2. Peter Diggle , Patrick Heagerty, Kung-Yee Liang , Scott Zeger. Analysis of Longitudinal Data 2nd Ed, 2002
   Amazon page     Peter Diggle home page    Book data sets     A Short Course in Longitudinal Data Analysis Peter J Diggle Nicola Reeve, Michelle Stanton (School of Health and Medicine, Lancaster University), June 2011
3. Judith D. Singer and John B. Willett . Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence New York: Oxford University Press, March, 2003.
  Text web page    Text data examples    Powerpoint presentations   good gentle intro to modelling collections of growth curves (and survival analysis) is Willett and Singer (1998)
4. Harvey Goldstein. The Design and Analysis of Longitudinal Studies: Their Role in the Measurment of Change (1979). Elsevier
  Amazon page    Goldstein Chap 6 Repeated measures data      Multilevel Statistical Models by Harvey Goldstein with data sets   
5. Verbeke, G. and Molenberghs, G. (2000). Linear Mixed Models for Longitudinal Data. Springer Series in Statistics. New-York: Springer.  Extended presentation: Introduction to Longitudinal Data Analysis A shorter exposition: Methods for Analyzing Continuous, Discrete, and Incomplete Longitudinal Data
6. A handbook of statistical analyses using R (second edition). Brian Everitt, Torsten Hothorn CRC Press, Index of book chapters   Stanford access      Univ Toronto psosting   Longitudinal chapters: Chap11   Chap12  Chap13. Data sets etc Package 'HSAUR2' March 3, 2012 Title A Handbook of Statistical Analyses Using R (2nd Edition)
7. Survival analysis Rupert G. Miller. Available as Stanford Tech Report
8. John D. Kalbfleisch , Ross L. Prentice The Statistical Analysis of Failure Time Data 2nd Ed
  Amazon page    online from Wiley
9. David Roxbee Cox, Peter A. W. Lewis The statistical analysis of series of events. Chapman and Hall, 1966
  Google books    Poisson process computing program
10. David J Bartholomew. Stochastic Models for Social Processes, Chichester 3rd edition: John Wiley and Sons.
   David J Bartholomew web page


Grading, Exams, and Credit Units
Stat222/Ed351A is listed as Letter or Credit/No Credit grading (Stat MS students should check whether S/NC is a viable option for their degree program.)
Grading (for the 2-unit base) will be based on two components:
  Each week I will post a few exercises for that week's content--towards the end of the qtr I'll identify a subset of those exercises to be turned in.
  During the Spring qtr exam period we will have an in-class (all materials available, "open" everything) exam. My reading of the Registrar's chart indicates Tues June 12 at 12:15PM
           see Class Calendar for details
The Registrar requires clear identification of the requirements for incremental units. The additional requirement for a 3-unit registration (the one unit above 2-units) is satisfied by a student presentation: a mini-lecture, approximately 15 minutes with handout. These can either be squeezed into class sessions or done separately with Rogosa. Good topics would include empirical longitudinal research, such as a data set or set of studies you are involved with, or an extension of class lecture topics such as preparing an additional data analysis example or a report on some technical readings. Discussion with Rogosa is encouraged.   

Course Problem Set

Statistical computing
Class presentation will be in, and students are encouraged to use, R (occasionally, some references to SAS and Mathematica). To the extent feasable, students can use whatever they are comfortable with.
1/7/09.  NY Times endorses R: Data Analysts Captivated by R's Power
Current version of R is R version 2.14.2 released on 2012-02-29. For references and software: The R Project for Statistical Computing   Closest download mirror is Berkeley
The CRAN Task View: Statistics for the Social Sciences provides an overview of some relevant R packages. Also the new CRAN Task View: Psychometric Models and Methods. Also of interest: CRAN Task View: Design of Experiments (DoE) and Analysis of Experimental Data
A good R-primer on various applications (repeated measures and lots else). Notes on the use of R for psychology experiments and questionnaires Jonathan Baron, Yuelin Li.   Another version
A remarkably useful set of R-resources from Murray State
Wm. Revelle who develops the psych package also has a draft text which covers standard statistics plus specialized measurement topics (plus other R intros)
For those with a life sciences background a useful resource may be the book Analysis of epidemiological data using R and Epicalc and the Epicalc package.
A Stat209 text, Data analysis and graphics using R (2007) J. Maindonald and J. Braun, Cambridge 2nd edition 2007. 3rd edition 2010   has available a short version in CRAN .
An additional R resource that is efficient if you are experienced with another statistical package is a presentation An Introduction to R, John Verzani  For categorical data, especially if you've had a course using Agresti, the lengthy guide by Laura Thompson has more than you want to know. For introductory materials on R see the Stat209 site, esp the computing labs, or more basic 2007 Stat141 site, especially the Course Files and Examples page.
According to Peter Diggle: "The best resource for R that I have found is Karl Broman's Introduction to R page."

                  Course Content: Files, Readings, Examples

4/2. First class, Organizational Meeting
   Initial meet-and-greet. Class logistics and longitudinal research overview
       Initial examples for longitudinal overview (that would have been shown if we had projection) taken from course resources:
          Verbeke slides from Ch 2, Sec3.3;   Laird,Ware slides 1-16;    Diggle slides 4-14, 22-28
   Time-1,time-2 data analysis examples    Measurement of change: time-1,time-2 data
      data example for handout    scan of 4/2 regression handout
   Distribute Myths/MeasurementOfChange CD   Slides for Myths talk (4/3: I did place some additional CD's in my Sequoia Hall mailbox, as indicated)

Longitudinal in the news
1. Low health literacy linked to premature death    Older People With Poorer Reading Skills Have HigherMortality Risk   Publication: Association between low functional health literacy and mortality in older adults: longitudinal cohort study, BMJ 16 March 2012
2. Red Meat Tied to Increased Mortality Risk   Red Meat Can Be Unhealthy, Study Suggests  Publication: Red Meat Consumption and Mortality Results From 2 Prospective Cohort Studies Archives of Internal Medicine, March 2012.   Health Professionals Follow-up Study
3. Women Who Drink Moderately Have Lower Stroke Risk   Publication: Alcohol Consumption and Risk of Stroke in Women, Stroke, March 2012.  Nurses' Health Study

WEEK 1 Exercises
1. Time1-time2 regressions; Class example 4/2
a. Push hard on the regression fits shown in the handout (also linked) with standard regression diagnostic tools (residuals etc) to see if you can find anything askew with the time2 on W and time1 regressions (student question). Point is that it is the standard interpretation of the coefficient of W rather than the regression fit that is the issue here.
b. Repeat the handout demonstration regressions using the fallible measures (the X's) from the bottom half of the linked data page. The X's are simply error-in-variable versions of the Xi's: X = Xi + error, with error having mean 0 and variance 10. Compare 5-number summaries for the amount of change from the earliest time "1" to the final observation "5" using the "Xi" measurements (upper frame) and the fallible "X" observations (lower frame).
2. Captopril and Blood pressure
The file captopril.dat contains the data shown in Section 2.2 of Verbeke, Introduction to Longitudinal Data Analysis, slides. Captopril is an angiotensin-converting enzyme inhibitor (ACE inhibitor) used for the treatment of hypertension. Use the before and after Spb measurements to examine the improvement (i.e. decrease) in blood pressure. Obtain a five-number summary for observed improvement. What is the correlation between change and initial blood pressure measurement? Obtain a confidence interval for the correlation and show the corresponding scatterplot.
3. (more challenging). Use mvrnorm to construct a second artificial data example (n=100) mirroring the 4/2 class handout BUT with the correlation between true individual rate of change and W set to .7 instead of 0. Carry out the corresponding regression demonstration.
       Solution provided for problem 3



4/9. Measurement of Change: Growth curve models and traditional time1-time2 issues
Class lecture covers Myths 1-6+.
Slides from Myths talk also on the CD with pubs
Class Handout, Companion for Myths talk

Class Data examples:
see week 1 data example links; Rogosa R-session to replicate week 1 handout, demonstrate wide-to-long data set conversion, and descriptive fitting of individual growth curves. Some useful plots from Rogosa R-session
The R-package PairedData has some interesting plots and statistical summaries for "before and after" data; here is a McNeil plot for Xi.1, Xi.5 in data example
Sleepstudy data from Doug Bates new lme4 book lme4: Mixed-effects modeling with R February 17, 2010 (draft chapters) Chapter 4: Sleepstudy example
Paired dichotomous data, McNemar's test (in R, mcnemar.test {stats}), Agresti (2nd ed) sec 10.1 Also see R-package "PropCIs" Prime Minister ex

Background Readings and Resources
Myths Chapter-- distributed on CD. Rogosa, D. R. (1995). Myths and methods: "Myths about longitudinal research," plus supplemental questions. In The analysis of change, J. M. Gottman, Ed. Hillsdale, New Jersey: Lawrence Erlbaum Associates, 3-65.
More stuff (if you don't like the ways I said it)   
I noticed John Gottman did a pub rewriting the myths: Journal of Consulting and Clinical Psychology 1993, Vol. 61, No. 6,907-910 The Analysis of Change: Issues, Fallacies, and New Ideas
Also John Willett did a rewrite of the Myths 'cuz I didn't want to reprint it again (or write a new version): Questions and Answers in the Measurement of Change REVIEW OF RESEARCH IN EDUCATION 1988 15: 345
Reliability Coefficients: Background info. Short primer on test reliability    Informal exposition in Shoe Shopping and the Reliability Coefficient    extensive technical material in Chap 7 Revelle text
A growth curve approach to the measurement of change. Rogosa, David; Brandt, David; Zimowski, Michele Psychological Bulletin. 1982 Nov Vol 92(3) 726-748 APA record   direct link
Rogosa, D. R., & Willett, J. B. (1985). Understanding correlates of change by modeling individual differences in growth. Psychometrika, 50, 203-228.
available from John Willet's pub page
Demonstrating the Reliability of the Difference Score in the Measurement of Change. David R. Rogosa; John B. Willett Journal of Educational Measurement, Vol. 20, No. 4. (Winter, 1983), pp. 335-343. Jstor
Maris, Eric. (1998). Covariance Adjustment Versus Gain Scores--Revisited. Psychological Methods, 3(3) 309-327. apa link  

Application (non-exemplary). There's always hope
NY Times Behavior trouble doesn't doom kids Early disruptive actions might not hurt academic success, studies say   
School readiness and later achievement. Duncan, Greg J.; Dowsett, Chantelle J.; Claessens, Amy; Magnuson, Katherine; Huston, Aletha C.; Klebanov, Pamela; Pagani, Linda S.; Feinstein, Leon; Engel, Mimi; Brooks-Gunn, Jeanne; Sexton, Holly; Duckworth, Kathryn; Japel, Crista Developmental Psychology. 2007 Nov Vol 43(6) 1428-1446

WEEK 2 Exercises
1. Reliability versus precision demonstration
  Consider a population with true change between time1 and time2 distributed Uniform [99,101] and measurement error Uniform [-1, 1]. If you used discrete Uniform in this construction then you could say measurement of change is accurate to 1 part in a hundred.
Calculate the reliability of the difference score.
Also try error Uniform [-2,2], accuracy one part in 50.
A similar demonstration can be found in my Shoe Shopping and the Reliability Coefficient
2. Regression toward the mean? Galton's data on the heights of parents and their children
In the "HistData" or "psych" packages reside the "galton" dataset, the primordial regression toward mean example.
Description: Galton (1886) presented these data in a table, showing a cross-tabulation of 928 adult children born to 205 fathers and mothers, by their height and their mid-parent’s height. A data frame with 928 observations on the following 2 variables. parent Mid Parent heights (in inches) child Child Height. Details: Female heights were adjusted by 1.08 to compensate for sex differences. (This was done in the original data set)
Consider "parent" as time1 data and "child" as time2 data and investigate whether these data indicate regression toward the mean according to either definition (metric or standardized)? Refer to Section 4 of the Myths chapter supplement (pagination 61-63) for an assessment of regression toward the mean (i.e. counting up number of subjects satisfying regression-toward-mean).
Aside: if you like odd plots, try this (and then look at the docs ?sunflowerplot; this may require the package "car" to be installed on your machine)
with(Galton,
{
sunflowerplot(parent,child, xlim=c(62,74), ylim=c(62,74))
reg <- lm(child ~ parent)
abline(reg)
lines(lowess(parent, child), col="blue", lwd=2)
if(require(car)) {
dataEllipse(parent,child, xlim=c(62,74), ylim=c(62,74), plot.points=FALSE)
}
}) 
3. Let's look again at the Week1 data, here using the bottom half, the fallible "X" measurements (constructed by adding noise to the Xi measurements).
a. Follow the Week 2 R-session and obtain the plot showing each subjects data and straight-line fit. Use lmList to obtain the 40 slopes for the straight-line fits. Compare the five-number summary of rates of change for the "X" measurement with that obtained for the perfectly measured "Xi" measurements in the posted R-session.
       Solution provided for problem 3a
b. Standardizing is always a bad idea is a good motto for life, especially with longitudinal data. Start out with the "X" data, and standardize (i.e. transform to mean 0, var 1) at each of the 3 time points. Note "scale" will do this for you (in wide form). For the standardized data obtain the plot showing each subjects data and straight-line fit. What do you have here?
4. Paired and unpaired samples, continuous vs categorical measurements.
Let's use again the 40 subjects in the week1 "X" data.
a. Measured data. Take the time1 and time5 observations and obtain a 95% Confidence Interval for the amount of change. Compare the width of that interval with a confidence interval for the difference beween the time5 and time1 means if we were told a different group of 40 subjects was measured at each of the time points (data no longer paired).
b. Dichotomous data. Instead look at these data with the criterion that a score of 50 or above is a "PASS" and below that is "FAIL". Carry out McNemar's test for the paired dichotomous data, and obtain a 95% CI for the difference between dependent proportions. Compare that confidence interval with the "unpaired" version (different group of 40 subjects was measured at each of the time points) for independent proportions.
4/16. Analysis of collections of growth curves (random effects models, lme)

Longitudinal in the news
Birth Rates for U.S. Teenagers Reach Historic Lows for All Age and Ethnic Groups April 2012 U.S. DEPARTMENT OF HEALTH AND HUMAN SERVICES Centers for Disease Control and Prevention National Center for Health Statistics

Lecture Readings:
Doug Bates lme4 book Chapter 4: Models for Longitudinal Data with Sleepstudy example Sections 4.1, 4.2.1, 4.4, 4.5 Or a set of slides for the sleepstudy example
Also technical item Chap 5, Section 5.5, REML vs MLE
Rogosa Myths about longitudinal research, supplement (on CD) Section 2 "Useful data analysis approaches" pagination 46-55. Ramus and North Carolina data examples
Additional versions:
North Carolina Data also in (with full development of the modelling) Longitudinal Data Analysis Examples with Random Coefficient Models. David Rogosa; Hilary Saner . Journal of Educational and Behavioral Statistics, Vol. 20, No. 2, Special Issue: Hierarchical Linear Models: Problems and Prospects. (Summer, 1995), pp. 149-170. Jstor
Another version (short) of the expository material is from the Timepath '97 (old SAS progranms) site: Growth Curve models ;    Data Analysis and Parameter Estimation ; Derived quantities for properties of collections of growth curves and bootstrap inference procedures

Class Data examples:
1.      Sleepstudy, Bates Ch 4, lme4 analyses handout   Plot of straight-line fits   Music to accompany long-distance truck driver data: 1971 The Flying Burrito Brothers "Six Days on the Road"
2.      Ramus data example      R using lme and lmer for Ramus data     
3.      North Carolina, female math performance (also in Rogosa-Saner)    North Carolina data (wide format);     making the "Long" version     NC data (long)    lmer analyses of NC data     plots for NC data
       Old   Timepath97 output for Rogosa-Saner data examples: Ramus (Myths chapter), Rat and North Carolina (ncfem210) including bootstrap procedures .
4. Brain Volume Data, in-class modeling exercise: analyses from "Variation in longitudinal trajectories of regional brain volumes of healthy men and women (ages 10 to 85 years) measured with atlas-based parcellation of MRI"
    cartoon plot of Lateral Ventricles data;     actual data plot of Lateral Ventricles data;    development of lmer (random effect) growth models

Background Resources
Data sets for Rogosa-Saner
A good gentle intro to modelling collections of growth curves (and survival analysis) is Willett and Singer (1998)
A Handbook of Statistical Analyses Using R -- 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues
Doug Bates new lme book lme4: Mixed-effects modeling with R February 17, 2010 (draft chapters) ; an updated version of Bates book: lme4: Mixed-effects modeling with R January 11, 2010
Mixed models in R using the lme4 package Part 2: Longitudinal data, modeling interactions Douglas Bates 8th International Amsterdam Conference on Multilevel Analysis 2011-03-16    another version
  Technical topics: Mixed models in R using the lme4 package Part 4: Theory of linear mixed models     Linear mixed model implementation in lme4 Douglas Bates Department of Statistics University of Wisconsin Madison October 4, 2011
Power calculations for growth curve modelling (in R): Power for linear models of longitudinal data with applications to Alzheimer's Disease Phase II study design Michael C. Donohue, Steven D. Edland, Anthony C. Gamst Division of Biostatistics and Bioinformatics University of California, San Diego September 1, 2010
Additional Web materials
Timepath97 Site (SAS based; documentation site used to use Java navigation so substitute links are a little clumsy but I made them work)
Additional talk materials: An Assortment of Longitudinal Data Analysis Examples and Problems 1/97, biostat
Overview and Implementation for Basic Longitudinal Data Analysis CRESST Sept '97
Doug Bates materials: Three packages, "SASmixed", "mlmRev" and "MEMSS" with examples and data sets for mixed effect models

WEEK 3 Exercises
1. Early Education data (From Bates and Willett-Singer). Week 3 class example, Data on early childhood cognitive development described in Doug Bates talk materials (pdf pages 49-52). Obtain these data from the R-package "mlmRev" or the Willett-Singer book site (in our week 1 intro links). Data are in long form and consist of 3 observations 58 treatment and 45 control children; see the Early entry in the mlmRev package docs. Produce the plot of individual trajectories shown pdf p.49, Bates talk. (note:Bates does connect-the-dots, we have done straight-line fit, your choice). Show five-number summaries of rates of impovement in cognitive scores for treatment and control groups. Develop and fit the fm12 lmer model shown in Bates pdf p.50 (note fm12 allows trt to effect rates of improvement but not level;). Interpret results.
2. Ramus Data example; see links in week 3 Class data examples. Use lmList to obtain the 20 OLS fits, with the initial time set to 8 years of age, i.e. intercepts are fits for the time of initial measurement (not t=0). Fit the lmer model for the collection of growth curves (using initial time = 8); verify that fixed effects are the sample means (over persons) of the lmList intercepts and slopes. Verify that the random effects variance for "age" (i.e. slopes) is the method-of-moments estimate for Var(theta). Compare the random effect estimates (ranef) which borrow strength for each subject with the OLS estimates from lmList (c.f. Bates Chap 4 discussion of sleepstudy data)
       Solution provided for problem 2
3. Continue problem 3a from week 2 with the "X" week 1 data. Produce a boxplot of the (40) individual rates of change and a scatterplot of the rates of change against the background, exogenous variable (W). Follow the week 3 NC example, pdf pages 3,4 of the plots link.
4. Brain example. Take the extended model (p.3 on link) and derive the indicated combined model (either version). Also do a parameter interpretation listing as done for the base model (pdf p.2 link)


4/23. Further topics: Individual Change and Collections of Growth Curves Analyses

Longitudinal in the news
1. Do Happy People Have Healthier Hearts? Optimism, Happiness Linked to Lower Heart Attack, Stroke Risk    Publication: Boehm, J. K., and Kubzansky, L. D. (2012, April 16). The Heart's Content: The Association Between Positive Psychological Well-Being and Cardiovascular Health. Psychological Bulletin. Advance online publication. doi: 10.1037/a0027448
2. Faster than constant-rate-of-change growth. Figure 10. The number of R add-on packages from R's main software repository Older analysis, Jon Fox, Figure 3, page 8.

Class Data examples:
1. North Carolina and Ramus examples from 4/16 listing. Smart First Year Student Analysis for NC    lmer analyses of NC data          NC bootstrap results (SAS)
     Ramus data example      R using lme and lmer for Ramus data      Ramus bootstrap results (SAS)
2. Sleepstudy example from 4/16 listing.  Doug Bates Slides (pdf pages 8-28)    Sleepstudy, Bates Ch 4, lme4 analyses handout      Individual plots (frame-by-frame)   Plot of straight-line fits   
3. Non-linear Models: Orange Tree growth.     Data from MEMSS package Data sets and sample analyses from Pinheiro and Bates, Mixedeffects Models in S and S-PLUS (Springer, 2000).
   Doug Bates Slides Orange trees analysis (pdf pages 8-16), Logistic SS (pdf p.6), pharmacokinetics ex (pdf pages 7, 17-24)   Plots and nlmer analysis, Orange tree data   Bates NLMM.Rnw  R graphical manual entry
      Self-Starting Logistic model      SSlogis help page, do ?SSlogis   post of annotated logistic curve with SSlogis arguments   another analysis of Orange Trees in the ASReml package manual section 8.9     additional tools in the grofit package
4. Poisson and Binomial models for responses. Doug Bates intro to generalized linear mixed models (GLMMs). Epilepsy data: Chapter 29 Count Data: The Epilepsy Study in Introduction to Longitudinal Data Analysis (also chap 27 for binary data) and epilepsy R-analysis in secs 13.3,13.4 in HSAUR, Chap 13 Analysing Longitudinal Data II -- Generalised Estimation Equations and Linear Mixed Effect Models: Treating Respiratory Illness and Epileptic Seizures Index of book chapters

Background Resources
Fitting linear mixed-effects models using lme4, Journal of Statistical Software Douglas Bates Martin Machler Ben Bolker
Linear mixed model implementation in lme4 Douglas Bates Department of Statistics University of Wisconsin Madison October 4, 2011
Applications: Interaction Between Serotonin Transporter Polymorphism (5-HTTLPR) and Stressful Life Events in Adolescents' Trajectories of Anxious/Depressed Symptoms Developmental Psychology 2012 American Psychological Association
Sizes and Long-Term Trends of Duck Broods in Maine, 1955-2007 Author(s) :Michael L. Schummer, R. Bradford Allen and Guiming Wang Source: Northeastern Naturalist, 18(1):73-86. 2011.

WEEK 4 Exercises
1. lmer/lme vs lm  Consider the sleepstudy and Ramus examples, collections of growth trajectories with no exogenous variable. Fitting the lmer models with Formula: Reaction ~ 1 + Days + (1 + Days | Subject) or Formula: ramus ~ I(age - 8) + (age | subj) has motivated the student question, what is going on here beyond what lm would do? So let's look at what lm would do in these examples. Verify (or disprove) the assertion that the fixed effects from lmer, which we have seen are the averages of the individual fit parameter estimates (i.e. lmList), and therefore the coefficients of the average growth curve are identical to the fit from lm (which ignores the existence of individual trajectories). Compare the results of the lm and lmer analyses for these two data sets.
2. Vocabulary learning data from test results on file in the Records Office of the Laboratory School of the University of Chicago. Source D R Bock, MSMBR. The data consist of scores, obtained from a cohort of pupils at the eigth through eleventh gade level on alternative forms of the vocabulary section of the Cooperative Reading Tests." There are 64 students in all, 36 male, 28 female (ordered) each with four equally spaced observations (test scores). Wide form of these data are in BOCKwide.dat and I kindly also made a long-form version BOCKlong.dat . Construct the usual collection of individual trajectory display (either connect-the-dots or compare to a straight-line). Obtain the means (over persons) and plot the group growth curve, also do separately by gender. Does there appear to be curvature (i.e. deceleration in vocabulary skill growth)? Construct an lmer model with the individual growth curve a quadratic function of grade (year), most convenient to use uncorrelated predictors grade - mean(grade) and (grade - mean(grade))^2. In the level II model allow each of the three paraters of the individual quadratic curves to differ by gender. Fit the lmer model and interpret the fixed and random effects you obtain. Compare the results with a lmer model in which the individual trajectories are straight-line. Use the anova model comparison functionality in R (e.g. anova(modLin, modQuad) to test whether the quadratic function for individual growth produces a better model fit.
3. Orange tree extras. Take the fixed effects from the orangre tree nlmer model, "m1" in the class materials, as the parameters of the "average" growth curve for this group of tress. Plot that logistic growth curve. Compare the fixed effects from nlmer to the results from nls for these data. More challenging Try to superimpose the group logistic curve )(above) onto the plots of the individual tree trajectories.
4. Asymptotic regression, SSasymp slide (pdf p.5 of Bates slides). Data are from Neter-Wasserman text in file CH13TA04.txt. The outcome variable is manufacturing relative efficiency (RelEff) over 90 weeks duration for two different locations. Plot the RelEff outcome against week for the two locations. Use the SSasymp function for a nlmer fit (or nls if needed) to see whether the asymptote differs for the two locations.
5. Autocorrelation example. Take the week 1 data and add AR(1) errors to the "Xi" observations. Assess the consequences for analyzing the collection of grwoth curves. Post of a worked out example of consequences.

4/30. Assessing Group Growth and Comparing Treatments: Repeated Measures Analysis of Variance and Related Methods

Lecture Readings:
Comparative Analyses of Pretest-Posttest Research Designs, Donna R. Brogan; Michael H. Kutner, The American Statistician, Vol. 34, No. 4. (Nov., 1980), pp. 229-232.   JSTOR link
Background primer on analysis of variance (with R); see sections 6.8, 6.9 of Notes on the use of R for psychology experiments and questionnaires Jonathan Baron, Yuelin Li.   Pdf version

Lecture Topics:
1. General formulation of random (mixed) effects model in terms of growth trajectories (see pdf pages 7-8) in week 3 resources An Assortment of Longitudinal Data Analysis Examples and Problems 1/97, Stanford biostat
2. Autocorrelation in individual trajectories, formulation and consequences (c.f. week 4 exercises). Textbook intro   R-package nlme (precursor to lme4) has multiple options, e.g. corAR1;  AR(1) example pdf page 20 of John Fox mixed models companion, also analysis of Loblolly pine trees   uses of the ACF function    reaction times    manual page.
3. Repeated measures analysis of variance for experimental comparisons.
    Brogan-Kutner liver function example.  Bock vocabulary data (Chicago).
4. Group growth and Experimental comparisons for count and dichotomous outcomes. Link functions for generalized linear mixed models (GLMMs), Bates slides (pdf pages 11-18)
     AIDS in Belgium example, single trajectory, count data using glm
     Epilepsy example, group comparisons, collection of individual trajectories. HSAUR chap 13
    Trend in proportions, group growth, Cochran-Armitage test. Expository paper: G. Salanti and K. Ulm (2003): Tests for Trend in Binary Response

Class Data examples:
Repeated measures analysis of variance, Brogan-Kutner data   wide form    long form   longform with subjects numbered sequentially   BK equivalences (old)   redo BK data, comparing lmer with aov
The ez package provides extended anova capabities.   Examples (blog notes) : Repeated measures ANOVA with R (functions and tutorials)   Repeated Measures ANOVA using R    Obtaining the same ANOVA results in R as in SPSS - the difficulties with Type II and Type III sums of squares
Count data: Rogosa R-session for Aids in Belgium    Epilepsy data; from HSAUR2 or Harvard book site   Rogosa R-session for Epilepsy
Trend in Proportions: College fund raising example     prop.trend.test help page ?prop.trend.test in R-session, Stat141 example (alcohol ordinal)

Application publications:
1.  Mere Visual Perception of Other People's Disease Symptoms Facilitates a More Aggressive Immune Response Psychological Science, April 2010   Pre-post data and difference scores (see Table 1)
2. Guns and testosterone. Guns Up Testosterone, Male Aggression
Guns, Testosterone, and Aggression: An Experimental Test of a Mediational Hypothesis Klinesmith, Jennifer; Kasser, Tim; McAndrew, Francis T,   Psychological Science. Vol 17(7), Jul 2006, pp. 568-571.


WEEK 5 Exercises
1. Treatment of Lead Exposed Children (TLC) Trial. Data and description reside at Laird-Ware text site
Start out by just using the subset of the longitudinal data Lead Level Week 0 and Week 6. Carry out the repeated measures anova for the relative effectiveness of chelation treatment with succimer or placebo (A,P). Show the three equivalences in the Brogan-Kutner paper between the repeated measures anova results and simple t-tests for these data. Next compare with a lmer fit following the class example (posted). Finally use all 4 measures (weeks 0,1,4,6) for a Active vs Placebo comparison using lmer. Compare with the results using only 2 observations.
2. Analysis of Covariance
part a. For the Brogan-Kutner data carry out an analysis of covariance (using premeasure as covariate) for the relative effectiveness of the surgery methods. Compare with class analyses.
part b. Slides 203-204 in the Laird-Ware text materials purport to demonstrate that analysis of covariance produces a more precise treatment effect estimate than difference scores (repeated measures anova). What very limiting assumption is slipped into their analysis? Can you create a counter-example to their assertion/proof?
   Solution Notes on the ALA (Laird-Ware) assertion
3. Exploratory (SFYS) analyses for epilepsy data. For each of the 59 patients compute a mean count over the four measurements.Compare progabide vs placebo on mean counts (five-number summaries etc).
Alternatively, try a simple transformation of counts, either sqrt(X + 3/8) or log(X + 1/2) for each of the 4 observations. Examine whether there are placebo vs drug differences in level or rate of change (over measurements).

5/7. Further Topics in longitudinal group comparisons (including Observational studies, Cohort Designs, Cross-over Designs)

Longitudinal in the news
Neonatal Abstinence Syndrome and Associated Health Care Expenditures United States, 2000-2009 Stephen W. Patrick, MD, et al JAMA, Publishedonline April 30,2012.
General topic, Stat is huge these days. Why Statistics? Science 6 April 2012: Vol. 336 no. 6077 p. 12

Lecture Examples readings:
HSAUR, Ch 13 Analysing Longitudinal Data II -- Generalised Estimation Equations and Linear Mixed Effect Models: Treating Respiratory Illness and Epileptic Seizures. Also Laird-Ware ALA slides (pdf pages 411-417).

Lecture Topics:
I. Group Comparisons for Longitudinal Experimental Designs
  A. Update/complete Repeated measures analysis of variance for experimental comparisons. (see Week 5 materials)        redo BK data, comparing lmer with aov  Brogan-Kutner liver function example.
  B. Analysis of Count data.      Epilepsy example, group comparisons, collection of individual trajectories. HSAUR chap 13    Rogosa R-session using gee and lmer
  C.    Binary Response, dichotomous outcomes. Respiratory Illness Data from HSAUR package. Data and description also at the ALA (Laird-Ware) site   Rogosa R-session using lmer   Also, Bates, fertility in Bangladesh (for HW).
II. Group Comparisons in Longitudinal Observational (non-experimental,  "quasi"-experimental) Designs
  A. Regression adjustments in quasi-experiments. Weisberg, H. I. Statistical adjustments and uncontrolled studies. Psychological Bulletin, 1979, 86, 1149-1164.
  B. Lord's paradox; pre-post group comparisons. Lord, F. M. (1967). A paradox in the interpretation of group comparisons. Psychological Bulletin, 68, 304-305.
   Wainer, H. (1991). Adjusting for differential base rates: Lord's Paradox again. Psychological Bulletin, 109, 147-151.
  C. Additional topics (quick mentions). Value-added analysis, Interrupted time-series, group-based trajectory modelling (matching).
III. Additional Research Designs, Longitudinal Comparisons
  A. Cohort effects. Cohort-sequential, Accelerated longitudinal designs. Robinson, K., Schmidt, T. and Teti, D. M. (2008) Issues in the Use of Longitudinal and Cross-Sectional Designs, in Handbook of Research Methods in Developmental Science (ed D. M. Teti), Blackwell Publishing Ltd, Oxford, UK
  B. Cross-over designs. Laird-Ware text slides (pdf pages 135-150). Crossover design data from slide 137, anova for crossover design ex

WEEK 6 Exercises
1. Level I, Level II model formulation for experimental group comparisons. In the respiratory (dichotomous outcome) and seizure (count outcome) examples, both of which focus on drug/placebo group comparisons, the specification of the individual trajectory (Level 1) model was not a major feature of the analysis. Rogosa note on formulating (g)lmer models.
a. The lmer model for the resp data in the class handout and section 13.4 of the HSAUR chapter
Formula: status ~ baseline + month + treatment + gender + age + centre + (1 | subject)
The within-subject term (1 | subject) in this model specifies a flat "trend" for logit(Pr(good)) over the months of observation (but adding "month" in the fixed effects negates that specification to some extent).
Compare the results from the 'reduced' model with no month term: Formula: status ~ baseline + treatment + gender + age + centre + (1 | subject) with a model that includes a trend over months,
Formula: status ~ baseline + month + treatment + gender + age + centre + (month | subject) . Compare estimate for the odds of "good" outcome for drug vs placebo; compare the model fits using anova. Which model appears perferable?
b. With the seizure data (epilepsy) there is a similar comparison to be considered. In the class handout the model used is:
seizure.rate ~ base + age + treatment + offset(per) + (period | subject) and the specification allows for a within-subject trend of log(seizure) over periods of observation. Compare these results with a 'reduced' model that specifies no time trend, (1 | subject). Compare estimates of seizure rate reduction and compare model fits.
2. Lord's Paradox, Repeated Measures Analysis of Variance
   Rogosa drawing, Lord's paradox
a. construct a two-group pre-post example with 20 observations in each group that mimics the description in Lord (1967): statistician 1 (difference scores) obtains 0 group effect; statistician 2 (analysis of covariance) obtains large group effect for the group higher on the pre-existing differences in pretest
b. construct second example for which statistician 1 (difference scores) obtains large group effect; statistician 2 (analysis of covariance) obtains 0 group effect
c. construct a third example (if possible) for which statistician 1 (difference scores) obtains large postive group effect; statistician 2 (analysis of covariance) obtains large negative group effect
d. for the examples in part a and in part c, analyze the artificial data using a repeated measures anova (one within, one between factor). [note: these examples have equal sizes within the between-subjects factor so the aov will give results matching lmer for the anova.] Demonstrate the equivalence from Brogan-Kutner paper that testing the groupXtime interaction term is equivalent to a t-test between groups on individual improvement (i.e. a statistician 1 analysis).
3. Dichotomous outcome, Bates Contraception data example. Go through the description and analysis in Part 5: Generalized linear mixed models (sections 3-5). Also useful is the corresponding R-code . Fit the "cm2" model used by Bates.

5/14. Analysis of Durations: Introduction to Survival Analysis Methods

Observational Studies in the news
Analytical Trend Troubles Scientists   Wall Street Journal, May 4 2012.
Longitudinal in the news
Obesity to affect 42% of Americans by 2030 with $550 billion in costs, say researchers     Publication:    Obesity and Severe Obesity Forecasts Through 2030 2012 Published by Elsevier Inc. on behalf of American Journal of Preventive Medicine
Survival Analysis in the news  see Week 1 news items

Useful introductions to Survival Analysis (mostly with R)
John Fox tutorial: Cox Proportional-Hazards Regression for Survival Data
Survival analysis text by Rupert G. Miller (Ch 2,3,4,6). Available as Stanford Tech Report
CHAPTER 11 Survival Analysis: Glioma Treatment and Breast Cancer Survival A handbook of statistical analyses using R (second edition). Brian Everitt, Torsten Hothorn CRC Press, Complete version (through Stanford access)    R-code for chapter11
An Introduction to Survival Analysis  Mark Stevenson EpiCentre, IVABS, Massey University
CHAPTER 11 Survival Analysis: Retention of Heroin Addicts in Methadone Maintenance Treatment. Handbook of Statistical Analyses Using Stata, Second Edition. Sophia Rabe-Hesketh Chapman and Hall/CRC 2000.

Main R-package: survival; Terry Therneau, Stanford Stat Ph.D
CRAN Task View: Survival Analysis . Survival analysis, also called event history analysis in social science, or reliability analysis in engineering, deals with time until occurrence of an event of interest. However, this failure time may not be observed within the relevant time period, producing so-called censored observations. This task view aims at presenting the useful R packages for the analysis of time to event data.
KM bootstrap in Hmisc package, bootkm. Exact tests, coin package, surv_test.

Class Data examples:
1. Miller leukemia data (Kaplan-Meier); pdf p.42 in online version     example in R, data in package survival
  Legacy versions SAS    Minitab
2. Herion (addict) data. Source: D.J. Hand, (et al.) Handbook of Small Data Sets. Properly formatted version
Analyses in Stevenson and Stata expositions above.
Additional analyses for herion: Bootstrapping, Math 159 Pomona    analysis in SAS (phreg)
Publication Source: Caplehorn,J., Bell,J.1991. Methadone dosage and the retention of patients inmaintenance treatment. The Medical Journal of Australia,154,195-199.
3. Recidivism data from John Fox tutorial.
4. Kalbfleisch and Prentice (1980) rat survival Data and description plus SAS analysis (Cox regression). Also best subsets Cox regression example, myeloma
5. R Textbook Examples. Applied Survival Analysis Chapter 3: Regression Models for Survival Data

WEEK 7-8 Exercises
1. Part a. In file teacha.dat in the class directory are 75 "survival times" (variable naeme 'career') indicating actual length of teachers careers (in years) in a rather rough school district. What is the median survival time? what proportion of teachers are still in the district after 2 years? 4 years? 6 years? Plot a survival curve from this complete set of times.
Part b. In file teachb.dat in the examples directory are the more realistic data: censored versions of the 75 "survival times" in part a. Column 1 has the times (career) and Column 2 has the censoring indicator (status = 1 if censored). Compute naive answers (ignoring censoring) to the questions in part a: what is the median survival time? what proportion of teachers are still in the district after 2 years? 4 years? 6 years?
Use the KAPLAN-MEIER PRODUCT-LIMIT ESTIMATE to answer the questions in part a: what is the median survival time? what proportion of teachers are still in the district after 2 years? 4 years? 6 years? Plot a survival curve with 95% confidence intervals. Obtain bootstrap (percentile) confidence intervals for the median survival time, and for the lower quartile (25th) of the survival time distribution.
2. Days to vaginal Cancer Mortality in Rats. The link for data example 4 above has these data and description and an assortment of (gratuitous) SAS analyses. From that file make yourself an R data set. Plot the Kaplan-Meier survival curves for the two groups (with the point-wise condidence intervals for each curve). Carry out the (asymptotic) log-rank test of identical survival curves. Compare those results with the exact (permutation) test. What are the median survival times in the two groups? Obtain a bootstrap estimate of the confidence interval for the difference of median survival times in the two groups (95% is a good default or 90%). How does this confidence interval compare with the tests for differences between the survival done above? One more thing...Redo the group comparsion of survival using Cox regression with predictor (covariate) Group membership (pretreatment regimes). Do the results agree with the previous analyses. Obtain a confidence interval for the hazard ratio (ratio of the hazard functions) between the two groups.
3. Replicate the analyses in the John Fox survival analysis tutorial for the Recidivism data (sec 3.2), links above. The experimental variable is fin indicating financial aid (or not). Start with a Kaplan Meier 2-group comparison, with plot and significance test. Then fit the 'full' model (mod.allison) and compare the significance of the experimental manipulation (fin). Plot the survival function from the cox regression (Fox Fig 1). Carry out the comparison (Fig 2) of estimated survival functions for those receiving (fin = 1) and not receiving (fin = 0) financial aid, with other covariates are fixed at their average values. Sec 5 has some model diagnostics: use the cox.zph function and plot the scaled Schoenfeld residuals.


5/21. Continue Analysis of Durations: Survival Analysis, Series of Events, Behavioral Observations
Survival Analysis in the news
Coffee linked to lower risk of death      Association of Coffee Drinking with Total and Cause-Specific Mortality Neal D. Freedman, Ph.D., Yikyung Park, Sc.D., Christian C. Abnet, Ph.D., Albert R. Hollenbeck, Ph.D., and Rashmi Sinha, Ph.D. N Engl J Med 2012; 366:1891-1904 May 17, 2012
  Good Cholesterol May Not Lower Heart Risk    Plasma HDL cholesterol and risk of myocardial infarction: a mendelian randomisation study, The Lancet

Lecture Topics
1. Revisit Group Comparisons of Survival (KM, Cox)  extensions of leukemia example (week 7)
2. Cox regression, Retention of Heroin Addicts in Methadone Maintenance Treatment. Analyses in Stevenson and Stata week 7 links. Data set (from D.J. Hand et al Handbook of Small Data Sets) linked week 7
3. Series of Events, Point Processes, Behavioral Observations.
Frailty models (individual differences, random effects) and Recurrent events (observe multiple on/off transitions and timing). Asthma data example from Duchateau et al (2003). Evolution of Recurrent Asthma Event Rate over Time in Frailty Models Journal of the Royal Statistical Society. Series C (Applied Statistics) 355-363.   see also Ch 3 in Frailty Models in Survival Analysis Andreas Wienke Chapman and Hall/CRC 2010
Behavioral Observations. David Rogosa; Ghassan Ghandour. Statistical Models for Behavioral Observations
Journal of Educational Statistics, Vol. 16, No. 3, Special Issue: Behavioral Observations. (Autumn, 1991), pp. 157-252. Jstor link    Reply to Discussants. Jstor link
Rogosa, D. R., Floden, R. E., & Willett, J. B. (1984). Assessing the stability of teacher behavior. Journal of Educational Psychology, 76, 1000-1027. APA link also available from John Willet's pub page

Computing Resources