Important: Read this before posting to this forum

  1. This forum is for questions related to the use of Apollo. We will answer some general choice modelling questions too, where appropriate, and time permitting. We cannot answer questions about how to estimate choice models with other software packages.
  2. There is a very detailed manual for Apollo available at http://www.ApolloChoiceModelling.com/manual.html. This contains detailed descriptions of the various Apollo functions, and numerous examples are available at http://www.ApolloChoiceModelling.com/examples.html. In addition, help files are available for all functions, using e.g. ?apollo_mnl
  3. Before asking a question on the forum, users are kindly requested to follow these steps:
    1. Check that the same issue has not already been addressed in the forum - there is a search tool.
    2. Ensure that the correct syntax has been used. For any function, detailed instructions are available directly in Apollo, e.g. by using ?apollo_mnl for apollo_mnl
    3. Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
    4. Make sure that R is using the latest official release of Apollo.
  4. If the above steps do not resolve the issue, then users should follow these steps when posting a question:
    1. provide full details on the issue, including the entire code and output, including any error messages
    2. posts will not immediately appear on the forum, but will be checked by a moderator first. This may take a day or two at busy times. There is no need to submit the post multiple times.

Higher LL(final) than LL(0) for one latent class

Ask questions about the results reported after estimation. If the output includes errors, please include your model code if possible.
Post Reply
ashtrudeau
Posts: 7
Joined: 27 Feb 2022, 19:41
Location: Wisconsin, USA

Higher LL(final) than LL(0) for one latent class

Post by ashtrudeau »

I have been using latent class FMNLs to associate respondent characteristics with their preferences in a discrete choice experiment. I am unsure about the validity of several competing model fits. In these cases, although the LL for the full model is higher than the starting LL, the LL of one or more of the classes' final model is lower than the LL(0). I have included the code and output for my best fitting model. In this case, the LL for the comparison class (with all individual covariate coefficients fixed at zero) is slightly lower than the LL(0), while the second latent class is more acceptable. Other, competing model fits have higher AIC or BIC values, but they do not have this problem with the class log likelihoods. So it's not clear to me how I should proceed with model selection.

In the output for separate classes, are these specifically the LLs for the MNL predicting class membership? And what is the implication if the baseline latent class's model performs worse than the null model? In addition to being the baseline level, class 1 was also more likely than class 2 to choose one of the opt out options (ASC1 and ASC2).

I am running version 0.2.8 of apollo. Here is the model code:

Code: Select all

# ################################################################# #
#### LOAD LIBRARY AND DEFINE CORE SETTINGS                       ####
# ################################################################# #

### Initialise code
apollo_initialise()

### Set core controls
apollo_control = list(
  modelName       = "FMNL 2LC walleye cov",
  modelDescr      = "Fractional MNL model 2LC cov",
  indivID         = "sys_RespNum", 
    nCores=3,
  outputDirectory = "output_cov_2LC_central_target"
)

# ################################################################# #
#### LOAD DATA AND APPLY ANY TRANSFORMATIONS                     ####
# ################################################################# #

### Loading data from package
### if data is to be loaded from a file (e.g. called data.csv), 
### the code would be: database = read.csv("data.csv",header=TRUE)
database = dce.data.f
### for data dictionary, use ?apollo_timeUseData


# ################################################################# #
#### DEFINE MODEL PARAMETERS                                     ####
# ################################################################# #

apollo_beta = c(
  b.fish=0,
    b.asc1.a= 0,
   b.asc2.a= 0,
    b.travel.a=0,
    b.wcatch.a=0,
    b.bcatch.a=0,
    b.pcatch.a=0,
    b.wsize.10.a=0,
    b.wsize.14.a=0,
    b.wsize.16.a=0,
    b.wsize.20.a=0,
    b.wsize.24.a=0,
    b.psize.7.a=0,
    b.psize.8.a=0,
    b.psize.10.a=0,
    b.bsize.12.a=0,
    b.bsize.16.a=0,
    b.bsize.20.a=0,
    b.wcatch.wsize.14.a=0,
    b.wcatch.wsize.16.a=0,
    b.wcatch.wsize.20.a=0,
    b.wcatch.wsize.24.a=0,
   b.bcatch.bsize.16.a=0,
   b.bcatch.bsize.20.a=0,
   b.pcatch.psize.7.a=0,
   b.pcatch.psize.8.a=0,
   b.pcatch.psize.10.a=0,
     b.wcatch.travel.a=0,
    b.wcatch.bcatch.a=0,
    b.wcatch.pcatch.a=0,

        b.asc1.b= 0,
    b.asc2.b= 0,
    b.travel.b=0,
    b.wcatch.b=0,
    b.bcatch.b=0,
    b.pcatch.b=0,
    b.wsize.10.b=0,
    b.wsize.14.b=0,
    b.wsize.16.b=0,
    b.wsize.20.b=0,
    b.wsize.24.b=0,
    b.psize.7.b=0,
    b.psize.8.b=0,
    b.psize.10.b=0,
    b.bsize.12.b=0,
    b.bsize.16.b=0,
    b.bsize.20.b=0,
   b.wcatch.wsize.14.b=0,
     b.wcatch.wsize.16.b=0,
     b.wcatch.wsize.20.b=0,
    b.wcatch.wsize.24.b=0,
     b.bcatch.bsize.16.b=0,
   b.bcatch.bsize.20.b=0,
    b.pcatch.psize.7.b=0,
     b.pcatch.psize.8.b=0,
    b.pcatch.psize.10.b=0,
      b.wcatch.travel.b=0,
    b.wcatch.bcatch.b=0,
    b.wcatch.pcatch.b=0,

     delta_a=0,
    delta_b=0,
    gamma.walleye.a=0,
    gamma.walleye.b=0,
    gamma.central.a=0,
    gamma.central.b=0,
    gamma.target.a=0,
    gamma.target.b=0

)

### Vector with names (in quotes) of parameters to be kept fixed at their starting value in apollo_beta, use apollo_beta_fixed = c() if none
apollo_fixed = c("b.fish","delta_a","gamma.walleye.a","gamma.central.a","gamma.target.a")


  # ################################################################# #
  #### DEFINE LATENT CLASS COMPONENTS                              ####
  # ################################################################# #
  



  apollo_lcPars=function(apollo_beta, apollo_inputs){
    lcpars = list()
    lcpars[["b.asc1"]] = list(b.asc1.a, b.asc1.b)
    lcpars[["b.asc2"]] = list(b.asc2.a, b.asc2.b)
    lcpars[["b.travel"]] = list(b.travel.a, b.travel.b)
    lcpars[["b.wcatch"]] = list(b.wcatch.a, b.wcatch.b)
    lcpars[["b.bcatch"]] = list(b.bcatch.a, b.bcatch.b)
    lcpars[["b.pcatch"]] = list(b.pcatch.a, b.pcatch.b)
    lcpars[["b.wsize.10"]] = list(b.wsize.10.a, b.wsize.10.b)
    lcpars[["b.wsize.14"]] = list(b.wsize.14.a, b.wsize.14.b)
    lcpars[["b.wsize.16"]] = list(b.wsize.16.a, b.wsize.16.b)
    lcpars[["b.wsize.20"]] = list(b.wsize.20.a, b.wsize.20.b)
    lcpars[["b.wsize.24"]] = list(b.wsize.24.a, b.wsize.24.b)
    lcpars[["b.psize.7"]] = list(b.psize.7.a, b.psize.7.b)
    lcpars[["b.psize.8"]] = list(b.psize.8.a, b.psize.8.b)
    lcpars[["b.psize.10"]] = list(b.psize.10.a, b.psize.10.b)
    lcpars[["b.bsize.12"]] = list(b.bsize.12.a, b.bsize.12.b)
    lcpars[["b.bsize.16"]] = list(b.bsize.16.a, b.bsize.16.b)
    lcpars[["b.bsize.20"]] = list(b.bsize.20.a, b.bsize.20.b)
    lcpars[["b.wcatch.wsize.14"]] = list(b.wcatch.wsize.14.a, b.wcatch.wsize.14.b)
     lcpars[["b.wcatch.wsize.16"]] = list(b.wcatch.wsize.16.a, b.wcatch.wsize.16.b)
      lcpars[["b.wcatch.wsize.20"]] = list(b.wcatch.wsize.20.a, b.wcatch.wsize.20.b)
      lcpars[["b.wcatch.wsize.24"]] = list(b.wcatch.wsize.24.a, b.wcatch.wsize.24.b)
      lcpars[["b.bcatch.bsize.16"]] = list(b.bcatch.bsize.16.a, b.bcatch.bsize.16.b)
      lcpars[["b.bcatch.bsize.20"]] = list(b.bcatch.bsize.20.a, b.bcatch.bsize.20.b)
      lcpars[["b.pcatch.psize.7"]] = list(b.pcatch.psize.7.a, b.pcatch.psize.7.b)
      lcpars[["b.pcatch.psize.8"]] = list(b.pcatch.psize.8.a, b.pcatch.psize.8.b)
      lcpars[["b.pcatch.psize.10"]] = list(b.pcatch.psize.10.a, b.pcatch.psize.10.b)
      lcpars[["b.wcatch.travel"]] = list(b.wcatch.travel.a, b.wcatch.travel.b)
      lcpars[["b.wcatch.bcatch"]] = list(b.wcatch.bcatch.a, b.wcatch.bcatch.b)
      lcpars[["b.wcatch.pcatch"]] = list(b.wcatch.pcatch.a, b.wcatch.pcatch.b)

    ### Utilities of class allocation model
    V=list()
    V[["class_a"]] = delta_a + gamma.walleye.a*walleyeAngler + gamma.central.a*central + gamma.target.a*target
    V[["class_b"]] = delta_b +gamma.walleye.b*walleyeAngler + gamma.central.b*central + gamma.target.b*target

    ### Settings for class allocation models
    classAlloc_settings = list(
      classes      = c(class_a=1, class_b=2), 
      utilities    = V  
    )
    
    lcpars[["pi_values"]] = apollo_classAlloc(classAlloc_settings)
    
    return(lcpars)
  }
# ################################################################# #
#### GROUP AND VALIDATE INPUTS                                   ####
# ################################################################# #

apollo_inputs = apollo_validateInputs()

# ################################################################# #
#### DEFINE MODEL AND LIKELIHOOD FUNCTION                        ####
# ################################################################# #

apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){

  ### Attach inputs and detach after function exit
  apollo_attach(apollo_beta, apollo_inputs)
  on.exit(apollo_detach(apollo_beta, apollo_inputs))

  ### Create list of probabilities P
  P = list()
  
  for(s in 1:2){
  ### List of utilities: these must use the same names as in fmnl_settings, order is irrelevant
   V=list()
      V[["alt1"]]  = (b.fish+b.travel[[s]]*travel_alt1+b.wcatch[[s]]*wcatch_alt1+b.pcatch[[s]]*pcatch_alt1+b.bcatch[[s]]*bcatch_alt1+
        b.wsize.10[[s]]*wsize_alt1_10+b.wsize.14[[s]]*wsize_alt1_14+b.wsize.16[[s]]*wsize_alt1_16+b.wsize.20[[s]]*wsize_alt1_20 +   b.wsize.24[[s]]*wsize_alt1_24+
        b.psize.7[[s]]*psize_alt1_7+b.psize.8[[s]]*psize_alt1_8+b.psize.10[[s]]*psize_alt1_10+
        b.bsize.12[[s]]*bsize_alt1_12+b.bsize.16[[s]]*bsize_alt1_16+b.bsize.20[[s]]*bsize_alt1_20)+ 
         b.wcatch.wsize.14[[s]]*wcatch_wsize_alt1_14+
         b.wcatch.wsize.16[[s]]*wcatch_wsize_alt1_16+
         b.wcatch.wsize.20[[s]]*wcatch_wsize_alt1_20+
        b.wcatch.wsize.24[[s]]*wcatch_wsize_alt1_24+
         b.bcatch.bsize.16[[s]]*bcatch_bsize_alt1_16+
         b.bcatch.bsize.20[[s]]*bcatch_bsize_alt1_20+
         b.pcatch.psize.7[[s]]*pcatch_psize_alt1_7+
         b.pcatch.psize.8[[s]]*pcatch_psize_alt1_8+
         b.pcatch.psize.10[[s]]*pcatch_psize_alt1_10+
        b.wcatch.travel[[s]]*wcatch_travel_alt1+
        b.wcatch.bcatch[[s]]*wcatch_bcatch_alt1+
        b.wcatch.pcatch[[s]]*wcatch_pcatch_alt1
      
      V[["alt2"]]  = (b.fish+b.travel[[s]]*travel_alt2+b.wcatch[[s]]*wcatch_alt2+b.pcatch[[s]]*pcatch_alt2+b.bcatch[[s]]*bcatch_alt2+
        b.wsize.10[[s]]*wsize_alt2_10+b.wsize.14[[s]]*wsize_alt2_14+b.wsize.16[[s]]*wsize_alt2_16+b.wsize.20[[s]]*wsize_alt2_20 + b.wsize.24[[s]]*wsize_alt2_24+
        b.psize.7[[s]]*psize_alt2_7+b.psize.8[[s]]*psize_alt2_8+b.psize.10[[s]]*psize_alt2_10+
        b.bsize.12[[s]]*bsize_alt2_12+b.bsize.16[[s]]*bsize_alt2_16+b.bsize.20[[s]]*bsize_alt2_20) +
         b.wcatch.wsize.14[[s]]*wcatch_wsize_alt2_14+
         b.wcatch.wsize.16[[s]]*wcatch_wsize_alt2_16+
         b.wcatch.wsize.20[[s]]*wcatch_wsize_alt2_20+
        b.wcatch.wsize.24[[s]]*wcatch_wsize_alt2_24+
         b.bcatch.bsize.16[[s]]*bcatch_bsize_alt2_16+
         b.bcatch.bsize.20[[s]]*bcatch_bsize_alt2_20+
         b.pcatch.psize.7[[s]]*pcatch_psize_alt2_7+
         b.pcatch.psize.8[[s]]*pcatch_psize_alt2_8+
         b.pcatch.psize.10[[s]]*pcatch_psize_alt2_10+
        b.wcatch.travel[[s]]*wcatch_travel_alt2+
        b.wcatch.bcatch[[s]]*wcatch_bcatch_alt2+
        b.wcatch.pcatch[[s]]*wcatch_pcatch_alt2

      
      V[["alt3"]] = (b.fish+b.travel[[s]]*travel_alt3+b.wcatch[[s]]*wcatch_alt3+b.pcatch[[s]]*pcatch_alt3+b.bcatch[[s]]*bcatch_alt3+
        b.wsize.10[[s]]*wsize_alt3_10+b.wsize.14[[s]]*wsize_alt3_14+b.wsize.16[[s]]*wsize_alt3_16+b.wsize.20[[s]]*wsize_alt3_20 + b.wsize.24[[s]]*wsize_alt3_24+
        b.psize.7[[s]]*psize_alt3_7+b.psize.8[[s]]*psize_alt3_8+b.psize.10[[s]]*psize_alt3_10+
        b.bsize.12[[s]]*bsize_alt3_12+b.bsize.16[[s]]*bsize_alt3_16+b.bsize.20[[s]]*bsize_alt3_20) +
         b.wcatch.wsize.14[[s]]*wcatch_wsize_alt3_14+
         b.wcatch.wsize.16[[s]]*wcatch_wsize_alt3_16+
         b.wcatch.wsize.20[[s]]*wcatch_wsize_alt3_20+
        b.wcatch.wsize.24[[s]]*wcatch_wsize_alt3_24+
         b.bcatch.bsize.16[[s]]*bcatch_bsize_alt3_16+
         b.bcatch.bsize.20[[s]]*bcatch_bsize_alt3_20+
         b.pcatch.psize.7[[s]]*pcatch_psize_alt3_7+
         b.pcatch.psize.8[[s]]*pcatch_psize_alt3_8+
         b.pcatch.psize.10[[s]]*pcatch_psize_alt3_10+
         b.wcatch.travel[[s]]*wcatch_travel_alt3+
        b.wcatch.bcatch[[s]]*wcatch_bcatch_alt3+
        b.wcatch.pcatch[[s]]*wcatch_pcatch_alt3

      V[["fishElse"]] = (b.asc1[[s]])
      V[["noFish"]] = (b.asc2[[s]])
  
  ### Define settings for MNL model component
      
       fmnl_settings = list(
        alternatives = c(alt1=1, alt2=2, alt3=3, fishElse=4, noFish=5),
        choiceShares    = list(alt1=n_alt1,
                               alt2=n_alt2,
                               alt3=n_alt3,
                               fishElse=nFishElse,
                               noFish=nNoFish),
        utilities=V
      )
 
       fmnl_settings$utilities= V
      fmnl_settings$componentName = paste0("Class_",s)
      
      ### Compute within-class choice probabilities using MNL model
      P[[paste0("Class_",s)]] = apollo_fmnl(fmnl_settings, functionality)
      
      ### Take product across observation for same individual
      P[[paste0("Class_",s)]] = apollo_panelProd(P[[paste0("Class_",s)]], apollo_inputs ,functionality)
      
    }
  
    
    
    
    ### Compute latent class model probabilities
    lc_settings  = list(inClassProb = P, classProb=pi_values)
    P[["model"]] = apollo_lc(lc_settings, apollo_inputs, functionality)
    
    ### Prepare and return outputs of function
    P = apollo_prepareProb(P, apollo_inputs, functionality)
    return(P)
  }
  
  

# ################################################################# #
#### MODEL ESTIMATION                                            ####
# ################################################################# #

model.2 = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)

# ################################################################# #
#### MODEL OUTPUTS                                               ####
# ################################################################# #

# ----------------------------------------------------------------- #
#---- FORMATTED OUTPUT (TO SCREEN)                               ----
# ----------------------------------------------------------------- #

apollo_modelOutput(model.2)

# ----------------------------------------------------------------- #
#---- FORMATTED OUTPUT (TO FILE, using model name)               ----
# ----------------------------------------------------------------- #
saveOutput_settings=list(
  printPVal=2
)

apollo_saveOutput(model.2, saveOutput_settings)


```
And here is the output

Code: Select all

Apollo ignition sequence completed
Several observations per individual detected based on the value of sys_RespNum. Setting panelData in
  apollo_control set to TRUE.
All checks on apollo_control completed.
All checks on database completed.
Preparing user-defined functions.

Testing likelihood function...
Apollo found a model component of type classAlloc without a componentName. The name was set to "classAlloc" by
  default.
Setting "avail" is missing, so full availability is assumed.
Setting "avail" is missing, so full availability is assumed.

Overview of choices for model component Class_1:
                                    alt1    alt2    alt3 fishElse  noFish
Times available                  2740.00 2740.00 2740.00  2740.00 2740.00
Observations with non-zero share 1634.00 1583.00 1571.00   956.00  348.00
Average share overall               0.27    0.25    0.26     0.17    0.05
Average share when available        0.27    0.25    0.26     0.17    0.05
Setting "avail" is missing, so full availability is assumed.

Overview of choices for model component Class_2:
                                    alt1    alt2    alt3 fishElse  noFish
Times available                  2740.00 2740.00 2740.00  2740.00 2740.00
Observations with non-zero share 1634.00 1583.00 1571.00   956.00  348.00
Average share overall               0.27    0.25    0.26     0.17    0.05
Average share when available        0.27    0.25    0.26     0.17    0.05

Summary of class allocation for model component :
The class allocation probabilities for model component "model" are calculated at the observation level in
  'apollo_lcPars', but are used in 'apollo_probabilities' to multiply within class probabilities that are at
  the individual level. Apollo will average the class allocation probabilities across observations for the
  same individual level before using them to multiply the within-class probabilities. If your class allocation
  probabilities are constant across choice situations for the same individual, then this is of no concern. If
  your class allocation probabilities however vary across choice tasks, then you should change your model
  specification in 'apollo_probabilities' to only call 'apollo_panelProd' after calling 'apollo_lc'.

Pre-processing likelihood function...
Preparing workers for multithreading...

Testing influence of parameters
Starting main estimation
Initial function value: -4409.86 
Initial gradient value:
           b.asc1.a            b.asc2.a          b.travel.a          b.wcatch.a          b.bcatch.a          b.pcatch.a 
          -44.60000          -199.05000          -201.63626           277.53032           183.47659           235.04033 
       b.wsize.10.a        b.wsize.14.a        b.wsize.16.a        b.wsize.20.a        b.wsize.24.a         b.psize.7.a 
           -9.20000            38.40000            51.30000            76.20000            92.95000            47.60000 
        b.psize.8.a        b.psize.10.a        b.bsize.12.a        b.bsize.16.a        b.bsize.20.a b.wcatch.wsize.14.a 
           64.15000           102.05000            54.60000            77.20000           100.40000            48.77108 
b.wcatch.wsize.16.a b.wcatch.wsize.20.a b.wcatch.wsize.24.a b.bcatch.bsize.16.a b.bcatch.bsize.20.a  b.pcatch.psize.7.a 
           45.37353            88.95605            88.18354            67.32846            76.91684            58.15049 
 b.pcatch.psize.8.a b.pcatch.psize.10.a   b.wcatch.travel.a   b.wcatch.bcatch.a   b.wcatch.pcatch.a            b.asc1.b 
           52.96479            88.46684           -83.34975           179.91902           227.46359           -44.60000 
           b.asc2.b          b.travel.b          b.wcatch.b          b.bcatch.b          b.pcatch.b        b.wsize.10.b 
         -199.05000          -201.63626           277.53032           183.47659           235.04033            -9.20000 
       b.wsize.14.b        b.wsize.16.b        b.wsize.20.b        b.wsize.24.b         b.psize.7.b         b.psize.8.b 
           38.40000            51.30000            76.20000            92.95000            47.60000            64.15000 
       b.psize.10.b        b.bsize.12.b        b.bsize.16.b        b.bsize.20.b b.wcatch.wsize.14.b b.wcatch.wsize.16.b 
          102.05000            54.60000            77.20000           100.40000            48.77108            45.37353 
b.wcatch.wsize.20.b b.wcatch.wsize.24.b b.bcatch.bsize.16.b b.bcatch.bsize.20.b  b.pcatch.psize.7.b  b.pcatch.psize.8.b 
           88.95605            88.18354            67.32846            76.91684            58.15049            52.96479 
b.pcatch.psize.10.b   b.wcatch.travel.b   b.wcatch.bcatch.b   b.wcatch.pcatch.b             delta_b     gamma.walleye.b 
           88.46684           -83.34975           179.91902           227.46359             0.00000             0.00000 
    gamma.central.b      gamma.target.b 
            0.00000             0.00000 
initial  value 4409.859880 
iter   2 value 4189.990497
iter   3 value 4111.052132
iter   4 value 4043.754788
iter   5 value 4035.518275
iter   6 value 4032.493280
iter   7 value 4031.451737
iter   8 value 4029.045913
iter   9 value 4026.290796
iter  10 value 4005.432582
iter  11 value 3977.499918
iter  12 value 3936.446657
iter  13 value 3920.540676
iter  14 value 3904.297100
iter  15 value 3898.976630
iter  16 value 3895.244632
iter  17 value 3891.518258
iter  18 value 3852.151227
iter  19 value 3851.677771
iter  20 value 3848.129154
iter  21 value 3844.633746
iter  22 value 3842.534934
iter  23 value 3841.482559
iter  24 value 3839.059392
iter  25 value 3838.764366
iter  26 value 3836.934147
iter  27 value 3833.575126
iter  28 value 3829.004371
iter  29 value 3824.498806
iter  30 value 3818.106719
iter  31 value 3814.214523
iter  32 value 3810.879911
iter  33 value 3808.066768
iter  34 value 3805.347375
iter  35 value 3802.156778
iter  36 value 3799.888529
iter  37 value 3797.205333
iter  38 value 3794.763945
iter  39 value 3792.605688
iter  40 value 3789.776144
iter  41 value 3785.181855
iter  42 value 3782.905297
iter  43 value 3778.706534
iter  44 value 3776.663462
iter  45 value 3770.178596
iter  46 value 3768.508556
iter  47 value 3766.558350
iter  48 value 3764.316794
iter  49 value 3761.745175
iter  50 value 3756.731907
iter  51 value 3749.912449
iter  52 value 3746.632142
iter  53 value 3745.008558
iter  54 value 3743.840500
iter  55 value 3742.090680
iter  56 value 3739.730379
iter  57 value 3738.078653
iter  58 value 3737.012988
iter  59 value 3736.369171
iter  60 value 3736.033779
iter  61 value 3735.507410
iter  62 value 3734.675699
iter  63 value 3733.997955
iter  64 value 3733.703601
iter  65 value 3732.886142
iter  66 value 3732.121287
iter  67 value 3730.746319
iter  68 value 3730.301144
iter  69 value 3727.855747
iter  70 value 3726.309712
iter  71 value 3725.682672
iter  72 value 3725.093735
iter  73 value 3724.567755
iter  74 value 3724.488537
iter  75 value 3724.468235
iter  76 value 3724.465119
iter  77 value 3724.464346
iter  78 value 3724.464255
iter  78 value 3724.464241
iter  78 value 3724.464241
final  value 3724.464241 
converged
Additional convergence test using scaled estimation. Parameters will be scaled by their current estimates and
  additional iterations will be performed.
initial  value 3724.464241 
iter   1 value 3724.464241
final  value 3724.464241 
converged
Estimated parameters:

Final LL: -3724.4642


Summary of class allocation for model component :

Calculating log-likelihood at equal shares (LL(0)) for applicable models...
Calculating log-likelihood at observed shares from estimation data (LL(c)) for applicable models...
Calculating LL of each model component...
Computing covariance matrix using analytical gradient.
 0%....25%....50%....75%....100%
Negative definite Hessian with maximum eigenvalue: -0.787344
Computing score matrix...
Model run by ashle using Apollo 0.2.8 on R 4.2.2 for Windows.
www.ApolloChoiceModelling.com

Model name                                  : FMNL 2LC walleye cov
Model description                           : Fractional MNL model 2LC cov
Model run at                                : 2023-02-28 11:34:42
Estimation method                           : bfgs
Model diagnosis                             : successful convergence 
Number of individuals                       : 548
Number of rows in database                  : 2740
Number of modelled outcomes                 : 2740

Number of cores used                        :  3 
Model without mixing

LL(start)                                   : -4409.86
LL (whole model) at equal shares, LL(0)     : -4409.86
LL (whole model) at observed shares, LL(C)  : Not applicable
LL(final, whole model)                      : -3724.46
Rho-squared vs equal shares                  :  Not applicable 
Adj.Rho-squared vs equal shares              :  Not applicable 
Rho-squared vs observed shares               :  Not applicable 
Adj.Rho-squared vs observed shares           :  Not applicable 
AIC                                         :  7572.93 
BIC                                         :  7939.7 

LL(0,Class_1)                    : -4409.86
LL(final,Class_1)                : -4505.87
LL(0,Class_2)                    : -4409.86
LL(final,Class_2)                : -4081.03

Estimated parameters                        :  62
Time taken (hh:mm:ss)                       :  00:01:25.12 
     pre-estimation                         :  00:00:21.92 
     estimation                             :  00:00:11.66 
     post-estimation                        :  00:00:51.54 
Iterations                                  :  82  
Min abs eigenvalue of Hessian               :  0.787344 

Unconstrained optimisation.

These outputs have had the scaling used in estimation applied to them.
Estimates:

You can see how LL(final, Class_1) is slightly lower than LL(0, Class_1), but this is not the case for class 2. To summarize, what does it mean for the validity of the model fit if, in comparison to other models, its AIC and BIC values are lower and the final pseudo r squared value is reasonable, but the baseline latent class pseudo r squared value is negative? Or does this imply some deeper problem?

Thanks a lot for your help; this is a wonderful resource.
stephanehess
Site Admin
Posts: 974
Joined: 24 Apr 2020, 16:29

Re: Higher LL(final) than LL(0) for one latent class

Post by stephanehess »

Hi

the way you need to understand this is that the fit within individual classes is for a case where the parameters in that class are used for the entire data. Then it's quite possible to have a case where the LL for a class is worse than LL0. What matters is that the model in that class works well for some people in the data, which is why it gets a non-zero share. What your output is telling you is that the model in this class works really badly for some other people, but that's fine as long as your overall fit is better

Does that makes snese?

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
ashtrudeau
Posts: 7
Joined: 27 Feb 2022, 19:41
Location: Wisconsin, USA

Re: Higher LL(final) than LL(0) for one latent class

Post by ashtrudeau »

That is a huge relief, thank you!
ashtrudeau
Posts: 7
Joined: 27 Feb 2022, 19:41
Location: Wisconsin, USA

Re: Higher LL(final) than LL(0) for one latent class

Post by ashtrudeau »

That is a huge relief, thank you!
Post Reply