|
摘自https://www.stata.com/statalist/archive/2011-07/msg00935.html
RE: st: Accuracy table after mlogit
----------------------------------------------------------------------------------------------
You can do this by hand. I first show how you can recreate the -estat
classification- results for -logit- (not all the concomitant
statistics, but you can do those easily as well), and then follow the
same procedure for -mlogit-. Note that the way the predicted choices
are computed (the choice corresponding to the maximum predicted
probability) is in no way the only way to compute predicted
multinomial choices:
/**************************/
// logit
webuse lbw, clear
logit low age lwt i.race smoke ptl ht ui
estat classification
predict prob
g pred_choice = (prob >= 0.5)
tab pred_choice low // recreate -estat classification-
// mlogit
webuse sysdsn1, clear
mlogit insure age male nonwhite i.site
predict prob*
egen pred_max = rowmax(prob*)
g pred_choice = .
forv i=1/3 {
replace pred_choice = `i' if (pred_max == prob`i')
}
local insure_lab: value label insure
label values pred_choice `insure_lab'
tab pred_choice insure
/**************************/
This is what is typically called the confusion matrix.
T
|