amp.modeller: Model age-mixing pattern.

Description Usage Arguments Details Value Examples

View source: R/amp.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
2
amp.modeller(dataframe, agegroup, timepoint, timewindow, start = FALSE,
  SHIMS = TRUE, method = "lmer")

Arguments

dataframe

The dataframe that is produced by agemix.episodes.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.

SHIMS

Should only the three most recent relationships be kept, like in the SHIMS survey?

method

Should the link[nlme]{lme} or link[lme4]{lmer} function be used? The lme function can be used to model heteroskedastic residual error.

Details

The amp.modeller function can use either the link[nlme]{lme} or the link[lme4]{lmer} 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 built with link[nlme]{lme} also explicitly account for heteroskedastic variance, since the variance in partner ages may grow for older ages.

The function produces a fitted model.

Value

returns a model fitted with link[nlme]{lme} or link[lme4]{lmer}

Examples

1
2
3
data(persreldf)
agemixpatdat <- amp.modeller(dataframe = persreldf, agegroup = c(18, 50),
timepoint = 30, timewindow = 0.5, start = FALSE, SHIMS = TRUE, method = "lmer")

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