graduate_grabill: The basic Grabill age-splitting method

View source: R/graduate.R

graduate_grabillR Documentation

The basic Grabill age-splitting method

Description

This method uses Grabill's redistribution of middle ages and blends into Sprague estimated single-age population counts for the first and final ten ages. Open age groups are preserved, as are annual totals.

Usage

graduate_grabill(Value, Age, AgeInt, OAG = TRUE)

Arguments

Value

numeric vector, presumably counts in grouped ages

Age

integer vector, lower bounds of age groups

AgeInt

integer vector, age interval widths

OAG

logical, default = TRUE is the final age group open?

Details

Dimension labeling is necessary. There must be at least six age groups (including the open group). One year of data will work as well, as long as it's given as a single-column matrix. Data may be given in either single or grouped ages. If the highest age does not end in a 0 or 5, and OAG == TRUE, then the open age will be grouped down to the next highest age ending in 0 or 5. If the highest age does not end in a 0 or 5, and OAG == FALSE, then results extend to single ages covering the entire 5-year age group.

Value

numeric vector in single ages.

References

\insertRef

shryock1973methodsDemoTools

Examples

a5 <- as.integer(rownames(pop5_mat))
p5 <- pop5_mat[,1]
p1g <- graduate_grabill(Value = p5, Age = a5, OAG = TRUE)
sum(p1g) - sum(p5)
p1s <- graduate_sprague(p5, Age = a5, OAG = TRUE)
## Not run: 
plot(seq(0,100,by=5),p5[,1]/5,type = "s", col = "gray", xlab = "Age", ylab = "Count")
lines(0:100, p1g, col = "red", lwd = 2)
lines(0:100, p1s, col = "blue", lty = 2, lwd =2)
legend("topright",
	lty = c(1,1,2),
	col = c("gray","red","blue"),
	lwd = c(1,2,1),
	legend = c("grouped","Grabill", "Sprague"))

## End(Not run)

# also works for single ages:
grab1 <- graduate_grabill(Value = pop1m_ind, Age = 0:100)
## Not run: 
plot(0:100, pop1m_ind)
lines(0:100, grab1)

## End(Not run)

timriffe/DemoTools documentation built on Jan. 28, 2024, 5:13 a.m.