spm_time_dep: A function for the model with time-dependent model...

View source: R/spm_time-dependent.R

spm_time_depR Documentation

A function for the model with time-dependent model parameters.

Description

A function for the model with time-dependent model parameters.

Usage

spm_time_dep(
  x,
  start = list(a = -0.05, f1 = 80, Q = 2e-08, f = 80, b = 5, mu0 = 0.001),
  frm = list(at = "a", f1t = "f1", Qt = "Q", ft = "f", bt = "b", mu0t = "mu0"),
  stopifbound = FALSE,
  lb = NULL,
  ub = NULL,
  verbose = FALSE,
  opts = NULL,
  lrtest = FALSE
)

Arguments

x

Input data table.

start

A list of starting parameters, default: start=list(a=-0.5, f1=80, Q=2e-8, f=80, b=5, mu0=1e-5).

frm

A list of formulas that define age (time) - dependency. Default: frm=list(at="a", f1t="f1", Qt="Q", ft="f", bt="b", mu0t="mu0").

stopifbound

Estimation stops if at least one parameter achieves lower or upper boundaries. Default: FALSE.

lb

Lower bound of parameters under estimation.

ub

Upper bound of parameters under estimation.

verbose

Turns on verbosing output.

opts

A list of options for nloptr. Default value: opt=list(algorithm="NLOPT_LN_NELDERMEAD", maxeval=100, ftol_rel=1e-8).

lrtest

Indicates should Likelihood-Ratio test be performed. Possible values: TRUE, H01, H02, H03, H04, H05 (see package Vignette for details) Default value: FALSE. Please see nloptr documentation for more information.

Value

A set of estimates of a, f1, Q, f, b, mu0.

status Optimization status (see documentation for nloptr package).

LogLik A logarithm likelihood.

objective A value of objective function (given by nloptr).

message A message given by nloptr optimization function (see documentation for nloptr package).

References

Yashin, A. et al (2007), Health decline, aging and mortality: how are they related? Biogerontology, 8(3), 291-302.<DOI:10.1007/s10522-006-9073-3>.

Examples

library(stpm)
set.seed(123)
#Data preparation:
n <- 5
data <- simdata_time_dep(N=n)
# Estimation:
opt.par <- spm_time_dep(data)
opt.par

izhbannikov/spm documentation built on Sept. 10, 2022, 12:15 p.m.