Hi all,
Example dataset:
Stata code:
xtmixed y treatment_time group sex age baseline_y if treatment_time>=0 || num:treatment_time
Summary of aim:
I am using xtmixed on panel data to predict y from treatment_time. The regression is only being run on data after treatment starts (when treatment_time is >=0) as we are looking at the impact of treatment on y.
Fixed and random variables are listed in the code and are chosen based on the variable’s perceived impact on y.
Summary of problem:
Stata automatically excludes subjects (labelled as num) if they have missing data for any of the fixed variables. Here, there is some missing data for baseline_y. I would like Stata to include subjects 1 and 3 who have missing values for baseline_y.
Options tried so far:
Many thanks in advance
Example dataset:
num | observation_num | group | sex | age | y | treatment_time | baseline_y |
1 | 1 | 1 | 1 | 50 | 72.4 | -6 | . |
1 | 2 | 1 | 1 | 50 | 67 | -3.3 | . |
1 | 3 | 1 | 1 | 50 | 64 | 4.9 | . |
1 | 4 | 1 | 1 | 50 | 76 | 5.5 | . |
2 | 1 | 1 | 0 | 51 | 30 | 0 | 30 |
2 | 2 | 1 | 0 | 51 | . | . | 30 |
2 | 3 | 1 | 0 | 51 | . | . | 30 |
2 | 4 | 1 | 0 | 51 | . | . | 30 |
3 | 1 | 0 | 1 | 70 | 67.7 | -4.7 | . |
3 | 2 | 0 | 1 | 70 | 63.2 | -3.5 | . |
3 | 3 | 0 | 1 | 70 | 69.8 | 2.3 | . |
3 | 4 | 0 | 1 | 70 | 71.6 | 2.8 | . |
4 | 1 | 0 | 1 | 65 | 78 | -2.6 | 58 |
4 | 2 | 0 | 1 | 65 | 73 | -2.1 | 58 |
4 | 3 | 0 | 1 | 65 | 67.9 | -2 | 58 |
4 | 4 | 0 | 1 | 65 | 67 | -1 | 58 |
xtmixed y treatment_time group sex age baseline_y if treatment_time>=0 || num:treatment_time
Summary of aim:
I am using xtmixed on panel data to predict y from treatment_time. The regression is only being run on data after treatment starts (when treatment_time is >=0) as we are looking at the impact of treatment on y.
Fixed and random variables are listed in the code and are chosen based on the variable’s perceived impact on y.
Summary of problem:
Stata automatically excludes subjects (labelled as num) if they have missing data for any of the fixed variables. Here, there is some missing data for baseline_y. I would like Stata to include subjects 1 and 3 who have missing values for baseline_y.
Options tried so far:
- I cannot impute the missing baseline_y values accurately. Any values that were accurately imputable have already been imputed and are in the dataset.
- I do not want to replace the missing data with a number (i.e. 999), due to concerns this will bias the data.
Many thanks in advance