loess_smth1: Wrapper to LOESS using demographic data.

View source: R/OGIVE.R

loess_smth1R Documentation

Wrapper to LOESS using demographic data.

Description

LOESS (locally weighted smoothing) helps to smooth data over age, preserving the open age group if necessary. This is a simple wrapper to stats::loess() but using standard demographic arguments. It is a popular tool to create a smooth line through a timeplot or scatter plot.

Usage

loess_smth1(Value, Age, OAG = TRUE, ...)

Arguments

Value

numeric vector of counts in single, abridged, or 5-year age groups.

Age

integer vector of ages corresponding to the lower integer bound of the counts.

OAG

logical. Whether or not the top age group is open. Default TRUE.

...

optional arguments passed to stats::loess()

Details

The total sum of Value is preserved in the output. One can control smoothness using the spar argument of stats::loess(). See loess for more details.

See Also

loess

Examples

## Not run: 
Age <- 0:99
plot(Age,pop1m_pasex)
lines(Age, loess_smth1(pop1m_pasex, Age, FALSE))

## End(Not run)

timriffe/DemoTools documentation built on Oct. 14, 2024, 12:53 p.m.