Announcement

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

  • Nested logit model problem

    We couldn't get a solution with the data we use, I wonder if we are editing the data incorrectly or if we have a coding error, please help.

    . import excel "C:\Users\Akkaraaslan\Desktop\nested son yil veri.xlsx", sheet("Sayfa1") firstrow

    . tab x25

    x25 | Freq. Percent Cum.
    ------------+-----------------------------------
    1 | 11,515 16.67 16.67
    2 | 11,515 16.67 33.33
    3 | 11,515 16.67 50.00
    4 | 11,515 16.67 66.67
    5 | 11,515 16.67 83.33
    6 | 11,515 16.67 100.00
    ------------+-----------------------------------
    Total | 69,090 100.00

    . nlogitgen type = x25(ypn: 1|2|3|4|5,ypmyn:6)
    new variable type is generated with 2 groups
    label list lb_type
    lb_type:
    1 ypn
    2 ypmyn

    . nlogittree x25 type, choice( __didep ) case( __strata )

    tree structure specified for the nested logit model

    type N x25 N k
    ---------------------------------
    ypn 57575 --- 1 11515 485
    |- 2 11515 503
    |- 3 11515 845
    |- 4 11515 149
    +- 5 11515 592
    ypmyn 11515 --- 6 11515 8941
    ---------------------------------
    total 69090 11515

    k = number of times alternative is chosen
    N = number of observations at each level

    Note: At least one case has only one alternative; nlogit will drop these cases.

    . nlogit __didep x28u ib1.x6u || type: x28 x3 , base(ypmyn) || x25:, noconstant case( __strata )
    note: variable 2.x6u has 1993 cases that are not alternative-specific: there is no within-case variability
    note: variable 3.x6u has 9914 cases that are not alternative-specific: there is no within-case variability
    note: branch 2 of level 1 is degenerate and the associated dissimilarity parameter ([ypmyn_tau]_cons) is not defined; see help
    nlogit for details

    tree structure specified for the nested logit model

    type N x25 N k
    ---------------------------------
    ypn 57575 --- 1 11515 485
    |- 2 11515 503
    |- 3 11515 845
    |- 4 11515 149
    +- 5 11515 592
    ypmyn 11515 --- 6 11515 8941
    ---------------------------------
    total 69090 11515

    k = number of times alternative is chosen
    N = number of observations at each level
    note: clogit model failed; null likelihood is invalid
    note: the LR test for IIA will not be computed

    Iteration 0: log likelihood = 5.688e-14
    Iteration 1: log likelihood = 6.393e-14
    Iteration 2: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 3: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 4: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 5: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 6: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 7: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 8: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 9: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 10: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 11: log likelihood = 6.488e-14
    BFGS stepping has contracted, resetting BFGS Hessian
    Iteration 12: log likelihood = 6.488e-14
    cannot compute an improvement -- flat region encountered
    r(430);


    Attached Files

  • #2
    Hello,
    Our Nested model has a structure called non-choice. In other words, while one side is unselected, there is a choice on the other side and it is a 2-level nested. The branch structure is as follows:
    Do you save
    1.Yes 2.No
    1.1 Real Estate (House, Shop, Land, Field, etc.)
    1.2 Gold-Currency
    1.3 Bank account
    1.4 Pave markets
    1.5 Investments in work



    . import excel "C:\Users\Akkaraaslan\Desktop\nested deneme\nested ham veri.xlsx", sheet("Sayfa1") firstrow

    . mclgen x25
    (54,575 observations created)

    Your response factor is x25 with 6 categories.
    Its main effects form the intercept of a multinomial logistic model,
    interactions with independent variables form their effects.

    . tab x25

    x25 | Freq. Percent Cum.
    ------------+-----------------------------------
    1 | 10,915 16.67 16.67
    2 | 10,915 16.67 33.33
    3 | 10,915 16.67 50.00
    4 | 10,915 16.67 66.67
    5 | 10,915 16.67 83.33
    6 | 10,915 16.67 100.00
    ------------+-----------------------------------
    Total | 65,490 100.00

    . nlogitgen type = x25(ypn: 1|2|3|4|5,ypmyn:6)
    new variable type is generated with 2 groups
    label list lb_type
    lb_type:
    1 ypn
    2 ypmyn

    . nlogittree x25 type, choice( __didep )

    tree structure specified for the nested logit model

    type N x25 N k
    ---------------------------------
    ypn 54575 --- 1 10915 455
    |- 2 10915 332
    |- 3 10915 560
    |- 4 10915 37
    +- 5 10915 554
    ypmyn 10915 --- 6 10915 8977
    ---------------------------------
    total 65490 10915

    k = number of times alternative is chosen
    N = number of observations at each level

    . nlogit __didep x3 x28 || type: x27 , base(ypmyn)||x25:, noconst case( Sirano ),
    variable x3 is not alternative-specific: it has no within-case variability
    r(459);


    x3 variable is age, x28 household size, x27 income variables,

    Comment

    Working...
    X