Using Clarify with Multinomial Logit, Ordered Probit, and Ordered Logit

/*This program illustrates use of the program Clarify with multinomial logit, ordered probit, and ordered logit.*/

/*Multinomial Logit */

use "c:\users\Documents\My Teaching\Maximum Likelihood\Data\brand.dta", clear

summarize

/* Following is an example of using Clarify to estimate a logit, calculate logit probabilities, and calculate first differences */

estsimp mlogit brand female age, basecategory (1)   /*Estimate a multinomial logit */

setx mean                                             /*Set variables at their means */

simqi, listx                                          /*Report probabilities at variable means */

setx (age) mean female 0                  /*Set age to mean, set female to 0 */

simqi, listx                                          /*Report probabiliies at these values */

setx (age) mean female 1                  /*Set gpa and tuce to mean, set psi to 1 */

simqi, listx                                          /*Report probabiliies at these values */

simqi, fd(prval(1)) changex(female min max)           /*Generate First Differences for Female Min to Max when brand=1*/

simqi, fd(prval(1)) changex(age min max)        /*Generate First Differences for Age Min to Max when brand=1 */

/*Ordered Probit */

use "/users/bdanwood/documents/my teaching/maximum likelihood//Data/affairs.dta", clear

replace affairs = affairs>0

summarize

estsimp oprobit ratingmarriage age yrsmarried religiousness affairs   /*Estimate an ordered probit */

setx mean                                     /*Set variables at their means */

simqi, listx                                  /*Report probabilities at variable means */

setx (age yrsmarried religiousness) mean affairs 0            /*Set gpa and tuce to mean, set psi to 0 */

simqi, listx                                  /*Report probabiliies at these values */

setx (age yrsmarried religiousness) mean affairs 1            /*Set gpa and tuce to mean, set psi to 1 */

simqi, listx                                  /*Report probabiliies at these values */

/* First differences can be calculated for each outcome. Below consider only outcome 5 */

simqi, fd(prval(5)) changex(age min max)      /*Generate First Differences for age Min to Max */

simqi, fd(prval(5)) changex(yrsmarried min max)          /*Generate First Differences for yrsmarried Min to Max*/

simqi, fd(prval(5)) changex(religiousness min max)       /*Generate First Differences for religiousness Min to Max*/

simqi, fd(prval(5)) changex(affairs min max)       /*Generate First Differences for affairs Min to Max*/

/* Ordered Logit */

use "/users/bdanwood/documents/my teaching/maximum likelihood//Data/affairs.dta", clear

replace affairs = affairs>0

summarize

estsimp ologit ratingmarriage age yrsmarried religiousness affairs   /*Estimate an ordered probit */

setx mean                                     /*Set variables at their means */

simqi, listx                                  /*Report probabilities at variable means */

setx (age yrsmarried religiousness) mean affairs 0            /*Set gpa and tuce to mean, set psi to 0 */

simqi, listx                                  /*Report probabiliies at these values */

setx (age yrsmarried religiousness) mean affairs 1            /*Set gpa and tuce to mean, set psi to 1 */

simqi, listx                                  /*Report probabiliies at these values */

/* First differences can be calculated for each outcome. Below consider only outcome 5 */

simqi, fd(prval(5)) changex(age min max)      /*Generate First Differences for age Min to Max */

simqi, fd(prval(5)) changex(yrsmarried min max)          /*Generate First Differences for yrsmarried Min to Max*/

simqi, fd(prval(5)) changex(religiousness min max)       /*Generate First Differences for religiousness Min to Max*/

simqi, fd(prval(5)) changex(affairs min max)       /*Generate First Differences for affairs Min to Max*/