timriffe / DemoTools

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

graduate_mono doesn't seem to work if ages don't start from 0 #237

Closed peterdavjohnson closed 3 years ago

peterdavjohnson commented 3 years ago

The first call works ok, but not the second.

Pop5 <- c(88962, 73756, 51990, 55395, 48562)
Age5 <- seq(0,20,5)

Pop <- graduate_mono(Pop5, Age5 )

Age5alt <- seq(45,65,5)
PopAlt <- graduate_mono(Pop5, Age5alt )
peterdavjohnson commented 3 years ago

I think I found the problem which seems to be corrected here (lines 1072-1074):

  AgePred               <- c(min(Age), min(Age) + cumsum(AgeInt)) # modified 5/5/21
  y                     <- c(0, cumsum(Value))
  AgeS                  <- min(Age):(min(Age)+sum(AgeInt)) # modified 5/5/21
timriffe commented 3 years ago

Yup, I’ll push in a bit. Appears in more than one place it seems

On Wed 5. May 2021 at 14:36, peterdavjohnson @.***> wrote:

I think I found the problem which seems to be corrected here (lines 1072-1074):

AgePred <- c(min(Age), min(Age) + cumsum(AgeInt)) # modified 5/5/21 y <- c(0, cumsum(Value)) AgeS <- min(Age):(min(Age)+sum(AgeInt)) # modified 5/5/21

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timriffe/DemoTools/issues/237#issuecomment-832651936, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG43GZGN7POABBK4UI3JWDTME3VRANCNFSM44EQMOSA .