# Simulating survival times following a Weibull distribuition with % of rigth-censored observations

I need to simulate survival times from Weibull(shape,scale) distribution with rigth-censoring. how to choose uniform distribution parameter in order to obtain approximately 20% (or 30%) of censored observations? And if the survival times follow lognormal distribution?

What determines the choice of the uniform distribution parameters to obtain the desired censorship rate, Regardless of the parametric distribution from which the survival times were generated?

• Could you explain what this "uniform distribution parameter" means? Exactly how is it used to implement censoring? – whuber Nov 17 '16 at 15:31
• I mean the parameters of uniform distribution used to simulate the censoring times (C) and then compare with T to obtain obs.time=min(T,C) – user29237 Nov 17 '16 at 15:53
• Please describe the censoring method, in detail, in the post itself. It still isn't clear how the censoring is occurring, for two reasons. First, a uniform distribution has two parameters, not one; and second (because of that) there is no unique solution. Therefore it sounds like you have in mind some kind of restricted version of the procedure you have hinted at in your comment. – whuber Nov 17 '16 at 15:56
• First of all, sorry for my english, iam still learning. My question is like this: "Simulate 100 individuals with survival times following a Gompertz distribution with shape parameter alpha=1 and scale parameter gamma=2. Also simulate independent censoring times following a uniform distribution in order to obtain approximately 30% of censored observations." (Beyersmann J.,Allignol. A. and Schumacher,M, 2012, pag 36). – user29237 Nov 17 '16 at 16:16
• In my case, I would like to use the Weibull and lognormal distribution (not Gompertz) to generate the survival times, but using the uniform distribution to draw censoring times. – user29237 Nov 17 '16 at 16:16

Let the uniform distribution be $X,$ defined on $[0,b],$ and the Weibull random variable by $Y,$ with shape parameter $\alpha$ and scale parameter $\beta.$

Since your censoring scheme involves using the minimum of the two random variables, suppose we look at the probability that $Y$ is less than $X.$

$$P[Y<X] =\int_0^b P[Y<X|X=x]f(x)dx$$

Now $f(x)$ is just ${1 \over b}$ and using the cdf formula for a Weibull we have

$$P[Y<X] ={1 \over b}\int_0^b \left[ {1-e^{-(x/\beta)^{\alpha}}} \right] dx$$

Working out the integral results in the following:

$$P[Y<X] =1+{\beta \over {b \alpha}} \left[\Gamma \left({1 \over \alpha} , \left( {b \over \beta} \right)^{\alpha} \right) - \Gamma{\left( {1 \over \alpha} \right)} \right]$$

The function $\Gamma(a,x)$ is the upper incomplete gamma function and $\Gamma(x)$ is the gamma function.

Now you can solve this numerically for $b$ using your desired censoring percentage.