Announcement

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

  • I would like to know how to deal with the error "assertion is false" when using the Lanza plugin for latent class analysis.

    I am a Japanese and beginner with stata so my poor English and ignorance of stata may irritate you.
    Sorry about that.

    What I want to know is how to deal with the fact that the latent class analysis does not work properly when using the Lanza plugin.

    First, here is the do file I ran

    discard
    //set trace on
    drop _all

    cd \\icho23-home01\vol_home01\home\s2320552\Desktop\class\Rele ase64-1.3.2\
    infile using classtxt


    /*Example 1: LCA model */
    doLCA Female Under18 o1824 Age_2534 Age_3544 Age_4554 Age_5564 Age_65 Occupation_employed Occupation_unemployed Occupation_student Occupation_pensioner Occupation_childcare Highereducation Higherincome q2_42 q2_43 q2_47 q2_49 q6_11 q6_12 q6_13 q6_14 q6_15 q6_16 q6_17 not_necessary Practical_reason Unabletouse_reason Totalban Banpavementriding q0_10 q5_2_8 q5_2_9 q5_2_10, ///
    nclass(2) ///
    seed(100000) ///
    seeddraws(100000) ///
    categories(2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5) ///
    criterion(0.000001) ///
    rhoprior(1.0)

    return list
    matrix list r(gamma)
    matrix list r(gammaSTD)
    //matrix list r(rho)
    //matrix list r(rhoSTD)



    And here are the results



    /*Example 1: LCA model */
    . doLCA Female Under18 o1824 Age_2534 Age_3544 Age_4554 Age_5564 Age_65 Occupation_employed Occupation_unemployed Occupation_student Occupation_pensioner Occupation_childcare
    > Highereducation Higherincome q2_42 q2_43 q2_47 q2_49 q6_11 q6_12 q6_13 q6_14 q6_15 q6_16 q6_17 not_necessary Practical_reason Unabletouse_reason Totalban Banpavementriding q
    > 0_10 q5_2_8 q5_2_9 q5_2_10, ///
    > nclass(2) ///
    > seed(100000) ///
    > seeddraws(100000) ///
    > categories(2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5) ///
    > criterion(0.000001) ///
    > rhoprior(1.0)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 observations deleted)
    (0 observations deleted)
    (0 observations deleted)
    variable Female was float now byte
    variable Under18 was float now byte
    variable o1824 was float now byte
    variable Age_2534 was float now byte
    variable Age_3544 was float now byte
    variable Age_4554 was float now byte
    variable Age_5564 was float now byte
    variable Age_65 was float now byte
    variable Occupation_employed was float now byte
    variable Occupation_unemployed was float now byte
    variable Occupation_student was float now byte
    variable Occupation_pensioner was float now byte
    variable Occupation_childcare was float now byte
    variable Highereducation was float now byte
    variable Higherincome was float now byte
    variable q2_42 was float now byte
    variable q2_43 was float now byte
    variable q2_47 was float now byte
    variable q2_49 was float now byte
    variable q6_11 was float now byte
    variable q6_12 was float now byte
    variable q6_13 was float now byte
    variable q6_14 was float now byte
    variable q6_15 was float now byte
    variable q6_16 was float now byte
    variable q6_17 was float now byte
    variable not_necessary was float now byte
    variable Practical_reason was float now byte
    variable Unabletouse_reason was float now byte
    variable Totalban was float now byte
    variable Banpavementriding was float now byte
    variable q0_10 was float now byte
    variable q5_2_8 was float now byte
    variable q5_2_9 was float now byte
    variable q5_2_10 was float now byte
    (128,625 bytes saved)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    (0 real changes made)
    591 contradictions in 1,225 observations
    assertion is false
    r(9);

    end of do-file

    r(9);






    error message is " assertion is false r(9);"




    An example of a data set is as follows



    Female Under18 o1824 Age_2534 Age_3544 Age_4554 Age_5564 Age_65 Occupation_employed Occupation_unemployed Occupation_student Occupation_pensioner Occupation_childcare Highereducation Higherincome q2_42 q2_43 q2_47 q2_49 q6_11
    1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1
    1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1
    0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1
    1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1 1 1
    1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 1
    0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0
    0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1
    0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0

    This is a bit of a mess, but I'd appreciate it if someone could help me find a solution to this problem.

  • #2
    -doLCA- is not an official Stata program, and it does not show up with Stata's -findit- command, so I'm unable to obtain any information about it. Not even where it comes from.

    Anyway, when careful programmers write programs, they often include code that checks whether whatever conditions are necessary for the calculations to proceed correctly are actually met by the data. This is done with -assert- or -confirm- statements. When the conditions are found to not be met, these commands cause the program to halt and give a message, "assertion is false." To know why this has happened, you have to know where in program -doLCA- the particular -assert- command was and what condition it was checking. To do that, run:
    Code:
    set tracedepth 1
    set trace on
    and then run your doLCA command again. You will get much more detailed output than you did originally. In particular, you will be able to see what the -assert- command was trying to verify. That may enable you to know what the problem is. If it isn't clear from that, you could post that output here and somebody might be able to help figure it out.

    In general, false assertions arise most commonly because there is something about the data that is not suitable for the program. Or it sometimes results because of a bug in the program itself--but, at least in official Stata commands, this is rare.

    Comment

    Working...
    X