aalenfrailty: Aalen frailty model

Description Usage Arguments Details Value Author(s) Examples

View source: R/aalenfrailty.R

Description

Additive hazards model with (gamma) frailty

Usage

1
aalenfrailty(time, status, X, id, theta, B = NULL, ...)

Arguments

time

Time variable

status

Status variable (0,1)

X

Covariate design matrix

id

cluster variable

theta

list of thetas (returns score evaluated here), or starting point for optimization (defaults to magic number 0.1)

B

(optional) Cumulative coefficients (update theta by fixing B)

...

Additional arguments to lower level functions

Details

Aalen frailty model

Value

Parameter estimates

Author(s)

Klaus K. Holst

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library("timereg")
dd <- simAalenFrailty(5000)
f <- ~1##+x
X <- model.matrix(f,dd) ## design matrix for non-parametric terms
system.time(out<-aalen(update(f,Surv(time,status)~.),dd,n.sim=0,robust=0))
dix <- which(dd$status==1)
t1 <- system.time(bb <- .Call("Bhat",as.integer(dd$status),
                              X,0.2,as.integer(dd$id),NULL,NULL,
                              PACKAGE="mets"))
spec <- 1
##plot(out,spec=spec)
## plot(dd$time[dix],bb$B2[,spec],col="red",type="s",
##      ylim=c(0,max(dd$time)*c(beta0,beta)[spec]))
## abline(a=0,b=c(beta0,beta)[spec])
##'

## Not run: 
thetas <- seq(0.1,2,length.out=10)
Us <- unlist(aalenfrailty(dd$time,dd$status,X,dd$id,as.list(thetas)))
##plot(thetas,Us,type="l",ylim=c(-.5,1)); abline(h=0,lty=2); abline(v=theta,lty=2)
op <- aalenfrailty(dd$time,dd$status,X,dd$id)
op

## End(Not run)

Example output

Loading required package: timereg
Loading required package: survival
Loading required package: lava
lava version 1.5
mets version 1.2.2
   user  system elapsed 
  0.026   0.000   0.027 
$theta
[1] 0.2216471

$sd
[1] 0.04997219

mets documentation built on Oct. 23, 2020, 5:55 p.m.