On Apr 10, 2012, at 11:48 PM, Christopher Kelvin wrote:
> Hello,
> I wish to censor 10% of my sample units of 50 from a Weibull
> distribution. Below is the code for it.
> I will need to know whether what i have done is correct and if not,
> can i have any suggestion to improve it?
> Thank you
>
> p=2;b=120
> n=50
> r=45
>
> t<-rweibull(r,shape=p,scale=b)
> meantrue<-gamma(1+(1/p))*b
> meantrue
>
> cen<- runif(n-r,min=0,max=meantrue)
> cen
I don't see how that works. You have five random draws from a uniform
distribution with support on some interval, not necessarily related to
the t vector. How are you deciding which of the variates should be
considered censored? Why wouldn't you just use set.seed(n); cens <-
sample(1:50, 5)) and use as an index?
--
David Winsemius, MD
West Hartford, CT