Hi everyone,
I have a dataset with information for teachers at baseline (time==0) and endline (time==1). Some teachers participated in a training (treatment==1) and some did not (control: treatment==0). The teachers at baseline are not the same as the teachers at endline, but they were selected at random from the same schools and we know they are similar based on several demographic characteristics (e.g. age, education level, socioeconomic level, etc.). Because the teachers are not the same, when I try to set my dataset for panel analysis, Stata shows the following message: "repeated time values within panel"
Could I create a group variable including the time variable, as shown below, to conduct panel data analysis? In other words, would that grouped variable allow me to estimate the difference in difference (i.e. difference between the treatment and control groups across time)? Please see the code below (also note that I am controlling for other variables, but for simplicity here I only included the dependent variable and main predictor in the command below):
Code:
egen panelvar=group(school_id class_id time)
xtset panelvar
xtreg teacher_performance treatment
The xtset command with the panelvar works fine, but I want to make sure the analysis is accounting for differences between the treatment and control groups across time and not just estimating before-and-after differences.
I thought of collapsing my dataset at the school level so that I have one school id per time unit, but my sample becomes very small, as I only have 30 schools between treatment and control schools. I don't think my results will be robust enough with such sample.
Many thanks in advance!
P
I have a dataset with information for teachers at baseline (time==0) and endline (time==1). Some teachers participated in a training (treatment==1) and some did not (control: treatment==0). The teachers at baseline are not the same as the teachers at endline, but they were selected at random from the same schools and we know they are similar based on several demographic characteristics (e.g. age, education level, socioeconomic level, etc.). Because the teachers are not the same, when I try to set my dataset for panel analysis, Stata shows the following message: "repeated time values within panel"
Could I create a group variable including the time variable, as shown below, to conduct panel data analysis? In other words, would that grouped variable allow me to estimate the difference in difference (i.e. difference between the treatment and control groups across time)? Please see the code below (also note that I am controlling for other variables, but for simplicity here I only included the dependent variable and main predictor in the command below):
Code:
egen panelvar=group(school_id class_id time)
xtset panelvar
xtreg teacher_performance treatment
The xtset command with the panelvar works fine, but I want to make sure the analysis is accounting for differences between the treatment and control groups across time and not just estimating before-and-after differences.
I thought of collapsing my dataset at the school level so that I have one school id per time unit, but my sample becomes very small, as I only have 30 schools between treatment and control schools. I don't think my results will be robust enough with such sample.
Many thanks in advance!
P
Comment