Lemma1 Conditional expectation with respect to a Dirichlet process prior, given right censored data.

Description

This function will compute the expectation of ∏ P [a_{i}, ∞) with respect to the Dirichlet process prior.

This is the expectation described in Lemma 1 of Zhou (2001), or Zhou (2004).

Usage

Lemma1(B, theta, ai, zi = numeric(0))

Arguments

B a positive number. The parameter for Dirichlet process prior, the weight of prior information. If B is very small, then the resulting Dirichlet process prior is “non-informative".

theta a positive number. Another parameter for Dirichlet process prior. The measure/parameter is α[t, ∞) = B exp(−θt) .

ai vector holding the right censored observations.

zi optional vector holding the uncensored observations.

Details

The Dirichlet process prior has a parameter α, which is a measure on the positive line. We took this measure α as α[t, ∞) = B exp(θt) + ∑ I[t ≤ z_{i} ≤ ∞).

The observations must all be non-negative.

Value

a single value that is the expectation.

Author(s)

Mai Zhou.

References

Susarla and Van Ryzin (1976) Nonparametric Bayesian estimation of survival curves from incomplete observations. J. Amer. Statist. Assoc. 71, 897-902.

Zhou, M. (2001). Nonparametric Bayes estimator of survival functions for doubly/interval censored data. Tech Report, Univ. of Kentucky.

See also Zhou, M. (2004). Statistica Sinica.

Examples

uncensored <- c(1,5,9)
rightcensored <- c(4,7)
NPBayes(B=12, theta=0.2, u=3.2, uncen=uncensored, rightcen=rightcensored)
leftpt <- 0
rightpt <- 3
NPBayes(B=12, theta=0.2, u=3.2, uncen=uncensored, rightcen=rightcensored,
lefts = leftpt, rights = rightpt)

NewLemma1 Compute the Conditional Expectation given left truncated and right censored observations

Description

This function will compute the expectation of P [u, ∞) ∏ P [x_{i}, ∞)/P [y_{i}, ∞), assuming the distribution function is distributed as a Dirichlet process prior. (assume x_{i} are all right censored.)

Similar to Lemma1 except the term involve y_{i}.

The data must be nonnegative. We assume F (0) = 0.

Usage

NewLemma1(B, theta, u=numeric(0), y, x, d)

Arguments

B a positive number. The parameter for the Dirichlet process prior, the weight of prior information. If B is very small, then the resulting prior is "non-informative".

theta a positive number. Another parameter for the Dirichlet process prior, how quickly the probability decrease. The measure/parameter is α[t, ∞) = B exp(−θt) .

u optional. a non-negative number, where the expectation of 1 − F̂(u) time [1 − F (x)]/[1 − F (y)] is to be computed.

y vector holding the truncation times.

x vector holding the right censored observations.

d vectors holding the censoring indicators for x.

Details

The parameter of the Dirichlet prior is a measure α: we took it to be α[t, ∞) = B exp(−θt).

If there are uncensored observations x, status=1, then the theoretical expectation will include terms like α{x}. Since this is zero for our choice of the α, we exclude those factor in the output.

The observations must all be non-negative.

The Bayes estimator is formed with the ratio of two such expectations, both of them include the term like α{x}.

Value

a single value that is the conditional expectation. If u is present then it includes a term 1 − F̂(u). If there is uncensored data, then the product it return will exclude the factor α{a_{i}}, which is zero under continuous measure. This do not matter when all we need is the ratio of two such terms. They will be canceled in a ratio expression anyway. (this is the case for the Bayes estimator).

Author(s)

Mai Zhou.

References

Susarla and Van Ryzin (1976) Nonparametric Bayesian estimation of survival curves from incomplete observations. J. Amer. Statist. Assoc. 71, 897-902.

Zhou, M. (2000). Nonparametric Bayes estimator of survival functions for doubly/interval censored data. Tech Report, Univ. of Kentucky.

See also Zhou, M. (2004). Statistica Sinica.

Zhou and Luan (2004). Tech Report, Univ. Kentucky

Examples

uncensored <- c(1,5,9)
rightcensored <- c(4,7)
NPBayes(B=12, theta=0.2, u=3.2, uncen=uncensored, rightcen=rightcensored)
leftpt <- 0
rightpt <- 3
NPBayes(B=12, theta=0.2, u=3.2, uncen=uncensored, rightcen=rightcensored,
lefts = leftpt, rights = rightpt)

NPBayes-internal Internal NPBayes functions

Description

Internal NPBayes functions

Usage

Allsigns(k)
Allends(lefts, rights)
MeasureB(B, theta, ai, zi)
binary4(k)

Details

These are not to be called by the user.

NPBayes Nonparametric Bayes estimate of CDF from arbitrary censored data

Description

This function will compute the nonparametric Bayes estimator of survival/distribution function from censored data with square error loss. The prior is a Dirichlet process.

The data can be uncensored, right censored, left censored or interval censored, but must be nonnegative. We assume F (0) = 0.

A left censored observation, t, is handled as an interval censored one with lefts = 0;

rights = t.

Usage

NPBayes(B, theta, u, uncen=numeric(0), rightcen=numeric(0),
          lefts=numeric(0), rights=numeric(0))

Arguments

B a positive number. The parameter for the Dirichlet process prior. The weight of prior information. If B is very small, then the resulting prior is "non-informative".

theta a positive number. Another parameter for Dirichlet process prior. The measure/parameter is α[t, ∞) = B exp(−θt) .

u a non-negative number, where the Bayes estimator 1 − F̂(u) is to be computed.

uncen optional vector holding the uncensored observations.

rightcen optional vector holding the right censored observations.

lefts optional vectors holding the left end-points of interval censored observations.

rights optional vectors holding the right end-points of interval censored observations. Their length must agree.

Details

If uncen, rightcen, lefts and rights are all missing, the estimator will be just the prior, 1 − F̂(u) = exp(−θu).

The observations must all be non-negative.

Due to rounding error and loss of significant digits in subtraction, the result can be untrustworthy when there are many interval censored data.

Value

a single value that is the nonparametric Bayes estimator 1 − F̂(u).

Author(s)

Mai Zhou.

References

Susarla and Van Ryzin (1976) Nonparametric Bayesian estimation of survival curves from incomplete observations. J. Amer. Statist. Assoc. 71, 897-902.

Zhou, M. (2000). Nonparametric Bayes estimator of survival functions for doubly/interval censored data. Tech Report, Univ. of Kentucky.

See also Zhou, M. (2004). Statistica Sinica.

Examples

uncensored <- c(1,5,9)
rightcensored <- c(4,7)
NPBayes(B=12, theta=0.2, u=3.2, uncen=uncensored, rightcen=rightcensored)
leftpt <- 0
rightpt <- 3

NPBayes(B=12, theta=0.2, u=3.2, uncen=uncensored, rightcen=rightcensored,
lefts = leftpt, rights = rightpt)

NPBayesT Nonparametric Bayes estimate of CDF from left truncated, right censored data

Description

This function will compute the nonparametric Bayes estimator of survival/distribution function from left truncated, right censored data with square error loss. The prior is a Dirichlet process.

The data must be nonnegative. We assume F (0) = 0.

Usage

NPBayesT(B, theta, u, y = numeric(0), x = numeric(0), status = numeric(0))

Arguments

B a positive number. The parameter for the Dirichlet process prior. It is the weight of prior information. If B is very small, then the resulting prior is "non-informative".

theta a positive number. Another parameter for Dirichlet process prior. The measure/parameter is α[t, ∞) = B exp(−θt) .

u a non-negative number, where the Bayes estimator of 1 − F̂(u) is to be computed.

y optional vector holding the (non-negative) left truncation times.

x optional vector holding the (possibly) right censored observations. ( x must > y ).

status optional vector holding the censoring status of the x vector. 1–uncensor, 0–censor.

Details

The observations must all be non-negative. Due to left truncation, data must also satisfy y_{i} < x_{i}.

Value

a single value that is the nonparametric Bayes estimator 1 − F̂(u).

Author(s)

Mai Zhou.

References

Susarla and Van Ryzin (1976) Nonparametric Bayesian estimation of survival curves from incomplete observations. J. Amer. Statist. Assoc. 71, 897-902.

Zhou, M. (2000). Nonparametric Bayes estimator of survival functions for doubly/interval censored data. Tech Report, Univ. of Kentucky.

See also Zhou, M. (2004). Statistica Sinica.

Luan, J, and Zhou, M. (2004). Nonparametric Bayes estimator of survival functions for censored data that are also subject to left truncation. Tech Report. Univ. Kentucky.

Examples

trunc <- c(2,4,10)
xtime <- c(9,13,15)
d <- c(1,0,0)
NPBayesT(B=8, theta=0.12, u=3.2, y=trunc, x=xtime, status=d)
#you should get 0.6955968 as the Bayes estimator
ui <- seq(0.1, 20, 0.1)
fui <- ui
for(i in 1:200)
   fui[i] <- NPBayesT(B=8, theta=0.12, u=ui[i],y=trunc, x=xtime, status=d)
#plot(ui, fui)
ypsy <- c(51, 58, 55, 28, 25, 48, 47, 25, 31, 30, 33, 43, 45, 35, 36)
xpsy <- c(52, 59, 57, 50, 57, 59, 61, 61, 62, 67, 68, 69, 69, 65, 76)
dpsy <- c(1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1 )
NPBayesT(B=8,theta=0.02,u=56,y=ypsy,x=xpsy,status=dpsy)

NPBayesT2 Nonparametric Bayes estimate of CDF from left truncated, right censored data

Description

This function will compute the nonparametric Bayes estimator of survival/distribution function from left truncated, right censored data with square error loss. The prior is a Dirichlet process.

The data must be nonnegative. We assume F (0) = 0.

Usage

NPBayesT2(B, theta, u, y = numeric(0), x = numeric(0), status = numeric(0))

B a positive number. The parameter for Dirichlet process prior. The weight of prior information. If B is very small, then the resulting prior is "noninformative".

theta a positive number. Another parameter for Dirichlet process prior. The measure/parameter is α[t, ∞) = B exp(−θt) .

u a non-negative number, where the estimator of 1−F̂(u) is to be computed.

y optional vector holding the (non-negative) truncation times.

x optional vector holding the (possibly) right censored observations.

status optional vector holding the censoring status of the x vector. 1–uncensor, 0–censor.

Details

The observations must all be non-negative. Due to left truncation, data must also satisfy y_{i} < x_{i}. The 3 data vectors, x, y, status must be of the same length. This function is standalone.

Value

a single value that is the Bayes nonparametric estimator 1 − F̂(u).

Author(s)

Mai Zhou.

References

Susarla and Van Ryzin (1976) Nonparametric Bayesian estimation of survival curves from incomplete observations. J. Amer. Statist. Assoc. 71, 897-902.

Zhou, M. (2000). Nonparametric Bayes estimator of survival functions for doubly/interval censored data. Tech Report, Univ. of Kentucky.

See also Zhou, M. (2004). Statistica Sinica.

Luan, J, and Zhou, M. (2004). Nonparametric Bayes estimator of survival functions for censored data that are also subject to left truncation. Tech Report. Univ. Kentucky.

Examples

trunc <- c(2,4,10)
xtime <- c(9,13,15)
d <- c(1,0,0)
NPBayesT(B=8, theta=0.12, u=3.2, y=trunc, x=xtime, status=d)
ui <- seq(0.1, 20, 0.1)
fui <- ui
for(i in 1:200)
   fui[i] <- NPBayesT(B=8, theta=0.12, u=ui[i],y=trunc, x=xtime, status=d)
#plot(ui, fui)

ypsy <- c(51, 58, 55, 28, 25, 48, 47, 25, 31, 30, 33, 43, 45, 35, 36)
xpsy <- c(52, 59, 57, 50, 57, 59, 61, 61, 62, 67, 68, 69, 69, 65, 76)
dpsy <- c(1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1 )
NPBayesT(B=8,theta=0.02,u=56,y=ypsy,x=xpsy,status=dpsy)