<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Hybrid Censoring in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732833#M5446</link>
    <description>&lt;P&gt;Hello Rick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for taking the time to look at my problem&lt;/P&gt;&lt;P&gt;X_qm are all greater than T and that is why I extracted them because these failures happened before time T. Instead I will be replacing them with X_qm (qm means that the size of this new data is m-q)&lt;/P&gt;&lt;P&gt;where q is the position where I started distracting the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do understand that X_qm not necessarily greater than &lt;STRONG&gt;T&lt;/STRONG&gt;. But research-wise that doesn't make any sense since these failure's time should occur after T. I am attaching a diagram that may help explain what I am trying to do.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS-pic.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57351iA9BD0DE21C8EB365/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS-pic.PNG" alt="SAS-pic.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Apr 2021 08:37:10 GMT</pubDate>
    <dc:creator>Salah</dc:creator>
    <dc:date>2021-04-11T08:37:10Z</dc:date>
    <item>
      <title>Hybrid Censoring</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732580#M5442</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am generating a vector X_p of size (m x1) the entries are failure times so they are ranked from smallest to largest. I set the study to end at time T(say 0.9). If (X_1,...., X_m) all occurred before T then the program is carried on to find the MLE and other estimators. If time T occurs before getting my m failures then&amp;nbsp; I have to extract the values that come after T (say m-q), then use them to generate new values from the truncated function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The problem that I am facing now is that&amp;nbsp;&lt;/STRONG&gt;these new data (I call it X_q_m) have a failure time that is &lt;STRONG&gt;smaller&lt;/STRONG&gt; than Time T!!! I tried sorting the extracted values before using them to generate the new data but I failed.&lt;/P&gt;
&lt;P&gt;Can anyone help me solving this problem, please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
   n=30;
   m=20;
   R=J(m, 1, 0);
   R[m]=10;
   T=1.3;
   seed=2;
   k=1;
   alpha=1;
   beta=1;

   Do N1=1 to K;
      ** progressive censoring ***;
      ****************************;
      W=J(m, 1, 0);
      V=J(m, 1, 0);
      X_p=J(m, 1, 0);
      X_A=J(m, 1, 0);
      U=J(m, 1, 0);
      X=J(m, 1, 0);

      do i=1 to m;
         W[i]=Uniform(seed);
      end;
      S=1+R[m];
      V[1]=W[1]**(1/S);

      do i=2 to m;
         S=S+(1+R[m-i+1]);
         V[i]=W[i]**(1/S);
      end;

      do i=1 to m;
         U[i]=1-prod(V[m:(m-i+1)] );
         ** the U's are the required progressively type II from U(0,1);
      end;
      X_p=((1-U)##(-1/alpha) -1)/beta;
      Call sort (X_p);
      
      * Find the position of the larget failure &amp;lt; T;
      do idx=1 to m-1;
         if ((X_p[idx] &amp;lt; T) &amp;amp; (X_p[idx+1] &amp;gt;=T)) then
            q=idx;
      end;
      
      * If the mth failure is larger than T;
      If X_p[m]&amp;gt;T then do;
         X_1_q=J(q, 1, 0);
         X_1_q=X_p[1:q];

         /* extract those failures that are less than T i.e. all X_1,...,X_q,X_(q+1) */
         Xp_remaining=J(m-q, m, 0);
         Xp_remaining=X_p[q+1:m];
         X_qm=Xp_remaining;
         *Call Sort (X_qm);
         Rq=R[1:q];
         
         **************************************************;
         ** Generate data of size m-q **;
         **************************************************;
         W1=J(m-q, 1, 0);
         U1=J(m-q, 1, 0);
         V1=J(m-q, 1, 0);
         X_q_m=J(m-q, 1, 0);
         X_A=J(m, 1, 0);

         do i=1 to m-q;
            W1[i]=Uniform(seed);
         end;
         S1=1+R[m-q];
         V1[1]=W1[1]**(1/S1);

         do i=2 to m-q;
            S1=S1+(1+R[m-i+1]);
            V1[i]=W1[i]**(1/S1);
         end;

         do i=1 to m-q;
            prod1=prod(V1[(m-q):((m-q)-i+1)] );
            U1[i]=1-(prod1);
            ** the U's are the required progressively type II from U(0,1);
         end;
         X_q_m=((U1#(1+beta#X_qm)##(-alpha)/(alpha*beta) )##(-1/(alpha+1))-1)/beta;
         call sort(X_q_m);
         X_A=X_1_q // X_q_m;
         X=X_A;
      end;
      *end the list for first if statement;
      else if (X_p[m]&amp;lt;=T) then do;
         q=m-1;
         X=X_p;
      end;
      *end the list for the else if statement;
   End;
   print T q X_q_m X_p X_A;
   quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732580#M5442</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-04-09T18:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Hybrid Censoring</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732597#M5443</link>
      <description>&lt;P&gt;When I run your program, I get the following output.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Region Capture.png" style="width: 277px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57234i69EAC54D46F8068D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Region Capture.png" alt="Region Capture.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;From your description, it sounds like you want to look at X_p and decide whether&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. All values are prior to T, -OR-&lt;/P&gt;
&lt;P&gt;2. Some values are &amp;gt; T. Extract those to X_q_m.&lt;/P&gt;
&lt;P&gt;Is that right? If not, explain what values are wrong and what the correct answer should be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732597#M5443</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-04-09T18:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Hybrid Censoring</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732631#M5444</link>
      <description>&lt;P&gt;Are you perhaps confusing X_qm and X_q_m?&amp;nbsp; By definition, all elements of X_qm are greater than T.&amp;nbsp; However, X_q_m is the expression&lt;/P&gt;
&lt;P&gt;X_q_m=((U1#(1+beta#X_qm)##(-alpha)/(alpha*beta) )##(-1/(alpha+1))-1)/beta;&lt;/P&gt;
&lt;P&gt;and those elements are not necessarily greater than T.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 20:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732631#M5444</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-04-09T20:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Hybrid Censoring</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732833#M5446</link>
      <description>&lt;P&gt;Hello Rick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for taking the time to look at my problem&lt;/P&gt;&lt;P&gt;X_qm are all greater than T and that is why I extracted them because these failures happened before time T. Instead I will be replacing them with X_qm (qm means that the size of this new data is m-q)&lt;/P&gt;&lt;P&gt;where q is the position where I started distracting the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do understand that X_qm not necessarily greater than &lt;STRONG&gt;T&lt;/STRONG&gt;. But research-wise that doesn't make any sense since these failure's time should occur after T. I am attaching a diagram that may help explain what I am trying to do.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS-pic.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57351iA9BD0DE21C8EB365/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS-pic.PNG" alt="SAS-pic.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Apr 2021 08:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732833#M5446</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-04-11T08:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hybrid Censoring</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732843#M5447</link>
      <description>&lt;P&gt;Two comments:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;In your program, you have two different variables that are using a similar name. I strongly recommend that you rename X_q_m to something else (Y?) so that it is easier to distinguish from X_qm.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, you say&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;X_qm are all greater than T&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;and later&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;I do understand that X_qm not necessarily greater than&amp;nbsp;&lt;STRONG&gt;T&lt;/STRONG&gt;.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Both statements cannot be true, and I think if you rename X_q_m it will be easier to debug your program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. For debugging purposes, the initial vectors of times (X_p) does not need to be random. Use a simple vector like X_p = {0.2, 0.4, 0.8, 1.1, 1.2, 1.4, 1.5, 2.0} and concetrate your efforts on the second part of the program, which is where your mistake is.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Apr 2021 10:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732843#M5447</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-04-11T10:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Hybrid Censoring</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732849#M5448</link>
      <description>&lt;P&gt;&lt;FONT color="#FF0000"&gt;For example, you say&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;X_qm are all greater than T&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;and later&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;I do understand that X_qm not necessarily greater than&amp;nbsp;&lt;STRONG&gt;T&lt;/STRONG&gt;.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Both statements cannot be true, and I think if you rename X_q_m it will be easier to debug your program.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sorry for the confusion what I meant to say is that since the failures supposed occurred after T, then their values must be &amp;gt; T. That is why I attached the diagram since it shows the two if statement that I am using in my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You pointed out in your previous reply that X_qm (now I call it Y) that it is not necessary &amp;gt; or &amp;lt; T. I meant to say that I agree with this notion but this doesn't work for my research.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;For debugging purposes, the initial vectors of times (X_p) does not need to be random. Use a simple vector like X_p = {0.2, 0.4, 0.8, 1.1, 1.2, 1.4, 1.5, 2.0} and concetrate your efforts on the second part of the program, which is where your mistake is&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To reply to this point, if you change R[m]=10 to R[1]=10&amp;nbsp; for example then there will be no problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any changes in the parameter may/may not create this problem to me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since I have to take different values of T, R, alpha, beta, and so on so I can't guarantee not to have this problem.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The problem is that these values create a huge bias for the MLE!!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;n=30;&lt;BR /&gt;m=20;&lt;BR /&gt;R=J(m, 1, 0);&lt;BR /&gt;R[m]=10;&lt;BR /&gt;T=1.3;&lt;BR /&gt;seed=2;&lt;BR /&gt;k=1;&lt;BR /&gt;alpha=1;&lt;BR /&gt;beta=1;&lt;/P&gt;&lt;P&gt;Do N1=1 to K;&lt;BR /&gt;** progressive censoring ***;&lt;BR /&gt;****************************;&lt;BR /&gt;W=J(m, 1, 0);&lt;BR /&gt;V=J(m, 1, 0);&lt;BR /&gt;X_p=J(m, 1, 0);&lt;BR /&gt;X_A=J(m, 1, 0);&lt;BR /&gt;U=J(m, 1, 0);&lt;BR /&gt;X=J(m, 1, 0);&lt;/P&gt;&lt;P&gt;do i=1 to m;&lt;BR /&gt;W[i]=Uniform(seed);&lt;BR /&gt;end;&lt;BR /&gt;S=1+R[m];&lt;BR /&gt;V[1]=W[1]**(1/S);&lt;/P&gt;&lt;P&gt;do i=2 to m;&lt;BR /&gt;S=S+(1+R[m-i+1]);&lt;BR /&gt;V[i]=W[i]**(1/S);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;do i=1 to m;&lt;BR /&gt;U[i]=1-prod(V[m:(m-i+1)] );&lt;BR /&gt;** the U's are the required progressively type II from U(0,1);&lt;BR /&gt;end;&lt;BR /&gt;X_p=((1-U)##(-1/alpha) -1)/beta;&lt;BR /&gt;Call sort (X_p);&lt;BR /&gt;&lt;BR /&gt;* Find the position of the larget failure &amp;lt; T;&lt;BR /&gt;do idx=1 to m-1;&lt;BR /&gt;if ((X_p[idx] &amp;lt; T) &amp;amp; (X_p[idx+1] &amp;gt;=T)) then&lt;BR /&gt;q=idx;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;* If the mth failure is larger than T;&lt;BR /&gt;If X_p[m]&amp;gt;T then do;&lt;BR /&gt;X_1_q=J(q, 1, 0);&lt;BR /&gt;X_1_q=X_p[1:q];&lt;/P&gt;&lt;P&gt;/* extract those failures that are less than T i.e. all X_1,...,X_q,X_(q+1) */&lt;BR /&gt;Xp_remaining=J(m-q, m, 0);&lt;BR /&gt;Xp_remaining=X_p[q+1:m];&lt;BR /&gt;X_qm=Xp_remaining;&lt;BR /&gt;*Call Sort (X_qm);&lt;BR /&gt;Rq=R[1:q];&lt;BR /&gt;&lt;BR /&gt;**************************************************;&lt;BR /&gt;** Generate data of size m-q **;&lt;BR /&gt;**************************************************;&lt;BR /&gt;W1=J(m-q, 1, 0);&lt;BR /&gt;U1=J(m-q, 1, 0);&lt;BR /&gt;V1=J(m-q, 1, 0);&lt;BR /&gt;Y=J(m-q, 1, 0);&lt;BR /&gt;X_A=J(m, 1, 0);&lt;/P&gt;&lt;P&gt;do i=1 to m-q;&lt;BR /&gt;W1[i]=Uniform(seed);&lt;BR /&gt;end;&lt;BR /&gt;S1=1+R[m-q];&lt;BR /&gt;V1[1]=W1[1]**(1/S1);&lt;/P&gt;&lt;P&gt;do i=2 to m-q;&lt;BR /&gt;S1=S1+(1+R[m-i+1]);&lt;BR /&gt;V1[i]=W1[i]**(1/S1);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;do i=1 to m-q;&lt;BR /&gt;prod1=prod(V1[(m-q):((m-q)-i+1)] );&lt;BR /&gt;U1[i]=1-(prod1);&lt;BR /&gt;** the U's are the required progressively type II from U(0,1);&lt;BR /&gt;end;&lt;BR /&gt;Y=((U1#(1+beta#X_qm)##(-alpha)/(alpha*beta) )##(-1/(alpha+1))-1)/beta;&lt;BR /&gt;call sort(Y);&lt;BR /&gt;X_A=X_1_q // Y;&lt;BR /&gt;X=X_A;&lt;BR /&gt;end;&lt;BR /&gt;*end the list for first if statement;&lt;BR /&gt;else if (X_p[m]&amp;lt;=T) then do;&lt;BR /&gt;q=m-1;&lt;BR /&gt;X=X_p;&lt;BR /&gt;end;&lt;BR /&gt;*end the list for the else if statement;&lt;BR /&gt;End;&lt;BR /&gt;print T q Y X_p X_A;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Apr 2021 12:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732849#M5448</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-04-11T12:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Hybrid Censoring</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732984#M5449</link>
      <description>&lt;P&gt;It is not clear whether you are asking a research question or a SAS/IML programming question. If it is a research question, perhaps you can discuss it with your advisor or a colleague.&amp;nbsp; If it is a programming problem, then please tell us what is wrong with the computation and what the correct answer should be.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 10:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Hybrid-Censoring/m-p/732984#M5449</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-04-12T10:34:46Z</dc:date>
    </item>
  </channel>
</rss>

