Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [mixlogit] constraining parameters

    Dear All,

    I'm trying to figure out how to constrain parameters of mixed logit model.
    What I want to know is how to constrain the means of random coefficients to be zero and how to make their variances to be the same.
    When I put variables in the rand(), which option should I add to constrain parameters.
    Thank you very much for your answers in advance!

    Jun

    Last edited by Jun Kim; 03 Nov 2016, 12:50.

  • #2
    Here's an example:

    Code:
    use http://fmwww.bc.edu/repec/bocode/t/traindata.dta
    
    * Define constraints
    constraint 1 [Mean]tod = 0
    constraint 2 [Mean]seasonal = 0
    constraint 3 [SD]tod = [SD]seasonal
    
    * Generate starting values
    clogit y price contract local wknown, group(gid)
    matrix start = e(b),0,0,0,0
    
    * Run mixed logit model
    mixlogit y price contract local wknown, group(gid) id(pid) ///
    rand(tod seasonal) constraints(1 2 3) from(start, copy)

    Comment


    • #3
      Many thanks for the reply.

      Comment


      • #4
        I tried to constrain two variances to be the same by using the following commands.

        constraint define 1 [Mean]var5=0
        constraint define 2 [Mean]var6=0
        constraint define 3 [SD]var5=[SD]var6

        clogit dev var1 var2 var3 var4, group(choice_id)
        matrix start = e(b),0,0,0,0,0

        mixlogit dev var1 var2 var3 var4, group(choice_id) id(id) rand(var5 var6) constraint(1 2 3) from(start, copy)

        However, every time I get the message "(note: constraint number 3 caused error r(303))".
        Can I fix the variance of random coefficient?
        Many thanks for the reply in advance!!!

        Jun

        Comment

        Working...
        X