method
smooth.demogdata(data, method = switch(data$type, mortality = "mspline", fertility = "cspline", migration = "loess"), age.grid, power = switch(data$type, mortality = 0.4, fertility = 1, migration = 1), b = 65, k = 30, span = 0.2, lambda = 1e-10, interpolate = FALSE, weight = data$type != "migration", obs.var = "empirical")
read.demogdata
."mspline"
(monotonic regression splines),
"cspline"
(concave regression splines),
"spline"
(unconstrained regression splines),
"loess"
(local quadratic using loess
).method=="mspline"
. Above this, the smooth curve
is assumed to be monotonically increasing.method=="loess"
.method=="loess"
.method=="cspline"
.interpolate==TRUE
, a linear interpolation is used instead of smoothing.data
except all
rate matrices are replaced with smooth versions and pop matrices are replaced with disaggregated population estimates obtained
using monotonic spline interpolation applied to the cumulative population data.
Weight
matrices are also added to the object showing the inverse
variances of the estimated smooth curves. method
determines the type of smoothing used.
k
. Methodology based on Wood (1994). Code calls gam
for the basic
computations.lambda
.
Methodology based on He and Ng (1999). Code calls cobs
for the basic computations.b=Inf
.loess
for the basic computations.france.sm <- smooth.demogdata(extract.years(fr.mort,1980:1997))
plot(france.sm)
plot(fr.mort,years=1980,type="p",pch=1)
lines(france.sm,years=1980,col=2)
Run the code above in your browser using DataLab