Hey!
This is my first post here at this forum. I have been battling with this problem for the last two days. I have 17 scoring variables in a panel with i patients for t months. Observed months can vary.
Due to anonymization, for some months the scores for all 17 variables are gone missing. I know that these variables are hardly changing. Therefore, if the last observed score is equal the first score after gone missing, then the missing in between should be the same. How can I do this?
I believe that an example will be better. This is my data, where F1-F6 is my scoring variables and S marks the observations that are “suppressed” due to anonymization.
I will only impute if non of the scoring variables have changed from the latest observed scoring.
If one or several has changed, then one should not replace these missing. I would like it to look like this:
Any ideas? I can post some of my failed tries, if needed.
This is my first post here at this forum. I have been battling with this problem for the last two days. I have 17 scoring variables in a panel with i patients for t months. Observed months can vary.
Due to anonymization, for some months the scores for all 17 variables are gone missing. I know that these variables are hardly changing. Therefore, if the last observed score is equal the first score after gone missing, then the missing in between should be the same. How can I do this?
I believe that an example will be better. This is my data, where F1-F6 is my scoring variables and S marks the observations that are “suppressed” due to anonymization.
ID | T | F1 | F2 | F3 | F4 | F5 | F6 | S |
1 | 1 | . | . | . | . | . | . | 1 |
1 | 2 | 2 | 3 | 2 | 3 | 2 | 4 | 0 |
1 | 3 | . | . | . | . | . | . | 1 |
1 | 4 | . | . | . | . | . | . | 1 |
1 | 5 | . | . | . | . | . | . | 1 |
1 | 6 | 2 | 3 | 2 | 3 | 2 | 4 | 0 |
1 | 7 | 2 | 3 | 2 | 3 | 2 | 4 | 0 |
1 | 8 | . | . | . | . | . | . | 1 |
1 | 9 | . | . | . | . | . | . | 1 |
1 | 10 | 2 | 3 | 3 | 4 | 2 | 4 | 0 |
2 | 1 | 1 | 2 | 1 | 1 | 2 | 3 | 0 |
2 | 2 | 1 | 2 | 1 | 1 | 2 | 3 | 0 |
2 | 3 | . | . | . | . | . | . | 1 |
2 | 4 | . | . | . | . | . | . | 1 |
2 | 5 | . | . | . | . | . | . | 1 |
2 | 6 | . | . | . | . | . | . | 1 |
2 | 7 | 1 | 2 | 1 | 1 | 4 | 4 | 1 |
2 | 8 | . | . | . | . | . | . | 1 |
2 | 9 | 1 | 2 | 1 | 1 | 4 | 4 | 1 |
If one or several has changed, then one should not replace these missing. I would like it to look like this:
ID | T | F1 | F2 | F3 | F4 | F5 | F6 | S |
1 | 1 | . | . | . | . | . | . | 1 |
1 | 2 | 2 | 3 | 2 | 3 | 2 | 4 | 0 |
1 | 3 | 2 | 3 | 2 | 3 | 2 | 4 | 1 |
1 | 4 | 2 | 3 | 2 | 3 | 2 | 4 | 1 |
1 | 5 | 2 | 3 | 2 | 3 | 2 | 4 | 1 |
1 | 6 | 2 | 3 | 2 | 3 | 2 | 4 | 0 |
1 | 7 | 2 | 3 | 2 | 3 | 2 | 4 | 0 |
1 | 8 | . | . | . | . | . | . | 1 |
1 | 9 | . | . | . | . | . | . | 1 |
1 | 10 | 2 | 3 | 3 | 4 | 2 | 4 | 0 |
2 | 1 | 1 | 2 | 1 | 1 | 2 | 3 | 0 |
2 | 2 | 1 | 2 | 1 | 1 | 2 | 3 | 0 |
2 | 3 | . | . | . | . | . | . | 1 |
2 | 4 | . | . | . | . | . | . | 1 |
2 | 5 | . | . | . | . | . | . | 1 |
2 | 6 | . | . | . | . | . | . | 1 |
2 | 7 | 1 | 2 | 1 | 1 | 4 | 4 | 1 |
2 | 8 | 1 | 2 | 1 | 1 | 4 | 4 | 1 |
2 | 9 | 1 | 2 | 1 | 1 | 4 | 4 | 1 |
Any ideas? I can post some of my failed tries, if needed.
Comment