Learn R Programming

spatsurv (version 2.0)

simsurv: simsurv function

Description

A function to simulate spatial parametric proportional hazards model. The function works by simulating candidate survival times using MCMC in parallel for each individual based on each individual's covariates and the common parameter effects, beta.

Usage

simsurv(
  X = cbind(age = runif(100, 5, 50), sex = rbinom(100, 1, 0.5), cancer = rbinom(100, 1,
    0.2)),
  beta = c(0.0296, 0.0261, 0.035),
  omega = 1,
  dist = exponentialHaz(),
  coords = matrix(runif(2 * nrow(X)), nrow(X), 2),
  cov.parameters = c(1, 0.1),
  cov.model = ExponentialCovFct(),
  mcmc.control = mcmcpars(nits = 1e+05, burn = 10000, thin = 90),
  savechains = TRUE
)

Value

in list element 'survtimes', a vector of simulated survival times (the last simulated value from the MCMC chains) in list element 'T' the MCMC chains

Arguments

X

a matrix of covariate information

beta

the parameter effects

omega

vector of parameters for the baseline hazard model

dist

the distribution choice: exp or weibull at present

coords

matrix with 2 columns giving the coordinates at which to simulate data

cov.parameters

a vector: the parameters for the covariance function

cov.model

an object of class covmodel, see ?covmodel

mcmc.control

mcmc control paramters, see ?mcmcpars

savechains

save all chains? runs faster if set to FALSE, but then you'll be unable to conduct convergence/mixing diagnostics

See Also

covmodel, survspat, tpowHaz, exponentialHaz, gompertzHaz, makehamHaz, weibullHaz