I'm using the xt commands, including xtsum, to analyze panel data in Stata. I'm either misunderstanding the output for "T-bar", or I made a mistake in one of my variables.
My xtsum output looks like this:
Variable Mean Std. Dev. Min Max Observations
hours overall 43.83559 31.24379 1 160 N = 1215108
between 25.89261 1 160 n = 44773
within 19.69052 -92.83108 188.2023 T-bar = 27.1393
My understanding is that T-bar represents the average number of observations per panel variable (in this case, per person). However, I also have a variable set up that counts the number of observations per person:
sort hcw_id pp_id
egen ppcount = max(pp_id), by(hcw_id)
pp_id is an observation ID per person, and hcw_id is the person ID. I've checked in the Data Editor to verify that pp_id is counting observations per peson and ppcount is taking the max value of pp_id for each person. For example, if there are 10 records for a person, each record will be labeled 1-10 with pp_id and ppcount will be 10.
Here is the confusing thing: the mean of ppcount is 46. This should mean that people in the data have, on average, 46 observations. But why is this so different from T-bar in the xtsum output? Am I misunderstanding something in the documentation for xtsum or is my ppcount variable way off?
By the way, I just thought of another way of double-checking this - pp_id counts the number of pay roll records per person. Based on other variables, I know that each person has worked around a year and a half, which would be about 40 biweekly pay periods. This suggests that ppcount is accurate, and T-bar is measuring something different.
Is anyone familiar with xtsum and able to shed some light on this? Thank you!