turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How can I calculate Stabilized Inverse Probability...

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-17-2018 12:56 PM

Hello,

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:

***Calculating probability of participation/no drop out given covariates;**

proc logistic data=ipw ;

class gender race income education smoking BMIcat ;

model responder = gender race income education smoking BMIcat;

output out=weights predicted=prob;

run;

***Computing inverse weights;**

data inverseweights;

set weights;

if responder=1 then ipw = 1/prob;

if responder=0 then ipw=1/(1-prob); run;

***Merging dataset containing inverse weights with full dataset;**

data weight.ipwanalysis;

merge inverseweights fulldataset (in=a);

if a; by id; run;

***Final Adjusted model weighted by IPW;**

proc glm data=ipwanalysis ;

class bmicat race;

model FinalScore=bmicat race age;

weight ipw;

lsmeans bmicat/ stderr pdiff cl; run; quit;

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

Accepted Solutions

Solution

04-19-2018
10:03 AM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to lousam

04-17-2018 06:44 PM

Try replacing your second step with:

```
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;
```

(untested)

PG

All Replies

Solution

04-19-2018
10:03 AM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to lousam

04-17-2018 06:44 PM

Try replacing your second step with:

```
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;
```

(untested)

PG