Learn R Programming

stpm (version 1.1.2)

simdata_cont2: Multi-dimensional simulation function for continuous trait. Similar to simdata_cont(...) but much faster.

Description

Multi-dimensional simulation function for continuous trait. Similar to simdata_cont(...) but much faster.

Usage

simdata_cont2(N = 10, a = -0.05, f1 = 80, Q = 2e-08, f = 80, b = 5,
  mu0 = 1e-05, theta = 0.08, ystart = 80, tstart = 30, tend = 105,
  dt = 1, sd0 = 1)

Arguments

N
Number of individuals.
a
A k by k matrix, which characterize the rate of the adaptive response.
f1
A particular state, which if a deviation from the normal (or optimal). This is a vector with length of k.
Q
A matrix k by k, which is a non-negative-definite symmetric matrix.
f
A vector-function (with length k) of the normal (or optimal) state.
b
A diffusion coefficient, k by k matrix.
mu0
mortality at start period of time.
theta
A displacement coefficient of the Gompertz function.
ystart
A vector with length equal to number of dimensions used, defines starting values of covariates.
tstart
A number that defines starting time (30 by default).
tend
A number, defines final time (105 by default).
dt
A discrete step size between two observations. A random uniform value is then added to this step size.
sd0
a standard deviation for modelling the next covariate value.

Value

  • A table with simulated data.

References

Yashin, A.I. et al (2007). Stochastic model for analysis of longitudinal data on aging and mortality. Mathematical Biosciences, 208(2), 538-551..

Examples

Run this code
library(stpm)
dat <- simdata_cont2(N=50)
head(dat)

Run the code above in your browser using DataLab