Microeconometrics using Stata: Solutions to Exercises 15 Multinomial Models
Автор: Dr. Bob Wen (Stata, Economics, Econometrics)
Загружено: 2020-11-05
Просмотров: 858
Описание:
00:00 Multinomial Models. Categorical data are data on a dependent variable that can fall into one of several mutually exclusive categories. Examples include different categories of self-assessed health status (excellent, good, fair, or poor) and different categories of marital structures (married, single, divorced, or separated). The textbook example.
01:22 Case-specific and alternative-specific regressors. Some regressors, such as gender, do not vary across alternatives and are called case-specific or alternative-invariant regressors. Other regressors, such as price, may vary across alternatives and are called alternative-specific or case-varying regressors.
01:58 Multinomial example: Choice of fishing mode. Dependent variable: mode. Explanatory variables: income, price, crate.
02:55 Exercise 1.
clear
cd "/Users/bobwen/Documents/Microeconometrics using Stata/"
capture log close
log using 15.12.log, text replace
version 11
set more off
*1. ordered logit and multinomial logit models
use "/Users/bobwen/Documents/Microeconometrics using Stata/musr/mus18data.dta", clear
keep if year==2
gen hlthpf=hlthp+hlthf
gen hlthe=1-hlthpf-hlthg
gen hlthstat=1 if hlthpf==1
replace hlthstat=2 if hlthg==1
replace hlthstat=3 if hlthe==1
tabulate hlthstat
summarize age linc ndisease
oprobit hlthstat age linc ndisease
estimates store oprobit
margins, dydx(*) predict(outcome(3)) atmean
matrix oprobit=r(b)
ologit hlthstat age linc ndisease
estimates store ologit
margins, dydx(*) predict(outcome(3)) atmean
matrix ologit=r(b)
mlogit hlthstat age linc ndisease, baseoutcome(1)
estimates store mlogit
margins, dydx(*) predict(outcome(3)) atmean
matrix mlogit=r(b)
matrix list oprobit
matrix list ologit
matrix list mlogit
esttab oprobit ologit mlogit, compress scalar(N ll aic bic) ///
sfmt(%7.0f) b(%7.2f) mtitle
07:03 Exercise 2.
*2. conditional logit and multinomial probit
use "/Users/bobwen/Documents/Microeconometrics using Stata/musr/mus15datalong.dta", clear
drop if fishmode=="charter" | mode==4
drop mode price crate
asclogit d p q, case(id) alternatives(fishmode) ///
casevars(income) basealternative(beach)
estimates store asclogit
estat mfx, varlist(p q income)
predict p_1, pr
sum p_1
recode p_1 (0/0.499999=0) (0.5/1=1), gen(d_p_1)
tab d d_p_1
asmprobit d p q, case(id) alternatives(fishmode) ///
casevars(income) correlation(unstructured) structural ///
vce(robust)
estimates store asmprobit
predict p_2, pr
sum p_2
recode p_2 (0/0.499999=0) (0.5/1=1), gen(d_p_2)
tab d d_p_2
esttab asclogit asmprobit, scalar(N ll aic bic) ///
mtitle compress sfmt(%7.0f) b(%7.2f)
11:43 Exercise 4.
*4. ordered probit model
use "/Users/bobwen/Documents/Microeconometrics using Stata/musr/mus18data.dta", clear
keep if year==2
gen hlthpf=hlthp+hlthf
gen hlthe=1-hlthpf-hlthg
gen hlthstat=1 if hlthpf==1
replace hlthstat=2 if hlthg==1
replace hlthstat=3 if hlthe==1
tabulate hlthstat
*ordered probit
oprobit hlthstat age linc ndisease
estimates store oprobit
margins,dydx(*) predict(outcome(3)) atmean
margins, dydx(age) atmean
*ordered logit
ologit hlthstat age linc ndisease
estimates store ologit
margins,dydx(*) predict(outcome(3)) atmean
margins, dydx(age) atmean
esttab ologit oprobit, scalar(N ll aic bic) mtitle compress sfmt(%7.0f) b(%7.2f)
#multinomial #conditional_logit #ordered_probit #Stata
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: