zelnik | R Documentation |
Zelnik's method is used to adjust distributions by year of age for digit preference.
zelnik(Value, p, Age)
Value |
numeric. A vector of demographic counts in single age groups. |
p |
integer. Perturbation vector used, 1 or 2. Default 1. |
Age |
integer. Vector of lower bound of age classes. |
Single year age groups are assumed. If q=1
, age x is affected by ages x-10 through x+10. If q=2
, age x is affected by ages x-15 through x+15.
A vector is returned of the same length as Value
, but the boundary values are imputed with NA
.
If q=1
, ages 0-9 and the final 10 ages are NA
. If q=2
, ages 0-14 and the final 15 ages are returned as NA
.
Note results do not sum to the total from the same age-range of Value
because smoothing draws from ages outside that range.
A vector with the adjusted values.
gray1987missingagesDemoTools
# data from gray1987missingages, Table 2, page 21: Aplication of Q1 and
# Q2 linear operators, Bangladesh Census, 1 March 1974-Males.
Pop <- c(941307,1041335,1237034,1411359,1383853,1541942,1321576,1285877,1563448,886705,
1623998,562924,1485173,543216,771219,903496,686431,370007,942999,250820,
1023667,200131,688640,222011,281738,1239965,288363,263326,483143,78635,
1349886,68438,415127,101596,100758,1392434,178633,126351,286520,50836,
1331036,48995,251153,58393,54995,1033812,68792,72766,175943,28254,
1038747,32894,136179,37667,38230,596049,52602,36493,74106,16759,
790643,20596,70109,18044,19891,357491,15253,17489,31057,8481,
429816,7951,35583,8612,6589,454645)
Age <-0:75
z1 <- zelnik(Pop,1,Age)
z2 <- zelnik(Pop,2,Age)
## Not run:
plot(Age,Pop,type='l',col = gray(.4))
lines(as.integer(names(z1)),z1,col = "blue",lwd=2)
lines(as.integer(names(z2)),z2,col = "red",lwd = 2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.