Description Usage Arguments Details Value Note Author(s) References Examples
Estimate 2D hazard function using smoothing spline ANOVA models.
1 2 3 4 5 6 7 8  sshzd2d(formula1, formula2, symmetry=FALSE, data, alpha=1.4,
weights=NULL, subset=NULL, id.basis=NULL, nbasis=NULL, seed=NULL,
prec=1e7, maxiter=30, skip.iter=FALSE)
sshzd2d1(formula1, formula2, symmetry=FALSE, data, alpha=1.4,
weights=NULL, subset=NULL, rho="marginal",
id.basis=NULL, nbasis=NULL, seed=NULL, prec=1e7, maxiter=30,
skip.iter=FALSE)

formula1 
Description of the hazard model to be fit on the first axis. 
formula2 
Description of the hazard model to be fit on the second axis. 
symmetry 
Flag indicating whether to enforce symmetry of the two axes. 
data 
Data frame containing the variables in the model. 
alpha 
Parameter defining crossvalidation scores for smoothing parameter selection. 
weights 
Optional vector of counts for duplicated data. 
subset 
Optional vector specifying a subset of observations to be used in the fitting process. 
id.basis 
Index of observations to be used as "knots." 
nbasis 
Number of "knots" to be used. Ignored when

seed 
Seed to be used for the random generation of "knots."
Ignored when 
prec 
Precision requirement for internal iterations. 
maxiter 
Maximum number of iterations allowed for internal iterations. 
skip.iter 
Flag indicating whether to use initial values of theta and skip theta iteration in marginal hazard estimation. 
rho 
Choice of rho function for sshzd2d1: 
The 2D survival function is expressed as
S(t1,t2)=C(S1(t1),S2(t2)), where S1(t1), S2(t2)
are marginal survival functions and C(u1,u2) is a 2D copula.
The marginal survival functions are estimated via the marginal
hazards as in sshzd
, and the copula is estimated
nonparametrically by calling sscopu2
.
When symmetry=TRUE
, a common marginal survial function
S1(t)=S2(t) is estimated, and a symmetric copula is estimated such
that C(u1,u2)=C(u2,u1).
Covariates can be incorporated in the marginal hazard models as in
sshzd
, including parametric terms via partial
and frailty terms via random
. Arguments formula1
and
formula2
are typically model formulas of the same form as the
argument formula
in sshzd
, but when
partial
or random
are needed, formula1
and
formula2
should be lists with model formulas as the first
elements and partial
/random
as named elements; when
necessary, variable configurations (that are done via argument
type
in sshzd
) should also be entered as named
elements of lists formula1
/formula2
.
When symmetry=TRUE
, parallel model formulas must be
consistent of each other, such as
formula1=list(Surv(t1,d1)~t1*u1,partial=~z1,random=~1id1) 
formula2=list(Surv(t2,d2)~t2*u2,partial=~z2,random=~1id2)

where pairs t1
t2
, d2
d2
respectively
are different elements in data
, pairs u1
u2
,
z1
z2
respectively may or may not be different
elements in data
, and factors id1
and id2
are typically the same but at least should have the same levels.
sshzd2d
and sshzd2d1
return a list object of class
"sshzd2d"
.
hzdrate.sshzd2d
can be used to evaluate the estimated
2D hazard function. survexp.sshzd2d
can be used to
calculate estimated survival functions.
sshzd2d1
executes faster than sshzd2d
, but often at
the cost of performance degradation.
The results may vary from run to run. For consistency, specify
id.basis
or set seed
.
Chong Gu, chong@stat.purdue.edu
Gu, C. (2013), Hazard estimation with bivariate survival data and copula density estimation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  ## THE FOLLOWING EXAMPLE IS TIMECONSUMING
## Not run:
data(DiaRet)
## Common proportional hazard model on the margins
fit < sshzd2d(Surv(time1,status1)~time1+trt1*type,
Surv(time2,status2)~time2+trt2*type,
data=DiaRet,symmetry=TRUE)
## Evaluate fitted survival and hazard functions
time < cbind(c(50,70),c(70,70))
cova < data.frame(trt1=as.factor(c(1,1)),trt2=as.factor(c(1,0)),
type=as.factor(c("juvenile","adult")))
survexp.sshzd2d(fit,time,cov=cova)
hzdrate.sshzd2d(fit,time,cov=cova)
## Association between margins: Kendall's tau and Spearman's rho
summary(fit$copu)
## Clean up
rm(DiaRet,fit,time,cova)
dev.off()
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.