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.

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



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


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


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


optional arguments passed to stats::loess()


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


if (FALSE) { Age <- 0:99 plot(Age,pop1m_pasex) lines(Age, loess_smth1(pop1m_pasex, Age, FALSE)) }