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
- /
- interaction when using proc logistic for data anal...

Topic Options

- Subscribe to 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-01-2014 12:33 PM

Hi all,

I have a question about interaction when using proc logistic for data analysis. I have a binary outcome death(0/1) and two binary predictors, MIHP(0/1) and black(0/1). I ran the following codes. To fit a logistic model with interaction between MIHP and black, I do go with two ways as follows. I expect to see exactly the same results in the output of the two ways, but I do not. Can anyone explain why?

Way#1: adding MIHP|black to the right hand side of the model statement

Way#2: first creating interaction variablein interact=MIHP*black, then adding MIHP, black, and interact to the rightside of the model statement

The two ways provide excatly the same model fit statistics (AIC, SC, and -2LogL), but the MLE of the parameters are not the same.

Why this happens? Which is the correct one? Or they should be used differently?

Thanks for the help,

Zhiying

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

Posted in reply to ZhiyingYou

04-01-2014 06:40 PM

Can you give more detail? Possibly the data? When I tried this on a toy example, I got the same results for both models:

data junk;

input var1 var2 DV $ count;

interact = var1*var2;

datalines;

0 0 0 100

0 0 1 50

0 1 0 25

0 1 1 75

1 0 0 100

1 0 1 10

1 1 0 10

1 1 1 90

;

proc logistic data = junk;

model DV = var1 var2 interact;

freq count;

run;

proc logistic data = junk;

model DV = var1|var2;

freq count;

run;

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

Posted in reply to ZhiyingYou

04-01-2014 10:38 PM

The differences you get are most likely due to differences in parameterisations. Not the same interaction levels are estimated in both fits. Look as this simple example:

**data cars;**

**length ab ba $4;**

**set sashelp.cars;**

**a = cylinders <= 4;**

**b = drivetrain = "Front";**

**cheap = MSRP <= 30000;**

**ab = cats("a",a,"b",b);**

**ba = cats("b",b,"a",a);**

**run;**

**title "a|b";**

**proc logistic data=cars;**

**class a b;**

**model cheap = a|b;**

**ods output parameterEstimates=a_b;**

**run;**

**title "a b ab";**

**proc logistic data=cars;**

**class a b ab;**

**model cheap = a b ab;**

**ods output parameterEstimates=ab;**

**run;**

**title "a b ba";**

**proc logistic data=cars;**

**class a b ba;**

**model cheap = a b ba;**

**ods output parameterEstimates=ba;**

**run;**

**data parmEstimates;**

**length model classVal0 classVal1 $4;**

**set a_b ab ba indsname=ds;**

**model = scan(ds,2,".");**

**where DF > 0;**

**run;**

**title "Parameter estimates for the three parameterisations";**

**proc print data=parmEstimates noobs; run;**

Check which levels of **a** and **b** are estimated in each model.

PG

PG