MastodonC/witan.cic

NA's generated in age-out-population

Closed this issue · 1 comments

mutate(age_out_quantile = min(if_else(exit_age >= 6565, quantile, NA_real_), na.rm = TRUE)) %>%

NA's are inserted at this point if exit age is more than or equal to 6565 days (just under 18 years old). There are records of up 6575 (just over 18 years old). Perhaps we haven't used 6570 days (18 years) due to leap years creating issues? Or maybe it's just a typo and the value to predicate against should 6575.

I think the question is do we want to keep data whereby someone has remained in care beyond their 18th birthday (only by a few days) - if so fix the predicate. If not, it may be worth keeping this in, but making the reporting of NA's more explicit (when running in R you're given a warning, which is lost during interop I suspect)

Just realised, we also only know a person's month of birth, so we generate a day within that month. Because we work with days, it is entirely possible the model can create a date that is too early, which only becomes evident when a person exits care on their 18 birthday, thus someone can remain in care beyond their 18th birthday (hence where 6575 comes from). Still unsure where 6565 comes from however.