Learn R Programming

stpm (version 1.1.2)

spm: A central function that estimates Stochastic Process Model parameters a from given dataset.

Description

A central function that estimates Stochastic Process Model parameters a from given dataset.

Usage

spm(x, model = "discrete", formulas = NULL, tol = NULL,
  stopifbound = FALSE, algorithm = "NLOPT_LN_NELDERMEAD", lb = NULL,
  ub = NULL, maxeval = 100, pinv.tol = 0.01, theta.range = seq(0.01,
  0.2, by = 0.001), verbose = FALSE)

Arguments

x
A dataset: is the output from prepare_data(...) function and consists of two separate data tables: (1) a data table for continuous-time model and (2) a data table for discrete-time model.
model
A model type. Choices are: "discrete", "continuous" or "time-dependent".
formulas
A list of parameter formulas used in the "time-dependent" model.
tol
A tolerance threshold for matrix inversion (NULL by default).
stopifbound
A flag (default=FALSE) if it is set then the optimization stops when any of the parametrs achives lower or upper boundary.
algorithm
An optimization algorithm used in nloptr package. Default: NLOPTR_NL_NELDERMEAD.
lb
Lower boundary, default NULL.
ub
Upper boundary, default NULL.
maxeval
Maximum number of evaluations of optimization algorithm. Default 100.
pinv.tol
A tolerance threshold for matrix pseudo-inverse. Default: 0.01.
theta.range
A user-defined range of the parameter theta used in discrete-time optimization and estimating of starting point for continuous-time optimization.
verbose
A verbosing output indicator (FALSE by default).

Value

  • For "discrete" and "continuous" model types: (1) a list of model parameter estimates for the discrete model type described in "Life tables with covariates: Dynamic Model for Nonlinear Analysis of Longitudinal Data", Akushevich et al, 2005., and (2) a list of model parameter estimates for the continuous model type described in "Stochastic model for analysis of longitudinal data on aging and mortality", Yashin et al, 2007, Math Biosci..

    For the "time-dependent" model (model parameters depend on time): a set of model parameter estimates.

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)
#Prepare data for optimization
data <- prepare_data(x=system.file("data","longdat.csv",package="stpm"), 
				   y=system.file("data","vitstat.csv",package="stpm"))
#Parameters estimation (default model: discrete-time):
p.discr.model <- spm(data)
p.discr.model
# Continuous-time model:
p.cont.model <- spm(data, model="continuous")
p.cont.model
#Model with time-dependent coefficients:
data <- prepare_data(x=system.file("data","longdat.csv",package="stpm"), 
				   y=system.file("data","vitstat.csv",package="stpm"), 
				   covariates="BMI")
p.td.model <- spm(data, model="time-dependent")
p.td.model

Run the code above in your browser using DataLab