easy.twostage: Fits two-stage model for describing depdendence in survival...

Description Usage Arguments Details Examples

View source: R/twostage.R

Description

If clusters contain more than two times, the algoritm uses a composite likelihood based on the pairwise bivariate models.

Usage

1
2
3
4
5
6
7
easy.twostage(margsurv = NULL, data = sys.parent(),
  score.method = "nlminb", status = "status", time = "time",
  entry = NULL, id = "id", Nit = 60, detail = 0, silent = 1,
  weights = NULL, control = list(), theta = NULL, theta.formula = NULL,
  desnames = NULL, deshelp = 0, var.link = 1, iid = 1, step = 0.5,
  model = "plackett", marginal.surv = NULL, strata = NULL,
  max.clust = NULL, se.clusters = NULL)

Arguments

margsurv

model

data

data frame

score.method

Scoring method

status

Status at exit time

time

Exit time

entry

Entry time

id

name of cluster variable in data frame

Nit

Number of iterations

detail

Detail for more output for iterations

silent

Debug information

weights

Weights for log-likelihood, can be used for each type of outcome in 2x2 tables.

control

Optimization arguments

theta

Starting values for variance components

theta.formula

design for depedence, either formula or design function

desnames

names for dependence parameters

deshelp

if 1 then prints out some data sets that are used, on on which the design function operates

var.link

Link function for variance (exp link)

iid

Calculate i.i.d. decomposition

step

Step size for newton-raphson

model

plackett or clayton-oakes model

marginal.surv

vector of marginal survival probabilities

strata

strata for fitting

max.clust

max clusters

se.clusters

clusters for iid decomposition for roubst standard errors

Details

The reported standard errors are based on the estimated information from the likelihood assuming that the marginals are known.

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
25
data(prt)
margp<- coxph(Surv(time,status==1)~factor(country),data=prt)
fitco<-twostage(margp,data=prt,clusters=prt$id)
summary(fitco)

des <- model.matrix(~-1+factor(zyg),data=prt);
fitco<-twostage(margp,data=prt,theta.des=des,clusters=prt$id)
summary(fitco)

dfam <- simSurvFam(1000)
dfam <- fast.reshape(dfam,var=c("x","time","status"))

desfs <- function(x,num1="num1",num2="num2")
{
pp <- (x[num1]=="m")*(x[num2]=="f")*1   ## mother-father
pc <- (x[num1]=="m" | x[num1]=="f")*(x[num2]=="b1" | x[num2]=="b2")*1 ## mother-child
cc <- (x[num1]=="b1")*(x[num2]=="b1" | x[num2]=="b2")*1               ## child-child
c(pp,pc,cc)
}

marg <- coxph(Surv(time,status)~factor(num),data=dfam)
out3 <- easy.twostage(marg,data=dfam,time="time",status="status",id="id",deshelp=0,
                      score.method="fisher.scoring",theta.formula=desfs,
                      desnames=c("parent-parent","parent-child","child-cild"))
summary(out3)

mets documentation built on May 2, 2019, 4:43 p.m.