In [6]:
import pymc as mc
import numpy as np
import numpy.ma as ma
N = 3000
#create some artificial data, like the data in the figure above. 
lifetime = mc.rweibull( 2, 5, size = N ) 
birth = mc.runiform(0, 10, N)

censor = (birth + lifetime) > 10 #an individual is right-censored if this is True 
lifetime_ = np.ma.masked_array( lifetime, censor ) #create the censorship event. 
lifetime_.set_fill_value( 10 ) #good for computations later.

In [7]:
lifetime_


Out[7]:
masked_array(data = [4.6677890715477215 -- 6.87163860635148 2.2968337471584315 --
 2.5563214845930076 5.47928438094956 -- 3.3276711637868917
 1.8030722842868065 -- 6.014444030877853 -- 2.538209865100129
 1.9689474407100782 -- -- 4.1463997424619095 -- -- -- -- -- -- --
 1.1173598807768839 -- 1.9988792029705387 -- 2.758446496447695
 8.286238956229505 -- -- -- 1.978660746214995 1.8969717591109716
 3.285967257230929 4.42777209758302 -- 2.104435804329948 2.229350368725095
 -- 2.902033623323978 2.8743748814080594 4.548787525698634 --
 1.6759006690543252 -- -- 4.54620865333014 5.415980371581806
 6.266854044165019 -- -- 7.37177458977044 2.545152643747292 -- --
 2.8292766718815465 4.225565782975995 0.7383465770340326 -- -- --
 5.576749181024875 -- -- 2.811606874779983 5.043220142983811
 2.2328694928537827 -- 3.843641780250481 2.2101365456722015
 3.807668630452098 -- 4.526496152602451 -- -- 3.4866261176905793 --
 4.631332340449155 -- 2.7345866001206747 -- 1.4625561266772475
 2.691256711600005 -- 6.795031648887491 -- -- 1.7657523575550813 --
 5.505195314030297 3.968061299336552 2.7950576673599263 1.862936350102953
 -- 1.4454381493002788 4.956633943408294 0.992932594777579],
             mask = [False  True False ..., False False False],
       fill_value = 10.0)

In [ ]: