Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: lrtest/aic/bic for discrete choice model with gllamm


From   William Verheul <[email protected]>
To   [email protected]
Subject   st: lrtest/aic/bic for discrete choice model with gllamm
Date   Fri, 29 Mar 2013 14:47:23 -0400

Dear Statalisters,

I'm using gllamm in Stata 11.2 for discrete choice (conjoint choice)
models with latent classes using the code found
http://www.gllamm.org/books/coffee.html adapted to my dataset (the
example comes from Chapter 13, Skrondal, A & Rabe-Hesketh, S.
Generalized Latent Variable Modeling: Multilevel, Longitudinal, and
Structural Equation Models, 2004).

I want to use a likelihood ratio-test and the BIC and AIC for model
selection. I encounter no problems for models with 1, 2 or 3 latent
classes, but for the model with a continuous random coefficient factor
(the "xfactor" model in the example), both lrtest (for likelihood
ratio-test, error: “estimation result xfactor not found” and estat ic
(for providing AIC and BIC, error: “type mismatch”)) don't work.

First I thought I made a mistake with adapting the code to my dataset,
but I encounter the same problem using the example data (found on
http://www.gllamm.org/books/coff.dat) and code with lrtest and estat
ic added (see the code used below).

My question is (how) can I do a lrtest and determine AIC & BIC for
models with a continuous random coefficient factor?

I'd be very grateful for advice!
Kind regards
Will


capture log close
log using coff, replace
set more off

* Read data, available on http://www.gllamm.org/books/coff.dat
insheet using http://www.gllamm.org/books/coff.dat, clear


sort id set alt
list alt brand1 brand2 cap1 cap2 price1 price2 therm filter if
id==1&alt==3&set==1

list set alt brand1 brand2 cap1 cap2 price1 price2 therm filter if id==1&alt==1
list set alt brand1 brand2 cap1 cap2 price1 price2 therm filter if id==1&alt==2

list set alt brand1 brand2 cap1 cap2 price1 price2 therm filter if
id==100&alt==1
list set alt brand1 brand2 cap1 cap2 price1 price2 therm filter if
id==100&alt==2

* two class model

eq brand1: brand1
eq brand2: brand2
eq cap1: cap1
eq cap2: cap2
eq price1: price1
eq price2: price2
eq therm: therm
eq filter: filter


matrix a=(-.3741151,-.4046775,-2.484026,.0602947,1.96566,1.482599,1.13633,
  .9201916,.9212055,.1210968,-1.434993,-.2476023,.0675716,-.489632,
-.0361355,.346111,1.00166)
gllamm alt, i(id) nrf(8) eqs(brand1 brand2 cap1 cap2 price1 price2
therm filter)   nocons l(mlogit) f(binom) expand(ind ch o) nip(2)
ip(fn) from(a) copy trace allc

est store two_class

* X-factor model

matrix a=(-.3122817,
-.6476055,-2.076853,.1265304,1.521768,1.204662,1.094804,
.9655845,.5079313,-.5094916,1.723556,.1910858,-1.71689,-1.108429,-.6040595,.086756)

cons def 1 [id1_1]brand1=1
eq load: brand1 brand2 cap1 cap2 price1 price2 therm filter

gllamm alt brand1 brand2 cap1 cap2 price1 price2 therm filter, i(id)
nocons l(mlogit) f(binom) expand(ind ch o) nrf(1) eqs(load)
constr(1) frload(1) trace from(a) copy nip(12) adapt
est store xfactor

estat ic
lrtest two_class xfactor

log close

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index