pattern.modeller: Model age-mixing pattern.

Description Usage Arguments Details Value Examples

View source: R/Misc/Pre.hhohhoMaxARTFinal.Sim/hho.rsimpacthelper.R View source: R/pattern.modeller.R

Description

Models the age-mixing pattern for the population simulated in Simpact. The user specifies a time point, time window, and age group for which they would like to obtain a summary of the age-mixing pattern. The user also specifies whether only relationships that started within the time window should be used.

Usage

1
pattern.modeller(dataframe, agegroup, timepoint, timewindow, start = FALSE)

Arguments

dataframe

The dataframe that is produced by agemix.df.maker

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.

Details

The pattern.modeller function uses the link[nlme]{lme} function to build a linear mixed effects model regressing the partner's age at the time the relationship started on his/her own age at the beginning of the relationship. The models are stratified by gender. Each person can have more than one relationship so a random intercept at the level of the person is added to the model.

The models also explicitly account for heteroskedastic variance, since the variance in partner ages tends to grow for older ages.

The function produces a list containing two elements. The first is a subsetted dataframe of relationships that meet the inclusion criteria specified in the function's arguments. This dataframe includes population-average partner age predictions from the model. The second element is a dataframe that contains key age-mixing pattern outputs from the model. These outputs can be found in the second dataframe:

slope

Also known as the beta-coefficient, this is the change in partner age for each year increase in age. It represents how fast the average age differences grow in the population.

intercept

This is the average partner age for the first age in the specified interval.

power

This represents how fast the variance in partner ages grows with increasing age.

lowerpower

This is the lower limit of the 95 confidence interval for the power coefficient.

upperpower

This is the upper limit of the 95 the power coefficient.

bvar

This is the between-subject variance from the model.

wvar

Also known as the residual error, this represents the amount of within-subject variance from the model.

Value

returns a list with two elements: 1. Dataframe of relationships inputted into model, and 2. dataframe of model outputs.

Examples

1
2
3
data(persreldf)
agemixpatdat <- pattern.modeller(dataframe = persreldf, agegroup = c(15, 30),
timewindow = 1, timepoint = 30)

wdelva/RSimpactHelp documentation built on Dec. 26, 2019, 3:42 a.m.