BookmarkSubscribeRSS Feed
Salah
Quartz | Level 8

Hello 

 

I have two data sets with sizes m1 and m2, I want to keep k1 observations from the m1 and k2 observations from m2. In my program I need to create two vectors randomly with integer values (R1 and R2) to work as my censored scheme such that R1[+] + k1=m1 and R2[+]+K2=m2.

 

My problem is that for some values (example K=8)  the code gives correct answer to R1 but not R2, for other values (K=15) none of them is correct. I am not sure where did I miss up?

 

Thank you

4 REPLIES 4
Rick_SAS
SAS Super FREQ

For each iteration, you are creating new vectors of length k for R1 and R2. However, you are computing s and s1 based on only the i_th component of that vector.  When the loop exits, R1 and R2 are whatever values they were assigned during the last iteration. 

Salah
Quartz | Level 8

Calculating the sums of R1 and R2  is not my intention. I am doing that just to make sure that the vectors are created correctly.

I need to creat R1 and R2 such that the sum of each of them plus the corresponding k add up to the original size of the data.

Is there a way to a complish that?

 

 

Thank you

Rick_SAS
SAS Super FREQ

What is the distribution from which you want to draw the elements of the vectors?

In your program, you use integers in the set {0, 1, 2}. Is that part of the constraints? Or are any integers allowed?

Are there other constraints? 

 

Because of the constraint that the elements sum to a value S, only the first n-1 elements can be randomly generated. The last element is determined to be S - sum(first n-1 values), 

 

 

Salah
Quartz | Level 8

I am sorry for not being clear.

 I am working on simulating two progressively censored data. The original data sizes are m1 and m2   I want to observe k1 from m1 and k2 from m2 and censor the rest (m1-k1 and m2-k2 respectively). 

In the algorithm for the simulation part I need to figure out how the observations will be censored from the original data. So I need to define the censoring schemes i.e. R1 and R2. The R1 and R2 must be random. So I decided to work on them on a separate code so my code won't be long when I post it on the site.

 

The only conditions are the elements of the vectors are integer>0,  R1[+]=m1-k1 and R2[+]=m2-k2. I could take for example m1=100 and k1=30 and in this case R1=J(3,1,0); R1[30]=70 or R1[1]=70 but this only covers the two extreme cases meaning what about the other cases where the values varies between 2nd,3rd ...etc.  positions.

I am struggling in how to do it for R1 and R2 at the same time and this is where I need the help.

 

Thank you