The interpolation is done by age (not cohort) using a linear or exponential function. This comes from the PAS spreadsheet called ADJINT.
interpolatePop( Pop1, Pop2, Date1, Date2, DesiredDate, method = "linear", roundoutput = FALSE )
Pop1 | numeric. A vector of demographic counts by age at time 1 (earlier date). |
---|---|
Pop2 | numeric. A vector of demographic counts by age at time 2 (later date). |
Date1 | date. The date corresponding to the population age distribution at time 1. See details for ways to express it. |
Date2 | date. The date corresponding to the population age distribution at time 2. See details for ways to express it. |
DesiredDate | date. The desired date of the output population age distribution. See details for ways to express it. |
method | string. The method to use for the interpolation, either "linear" or "exponential". Default "linear". |
roundoutput | logical. Whether or not to return integers. Default |
A vector of the interpolated population for the requested date.
The age group structure of the output is the same as that of the input. Ideally, DesiredDate
should be between the Date1 and Date2.
Dates can be given in three ways 1) a Date
class object, 2) an unambiguous character string in the format "YYYY-MM-DD"
,
or 3) as a decimal date consisting in the year plus the fraction of the year passed as of the given date.
United States Census Bureau (2017). “Population Analysis System (PAS) Software.” https://www.census.gov/data/software/pas.html, https://www.census.gov/data/software/pas.html.
Sean Fennel
# YYYY-MM-DD dates as character EarlyDate <- "1980-04-07" LaterDate <- "1990-10-06" DesiredDate <- "1985-07-01" interpolatePop(popA_earlier, popA_later, EarlyDate, LaterDate, DesiredDate)#> [1] 151269.21 698637.56 935163.70 838408.52 669361.53 555363.48 452291.31 #> [8] 373698.99 370798.20 334150.36 258103.71 223758.80 190651.53 158396.80 #> [15] 119288.68 80400.82 46479.94 51836.50interpolatePop(popA_earlier, popA_later, EarlyDate, LaterDate, DesiredDate, method = "exponential")#> [1] 142611.79 658653.23 881642.53 790424.84 631052.72 523578.99 426405.83 #> [8] 352311.49 349576.73 315026.30 243331.95 210952.67 179740.18 149331.46 #> [15] 112461.57 75799.33 43819.81 48869.80if (FALSE) { plot(popA_earlier, t ='l', col='red', ylim = c(400,1220000), ylab = 'The counts', xlab = 'Age groups') lines(interpolatePop(popA_earlier, popA_later, EarlyDate, LaterDate, DesiredDate), t = 'l', col='black') lines(popA_later, t = 'l', col='blue') legend(12,1000000, legend = c('Pop in 1980-04-07', 'Pop in 1985-07-01', 'Pop in 1990-10-06'), col=c('red','black','blue'), lty = 1) }