convertToWideFormat {MicSim} | R Documentation |
Reshaping microsimulation output into wide format
Description
The function reshapes the output given by micSim or by micSimParallel into wide format. In wide format, the data comprises for each episode which an individual experiences additional column entries.
Usage
convertToWideFormat(pop)
Arguments
pop |
The data frame |
Value
A data frame comprising the microsimulation output in wide format.
- ID
is the unique numerical person identifier of an individual.
- birthDate
is the birth date of an individual.
- initState
is the state in which an individual initially entered the virtual population of the simulation.
- ns
gives the number of (completed) episodes an individual has passed.
- The variables From.i
and To.i
mark the start und the arrival state of the transition corresponding to episode i
. The variables transitionTime.i
and transitionAge.i
give the corresponding transition time and age. The enumerator i
ranges from 1 to the maximal number of transitions which an individual experienced during simulation. Only completed episodes are counted.
Author(s)
Sabine Zinn
Examples
# Run microsimulation before, e.g., the complex example described on the
# help page of the function "micSim".
## Not run:
pop <- micSim(initPop, immigrPop, transitionMatrix, absStates, initStates,
initStatesProb, maxAge, simHorizon, fertTr)
popWide <- convertToWideFormat(pop)
## End(Not run)