use "C:\DATA\stata\mus\mus15data.dta", clear log using "H:\Documents and Settings\Lee\My Documents\Document\stata\asclogit.smcl", replace generate id = _n list mode price pbeach ppier pprivate pcharter in 1/4, clean * Multinomial Logit -- case specific vars only in short form mlogit mode income, baseoutcome(1) * Convert data to long form for asclogit reshape long d p q, i(id) j(fishmode beach pier private charter) string list in 1/4 * Drop the variables that don't make sense in long form drop mode price crate * Conditional logit with case and alternative specific variables asclogit d p q, case(id) alternatives(fishmode) casevars(income) * Predicted probabilities of choice of each mode and compare to actual freqs predict pasclogit, pr table fishmode, contents(mean d mean pasclogit sd pasclogit) cellwidth(15) * Marginal effect at mean of change in price estat mfx, varlist(p) * MNL is CL with no alternative specific regressors asclogit d, case(id) alternatives(fishmode) casevars(income) basealternative(beach) * Nested Logit * define the tree nlogitgen type = fishmode(shore: pier | beach, boat: private | charter) * check the tree nlogittree fishmode type, choice(d) * estimate the model nlogit d p q || type:, base(shore) || fishmode: income, case(id) notree nolog predict plevel1 plevel2, pr tabulate fishmode, summarize(plevel2) log close