BookmarkSubscribeRSS Feed
Ashley09
Calcite | Level 5

Hi all,

I am trying to check the Independence of Irrelevant Alternatives Assumption (IIA), using Hauman test in SAS. 

I found the following code :

proc model data=dataset out=fiml2;
endogenous y1 y2;

y1 = py2 * y2 + px1 * x1 + interc;
y2 = py1* y1 + pz1 * z1 + d2;

fit y1 y2 / ols 2sls hausman;
instruments x1 z1;
run;

 

But I have to detect the test between three variables: P1, P2, P3. 

How does one modify the syntax for a third variable?  How would the  lines of the syntax be changed? 

5 REPLIES 5
SASCom1
SAS Employee

Hi @Ashley09 

 

The Independence of Irrelevant Alternatives (IIA) property is a property discussed in the multinomial logit and conditional logit models where the probability ratios between any two alternatives are independent of other alternatives:

 

SAS Help Center: Multinomial Logit and Conditional Logit

 

This property can be tested using the Hausman test, using the %IIA macro provided in the following example in PROC MDC documentation:

 

SAS Help Center: Hausman’s Specification Test

 

The above example tested the IIA property using alternative 9(i.e., testing that alternative 9 is irrelevant), and also tested the IIA property using alternative 8, 9, and 10 in the second example. 

 

If you have a multinomial logit or conditional logit model and you wanted to test IIA property that some alternatives in the choice set are irrelevant, then you can follow the above example and use the %IIA macro accordingly.

 

The PROC MODEL code in your original post is a different application of Hausman test. It is irrelevant to the Hausman test of IIA property of the multinomial logit and conditional logit models discussed above. 

Ashley09
Calcite | Level 5

It still doesn't seem to work. It gives the following error: "ERROR: Variable ID in list does not match type prescribed for this list."

Is proc mdc only used for nested data? Since my data is not nested.

I have run a multinomial logistic regression; I am checking the IIA assumption before using two of three groups for further analysis.

ballardw
Super User

@Ashley09 wrote:

It still doesn't seem to work. It gives the following error: "ERROR: Variable ID in list does not match type prescribed for this list."

Is proc mdc only used for nested data? Since my data is not nested.

I have run a multinomial logistic regression; I am checking the IIA assumption before using two of three groups for further analysis.


Interesting that you are siting an error for a variable that does not appear in the original post. And you are now referencing a procedure not mentioned in your original post:

Hi all,

I am trying to check the Independence of Irrelevant Alternatives Assumption (IIA), using Hauman test in SAS. 

I found the following code :

proc model data=dataset out=fiml2;
endogenous y1 y2;

y1 = py2 * y2 + px1 * x1 + interc;
y2 = py1* y1 + pz1 * z1 + d2;

fit y1 y2 / ols 2sls hausman;
instruments x1 z1;
run;

 

 

Typically this error about "does not match list" appears when you use a variable that is character in a place that SAS expects numeric values. So run Proc Contents on your data set and verify the variable type of the variable Id.

 

Or did you miss as ; and an ID statement start is being used as a variable on a previous statement? Maybe show the entire LOG of the procedure including the CODE and all the messages? Copy the text from the Log and paste into a text box opened on the forum with the </> icon that appears above the message window. The text box sets text apart from question/discussion and preserves the formatting of text that often included diagnostic characters. The message windows here will reformat text and sometimes makes it hard to identify where SAS indicated the problem exists.

Ashley09
Calcite | Level 5
I was referring to the first solution posted above ( SAS Help Center: Hausman’s Specification Test).
Proc mdc is used in this macro along with id variable, which seems to give error.
SASCom1
SAS Employee

hi @Ashley09 

 

Without knowledge of the PROC MDC code you are using and what your input data set looks like, it is hard to pinpoint specifically what exactly is causing the error message "ERROR: Variable ID in list does not match type prescribed for this list.",  but if the 'ID' variable referenced in the error message is the variable specified on the ID statement, then you may first want to verify that this variable is numeric variable rather than character variable.  If the variable specified in ID statement is character variable, then the error will occur. If you have verified that the ID variable is numeric but still produces the error, then you may want to check whether your data set is properly structured according to the ID variable, as PROC MDC requires that each individual decision maker has one case for each alternative in his choice set, as shown in this example how to convert an original data set into the new data structure which PROC MDC accepts :

 

Conditional Logit: Estimation and Prediction

 

If you have verified that your input data set is structured properly according to the above example, and that the ID variable specified in the ID statement is numeric variable, but still encounter the error message, then it will be helpful if you can please send in your log file showing the PROC MDC syntax submitted as well as all the error/warning messages, together with a sample of your input data set that contains at least several subjects, and I will take a further look.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1083 views
  • 1 like
  • 3 in conversation