timriffe / DemoTools

Tools for the evaluation, adjustment, and standardization of demographic data
https://timriffe.github.io/DemoTools
Other
59 stars 31 forks source link

In AGEINT.R, interp function assumes values can not be negative #245

Closed peterdavjohnson closed 3 years ago

peterdavjohnson commented 3 years ago

In the interp function, lines 286-289:

  if(all(!is.na(int)) & any(int<0)){
    cat("Negative values were turned 0. No accepted in population counts, fertility rates or life table functions.\n")
    int[int<0] <- 0  
  }

In interp_coh.R it is being used to interpolate logit(qx) which is mostly negative. Maybe there should be an option that indicates whether negative values are ok. Maybe NegativeOK = TRUE/FALSE? Default to FALSE to be consistent with current version.