loess_smth1 | R Documentation |
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, ...)
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 |
... |
optional arguments passed to |
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.
loess
## Not run:
Age <- 0:99
plot(Age,pop1m_pasex)
lines(Age, loess_smth1(pop1m_pasex, Age, FALSE))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.