In https://github.com/PHSKC-APDE/apde.chi.tools/blob/main/R/chi_qa_tro.R#L305 we have:
report_message("Checking that caution flag exists if RSE >= 30%")
# Modified to only check non-NA RSE values
if(nrow(CHIestimates[(numerator == 0 | (!is.na(rse) & rse>=30)) & (caution != "!" | is.na(caution)) ]) > 0 ){
status <- 0
if(verbose){
warning("There is at least one row where a caution flag ('!') is not used and rse >= 30%.
Please fix this error prior to rerunning the chi_qa_tro() function.
You can view the problematic data by typing something like: View(CHIestimates[!is.na(rse) & rse>=30 & (caution != '!' | is.na(caution))])")
}
}
The question is, when numerator == 0, should we really expect caution == '!'?
When numerator is 0, result is 0, which means RSE = se / 0, which is undefined. (Technically Inf in R, but we change to NA because SQL can't deal with Inf). So, when RSE == NA, then I think caution should also be NA. Do you agree?
If you agree, I can just get rid of numerator == 0 | , which will solve this issue. I can take care of this. I just want your opinion in case I'm missing something.
BTW, this is not theoretical. It came up more than 30 times in ACS uninsured analyses.
In https://github.com/PHSKC-APDE/apde.chi.tools/blob/main/R/chi_qa_tro.R#L305 we have:
The question is, when
numerator == 0, should we really expectcaution == '!'?When numerator is 0, result is 0, which means RSE = se / 0, which is undefined. (Technically
Infin R, but we change toNAbecause SQL can't deal with Inf). So, when RSE == NA, then I think caution should also be NA. Do you agree?If you agree, I can just get rid of
numerator == 0 |, which will solve this issue. I can take care of this. I just want your opinion in case I'm missing something.BTW, this is not theoretical. It came up more than 30 times in ACS uninsured analyses.