* STATA Program * copyright C 2008 by A. Colin Cameron and Pravin K. Trivedi * used for "Microeconometrics using Stata" * by A. Colin Cameron and Pravin K. Trivedi (2008) * Stata Press * Przyklad do 18 rozdzialu podrecznika Cameron i Trivedi ********************************************** set more off version 10.1 clear all set memory 30m set linesize 90 set scheme s1mono /* Graphics scheme */ ********** DATA DESCRIPTION ********** * mus18data.dta * Rand Health Insurance Experiment data * Essentially same data as in P. Deb and P.K. Trivedi (2002) * "The Structure of Demand for Medical Care: Latent Class versus * Two-Part Models", Journal of Health Economics, 21, 601-625 * except that paper used different outcome (counts rather than $) * Each observation is for an individual over a year. * Individuals may appear in up to five years. * All available sample is used except only fee for service plans included. * If panel data used then clustering is on id (person id) ********** 18.3 NONLINEAR PANEL-DATA EXAMPLE * Describe dependent variables and regressors use mus18data.dta, clear describe dmdu med mdu lcoins ndisease female age lfam child id year * Summarize dependent variables and regressors summarize dmdu med mdu lcoins ndisease female age lfam child id year * Panel description of dataset xtset id year xtdescribe * Panel summary of time-varying regressors xtsum age lfam child ********** 18.4 PANEL BINARY OUTCOME MODELS * Panel summary of dependent variable xtsum dmdu * Year-to-year transitions in whether visit doctor xttrans dmdu * Correlations in the dependent variable corr dmdu l.dmdu l2.dmdu * Logit cross-section with panel-robust standard errors logit dmdu lcoins ndisease female age lfam child, vce(cluster id) nolog * Pooled logit cross-section with exchangeable errors and panel-robust VCE xtlogit dmdu lcoins ndisease female age lfam child, pa corr(exch) vce(robust) nolog * Logit random-effects estimator xtlogit dmdu lcoins ndisease female age lfam child, re nolog * Logit fixed-effects estimator xtlogit dmdu lcoins ndisease female age lfam child, fe nolog * Logit mixed-effects estimator (same as xtlogit, re) * xtmelogit dmdu lcoins ndisease female age lfam child || id: * Panel logit estimator comparison global xlist lcoins ndisease female age lfam child quietly logit dmdu $xlist, vce(cluster id) estimates store POOLED quietly xtlogit dmdu $xlist, pa corr(exch) vce(robust) estimates store PA quietly xtlogit dmdu $xlist, re // SEs are not cluster-robust estimates store RE quietly xtlogit dmdu $xlist, fe // SEs are not cluster-robust estimates store FE estimates table POOLED PA RE FE, equations(1) se b(%8.4f) stats(N ll) stfmt(%8.0f)