Learn R Programming

stpm (version 1.1.2)

spm_projection: A data projection with previously estimated or user-defined parameters. Projections are constructed for a cohort with fixed or normally distributed initial covariates.

Description

A data projection with previously estimated or user-defined parameters. Projections are constructed for a cohort with fixed or normally distributed initial covariates.

Usage

spm_projection(x, N = 100, ystart = 80, model = "discrete", f = NULL,
  tstart = 30, tend = 105, dt = 1, sd0 = 4)

Arguments

x
A list of parameters from output of the spm(...) function.
N
A number of individual to simulate, N=100 by default.
ystart
A vector of starting values of covariates (variables), ystart=80 by default.
model
A model type. Choices are: "discrete", "continuous" or "time-dependent".
f
A list of formulas for the time-dependent model (NULL by default).
tstart
Start time (age), default=30.
tend
End time (age), default=105.
dt
A time interval between observations, dt=1 by default.
sd0
A standard deviation value for simulation of the next value of variable. sd0=4 by default.

Value

  • An object of 'spm.projection' class with two elements. (1) A simulated data set. (2) A summary statistics which includes (i) age-specific means of state variables and (ii) Survival probabilities.

References

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

Akushevich I., Kulminski A. and Manton K. (2005). Life tables with covariates: Dynamic model for Nonlinear Analysis of Longitudinal Data. Mathematical Popu-lation Studies, 12(2), pp.: 51-80. .

Yashin, A. et al (2007), Health decline, aging and mortality: how are they related? Biogerontology, 8(3), 291-302..

Examples

Run this code
library(stpm)
# Setting up the model
model.par <- list()
model.par[["Ya2007"]]$a <- matrix(c(-0.05, 1e-3, 2e-3, -0.05), nrow=2, ncol=2, byrow=TRUE)
model.par[["Ya2007"]]$f1 <- matrix(c(90, 35), nrow=1, ncol=2)
model.par[["Ya2007"]]$Q <- matrix(c(1e-8, 1e-9, 1e-9, 1e-8), nrow=2, ncol=2, byrow=TRUE)
model.par[["Ya2007"]]$f <- matrix(c(80, 27), nrow=1, ncol=2)
model.par[["Ya2007"]]$b <- matrix(c(6, 2), nrow=2, ncol=2)
model.par[["Ya2007"]]$mu0 <- 1e-6
model.par[["Ya2007"]]$theta <- 0.09
# Projection
# Discrete-time model
data.proj.discrete <- spm_projection(model.par, N=5000, ystart=c(80, 27))
plot(data.proj.discrete$stat$srv.prob)
# Continuous-time model
data.proj.continuous <- spm_projection(model.par, N=5000, ystart=c(80, 27), model="continuous")
plot(data.proj.continuous$stat$srv.prob)

Run the code above in your browser using DataLab