Description Usage Arguments Details Value Examples
View source: R/agedif.median.R
Calculate the median and inter-quartile range (IQR) of age differences for the population simulated in Simpact. The user specifies a time point, time window, and age group for which they would like to obtain the median age difference.
1 | agedif.median(df, agegroup, timepoint, timewindow, start = FALSE)
|
df |
The dataframe that is produced by |
agegroup |
Boundaries of the age group that should be retained, e.g. c(15, 30). The interval is closed on the left and open on the right. |
timepoint |
Point in time during the simulation to be used in the calculation. |
timewindow |
The length of time before the timepoint for which relationships should be included, e.g. 1, representing one year before the timepoint. This should be a whole number. |
start |
This is a logical indicating that only relationships starting after the beginning of the window should be used. If start = FALSE relationships could start before the time window. This is the default. |
The user can optionally choose whether or not they would like to examine only relationships that began during their specified time window.
The table that is returned contains the median stratified by gender, as well as the overall median in the population. The user should be aware that the number of relationships for men and women does not sum to the same number as the overall number. This is because Simpact produces a complete closed population and therefore some of the relationships used to calculate the median for men, may also be included in the calculation for women. The overall calculation, examines only unique relationships in the entire population.
A dataframe of class "tbl_df" "tbl" "data.frame"
1 2 3 4 5 | # In our population we want to look at the median age difference for men
# and women 40 years into the simulation. We want to pretend we are
# replicating a survey where participants are included only if they are
# between the ages of 18 and 49. Furthermore, the are asked only about
# the relationships that happened in the previous 2 years.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.