Description Usage Arguments Author(s) See Also Examples
survfit
was written in Fortran by Dr. V. Ducrocq (INRA, France:
[email protected]) and Dr. J. Soelkner (Vienna:
[email protected]) to fit Weibull and Cox proportional hazards
models with random effects for very large data sets. This is a
cutdown version adapted to R. The full Survival Kit, including the
manual, can be obtained from http://www.boku.ac.at/nuwi/popgen.
1 2 3 4 5 6 7  survkit(times, censor=NULL, ccov=NULL, tvcov=NULL,
strata=NULL, id=NULL, model="Weibull", baseline=FALSE,
residuals=FALSE, survival=NULL, svalues=NULL, valrho=NULL,
constraints=NULL, impose=NULL, dist=NULL, random=NULL,
estimate=NULL, moments=FALSE, rule=NULL, pedigree=NULL,
integrate=NULL, jointmode=FALSE, within=NULL, converge=1.e8,
iterlim=100)

times 
Vector of times (events, rightcensoring, change in timevarying covariate, lefttruncation). 
censor 
Corresponding vector of censoring indicators. 1: event; 0: censored; 1: change of timevarying covariate; 2: lefttruncation time. 
ccov 
Model formula for timeconstant covariates. These may have one value per individual or one per time. Because of the way factor variables are handled, interactions must be coded as new variables. 
tvcov 
Model formula for timevarying covariates with one value per time. There can only be one changepoint per individual. Again, interactions must be coded as new variables. 
strata 
A factor variable specifying stratification. With the Weibull model, different intercepts and power parameters are calculated for each stratum. For the Cox model, a different baseline curve is fitted. 
id 
A variable giving individual identification numbers (starting at one). If not supplied, all times are assumed to refer to different individuals. 
model 
Weibull or Cox model, or KaplanMeier estimates. 
baseline 
If TRUE, the baseline values are calculated for the Cox model. 
residuals 
If TRUE, calculate residuals (only for Cox model). 
survival 
Calculate values of the survival function at

svalues 
A vector of quantile values (between 0 and 100),
spacing and maximum for equallyspaced, or specific times for

valrho 
A fixed value of the Weibull power parameter if it is not to be estimated. 
constraints 
By default, the category of each factor variable
with the 
impose 
A list of a vector of variable names and a corresponding vector of their baseline category numbers. Any factor variables not given will have their first category as baseline. 
dist 
The distribution of the random effect: loggamma, normal, or multivariate (normal). 
random 
A factor variable specifying the random effect. 
estimate 
One fixed value for the mode of the variance of the random effect or three values if the mode is to be estimated: lower and upper bounds, and precision. 
moments 
Estimate the first three moments of the random effect as well as the mode. 
rule 
For the multivariate normal random effect, the genetic
relationships: 
pedigree 
A matrix with four columns required for the multivariate normal random effect, containing the individual id, the sex, the father's category, and the mother's category. 
integrate 
A factor variable to integrate out as the loggamma random effect in a Weibull model. (Not available for the Cox model.) 
jointmode 
If TRUE, the loggamma variance parameter is
estimated simultaneously with the other parameters using the
information in 
within 
A second factor variable (within the 
converge 
The convergence criterion, by default 1.e8. 
iterlim 
Maximum number of iterations. 
V. Ducrocq, J. Soelkner, and J.K. Lindsey
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  # y < trunc(rweibull(20,2,20))
y < c(6,22,43,16,7,6,15,35,10,9,18,34,7,13,10,17,14,19,11,13)
# cens < rbinom(20,1,0.9)
cens < c(1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1)
id < gl(2,10)
# x < rnorm(20)
x < c(1.82881379,1.06606868,0.70877744,0.09932880,0.60626148,0.75371046,
0.23884069,0.51199483,0.73060095,0.93222151,2.27947539,0.73855454,
0.36412735,0.89122114,0.05025962,0.10001587,1.11460865,1.87315971,
0.11280052,1.6880509)
# KaplanMeier estimates
survkit(y, censor=cens, model="Kaplan")
# null Weibull model
survkit(y, censor=cens)
# one timeconstant covariate
survkit(y, censor=cens, ccov=~x)
# stratify
survkit(y, censor=cens, ccov=~x, strata=id)
# estimate a normal random effect
survkit(y, censor=cens, ccov=~x, random=id, dist="normal",
estimate=c(0.1,10,0.01), moments=TRUE)
# try a fixed value for the normal random effect
survkit(y, censor=cens, ccov=~x, random=id, dist="normal",
estimate=1.3)
# estimate a loggamma random effect
survkit(y, censor=cens, ccov=~x, random=id, dist="loggamma",
estimate=c(0.1,10,0.01))
# estimate a loggamma random effect by integrating it out
## Not run:
survkit(y, censor=cens, ccov=~x, dist="loggamma", estimate=1.3,
integ=id, jointmode=TRUE)
# try a fixed value of the loggamma random effect, integrating it out
survkit(y, censor=cens, ccov=~x, dist="loggamma", estimate=1,
integ=id)
## End(Not run)
#
# Cox model with one timeconstant covariate
print(z < survkit(y, censor=cens, ccov=~x, model="Cox", residuals=TRUE,
baseline=TRUE))
residuals(z)
baseline(z)
# obtain the quantiles
print(z < survkit(y, censor=cens, ccov=~x, model="Cox",
survival="quantiles", svalues=seq(10,90,by=10)))
survival(z)
# estimate a loggamma random effect
survkit(y, censor=cens, ccov=~x, model="Cox", random=id,
dist="loggamma", estimate=c(0.1,10,0.01))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.