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.

Error in MNL estimation

Ask questions about errors you encouunter. Please make sure to include full details about your model specifications, and ideally your model file.
Post Reply
maxrudolf
Posts: 3
Joined: 16 May 2024, 14:45

Error in MNL estimation

Post by maxrudolf »

Hello

I have problems in estimating a simple MNL model. It seems to be a rather trivial issue. However, I spent a lot of time finding it and consulted several posts in this forum without success.
The error code reads:
WARNING: Your model did not converge properly, and some of your parameter values
are tending to +/- infinity. This could point to an identification
issue. If you want to retain these parameters in the model, you may
wish to set their value(s) in apollo_beta to the estimated value(s),
include the parameter name(s) in apollo_fixed, and re-estimate the
model.
WARNING: Estimation failed. No covariance matrix to compute.


I have four categorical attributes (2-4 levels) and a continous attribute (price). The attributes are coded with values from 0 (opt-out) to 2,3 or 4 (depending on the levels).
I have two unlabbled alternatives and an opt-out.



This is the code that I use:

Code: Select all

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

### Clear memory
rm(list = ls())

### Load Apollo library
library(apollo)

### Initialise code
apollo_initialise()

### Set core controls
apollo_control = list(
  modelName       = "model_1",
  modelDescr      = "basic MNL model",
  indivID         = "sys_SequentialRespNum",  
  nCores          = 1,
  outputDirectory = "output"
)

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

### Get data
database = read.csv("pilot_CE.csv")

# ################################################################# #
#### DEFINE MODEL PARAMETERS                                     ####
# ################################################################# #
apollo_beta = c(b_bio       = 0,
                       	b_ft        = 0,
              		b_hum       = 0,
               		b_farm      = 0,
                	b_kmu       = 0,
                	b_konz      = 0,
                	b_coop      = 0,
                	b_dt        = 0,
                	b_water    = 0,
                	b_forest    = 0,
                	b_erosion   = 0,
                	b_co2       = 0,
                	b_ch        = 0,
                	b_gs        = 0,
                	b_price       = 0,    
                	b_asc1      = 0,
                	b_asc2      = 0,
                	b_out       = 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_bio", "b_kmu", "b_water", "b_ch", "b_out")


# ################################################################# #
#### GROUP AND VALIDATE INPUTS                                   ####
# ################################################################# #

apollo_inputs = apollo_validateInputs()

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

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

  ### Function initialisation: do not change the following three commands
  ### 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()

  ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
  V = list()
  V[["alt1"]] = b_bio * (Label == 1) + b_ft * (Label == 2) + b_hum * (Label == 3) + b_farm * (Label == 4) +
                b_kmu * (Dist == 1) + b_konz * (Dist == 2) + b_coop * (Dist == 3) + b_dt * (Dist == 4) +
                b_water * (ECO == 1) + b_forest * (ECO == 2) + b_erosion * (ECO == 3) + b_co2 * (ECO == 4) +
                b_ch * (COO == 1) + b_gs * (COO == 2) +
                b_price * Price +
                b_asc1
  V[["alt2"]] = b_bio * (Label == 1) + b_ft * (Label == 2) + b_hum * (Label == 3) + b_farm * (Label == 4) +
                b_kmu * (Dist == 1) + b_konz * (Dist == 2) + b_coop * (Dist == 3) + b_dt * (Dist == 4) +
                b_water * (ECO == 1) + b_forest * (ECO == 2) + b_erosion * (ECO == 3) + b_co2 * (ECO == 4) +
                b_ch * (COO == 1) + b_gs * (COO == 2) +
                b_price * Price +
                b_asc2
  V[["optout"]] = b_out


  
  ### Define settings for MNL model component
  mnl_settings = list(
    alternatives  = c(alt1=1, alt2=2, optout=3),
    choiceVar     = Concept,
    utilities     = V
  )

  ### Compute probabilities using MNL model
  P[["model"]] = apollo_mnl(mnl_settings, functionality)

  ### Take product across observation for same individual
  P = apollo_panelProd(P, apollo_inputs, functionality)

  ### Prepare and return outputs of function
  P = apollo_prepareProb(P, apollo_inputs, functionality)
  return(P)
}

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

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


When I run the code, I get the following output:

Code: Select all

> 
Apollo ignition sequence completed
Several observations per individual detected based on the value of
  sys_SequentialRespNum. 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...
Setting "avail" is missing, so full availability is assumed.

Overview of choices for MNL model component :
                                   alt1 alt2 optout
Times available              	           850.00  850 850.00
Times chosen              	           282.00  340 228.00
Percentage chosen overall              33.18   40  26.82
Percentage chosen when available  33.18   40  26.82


Pre-processing likelihood function...

Testing influence of parameters
Starting main estimation

BGW using analytic model derivatives supplied by caller...


Iterates will be written to:
 output/model_1_iterations.csv
    it    nf     F            RELDF    PRELDF    RELDX    MODEL stppar
     0     1 9.338204454e+02
     1     3 8.080264895e+02 1.347e-01 1.545e-01 1.00e+00   G   8.98e+00
     2     4 7.145230304e+02 1.157e-01 1.758e-01 4.81e-01   G   7.47e+00
     3     6 5.921750706e+02 1.712e-01 1.440e-01 9.14e-01   S   1.57e-01
     4     7 4.719827479e+02 2.030e-01 5.165e-01 4.13e-01   G   6.47e-02
     5     8 4.357836453e+02 7.670e-02 1.523e-01 3.41e-01   G   2.73e-02
     6    10 4.339183332e+02 4.280e-03 3.654e-03 3.33e-02   S   4.56e-02
     7    11 4.317097155e+02 5.090e-03 5.634e-03 3.64e-02   G   3.74e-02
     8    12 4.301468326e+02 3.620e-03 6.129e-03 5.14e-02   G   1.69e-02
     9    13 4.293513382e+02 1.849e-03 2.475e-03 5.21e-02   G   8.75e-03
    10    14 4.289230065e+02 9.976e-04 7.655e-04 4.73e-02   S   6.73e-04
    11    15 4.286934830e+02 5.351e-04 4.086e-04 4.32e-02   S   3.45e-04
    12    16 4.285705699e+02 2.867e-04 2.183e-04 3.98e-02   S   1.80e-04
    13    17 4.285048406e+02 1.534e-04 1.166e-04 3.69e-02   S   9.47e-05
    14    19 4.285000209e+02 1.125e-05 1.107e-05 3.72e-03   S   3.38e-03
    15    21 4.284917382e+02 1.933e-05 1.921e-05 6.93e-03   S   2.24e-04
    16    23 4.284688989e+02 5.330e-05 5.040e-05 2.48e-02   S   2.57e-05
    17    27 4.284687418e+02 3.667e-07 3.251e-06 3.80e-04   S   1.15e-01
    18    28 4.284685574e+02 4.304e-07 6.715e-07 2.39e-04   S   2.82e-02
    19    29 4.284683607e+02 4.589e-07 6.152e-07 2.44e-04   S   2.75e-02
    20    32 4.284675041e+02 1.999e-06 2.186e-06 1.18e-03   S   1.28e-03
    21    34 4.284671495e+02 8.277e-07 9.357e-07 4.67e-04   S   1.39e-02
    22    37 4.284645571e+02 6.050e-06 6.039e-06 3.72e-03   S   2.98e-04
    23    39 4.284635404e+02 2.373e-06 2.373e-06 1.53e-03   S   3.79e-03
    24    42 4.284567084e+02 1.595e-05 1.591e-05 1.16e-02   S   0.00e+00
    25    45 4.284559896e+02 1.678e-06 2.838e-06 1.25e-03   S   3.85e-03
    26    48 4.284403099e+02 3.660e-05 2.773e-05 4.34e-02   S   0.00e+00
    27    51 4.284402486e+02 1.429e-07 4.683e-07 4.44e-04   S   7.32e-03
    28    55 4.284352918e+02 1.157e-05 7.739e-06 2.77e-02   S   0.00e+00
    29    56 4.284326067e+02 6.267e-06 4.835e-06 2.63e-02   S   4.75e-06
    30    57 4.284311523e+02 3.395e-06 2.620e-06 2.50e-02   S   2.58e-06
    31    58 4.284303646e+02 1.839e-06 1.419e-06 2.38e-02   S   1.40e-06
    32    59 4.284299379e+02 9.959e-07 7.685e-07 2.27e-02   S   7.57e-07
    33    60 4.284297068e+02 5.394e-07 4.163e-07 2.17e-02   S   4.10e-07
    34    61 4.284295816e+02 2.922e-07 2.255e-07 2.08e-02   S   2.22e-07
    35    62 4.284295138e+02 1.582e-07 1.221e-07 2.00e-02   S   1.20e-07
    36    63 4.284294771e+02 8.573e-08 6.615e-08 1.92e-02   S   6.51e-08
    37    64 4.284294572e+02 4.642e-08 3.583e-08 1.85e-02   S   3.53e-08
    38    65 4.284294464e+02 2.515e-08 1.942e-08 1.78e-02   S   1.91e-08
    39    66 4.284294406e+02 1.362e-08 1.051e-08 1.72e-02   S   1.04e-08
    40    67 4.284294374e+02 7.378e-09 5.695e-09 1.67e-02   S   5.61e-09
    41    68 4.284294357e+02 3.995e-09 3.087e-09 1.61e-02   S   3.05e-09
    42    69 4.284294348e+02 2.165e-09 1.674e-09 1.56e-02   S   1.66e-09
    43    70 4.284294343e+02 1.172e-09 9.048e-10 1.51e-02   S   8.94e-10
    44    71 4.284294340e+02 6.348e-10 4.899e-10 1.47e-02   S   3.11e-08

***** Singular convergence *****

Estimated parameters:
             Estimate
b_bio           0.000
b_ft           -2.098
b_hum          52.444
b_farm         -4.052
b_kmu           0.000
b_konz        -18.740
b_coop         31.386
b_dt           11.079
b_water         0.000
b_forest        1.895
b_erosion       2.282
b_co2           4.939
b_ch            0.000
b_gs           -6.024
b_price        73.865
b_asc1        -21.171
b_asc2        -20.984
b_out           0.000

Final LL: -428.4294

WARNING: Your model did not converge properly, and some of your parameter values
  are tending to +/- infinity. This could point to an identification
  issue. If you want to retain these parameters in the model, you may
  wish to set their value(s) in apollo_beta to the estimated value(s),
  include the parameter name(s) in apollo_fixed, and re-estimate the
  model.
WARNING: Estimation failed. No covariance matrix to compute.

  Current process will resume in 3 seconds unless interrupted by the
  user...

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...
Calculating other model fit measures

Your model was estimated using the BGW algorithm. Please acknowledge
  this by citing Bunch et al. (1993) - DOI 10.1145/151271.151279
Model run by rudolf using Apollo 0.3.2 on R 4.4.0 for Windows.
Please acknowledge the use of Apollo by citing Hess & Palma (2019)
  DOI 10.1016/j.jocm.2019.100170
  www.ApolloChoiceModelling.com

Model name                                  : model_1
Model description                           : basic MNL model
Model run at                                : 2024-05-21 17:32:02.644595
Estimation method                           : bgw
Model diagnosis                             : Singular convergence
Number of individuals                       : 107
Number of rows in database                  : 850
Number of modelled outcomes                 : 850

Number of cores used                        :  1
Model without mixing

LL(start)                                   : -933.82
LL at equal shares, LL(0)                   : -933.82
LL at observed shares, LL(C)                : -922.7
LL(final)                                   : -428.43
Rho-squared vs equal shares                  :  0.5412
Adj.Rho-squared vs equal shares              :  0.5273
Rho-squared vs observed shares               :  0.5357
Adj.Rho-squared vs observed shares           :  0.5238
AIC                                         :  882.86
BIC                                         :  944.55

Estimated parameters                        : 13
Time taken (hh:mm:ss)                       :  00:00:6.34
     pre-estimation                         :  00:00:1.68
     estimation                             :  00:00:4.63 
     post-estimation                        :  00:00:0.03
Iterations                                  :  44 (Singular convergence)

Unconstrained optimisation.

Estimates:
             Estimate        s.e.   t.rat.(0)    Rob.s.e. Rob.t.rat.(0)
b_bio           0.000          NA          NA          NA            NA
b_ft           -2.098          NA          NA          NA            NA
b_hum          52.444          NA          NA          NA            NA
b_farm         -4.052          NA          NA          NA            NA
b_kmu           0.000          NA          NA          NA            NA
b_konz        -18.740          NA          NA          NA            NA
b_coop         31.386          NA          NA          NA            NA
b_dt           11.079          NA          NA          NA            NA
b_water         0.000          NA          NA          NA            NA
b_forest        1.895          NA          NA          NA            NA
b_erosion       2.282          NA          NA          NA            NA
b_co2           4.939          NA          NA          NA            NA
b_ch            0.000          NA          NA          NA            NA
b_gs           -6.024          NA          NA          NA            NA
b_price        73.865          NA          NA          NA            NA
b_asc1        -21.171          NA          NA          NA            NA
b_asc2        -20.984          NA          NA          NA            NA
b_out           0.000          NA          NA          NA            NA

Best wishes and thank you already in advance,
Max
stephanehess
Site Admin
Posts: 1085
Joined: 24 Apr 2020, 16:29

Re: Error in MNL estimation

Post by stephanehess »

This could be an overspecification as a result of your specific design. To help us diagnose it, can you send us the results without ascs, and with only asc?
--------------------------------
Stephane Hess
www.stephanehess.me.uk
maxrudolf
Posts: 3
Joined: 16 May 2024, 14:45

Re: Error in MNL estimation

Post by maxrudolf »

Certainly,
The data is from a pilot study with 120 participants. The experimental design was done in Sawtooth using the "Balanced Overlap" method.

these are the results without ascs:

Code: Select all

pollo ignition sequence completed
Several observations per individual detected based on the value of
  sys_SequentialRespNum. 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...
Setting "avail" is missing, so full availability is assumed.

Overview of choices for MNL model component :
                                   alt1 alt2 optout
Times available                  850.00  850 850.00
Times chosen                     282.00  340 228.00
Percentage chosen overall         33.18   40  26.82
Percentage chosen when available  33.18   40  26.82


Pre-processing likelihood function...

Testing influence of parameters
Starting main estimation

BGW using analytic model derivatives supplied by caller...


Iterates will be written to:
 output/model_1_iterations.csv
    it    nf     F            RELDF    PRELDF    RELDX    MODEL stppar
     0     1 9.338204454e+02
     1     4 8.286700681e+02 1.126e-01 1.261e-01 1.00e+00   G   1.23e+01
     2     5 6.858278054e+02 1.724e-01 2.841e-01 6.58e-01   G   3.77e+00
     3     7 5.746558701e+02 1.621e-01 2.027e-01 5.41e-01   G   4.90e-01
     4     8 4.636207935e+02 1.932e-01 1.985e-01 5.16e-01   G   7.15e-02
     5     9 4.421315646e+02 4.635e-02 1.396e-01 3.80e-01   G   1.02e-01
     6    10 4.363930414e+02 1.298e-02 4.304e-02 1.08e-01   G   9.76e-03
     7    11 4.336121445e+02 6.372e-03 6.499e-03 2.45e-01   G   1.93e-03
     8    12 4.317233776e+02 4.356e-03 3.502e-03 2.46e-01   G   2.66e-05
     9    13 4.311398550e+02 1.352e-03 3.474e-03 5.82e-02   G   -2.66e-05
    10    15 4.311375904e+02 5.253e-06 2.288e-05 4.99e-02   G   1.35e-03
    11    17 4.311375754e+02 3.500e-08 1.937e-07 3.68e-02   G   6.44e-05
    12    19 4.311375502e+02 5.844e-08 1.247e-07 4.72e-02  G-S  3.27e-05
    13    20 4.311375494e+02 1.855e-09 1.045e-09 2.47e-02   S   3.83e-11
    14    21 4.311375463e+02 7.060e-09 5.217e-08 1.67e-01   G   6.96e-06
    15    23 4.311375463e+02 6.010e-13 3.133e-13 8.58e-03  G-S  -1.51e-12

***** Singular convergence *****

Estimated parameters:
             Estimate
b_bio           0.000
b_ft           10.414
b_hum          28.533
b_farm         17.267
b_kmu           0.000
b_konz         36.405
b_coop         16.264
b_dt           20.267
b_water         0.000
b_forest       15.448
b_erosion      20.319
b_co2          24.076
b_ch            0.000
b_gs           20.084
b_price        46.896
b_out          27.832

Final LL: -431.1375

WARNING: Your model did not converge properly, and some of your parameter values
  are tending to +/- infinity. This could point to an identification
  issue. If you want to retain these parameters in the model, you may
  wish to set their value(s) in apollo_beta to the estimated value(s),
  include the parameter name(s) in apollo_fixed, and re-estimate the
  model.
WARNING: Estimation failed. No covariance matrix to compute.

  Current process will resume in 3 seconds unless interrupted by the
  user...

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...
Calculating other model fit measures

Your model was estimated using the BGW algorithm. Please acknowledge
  this by citing Bunch et al. (1993) - DOI 10.1145/151271.151279
  
  
Model name                                  : model_1
Model description                           : basic MNL model - no asc
Model run at                                : 2024-05-22 13:00:42.293123
Estimation method                           : bgw
Model diagnosis                             : Singular convergence
Number of individuals                       : 107
Number of rows in database                  : 850
Number of modelled outcomes                 : 850

Number of cores used                        :  1
Model without mixing

LL(start)                                   : -933.82
LL at equal shares, LL(0)                   : -933.82
LL at observed shares, LL(C)                : -922.7
LL(final)                                   : -431.14
Rho-squared vs equal shares                  :  0.5383
Adj.Rho-squared vs equal shares              :  0.5255
Rho-squared vs observed shares               :  0.5327
Adj.Rho-squared vs observed shares           :  0.5219
AIC                                         :  886.28
BIC                                         :  943.22

Estimated parameters                        : 12
Time taken (hh:mm:ss)                       :  00:00:4.74
     pre-estimation                         :  00:00:1.26
     estimation                             :  00:00:3.45
     post-estimation                        :  00:00:0.03
Iterations                                  :  15 (Singular convergence)

Unconstrained optimisation.

Estimates:
             Estimate        s.e.   t.rat.(0)    Rob.s.e. Rob.t.rat.(0)
b_bio           0.000          NA          NA          NA            NA
b_ft           10.414          NA          NA          NA            NA
b_hum          28.533          NA          NA          NA            NA
b_farm         17.267          NA          NA          NA            NA
b_kmu           0.000          NA          NA          NA            NA
b_konz         36.405          NA          NA          NA            NA
b_coop         16.264          NA          NA          NA            NA
b_dt           20.267          NA          NA          NA            NA
b_water         0.000          NA          NA          NA            NA
b_forest       15.448          NA          NA          NA            NA
b_erosion      20.319          NA          NA          NA            NA
b_co2          24.076          NA          NA          NA            NA
b_ch            0.000          NA          NA          NA            NA
b_gs           20.084          NA          NA          NA            NA
b_price        46.896          NA          NA          NA            NA
b_out          27.832          NA          NA          NA            NA

and the results with only asc:

Code: Select all

Apollo ignition sequence completed
Several observations per individual detected based on the value of
  sys_SequentialRespNum. 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...
Setting "avail" is missing, so full availability is assumed.

Overview of choices for MNL model component :
                                   alt1 alt2 optout
Times available                  850.00  850 850.00
Times chosen                     282.00  340 228.00
Percentage chosen overall         33.18   40  26.82
Percentage chosen when available  33.18   40  26.82


Pre-processing likelihood function...

Testing influence of parameters
Starting main estimation

BGW using analytic model derivatives supplied by caller...


Iterates will be written to:
 output/model_1_iterations.csv
    it    nf     F            RELDF    PRELDF    RELDX    MODEL stppar
     0     1 9.338204454e+02
     1     3 8.062477485e+02 1.366e-01 1.574e-01 1.00e+00   G   8.69e+00
     2     4 7.015033785e+02 1.299e-01 1.876e-01 4.87e-01   G   7.13e+00
     3     6 5.496041427e+02 2.165e-01 1.788e-01 5.58e-01   S   2.89e-02
     4     7 4.842680555e+02 1.189e-01 2.492e-01 3.55e-01   S   1.60e-01
     5     9 4.737217332e+02 2.178e-02 2.153e-02 5.08e-02   S   4.06e-01
     6    10 4.653920552e+02 1.758e-02 1.295e-02 7.06e-02   S   4.12e-02
     7    11 4.466924471e+02 4.018e-02 9.696e-02 8.67e-02   G   3.82e-01
     8    12 4.395879225e+02 1.590e-02 3.084e-02 1.77e-01   G   1.53e-01
     9    14 4.385746659e+02 2.305e-03 2.159e-03 3.76e-02   S   7.29e-01
    10    16 4.358183593e+02 6.285e-03 8.191e-03 1.10e-01   G   3.05e-01
    11    18 4.328388248e+02 6.837e-03 1.190e-02 2.56e-01   G   1.39e-01
    12    20 4.321239771e+02 1.652e-03 1.981e-03 3.78e-02   S   1.95e+00
    13    21 4.317323946e+02 9.062e-04 1.455e-03 5.80e-02   G   1.58e+00
    14    22 4.315079102e+02 5.200e-04 4.021e-04 4.88e-02   S   6.77e-03
    15    23 4.313070383e+02 4.655e-04 3.517e-04 7.77e-02   S   -2.32e-03
    16    25 4.312591961e+02 1.109e-04 1.311e-04 2.61e-02   S   5.29e-01
    17    27 4.312025097e+02 1.314e-04 1.281e-04 5.97e-02   S   1.99e-02
    18    28 4.311735868e+02 6.707e-05 1.117e-04 5.85e-02   S   6.12e-04
    19    30 4.311612969e+02 2.850e-05 6.302e-05 3.14e-02   S   1.18e-01
    20    31 4.311539605e+02 1.702e-05 1.361e-05 2.85e-02   S   9.00e-03
    21    32 4.311459164e+02 1.866e-05 1.631e-05 3.96e-02   S   1.88e-02
    22    33 4.311417031e+02 9.772e-06 6.797e-06 3.82e-02   S   -1.88e-05
    23    34 4.311396322e+02 4.803e-06 3.338e-06 3.49e-02   S   -1.88e-05
    24    35 4.311386325e+02 2.319e-06 1.811e-06 6.03e-02   S   1.78e-04
    25    36 4.311380159e+02 1.430e-06 1.656e-06 5.62e-02   S   -1.78e-07
    26    37 4.311378125e+02 4.719e-07 3.095e-07 2.38e-02   S   -1.78e-10
    27    38 4.311376731e+02 3.234e-07 2.290e-07 2.94e-02   S   -1.78e-10
    28    39 4.311376109e+02 1.442e-07 9.913e-08 2.53e-02   S   -1.78e-10
    29    40 4.311375784e+02 7.543e-08 5.245e-08 2.50e-02   S   -1.78e-10
    30    41 4.311375624e+02 3.707e-08 2.567e-08 2.35e-02   S   -1.78e-10
    31    42 4.311375543e+02 1.866e-08 1.294e-08 2.25e-02   S   -1.78e-10
    32    43 4.311375503e+02 9.307e-09 6.450e-09 2.15e-02   S   -1.78e-10
    33    44 4.311375483e+02 4.659e-09 3.229e-09 2.76e-02   S   -1.78e-10
    34    45 4.311375473e+02 2.328e-09 1.614e-09 3.96e-02   S   -1.78e-10
    35    46 4.311375468e+02 1.164e-09 8.071e-10 5.79e-02   S   -1.78e-10
    36    47 4.311375466e+02 5.822e-10 4.035e-10 1.01e-01   S   -1.78e-10
    37    48 4.311375464e+02 2.911e-10 2.018e-10 3.97e-02   S   -1.78e-10
    38    49 4.311375464e+02 1.455e-10 1.009e-10 2.99e-01   S   -1.78e-10
    39    50 4.311375463e+02 7.278e-11 5.044e-11 2.41e-01   S   7.95e-12

***** Singular convergence *****

Estimated parameters:
             Estimate
b_bio           0.000
b_ft           12.235
b_hum           4.809
b_farm         14.775
b_kmu           0.000
b_konz         39.033
b_coop         16.601
b_dt           31.465
b_water         0.000
b_forest       21.269
b_erosion      16.586
b_co2           4.221
b_ch            0.000
b_gs            7.718
b_price        42.615
asc            28.183
b_out          51.986

Final LL: -431.1375

WARNING: Your model did not converge properly, and some of your parameter values
  are tending to +/- infinity. This could point to an identification
  issue. If you want to retain these parameters in the model, you may
  wish to set their value(s) in apollo_beta to the estimated value(s),
  include the parameter name(s) in apollo_fixed, and re-estimate the
  model.
WARNING: Estimation failed. No covariance matrix to compute.

  Current process will resume in 3 seconds unless interrupted by the
  user...

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...
Calculating other model fit measures

Your model was estimated using the BGW algorithm. Please acknowledge
  this by citing Bunch et al. (1993) - DOI 10.1145/151271.151279
Model run by rudolf using Apollo 0.3.2 on R 4.4.0 for Windows.
Please acknowledge the use of Apollo by citing Hess & Palma (2019)
  DOI 10.1016/j.jocm.2019.100170
  www.ApolloChoiceModelling.com

Model name                                  : model_1
Model description                           : basic MNL model
Model run at                                : 2024-05-22 13:07:19.147946
Estimation method                           : bgw
Model diagnosis                             : Singular convergence
Number of individuals                       : 107
Number of rows in database                  : 850
Number of modelled outcomes                 : 850

Number of cores used                        :  1
Model without mixing

LL(start)                                   : -933.82
LL at equal shares, LL(0)                   : -933.82
LL at observed shares, LL(C)                : -922.7
LL(final)                                   : -431.14
Rho-squared vs equal shares                  :  0.5383
Adj.Rho-squared vs equal shares              :  0.5244
Rho-squared vs observed shares               :  0.5327
Adj.Rho-squared vs observed shares           :  0.5208
AIC                                         :  888.28
BIC                                         :  949.96

Estimated parameters                        : 13
Time taken (hh:mm:ss)                       :  00:00:4.93
     pre-estimation                         :  00:00:1.01
     estimation                             :  00:00:3.9 
     post-estimation                        :  00:00:0.03
Iterations                                  :  39 (Singular convergence)

Unconstrained optimisation.

Estimates:
             Estimate        s.e.   t.rat.(0)    Rob.s.e. Rob.t.rat.(0)
b_bio           0.000          NA          NA          NA            NA
b_ft           12.235          NA          NA          NA            NA
b_hum           4.809          NA          NA          NA            NA
b_farm         14.775          NA          NA          NA            NA
b_kmu           0.000          NA          NA          NA            NA
b_konz         39.033          NA          NA          NA            NA
b_coop         16.601          NA          NA          NA            NA
b_dt           31.465          NA          NA          NA            NA
b_water         0.000          NA          NA          NA            NA
b_forest       21.269          NA          NA          NA            NA
b_erosion      16.586          NA          NA          NA            NA
b_co2           4.221          NA          NA          NA            NA
b_ch            0.000          NA          NA          NA            NA
b_gs            7.718          NA          NA          NA            NA
b_price        42.615          NA          NA          NA            NA
asc            28.183          NA          NA          NA            NA
b_out          51.986          NA          NA          NA            NA

stephanehess
Site Admin
Posts: 1085
Joined: 24 Apr 2020, 16:29

Re: Error in MNL estimation

Post by stephanehess »

It's clearly overspecified then. Can you share your data and code with me outside the forum and I'll have a look?
--------------------------------
Stephane Hess
www.stephanehess.me.uk
stephanehess
Site Admin
Posts: 1085
Joined: 24 Apr 2020, 16:29

Re: Error in MNL estimation

Post by stephanehess »

I now had a closer look and you are using the same attribute names in the utilities for alternatives 1 and 2. This, alongside the constants, makes it impossible for you to estimate the model. There should be separate attributes in the utilities for different alternatives, as only differences in utility matter
--------------------------------
Stephane Hess
www.stephanehess.me.uk
maxrudolf
Posts: 3
Joined: 16 May 2024, 14:45

Re: Error in MNL estimation

Post by maxrudolf »

Thank you very much for your help.
It turned out that I was using the wrong (long) data format.
Post Reply