Learn R Programming

qlifetable (version 0.0.2-4)

distribute_excess: Randomly distributes the excess of recorded births in a given day

Description

Randomly distributes a number of births equivalent to the excess of registered births on a given day of a year among the different days of that year.

Usage

distribute_excess(
  date.birth,
  day = "01-01",
  maximum.excess = 50,
  date.event = NULL
)

Value

A numeric vector of the same length and order as data.birth.

Arguments

date.birth

A character vector with the dates of birth in format either "yyyy-mm-dd" or "yyyy-mm-dd hour:min:secs" (for instance, "2016-01-20 12:00:00") of a population.

day

A character vector in format "mm-dd" with the day of the year for which the (assumed) excess must be randomly distributed. By default, "01-01".

maximum.excess

A numeric value indicating the percentage of births registered above the average to be surpassed in the target day in order to consider that in that day an excess of births has been artificially recorded.

date.event

A character vector with the dates of events in format either "yyyy-mm-dd" or "yyyy-mm-dd hour:min:secs" (for instance, "2016-01-20 12:00:00") linked to the population of births. By default, NULL. When the dates of births are linked to some dates of events and both occur in the same year, it can happen that some imputed dates of births be posterior to the dates of events. The inclusion of this argument (when different of NULL) avoids this possibility happening.

Author

Josep Lledo josep.lledo@uv.es

Jose M. Pavia pavia@uv.es

References

Pavia, JM and Lledo, J (2022). Estimation of the Combined Effects of Ageing and Seasonality on Mortality Risk. An application to Spain. *Journal of the Royal Statistical Society, Series A (Statistics in Society)*, 185(2), 471-497. tools:::Rd_expr_doi("10.1111/rssa.12769")

See Also

time_exposed_ins, time_exposed_outs

Examples

Run this code

dates <- c("1920-05-13", "1999-04-12", "2019-01-01", "2019-01-01",
           "2022-01-01", "2022-01-01", "2022-01-01", "2022-01-01", "2022-01-01")
distribute_excess(dates)

Run the code above in your browser using DataLab