Dear all,
I'm using the 'mixlogit' command to estimate a RPL model. I want to put interactions to a variable that is random, with a parameter with a log-normal distribution. But I want the interactions to be fixed. However, I need their parameters to be log-normal, to be sure that when adding to the random variable that has a log-normal parameter, the values are still positive.
I didn't find a straight way to restrict parameters distribution (neither in this command or anywhere in stata). I find a way following an answer by Arne Risa Hole (author on -mixlogit- ) to how to constraint parameter values, that was very useful. Following that, I constructed the example below to my end, but I wander if that is the right way to do it. Any advice is very welcome.
thanks,
MatÃas
I'm using the 'mixlogit' command to estimate a RPL model. I want to put interactions to a variable that is random, with a parameter with a log-normal distribution. But I want the interactions to be fixed. However, I need their parameters to be log-normal, to be sure that when adding to the random variable that has a log-normal parameter, the values are still positive.
I didn't find a straight way to restrict parameters distribution (neither in this command or anywhere in stata). I find a way following an answer by Arne Risa Hole (author on -mixlogit- ) to how to constraint parameter values, that was very useful. Following that, I constructed the example below to my end, but I wander if that is the right way to do it. Any advice is very welcome.
Code:
use http://fmwww.bc.edu/repec/bocode/t/traindata.dta *this inverts price variable, because I will want to put it log-norma gen mprice=-1*price *this creates a variable that vary by individual, but not by option attribute. That is, is an observed feature of the individual gen obs_feat = rnormal() bysort pid: replace obs_feat= obs_feat[1] *generate the interaction of the price and the observed feature gen int1=mprice*obs_feat gen int2=price*obs_feat * Define constraints constraint 1 [SD]int1 = 0 * Generate starting values clogit y contract local wknown int2 price , group(gid) matrix start = e(b),0,0,0,0,0 * Run mixed logit model mixlogit y , group(gid) id(pid) /// rand(contract local wknown int1 mprice) constraints(1) ln(2) from(start, copy)
thanks,
MatÃas
Comment