lbsample: Generates length bias samples from a parametric family.

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Generates length bias samples from a parametric family.

Usage

1
lbsample(n, family, par = list(shape, rate, meanlog, sdlog), censor.vec = rexp(n))

Arguments

n

An integer indicates the number of the desired samples.

family

A string. Options are weibull, gamma, exponential, lognormal , and loglogistic.

par

A list of parameters related to the chosen family, meanlog, and sdlog for lognormal, and shape and rate for the rest.

censor.vec

An integer vector of the censoring indicator. When the generated sample is bigger than the values of the vector, the function return 1 in the output, meaning that sample is right censored.

Details

This function uses the sampling scheme described in Younger(2011).

weibull: f(x)= k*b*(x*b)^(k-1)*exp(1(x*b)^k)

x>=0, rate=b>0, shape=k>0.

exponential: f(x)=lambda*exp(-lambda*x)

x>=0, rate=lambda>0.

lognormal: f(x)=[1/(x*sigma*sqrt(2*pi))]*exp(-[(ln(x)-mu)^2]/2*sigma^2)

x>0, sdlog=sigma>0, meanlog=mu.

loglogistic: f(x)=[(b/a)*(x/a)^(b-1)]/[1+(x/a)^b]^2

x>=0, rate=1/a>0, shape=b>0.

Value

time

A vector of n random length bias samples from the density function specified in family, giving the residual lifetime.

censor

A vector of n boolean integers to indicates if the sample is censored or not, 1 for censored samples and 0 for uncensored.

onset

Starting time of the follow up for each individual, sampled from uniform distribution.

Note

The length of the censor.vec must match the number of the desired samples.

Author(s)

Pierre-Jerome Bergeron and Vahid Partovi Nia

References

Jaime Younger. (2011) Goodness-of-Fit for Length-Biased Survival Data with Right-Censoring.

See Also

lbfit.nonpar, lbfit.par.

Examples

1
2
mydata=lbsample(500,family="exponential",par=list(rate=1))
hist(mydata$time)

lbiassurv documentation built on May 2, 2019, 4:50 p.m.