stata - Evaluating the Fractional Logit Model - McFadden's Adjusted R^2 -
i estimating model dependent variable fraction (between 0 , 1). used commands in stata 14.1
glm y x, link(logit) family(binomial) robust nolog
as
fracreg logit y x, vce(robust)
both commands deliver same results.
now want evaluate outcome, ideally mcfadden's adjusted r^2. yet, neither fitstat
nor estat gof
seem work after run regressions. error message fitstat not work last model estimated
, not available after fracreg r(321)
.
does of know alternative command mcfadden's adjusted r^2? or have use different evaluation method?
to adjust mcfadden's r^2, need subtract number of predictors full model log likelihood in numerator of fractional part. formula here. note may negative values.
here's how might that:
set more off webuse set http://fmwww.bc.edu/repec/bocode/w webuse wedderburn, clear /* (1) fracreg way */ fracreg logit yield i.site i.variety, nolog di "fracreg mcfadden's adj. r^2:" %-9.3f 1-(e(ll)-e(k))/(e(ll_0)) /* (2) glm way */ glm yield, link(logit) family(binomial) robust nolog // intercept model local ll_0 = e(ll) glm yield i.site i.variety, link(logit) family(binomial) robust nolog // full model di "mcfadden's adj. r^2: " %-9.3f 1-(e(ll)-e(k))/`ll_0'
the glm r^2 different because maximization algorithm different , likelihoods different well. not sure how tweak ml options match exactly.
you can verify did things correctly command fitstat works:
sysuse auto, clear logit foreign price mpg fitstat di "mcfadden's adj. r^2: " %-9.3f 1-(e(ll)-e(k))/(e(ll_0))
Comments
Post a Comment