<?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 How can I calculate Stabilized Inverse Probability weights? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-calculate-Stabilized-Inverse-Probability-weights/m-p/454845#M23755</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to use stabilized IP weights for my analysis because of the large weights I get when I use the regular IPW (due to large variance). I calculated the regular IPW using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Calculating probability of participation/no drop out given covariates;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;proc logistic data=ipw ;&lt;BR /&gt;class gender race income education smoking BMIcat&amp;nbsp;;&lt;BR /&gt;model responder = &lt;SPAN&gt;gender&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;race income&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;education smoking BMIcat&lt;/SPAN&gt;;&lt;BR /&gt;output out=weights predicted=prob;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Computing inverse weights;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data inverseweights;&lt;BR /&gt;set weights;&lt;BR /&gt;if responder=1 then ipw = 1/prob;&lt;BR /&gt;if responder=0 then ipw=1/(1-prob);&amp;nbsp;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Merging dataset containing inverse weights with full dataset;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data weight.ipwanalysis;&lt;BR /&gt;merge inverseweights fulldataset (in=a);&lt;BR /&gt;if a;&amp;nbsp;&amp;nbsp;by id;&amp;nbsp;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Final Adjusted model weighted by IPW;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;proc glm data=ipwanalysis ;&lt;BR /&gt;class bmicat race;&lt;BR /&gt;model FinalScore=bmicat race age;&lt;BR /&gt;weight ipw;&lt;BR /&gt;lsmeans bmicat/ stderr pdiff cl;&amp;nbsp;run;&amp;nbsp;&amp;nbsp;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I calculate and use Stabilized Inverse Probability Weights (instead of regular IPW) so that I can weight the mean differences I get from my final adjusted model (proc glm). I appreciate any help you can offer&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2018 16:56:43 GMT</pubDate>
    <dc:creator>lousam</dc:creator>
    <dc:date>2018-04-17T16:56:43Z</dc:date>
    <item>
      <title>How can I calculate Stabilized Inverse Probability weights?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-calculate-Stabilized-Inverse-Probability-weights/m-p/454845#M23755</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to use stabilized IP weights for my analysis because of the large weights I get when I use the regular IPW (due to large variance). I calculated the regular IPW using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Calculating probability of participation/no drop out given covariates;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;proc logistic data=ipw ;&lt;BR /&gt;class gender race income education smoking BMIcat&amp;nbsp;;&lt;BR /&gt;model responder = &lt;SPAN&gt;gender&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;race income&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;education smoking BMIcat&lt;/SPAN&gt;;&lt;BR /&gt;output out=weights predicted=prob;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Computing inverse weights;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data inverseweights;&lt;BR /&gt;set weights;&lt;BR /&gt;if responder=1 then ipw = 1/prob;&lt;BR /&gt;if responder=0 then ipw=1/(1-prob);&amp;nbsp;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Merging dataset containing inverse weights with full dataset;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data weight.ipwanalysis;&lt;BR /&gt;merge inverseweights fulldataset (in=a);&lt;BR /&gt;if a;&amp;nbsp;&amp;nbsp;by id;&amp;nbsp;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Final Adjusted model weighted by IPW;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;proc glm data=ipwanalysis ;&lt;BR /&gt;class bmicat race;&lt;BR /&gt;model FinalScore=bmicat race age;&lt;BR /&gt;weight ipw;&lt;BR /&gt;lsmeans bmicat/ stderr pdiff cl;&amp;nbsp;run;&amp;nbsp;&amp;nbsp;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I calculate and use Stabilized Inverse Probability Weights (instead of regular IPW) so that I can weight the mean differences I get from my final adjusted model (proc glm). I appreciate any help you can offer&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 16:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-calculate-Stabilized-Inverse-Probability-weights/m-p/454845#M23755</guid>
      <dc:creator>lousam</dc:creator>
      <dc:date>2018-04-17T16:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I calculate Stabilized Inverse Probability weights?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-calculate-Stabilized-Inverse-Probability-weights/m-p/454950#M23759</link>
      <description>&lt;P&gt;Try replacing your second step with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table marginalWeights as
select 
    sum(responder) / count(responder) as marginalWeight
from weights;

create table inverseWeights as
select 
    *,
    case responder
        when 1 then marginalWeight / prob
        when 0 then (1 - marginalWeight) / (1-prob)
        else .
        end as ipw
from weights, marginalWeights
order by id;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 22:44:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-calculate-Stabilized-Inverse-Probability-weights/m-p/454950#M23759</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-04-17T22:44:06Z</dc:date>
    </item>
  </channel>
</rss>

