Dear statlisters,
I think this is more a problem of logic and using basic bysort commands, however I am hitting a block and coding what I perceive to be nonsence.
I have panel data. Each individual gets sampled potentially many times over the course of time. The sample result (date stamped) is one of ~200 categories (if positive) or negative. Sampling is not 100% sensitive and so a negative in close temporal proximity to any positive might be regarded as a false negative. Sampling can occur very frequently, and there may be several samples in a short space of time resulting in 1) repetition of the same category positive, 2) different category positives close to one another, 3) the same as 1 and 2, but mixed with additional negatives, 4) only negatives.
Objective: To deduplicate the data by defining an 'episode' defined by duration of time and remove 'duplicates'.
Aim 1
Per individual: Remove negatives which are sufficiently close to a positive as to regard them as duplicate measures (which were insufficiently sensitive). eg If (abs(Date[positive] - Date[negative]))<14 then drop Negative (ie within 14 days of a positive - it doesn't matter if there are positives closer to that particular negative, it will get dropped regardless)
Aim 2
Following on from Aim 1. Now classifying positives as per their subgroup eg A, B, C. eg Per individual positive-A episode: Deduplicate by dropping all positive-As within 14 days of the first positive-A, then drop all positive A's within 14 days of the next 'not-yet-dropped' positive-A, until reaching the end of that individual
There is a further problem down the line of how to classify episodes which have more than one category of positive in them, but I need to think about this further.
Thanks for your thoughts.
Kind regards
Robert
I think this is more a problem of logic and using basic bysort commands, however I am hitting a block and coding what I perceive to be nonsence.
I have panel data. Each individual gets sampled potentially many times over the course of time. The sample result (date stamped) is one of ~200 categories (if positive) or negative. Sampling is not 100% sensitive and so a negative in close temporal proximity to any positive might be regarded as a false negative. Sampling can occur very frequently, and there may be several samples in a short space of time resulting in 1) repetition of the same category positive, 2) different category positives close to one another, 3) the same as 1 and 2, but mixed with additional negatives, 4) only negatives.
Objective: To deduplicate the data by defining an 'episode' defined by duration of time and remove 'duplicates'.
Aim 1
Per individual: Remove negatives which are sufficiently close to a positive as to regard them as duplicate measures (which were insufficiently sensitive). eg If (abs(Date[positive] - Date[negative]))<14 then drop Negative (ie within 14 days of a positive - it doesn't matter if there are positives closer to that particular negative, it will get dropped regardless)
Aim 2
Following on from Aim 1. Now classifying positives as per their subgroup eg A, B, C. eg Per individual positive-A episode: Deduplicate by dropping all positive-As within 14 days of the first positive-A, then drop all positive A's within 14 days of the next 'not-yet-dropped' positive-A, until reaching the end of that individual
There is a further problem down the line of how to classify episodes which have more than one category of positive in them, but I need to think about this further.
Thanks for your thoughts.
Kind regards
Robert

Comment