Skip to content

Commit

Permalink
version 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Takeshi Emura authored and cran-robot committed Feb 27, 2018
1 parent 701d4f3 commit ede799f
Show file tree
Hide file tree
Showing 19 changed files with 243 additions and 50 deletions.
19 changes: 12 additions & 7 deletions DESCRIPTION
@@ -1,15 +1,20 @@
Package: depend.truncation
Type: Package
Title: Statistical Inference for Parametric and Semiparametric Models
Based on Dependently Truncated Data
Version: 2.8
Date: 2017-08-11
Title: Statistical Methods for the Analysis of Dependently Truncated
Data
Version: 3.0
Date: 2018-02-27
Author: Takeshi Emura
Maintainer: Takeshi Emura <takeshiemura@gmail.com>
Description: Suppose that one can observe bivariate random variables (X, Y) only when X<=Y holds. Data (Xj, Yj), subject to Xj<=Yj, for all j=1,...,n, are called truncated data. For truncated data, several different approaches are implemented for statistical inference on (X, Y), when X and Y are dependent. Also included is truncated data on the number of deaths at each year (1963-1980) for Japanese male centenarians.
Description: Estimation and testing methods for dependently truncated data.
Semi-parametric methods are based on Emura et al. (2011)<Stat Sinica 21:349-67>, Emura & Wang (2012)<doi:10.1016/j.jmva.2012.03.012>,
and Emura & Murotani (2015)<doi:10.1007/s11749-015-0432-8>.
Parametric approaches are based on Emura & Konno (2012)<doi:10.1007/s00362-014-0626-2> and Emura & Pan (2017)<doi:10.1007/s00362-017-0947-z>.
A regression approach is based on Emura & Wang (2016)<doi:10.1007/s10463-015-0526-9>. Quasi-independence tests are based on Emura & Wang (2010)<doi:10.1016/j.jmva.2009.07.006>.
Right-truncated data for Japanese male centenarians are given by Emura & Murotani (2015)<doi:10.1007/s11749-015-0432-8>.
License: GPL-2
Depends: mvtnorm
NeedsCompilation: no
Packaged: 2017-08-11 10:29:43 UTC; user
Packaged: 2018-02-27 09:46:18 UTC; user
Repository: CRAN
Date/Publication: 2017-08-11 10:30:02 UTC
Date/Publication: 2018-02-27 12:43:41 UTC
32 changes: 18 additions & 14 deletions MD5
@@ -1,9 +1,11 @@
8437f16495cb0ecb881fa0c909bcf665 *DESCRIPTION
44d9add733cdcecb198f52a9d5387fa9 *DESCRIPTION
f5841766251dc0c869d19a675b8496e3 *NAMESPACE
09beba7cbbeaafd6dabec3b4096c82ca *R/CHAIEB.Clayton.R
fa081a5e5b1f39e554455c4ef29645a5 *R/CHAIEB.Frank.R
8d7d7af7c9da07fd6e2a854186c736db *R/EMURA.Clayton.R
c56838dbe7de3ae13e6662f0580dc88a *R/EMURA.Frank.R
f946434ff696df2a22b3b3079ae25de8 *R/Logrank.stat.R
ee40baf20b15d3955e9f86738b3a71f0 *R/Logrank.stat.tie.R
e5e5c46136f25d1c7478f0c9fd93bbde *R/NPMLE.Frank.R
83c46b71ab293b7f5f005ec001e7a836 *R/NPMLE.Indep.R
a4bc9ce75704d7e90317a473c474f4e4 *R/NPMLE.Normal.R
Expand All @@ -13,17 +15,19 @@ ecc73ac3801ef0f44643390d983f99fd *R/PMLE.Clayton.Exponential.R
f2ed2c90aeebc543cdb5f08f3dfb95f5 *R/PMLE.Normal.R
e9983fcee1b9b5c0dccba71c6d1db52c *R/dependAFT.reg.R
54a066467cb3c3cb4767447efe45f665 *data/centenarian.rda
b0467e1b6d5f51a1fa8e54003d4ffd05 *man/CHAIEB.Clayton.Rd
2d686eadc7c3c523f2387dc2b1880235 *man/CHAIEB.Frank.Rd
41f8243f9ed7f6f99ae141becba20881 *man/EMURA.Clayton.Rd
f61345762dda2e013b532cf0d245cf44 *man/EMURA.Frank.Rd
f8f2536eeae9dd06911340c42c47f725 *man/NPMLE.Frank.Rd
b7191e8b79525f1f36f6b57a4d08c8c8 *man/NPMLE.Indep.Rd
cf72a0814d2843fc4c8c37b99ed3b023 *man/NPMLE.Normal.Rd
54dcf5e71c251cd0d9bdec4368836b23 *man/NPMLE.Plackett.Rd
ae0ff7730b1c4bf66af1c762f98b2df1 *man/PMLE.Clayton.Exponential.Rd
4c6112490bc6984a4fdeb0a31d9a032b *man/PMLE.Clayton.Weibull.Rd
a2d53d92104c1f76ffd8c2fb4fe0fee1 *man/PMLE.Normal.Rd
5f6371504cd13938eb80ac3959fe6276 *man/CHAIEB.Clayton.Rd
fcc0378c4c168b1d78366adc7a670ce6 *man/CHAIEB.Frank.Rd
55d6bdc1ea93c684d37ddd4163516646 *man/EMURA.Clayton.Rd
33c306ebfca5c1a3ce38273eea09599e *man/EMURA.Frank.Rd
da2de5ddf6ff4fb619d53d3db4d460ca *man/Logrank.stat.Rd
9dfdb36613fe188139b5880cf584002d *man/Logrank.stat.tie.Rd
a2a9d709bcef6d497b6238ecda65864b *man/NPMLE.Frank.Rd
a0cf817bd197e77cdeabe4cd8899f33a *man/NPMLE.Indep.Rd
189054829b2eea0149a005fa582d8e9f *man/NPMLE.Normal.Rd
d96afa81bc1e6424160e9d9c84392bed *man/NPMLE.Plackett.Rd
646ed6f097d641e9ae2c567ffdbde2b7 *man/PMLE.Clayton.Exponential.Rd
72079926c5c75d21910a592f351efb76 *man/PMLE.Clayton.Weibull.Rd
680aae4225e77e2e062047bfc1075725 *man/PMLE.Normal.Rd
dace902cb65b1b1d0c13cd2ad323ab7b *man/centenarian.Rd
31bcc3b9ead9a068b94edb9d59a7b727 *man/depend.truncation-package.Rd
c542d316d8d8882197f576bf0528e43c *man/dependAFT.reg.Rd
ca99fbbb84424e149554fe4db990f637 *man/depend.truncation-package.Rd
d413db43bc108561abae8571056ffc7b *man/dependAFT.reg.Rd
48 changes: 48 additions & 0 deletions R/Logrank.stat.R
@@ -0,0 +1,48 @@
Logrank.stat=function(x.trunc,z.trunc,d){
m=length(x.trunc)
#######Lynden-Bell's estimator######
t=c(x.trunc,z.trunc) ;t.o=t[order(t)] ;d.o=c(rep(0,m),rep(1,m))[order(t)]
dd.o=c(rep(0,m),d)[order(t)] ;r.diag=numeric(2*m)
for(i in 1:(2*m)){
r.diag[i]=sum( (x.trunc<=t.o[i])&(z.trunc>=t.o[i]) )
}
sc.diag=cumprod( 1-d.o*(1-dd.o)/r.diag*(r.diag>1) )
sc=(sc.diag[d.o==1])[rank(z.trunc)]

#######estimating truncation proportion######
x.o=sort(x.trunc)[-1]
r.diag=numeric(m-1)
for(i in 1:(m-1)){
r.diag[i]=sum((x.trunc<=x.o[i])&(z.trunc>=x.o[i]))
}
hat.c=m*prod((1-1/r.diag)[r.diag>1])

######summarizing data(making risk set on grids)#####
r.point=sckm.point=r.grid=sckm.grid=0
for(i in 1:m){
x=x.trunc[i] ;z=z.trunc[i]
if(d[i]==1){
r.point=c(r.point,sum((x.trunc<=x)&(z.trunc>=z)))
sckm.point=c(sckm.point,sc[i])
}
index=(x.trunc<=x)&(z.trunc>x)&(z.trunc<=z)&(d==1)
num=sum(index)
if(num>0){
r.vec=numeric(num); sckm.vec<-numeric(num)
for(j in 1:num){
zz=z.trunc[index][j]
r.vec[j]=sum( (x.trunc<=x)&(z.trunc>=zz) )
sckm.vec[j]=(sc[index])[j]
}
r.grid=c(r.grid,r.vec); sckm.grid=c(sckm.grid,sckm.vec)
}
}
r.point=r.point[-1] ;sckm.point=sckm.point[-1] ;r.grid=r.grid[-1]
sckm.grid=sckm.grid[-1]

######computing the logrank statistics#######
L0=length(r.point)-sum(1/r.grid) # Logrank stat. rho=0
L1=sum(r.point/sckm.point)/m-sum(1/sckm.grid)/m # Gehan's stat. rho=1
Llog=sum(1/log(hat.c*r.point/sckm.point/m))-sum(1/log(hat.c*r.grid/sckm.grid/m)/r.grid)
c(L0,L1,Llog)
}
48 changes: 48 additions & 0 deletions R/Logrank.stat.tie.R
@@ -0,0 +1,48 @@
Logrank.stat.tie=function(x.trunc,z.trunc,d){
m=length(x.trunc)
x.grid=sort(as.numeric(levels(factor(x.trunc))))
num.x=length(x.grid)
############ truncation proportion ############
x.min=min(x.trunc)
R1=sum((x.trunc<=x.min)&(z.trunc>=x.min))
hat.c=m/R1
for(i in 2:num.x){
v=x.grid[i]
Nx=sum((x.trunc==v))
Rx=sum((x.trunc<=v)&(z.trunc>=v))
if(Rx>1){hat.c=hat.c*(1-Nx/Rx)}
}

############ Log-rank statistics ############
L0=0;L1=0;Llog=0
for(i in 1:num.x){
xx=x.grid[i]
z.max=max(z.trunc[as.logical((x.trunc==xx))])
temp.z=(z.trunc>=xx)&(x.trunc<=xx)&(z.trunc<=z.max)
z.grid=as.numeric(levels(factor(z.trunc[temp.z])))
num.z=length(z.grid)
for(j in 1:num.z){
zz=z.grid[j]
Sc=1
z.order=sort( as.numeric(levels(factor(z.trunc))) )
num.c=sum( z.order<zz )
if(num.c>0){
for(k in 1:num.c){
u=z.order[k]
Nc=sum( (1-d)[(z.trunc==u)] )
Rc=sum((x.trunc<=u)&(z.trunc>=u))
if(Rc>1){Sc=Sc*(1-Nc/Rc)}
}
}
n11=sum((x.trunc==xx)&(z.trunc==zz)&(d==1))
n10=sum((x.trunc==xx)&(z.trunc>=zz))
n01=sum((x.trunc<=xx)&(z.trunc==zz)&(d==1))
R=sum((x.trunc<=xx)&(z.trunc>=zz))
L0=L0+n11-n10*n01/R
hat.v=R/m/Sc
L1=L1+hat.v*(n11-n10*n01/R)
Llog=Llog-1/log(hat.c*hat.v)*(n11-n10*n01/R)
}
}
c(L0,L1,Llog)
}
2 changes: 1 addition & 1 deletion man/CHAIEB.Clayton.Rd
@@ -1,7 +1,7 @@
\name{CHAIEB.Clayton}
\alias{CHAIEB.Clayton}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Semi-parametric Inference for Copula Models with Dependently Truncated Data}
\title{Semi-parametric Inference under the Clayton Copula with Dependent Truncation}
\description{A copula-based estimation based on dependent truncation data under
the Clayton copula model(Lakhal-Chaieb, Rivest & Abdous 2006; Emura & Murotani 2015).
The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
2 changes: 1 addition & 1 deletion man/CHAIEB.Frank.Rd
@@ -1,7 +1,7 @@
\name{CHAIEB.Frank}
\alias{CHAIEB.Frank}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Semi-Parametric Inference for Copula Models with Dependently Truncated Data}
\title{Semi-parametric Inference under the Frank Copula with Dependent Truncation}
\description{A copula-based estimation based on dependent truncation data under
the Frank copula model(Lakhal-Chaieb, Rivest & Abdous 2006; Emura & Murotani 2015).
The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
2 changes: 1 addition & 1 deletion man/EMURA.Clayton.Rd
@@ -1,7 +1,7 @@
\name{EMURA.Clayton}
\alias{EMURA.Clayton}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Semi-parametric Inference for Copula Models with Dependently Truncated Data}
\title{Semi-parametric Inference under the Clayton Copula with Dependent Truncation}
\description{A copula-based estimation based on dependent truncation data under
the Clayton copula model (Emura, Wang & Hung 2011; Emura & Murotani 2015).
The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
2 changes: 1 addition & 1 deletion man/EMURA.Frank.Rd
@@ -1,7 +1,7 @@
\name{EMURA.Frank}
\alias{EMURA.Frank}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Semi-parametric Inference for Copula Models with Dependently Truncated Data}
\title{Semi-parametric Inference under the Frank Copula with Dependent Truncation}
\description{A copula-based estimation based on dependent truncation data under
the Frank copula model (Emura, Wang & Hung 2011; Emura & Murotani 2015).
The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
44 changes: 44 additions & 0 deletions man/Logrank.stat.Rd
@@ -0,0 +1,44 @@
\name{Logrank.stat}
\alias{Logrank.stat}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
The weighted log-rank statistics for testing quasi-independence (without ties in data)
}
\description{
The three log-rank statistics (L_0, L_1, and L_log) corresponding to 3 different weights.
}
\usage{
Logrank.stat(x.trunc, z.trunc, d)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{x.trunc}{vector of variables satisfying x.trunc<=z.trunc}
\item{z.trunc}{vector of variables satisfying x.trunc<=z.trunc}
\item{d}{censoring indicator(0=censoring,1=failure) for z.trunc}
}
\details{
If there is no tie in the data, the function "Logrank.stat.tie" and "Logrank.stat" give identical results.
However, "Logrank.stat" is computationally more efficient. The simulations of Emura & Wang (2010) are
based on "Logrank.stat" since simulated data are generated from continuous distributions. The real data analyses
of Emura & Wang (2010) are based on "Logrank.stat.tie" since there are many ties in the data.
}
\value{
\item{L0}{Logrank statistics (most powerfull to detect the Clayton copula type dependence)}
\item{L1}{Logrank statistics (most powerfull to detect the Frank copula type dependence)}
\item{Llog}{Logrank statistics (most powerfull to detect the Gumbel copula type dependence)}
}
\references{
Emura T, Wang W (2010) Testing quasi-independence for truncation data. Journal of Multivariate Analysis 101, 223-239
}
\author{Takeshi Emura}

\examples{
x.trunc=c(10,5,7,1,3,9)
z.trunc=c(12,11,8,6,4,13)
d=c(1,1,1,1,0,1)
Logrank.stat(x.trunc,z.trunc,d)
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ Copula }
\keyword{ Quasi-independence test }% __ONLY ONE__ keyword per line
45 changes: 45 additions & 0 deletions man/Logrank.stat.tie.Rd
@@ -0,0 +1,45 @@
\name{Logrank.stat.tie}
\alias{Logrank.stat.tie}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
The weighted log-rank statistics for testing quasi-independence (with ties in data)
}
\description{
The three log-rank statistics (L_0, L_1, and L_log) corresponding to 3 different weights.
}
\usage{
Logrank.stat.tie(x.trunc, z.trunc, d)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{x.trunc}{vector of variables satisfying x.trunc<=z.trunc}
\item{z.trunc}{vector of variables satisfying x.trunc<=z.trunc}
\item{d}{censoring indicator(0=censoring,1=failure) for z.trunc}
}
\details{
If there is no tie in the data, the function "Logrank.stat.tie" and "Logrank.stat" give identical results.
However, "Logrank.stat" is computationally more efficient. The simulations of Emura & Wang (2010) are
based on "Logrank.stat" since simulated data are generated from continuous distributions. The real data analyses
of Emura & Wang (2010) are based on "Logrank.stat.tie" since there are many ties in the data.
}
\value{
\item{L0}{Logrank statistics (most powerfull to detect the Clayton copula type dependence)}
\item{L1}{Logrank statistics (most powerfull to detect the Frank copula type dependence)}
\item{Llog}{Logrank statistics (most powerfull to detect the Gumbel copula type dependence)}
}
\references{
Emura T, Wang W (2010) Testing quasi-independence for truncation data. Journal of Multivariate Analysis 101, 223-239
}
\author{Takeshi Emura}

\examples{
x.trunc=c(10,5,7,1,3,9)
z.trunc=c(12,11,8,6,4,13)
d=c(1,1,1,1,0,1)
Logrank.stat.tie(x.trunc,z.trunc,d)
Logrank.stat(x.trunc,z.trunc,d) ## since there is no tie, the results are the same.
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ Copula }
\keyword{ Quasi-independence test }% __ONLY ONE__ keyword per line
2 changes: 1 addition & 1 deletion man/NPMLE.Frank.Rd
Expand Up @@ -2,7 +2,7 @@
\alias{NPMLE.Frank}
%- Also NEED an '\alias' for EACH other topic documented here.

\title{Semiparametric Inference for Copula Models with Dependent Truncation Data}
\title{Semiparametric Inference under the Frank Copula with Dependent Truncation}

\description{Nonparametric maximum likelihood estimation for dependent truncation data under
the Frank copula models (Emura & Wang, 2012). The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
2 changes: 1 addition & 1 deletion man/NPMLE.Indep.Rd
Expand Up @@ -2,7 +2,7 @@
\alias{NPMLE.Indep}
%- Also NEED an '\alias' for EACH other topic documented here.

\title{Semiparametric Inference for Copula Models with Dependent Truncation Data}
\title{Semiparametric Inference under the Independence Copula with Dependent Truncation}

\description{Nonparametric maximum likelihood estimation for dependent truncation data under
the independence copula models (Emura & Wang, 2012). The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
2 changes: 1 addition & 1 deletion man/NPMLE.Normal.Rd
Expand Up @@ -2,7 +2,7 @@
\alias{NPMLE.Normal}
%- Also NEED an '\alias' for EACH other topic documented here.

\title{Semiparametric Inference for Copula Models with Dependent Truncation Data}
\title{Semiparametric Inference under the Normal Copula with Dependent Truncation}

\description{Nonparametric maximum likelihood estimation for dependent truncation data under
the normal(Gaussian) copula models (Emura & Wang, 2012). The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
2 changes: 1 addition & 1 deletion man/NPMLE.Plackett.Rd
Expand Up @@ -2,7 +2,7 @@
\alias{NPMLE.Plackett}
%- Also NEED an '\alias' for EACH other topic documented here.

\title{Semiparametric Inference for Copula Models with Dependent Truncation Data}
\title{Semiparametric Inference under the Plackett Copula with Dependent Truncation}

\description{Nonparametric maximum likelihood estimation for dependent truncation data under
the Plackett copula models (Emura & Wang, 2012). The forms of the marginal distributions for X and Y are completely unspecified, but
Expand Down
4 changes: 2 additions & 2 deletions man/PMLE.Clayton.Exponential.Rd
@@ -1,7 +1,7 @@
\name{PMLE.Clayton.Exponential}
\alias{PMLE.Clayton.Exponential}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Parametric Inference for Exponential Models with Dependent Truncation Data}
\title{Parametric Inference for Bivariate Exponential Models with Dependent Truncation}
\description{Maximum likelihood estimation (MLE) for dependent truncation data under
the Clayton copula with Exponential margins for a bivariate lifetimes (L, X). The truncated data (L_j, X_j), subject to L_j<=X_j for all j=1, ..., n,
are used to obtain the MLE for the population parameters of (L, X).}
Expand Down Expand Up @@ -32,7 +32,7 @@ PMLE.Clayton.Exponential(l.trunc, x.trunc, GOF = TRUE,
\item{K }{ Kolmogorov-Smirnov goodness-of-fit test statistics}
}
\references{
Emura T, Pan CH (2017-), Parametric likelihood inference and goodness-of-fit for dependently left-truncated data, a copula-based approach(in revision, Statistical Papers).
Emura T, Pan CH (2017), Parametric likelihood inference and goodness-of-fit for dependently left-truncated data, a copula-based approach, Statistical Papers, doi:10.1007/s00362-017-0947-z.
}
\author{Takeshi Emura, Chi-Hung Pan}
%% ~Make other sections like Warning with \section{Warning }{....} ~
Expand Down
4 changes: 2 additions & 2 deletions man/PMLE.Clayton.Weibull.Rd
@@ -1,7 +1,7 @@
\name{PMLE.Clayton.Weibull}
\alias{PMLE.Clayton.Weibull}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Parametric Inference for Weibull Models with Dependent Truncation Data}
\title{Parametric Inference for Bivariate Weibull Models with Dependent Truncation}
\description{Maximum likelihood estimation (MLE) for dependent truncation data under
the Clayton copula with Weibull margins for a bivariate lifetimes (L, X). The truncated data (L_j, X_j), subject to L_j<=X_j for all j=1, ..., n,
are used to obtain the MLE for the population parameters of (L, X).}
Expand Down Expand Up @@ -34,7 +34,7 @@ PMLE.Clayton.Weibull(l.trunc, x.trunc, GOF = TRUE,
\item{K }{ Kolmogorov-Smirnov goodness-of-fit test statistics}
}
\references{
Emura T, Pan CH (2017-), Parametric likelihood inference and goodness-of-fit for dependently left-truncated data, a copula-based approach (in revision, Statistical Papers).
Emura T, Pan CH (2017), Parametric likelihood inference and goodness-of-fit for dependently left-truncated data, a copula-based approach, Statistical Papers, doi:10.1007/s00362-017-0947-z.
}
\author{Takeshi Emura}
%% ~Make other sections like Warning with \section{Warning }{....} ~
Expand Down
2 changes: 1 addition & 1 deletion man/PMLE.Normal.Rd
@@ -1,7 +1,7 @@
\name{PMLE.Normal}
\alias{PMLE.Normal}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Parametric Inference for Models with Dependent Truncation Data}
\title{Parametric Inference for Bivariate Normal Models with Dependent Truncation}
\description{Maximum likelihood estimation (MLE) for dependent truncation data under
the bivariate normal distribution. A bivariate normal distribution is assumed for bivariate
random variables (L, X). The truncated data (L_j, X_j), subject to L_j<=X_j for all j=1, ..., n,
Expand Down

0 comments on commit ede799f

Please sign in to comment.