coxseisim: A function to simulate a CoxSEI process conditional on...

Description Usage Arguments Value Author(s) Examples

View source: R/coxseisim.R

Description

simulate the sample path of the CoxSEI model with given covariate process values, and excitation function and order of autodependence in the excitation term.

Usage

1
2
3
4
5
6
7
8
coxseisim(parreg, parg, lmd0 = function(tt) (1 + 0.5 * cos(2 * pi *
tt)),
          g = function(x, parg) {
                 ifelse(x <= 0, 0, parg[1] * parg[2] * exp(-parg[2] * x))
              },
          censor = 1, m = 2, trace=TRUE,
          Z = function(x) matrix(0, length(x), length(parreg))
         )

Arguments

parreg

the regression parameter

parg

parameters of the excitation function

lmd0

the baseline intensity function

g

the excitation function

censor

the censoring time

m

order of autoregression in the excitation component of the intensity process

trace

whether to trace the data generation process; defaults to TRUE

Z

a function to calculate the covariate values at a specified event time

Value

A data frame with provided covariate values and the censoring time, and the generated event times.

Author(s)

Feng Chen <feng.chen@unsw.edu.au>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
    n.smp <- 100;
    z <- matrix(NA,n.smp,3)
    for(i in 1:n.smp)
    z[i,] <- round(c(runif(1,0.5,1.5),runif(1,1.5,2.5),rbinom(1,1,0.5)),2)
    dat <- coxseisim(1:3*0.2,c(0.07,10),censor=rlnorm(1,0,0.1),m=2,
    Z=function(x)matrix(z[1,],length(x),3,byrow=TRUE))
    dat$id <- 1;
    for(i in 2:n.smp){
      dattmp <- coxseisim(1:3*0.2,c(0.07,10),censor=rlnorm(1,0,0.1),m=2,
      Z=function(x)matrix(z[i,],length(x),3,byrow=TRUE))
      dattmp$id <- i;
      dat <- rbind(dat,dattmp)
    }

coxsei documentation built on Feb. 8, 2020, 9:07 a.m.