<?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: IPTW and time-dependent Cox model in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976851#M48994</link>
    <description>&lt;P&gt;PROC PHREG support RANDOM statement which could take TIME as a random effect.&lt;/P&gt;
&lt;P&gt;But you want a time-dependent Cox regression, it looks like a combination of time series analysis and Cox model .&lt;/P&gt;
&lt;P&gt;Maybe you should check SAS/ETS doc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1760322873894.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110572iEF81EA72FF92100E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1760322873894.png" alt="Ksharp_0-1760322873894.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Oct 2025 02:34:57 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2025-10-13T02:34:57Z</dc:date>
    <item>
      <title>IPTW and time-dependent Cox model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976821#M48990</link>
      <description>&lt;P&gt;Hello, guys. I have encountered an issue that I had never faced before. As my statistical knowledge grows, the data analysis task also gets more complicated. Here is my question:&amp;nbsp;For a time-dependent Cox regression, we would like to use the IPTW for the control of time-fixed confounders, wile leaving the intervention of interest and the time-varying confounders only in the time-dependent Cox model. However, what we are uncertain is, when should we use the logistic model to get the weight values for each row? The most raw data where each individual is a row, or, the rephrased dataset where multiple rows are from a same individual but during different follow-up intervals. Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Gemini feedback this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;You should use the logistic model to calculate the IPT weights on the &lt;STRONG&gt;most raw data where each individual is a single row&lt;/STRONG&gt;, provided your &lt;STRONG&gt;time-fixed confounders are truly constant over the entire follow-up period&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;The reason for this lies in the goal of IPTW for time-fixed confounding: to balance the &lt;I&gt;initial&lt;/I&gt; probability of treatment assignment based on baseline (time-fixed) characteristics.&lt;/P&gt;
&lt;P&gt;Here is the breakdown of why and how to handle the data structure:&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Why Use the Raw, Single-Row Dataset&lt;/H2&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Inverse Probability of Treatment Weighting (IPTW) method, when controlling only for &lt;STRONG&gt;time-fixed confounders&lt;/STRONG&gt;, requires modeling the probability of receiving a particular intervention based on the individual's baseline characteristics.&lt;/P&gt;
&lt;OL start="1"&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Time-Fixed Treatment:&lt;/STRONG&gt; Your intervention of interest is also time-fixed (though its &lt;I&gt;effect&lt;/I&gt; is time-dependent). The weights need to reflect the initial treatment decision.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Time-Fixed Confounders:&lt;/STRONG&gt; Since your confounders are time-fixed (e.g., age at baseline, sex, disease stage at entry), the propensity score (PS) for an individual remains constant throughout their follow-up.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Simplicity and Consistency:&lt;/STRONG&gt; Calculating the PS once per individual on the raw dataset ensures that:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;The PS calculation reflects the &lt;STRONG&gt;baseline characteristics&lt;/STRONG&gt; that drove the initial treatment assignment.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Every interval (every row) of that individual in the rephrased dataset will receive the &lt;STRONG&gt;exact same weight&lt;/STRONG&gt;, preserving the marginal treatment effect estimate.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Correct Procedure (Using Raw Data)&lt;/H3&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="1"&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Data Structure:&lt;/STRONG&gt; Use the dataset where each row is a unique individual, containing the binary treatment status and all baseline (time-fixed) confounders.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Model:&lt;/STRONG&gt; Fit a standard logistic regression model for the probability of receiving the intervention.&lt;/P&gt;
&lt;DIV class="math-block"&gt;&lt;SPAN class="katex-display"&gt;&lt;SPAN class="katex"&gt;&lt;SPAN class="katex-html" aria-hidden="true"&gt;&lt;SPAN class="base"&gt;&lt;SPAN class="mord text"&gt;&lt;SPAN class="mord"&gt;logit&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="mopen"&gt;[&lt;/SPAN&gt;&lt;SPAN class="mord mathnormal"&gt;P&lt;/SPAN&gt;&lt;SPAN class="mopen"&gt;(&lt;/SPAN&gt;&lt;SPAN class="mord text"&gt;&lt;SPAN class="mord"&gt;Treatment&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="mrel"&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="base"&gt;&lt;SPAN class="mord"&gt;1∣&lt;/SPAN&gt;&lt;SPAN class="mord mathbf"&gt;Z&lt;/SPAN&gt;&lt;SPAN class="mclose"&gt;)]&lt;/SPAN&gt;&lt;SPAN class="mrel"&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="base"&gt;&lt;SPAN class="mord mathnormal"&gt;α&lt;/SPAN&gt;&lt;SPAN class="mbin"&gt;+&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="base"&gt;&lt;SPAN class="mord mathbf"&gt;Z&lt;/SPAN&gt;&lt;SPAN class="mord mathnormal"&gt;δ&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;(&lt;SPAN class="math-inline"&gt;&lt;SPAN class="katex"&gt;&lt;SPAN class="katex-html" aria-hidden="true"&gt;&lt;SPAN class="base"&gt;&lt;SPAN class="mord mathbf"&gt;Z&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; are your time-fixed confounders).&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Calculate Weights (&lt;SPAN class="math-inline"&gt;&lt;SPAN class="katex"&gt;&lt;SPAN class="katex-html" aria-hidden="true"&gt;&lt;SPAN class="base"&gt;&lt;SPAN class="mord"&gt;&lt;SPAN class="mord mathnormal"&gt;W&lt;/SPAN&gt;&lt;SPAN class="msupsub"&gt;&lt;SPAN class="vlist-t vlist-t2"&gt;&lt;SPAN class="vlist-r"&gt;&lt;SPAN class="vlist"&gt;&lt;SPAN class=""&gt;&lt;SPAN class="sizing reset-size6 size3 mtight"&gt;&lt;SPAN class="mord mathnormal mtight"&gt;i&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="vlist-s"&gt;​&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/STRONG&gt; Calculate the ATE or ATT weights for each individual.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Merge:&lt;/STRONG&gt; Merge the calculated weight (&lt;SPAN class="math-inline"&gt;&lt;SPAN class="katex"&gt;&lt;SPAN class="katex-html" aria-hidden="true"&gt;&lt;SPAN class="base"&gt;&lt;SPAN class="mord"&gt;&lt;SPAN class="mord mathnormal"&gt;W&lt;/SPAN&gt;&lt;SPAN class="msupsub"&gt;&lt;SPAN class="vlist-t vlist-t2"&gt;&lt;SPAN class="vlist-r"&gt;&lt;SPAN class="vlist"&gt;&lt;SPAN class=""&gt;&lt;SPAN class="sizing reset-size6 size3 mtight"&gt;&lt;SPAN class="mord mathnormal mtight"&gt;i&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="vlist-s"&gt;​&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;) onto the rephrased dataset using the individual ID. Each row/interval for the same person receives the identical weight.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Model:&lt;/STRONG&gt; Run the time-dependent Cox model using the rephrased data, including the intervention of interest, time-varying confounders, and the calculated weights in the &lt;CODE&gt;WEIGHT&lt;/CODE&gt; statement.&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Why You Should AVOID the Rephrased Dataset for Weights&lt;/H2&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use the rephrased (interval-based) dataset for the logistic regression:&lt;/P&gt;
&lt;OL start="1"&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Redundancy:&lt;/STRONG&gt; You would be running the same regression (treatment on time-fixed covariates) thousands of times, but the only variation would be the time interval and censoring status, which &lt;STRONG&gt;are not used&lt;/STRONG&gt; in the propensity score calculation.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Incorrect Interpretation:&lt;/STRONG&gt; A logistic regression on interval data is generally used for &lt;STRONG&gt;time-varying&lt;/STRONG&gt; propensity scores, where you model the probability of treatment &lt;I&gt;at time t&lt;/I&gt; conditional on time-varying confounders. Since your confounders are &lt;I&gt;time-fixed&lt;/I&gt;, this introduces unnecessary complexity and potential confusion without adding statistical value.&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;Crucial Note:&lt;/STRONG&gt; If your model included &lt;STRONG&gt;time-varying confounders&lt;/STRONG&gt; and you needed to use sequential (time-varying) IPTW, then you &lt;I&gt;would&lt;/I&gt; need to use the rephrased, multiple-row dataset and model the probability of &lt;I&gt;staying on&lt;/I&gt; the treatment or &lt;I&gt;switching&lt;/I&gt; at each time point. However, your goal is only to control for &lt;STRONG&gt;time-fixed confounders&lt;/STRONG&gt;, making the single-row baseline PS calculation the correct choice.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder if doing so this way will disturb the pseudo-cohort created by the IPTW technique from the raw dataset. It seems a same weight value will be assigned to the time-dependent dataset in which each individual might have more than one rows if they were followed long enough and their time-varying cofactor changed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Oct 2025 10:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976821#M48990</guid>
      <dc:creator>TomHsiung</dc:creator>
      <dc:date>2025-10-12T10:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: IPTW and time-dependent Cox model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976822#M48991</link>
      <description>&lt;P&gt;I can't say that I've heard of someone doing this before (calculating the weights only from the time-fixed variables), but I think the Gemini advice actually makes sense.&amp;nbsp; I've only used IPTW in a longitudinal dataset with weights that varied over time because in those cases, it was reasonable to think that the probability of treatment could be influenced by the time-varying covariates, but if that's not a concern in your data, I would say your approach seems logical.&amp;nbsp; And yes (re: your last sentence) - everyone would have the same weight in your case regardless of the timepoint, but I think that's what you &lt;EM&gt;want&lt;/EM&gt; based on your initial description.&amp;nbsp; All that said, I only "play a statistician on TV", so hopefully others will chime in.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Oct 2025 11:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976822#M48991</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-10-12T11:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: IPTW and time-dependent Cox model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976823#M48992</link>
      <description>&lt;P&gt;Thanks for your feedback, pal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have never heard of the time-dependent IPTW. I have read thousands of clinical study publications but not yet encountered a case with the time-based IPTW technique. It must be very cool.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Oct 2025 11:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976823#M48992</guid>
      <dc:creator>TomHsiung</dc:creator>
      <dc:date>2025-10-12T11:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: IPTW and time-dependent Cox model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976851#M48994</link>
      <description>&lt;P&gt;PROC PHREG support RANDOM statement which could take TIME as a random effect.&lt;/P&gt;
&lt;P&gt;But you want a time-dependent Cox regression, it looks like a combination of time series analysis and Cox model .&lt;/P&gt;
&lt;P&gt;Maybe you should check SAS/ETS doc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1760322873894.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110572iEF81EA72FF92100E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1760322873894.png" alt="Ksharp_0-1760322873894.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 02:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976851#M48994</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-10-13T02:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: IPTW and time-dependent Cox model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976883#M48999</link>
      <description>&lt;P&gt;This was a long time ago and I don't remember the details, but it was a marginal structural model, and the weight used at timepoint (n) was the &lt;EM&gt;cumulative product&lt;/EM&gt; of all weights from T(1) to T(n) for that individual.&amp;nbsp; The weights were a real mess to deal with because of this method as it would very often result in extreme values that needed to either be trimmed or otherwise dealt with.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 14:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976883#M48999</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-10-13T14:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: IPTW and time-dependent Cox model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976962#M49004</link>
      <description>Thanks, pal. Hmmm, looks like we should avoid the IPTW technique for time-dependent COX model.</description>
      <pubDate>Tue, 14 Oct 2025 13:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/IPTW-and-time-dependent-Cox-model/m-p/976962#M49004</guid>
      <dc:creator>TomHsiung</dc:creator>
      <dc:date>2025-10-14T13:34:53Z</dc:date>
    </item>
  </channel>
</rss>

