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.

Problem of Hessian matrix and missing s.e

Ask questions about the results reported after estimation. If the output includes errors, please include your model code if possible.
Post Reply
zx9203
Posts: 24
Joined: 13 Jun 2020, 09:52

Problem of Hessian matrix and missing s.e

Post by zx9203 »

Hi there,

My mixed logit model with price following lognormal distribution failed at starting values. After trying the command "WorkInLogs", it worked with successful convergence but the s.e and t ratio are missing in the output. It warns me that "Some eigenvalues of hessian are positive, indicating potential problems!"

I attach my codes as following. Please help!


# ################################################################# #
#### 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 ="0825mixed logit(3)",
modelDescr ="Mixed logit model,ttp lognormal",
indivID ="id",
workInLogs = TRUE,
mixing = TRUE,
nCores = 4
)

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

database = read.csv("C:/Users/Administrator/Desktop/zhangxian/0728main_balanced_pool.csv",header=TRUE)
database$ttp_1 <- database$ttp_1 * (-1)
database$ttp_2 <- database$ttp_2 * (-1)
database$ttp_3 <- database$ttp_3 * (-1)
database$ttp_4 <- database$ttp_4 * (-1)

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

### Vector of parameters, including any that are kept fixed in estimation
apollo_beta = c(asc_non_purchase = 0,
mu_b_ttp = -3,
sigma_b_ttp = 0,
mu_b_deal = 0,
sigma_b_deal = 0,
mu_b_star = 0,
sigma_b_star = 0,
mu_b_ave_safe = 0,
sigma_b_ave_safe = 0,
mu_b_very_safe = 0,
sigma_b_very_safe= 0,
b_wellknown = 0,
b_ave_loc = 0,
b_very_loc = 0,
b_ave_clean = 0,
mu_b_very_clean = 0,
sigma_b_very_clean=0,
mu_b_quiet_night = 0,
sigma_b_quiet_night=0,
mu_b_quiet_allday = 0,
sigma_b_quiet_allday=0,
mu_b_rev = 0,
sigma_b_rev = 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()

# ################################################################# #
#### DEFINE RANDOM COMPONENTS ####
# ################################################################# #

### Set parameters for generating draws
apollo_draws = list(
interDrawsType = "halton",
interNDraws = 500,
interUnifDraws = c(),
interNormDraws = c("draws_ttp", "draws_deal", "draws_star", "draws_ave_safe", "draws_very_safe", "draws_very_loc", "draws_very_clean", "draws_quiet_night", "draws_quiet_allday", "draws_rev"),
intraDrawsType = "halton",
intraNDraws = 0,
intraUnifDraws = c(),
intraNormDraws = c()
)

### Create random parameters
apollo_randCoeff = function(apollo_beta, apollo_inputs){
randcoeff = list()

randcoeff[["b_ttp"]] = exp(mu_b_ttp + sigma_b_ttp * draws_ttp)
randcoeff[["b_deal"]] = mu_b_deal + sigma_b_deal * draws_deal
randcoeff[["b_star"]] = mu_b_star + sigma_b_star * draws_star
randcoeff[["b_ave_safe"]] = mu_b_ave_safe + sigma_b_ave_safe * draws_ave_safe
randcoeff[["b_very_safe"]] = mu_b_very_safe + sigma_b_very_safe * draws_very_safe
randcoeff[["b_very_clean"]] = mu_b_very_clean + sigma_b_very_clean * draws_very_clean
randcoeff[["b_quiet_night"]] = mu_b_quiet_night + sigma_b_quiet_night * draws_quiet_night
randcoeff[["b_quiet_allday"]] = mu_b_quiet_allday + sigma_b_quiet_allday * draws_quiet_allday
randcoeff[["b_rev"]] = mu_b_rev + sigma_b_rev * draws_rev



return(randcoeff)
}

# ################################################################# #
#### 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[['option_1']] = b_ttp * ttp_1 + b_deal * free_1 + b_star * star_1 + b_ave_safe * (safe_1==1) + b_very_safe * (safe_1==2) + b_wellknown * wellknown_1 + b_ave_loc * (loc_1==1) + b_very_loc * (loc_1==2) + b_ave_clean * (clean_1==1) + b_very_clean * (clean_1==2) + b_quiet_night * (noise_1==1) + b_quiet_allday * (noise_1==2) + b_rev * rev_1
V[['option_2']] = b_ttp * ttp_2 + b_deal * free_2 + b_star * star_2 + b_ave_safe * (safe_2==1) + b_very_safe * (safe_2==2) + b_wellknown * wellknown_2 + b_ave_loc * (loc_2==1) + b_very_loc * (loc_2==2) + b_ave_clean * (clean_2==1) + b_very_clean * (clean_2==2) + b_quiet_night * (noise_2==1) + b_quiet_allday * (noise_2==2) + b_rev * rev_2
V[['option_3']] = b_ttp * ttp_3 + b_deal * free_3 + b_star * star_3 + b_ave_safe * (safe_3==1) + b_very_safe * (safe_3==2) + b_wellknown * wellknown_3 + b_ave_loc * (loc_3==1) + b_very_loc * (loc_3==2) + b_ave_clean * (clean_3==1) + b_very_clean * (clean_3==2) + b_quiet_night * (noise_3==1) + b_quiet_allday * (noise_3==2) + b_rev * rev_3
V[['non-purchase']] = asc_non_purchase

### Define settings for MNL model component
mnl_settings = list(
alternatives = c('option_1'=1, 'option_2'=2, 'option_3'=3, 'non-purchase'=4),
avail = 1,
choiceVar = choice,
V = 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)

### Average across inter-individual draws
P = apollo_avgInterDraws(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, estimate_settings=list(hessianRoutine="maxLik"))

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

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

apollo_modelOutput(model)

# ----------------------------------------------------------------- #
#---- FORMATTED OUTPUT (TO FILE, using model name) ----
# ----------------------------------------------------------------- #

apollo_saveOutput(model)

Best, Xian
dpalma
Posts: 190
Joined: 24 Apr 2020, 17:54

Re: Problem of Hessian matrix and missing s.e

Post by dpalma »

Hi Xian,

It's hard to figure out what is wrong with the model without seeing the output. Could you post the output of your model?

I am assuming that variables safe, loc, clean and noise have at least three levels, as otherwise the utilities would be overspecified.

Best Regards
David
zx9203
Posts: 24
Joined: 13 Jun 2020, 09:52

Re: Problem of Hessian matrix and missing s.e

Post by zx9203 »

Dear David,

Thanks you so much for your reply! Those attributes do have three levels, and that's why I created two dummies for each. Here's the major excerpts of my output (the full output is too long that I could not submit the reply) :


Model name : 0825mixed logit(3)
Model description : Mixed logit model,ttp lognormal
Model run at : 2020-08-25 11:09:58
Estimation method : bfgs
Model diagnosis : successful convergence
Number of individuals : 1710
Number of observations : 41040

Number of cores used : 4
Number of inter-person draws : 500 (halton)

LL(start) : -1903165
LL(0) : -56893.52
LL(final) : -41999.75
Rho-square (0) : 0.2618
Adj.Rho-square (0) : 0.2614
AIC : 84045.5
BIC : 84243.81
Estimated parameters : 23
Time taken (hh:mm:ss) : 02:41:1.94
Iterations : 50
Min abs eigenvalue of hessian : 0
Some eigenvalues of hessian are positive, indicating potential problems!

Estimates:
Estimate Std.err. t.ratio(0) Rob.std.err. Rob.t.ratio(0)
asc_non_purchase -0.3788 Inf 0 NaN NaN
mu_b_ttp -129.3288 Inf 0 NaN NaN
sigma_b_ttp -0.0002 Inf 0 NaN NaN
mu_b_deal 0.4457 Inf 0 NaN NaN
sigma_b_deal -0.4178 Inf 0 NaN NaN
mu_b_star -0.2833 Inf 0 NaN NaN
sigma_b_star -0.5567 Inf 0 NaN NaN
mu_b_ave_safe 0.5095 Inf 0 NaN NaN
sigma_b_ave_safe 0.2578 Inf 0 NaN NaN
mu_b_very_safe 0.8447 Inf 0 NaN NaN
sigma_b_very_safe -0.5406 Inf 0 NaN NaN
b_wellknown 0.0803 Inf 0 NaN NaN
b_ave_loc 0.1035 Inf 0 NaN NaN
b_very_loc 0.1705 Inf 0 NaN NaN
b_ave_clean 0.2396 Inf 0 NaN NaN
mu_b_very_clean 0.4543 Inf 0 NaN NaN
sigma_b_very_clean -0.1409 Inf 0 NaN NaN
mu_b_quiet_night 1.2604 Inf 0 NaN NaN
sigma_b_quiet_night 0.5618 Inf 0 NaN NaN
mu_b_quiet_allday 1.4682 Inf 0 NaN NaN
sigma_b_quiet_allday 0.7740 Inf 0 NaN NaN
mu_b_rev 0.2317 Inf 0 NaN NaN
sigma_b_rev -0.2702 Inf 0 NaN NaN

Overview of choices for model component "MNL"
option_1 option_2 option_3 non-purchase
Times available 41040 41040.00 41040.00 41040.00
Times chosen 12723 14113.00 11832.00 2372.00
Percentage chosen overall 31 34.39 28.83 5.78
Percentage chosen when available 31 34.39 28.83 5.78

WARNING: Availability not provided to 'apollo_mnl' (or some elements are NA).
Full availability assumed.


Classical covariance matrix:
asc_non_purchase mu_b_ttp sigma_b_ttp mu_b_deal
asc_non_purchase Inf Inf Inf Inf
mu_b_ttp Inf Inf Inf Inf
sigma_b_ttp Inf Inf Inf Inf
mu_b_deal Inf Inf Inf Inf
sigma_b_deal Inf Inf Inf Inf
mu_b_star Inf Inf Inf Inf
sigma_b_star Inf Inf Inf Inf
mu_b_ave_safe Inf Inf Inf Inf
sigma_b_ave_safe Inf Inf Inf Inf
mu_b_very_safe Inf Inf Inf Inf
sigma_b_very_safe Inf Inf Inf Inf
b_wellknown Inf Inf Inf Inf
b_ave_loc Inf Inf Inf Inf
b_very_loc Inf Inf Inf Inf
b_ave_clean Inf Inf Inf Inf
mu_b_very_clean Inf Inf Inf Inf
sigma_b_very_clean Inf Inf Inf Inf
mu_b_quiet_night Inf Inf Inf Inf
sigma_b_quiet_night Inf Inf Inf Inf
mu_b_quiet_allday Inf Inf Inf Inf
sigma_b_quiet_allday Inf Inf Inf Inf
mu_b_rev Inf Inf Inf Inf
sigma_b_rev Inf Inf Inf Inf


When I set every random variable as of normal distribution, the output did report s.e and t-ratio. But noticing the sigma of b_ttp (parameter of total price) was highly significant, I think it's better to use log-normal rather than fixing it. Does this problem come from including too many attributes?

Best,
Xian
stephanehess
Site Admin
Posts: 974
Joined: 24 Apr 2020, 16:29

Re: Problem of Hessian matrix and missing s.e

Post by stephanehess »

Hi Xian

the problem seems to relate to b_ttp where the mean of the log of this lognormally distributed parameter goes towards -inf, as it has an estimate of -129, meaning that the median of b_ttp will be zero.

Is this a price coefficient, in which case you likely want a negative lognormal, rather than a positive lognormal, i.e.

randcoeff[["b_ttp"]] = -exp(mu_b_ttp + sigma_b_ttp * draws_ttp)

Best wishes

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
zx9203
Posts: 24
Joined: 13 Jun 2020, 09:52

Re: Problem of Hessian matrix and missing s.e

Post by zx9203 »

Dear Stephane,

Thanks a lot for your reply! ttp refers to total price in my case. I have transformed the values to negative in my data. And I also tried using -exp directly without transforming my data. But all failed. Is there any other possibility?

Best,
Xian
stephanehess
Site Admin
Posts: 974
Joined: 24 Apr 2020, 16:29

Re: Problem of Hessian matrix and missing s.e

Post by stephanehess »

Xian

can you show us the results for the model with Normal distributions too?

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
zx9203
Posts: 24
Joined: 13 Jun 2020, 09:52

Re: Problem of Hessian matrix and missing s.e

Post by zx9203 »

Dear Stephane,

Sure, please check the following result using normal distribution (the forum does not allow me to attach txt file, so I can only partially show you like this):


Model name : 0820mixed logit(2)
Model description : Mixed logit model
Model run at : 2020-08-21 09:54:51
Estimation method : bfgs
Model diagnosis : successful convergence
Number of individuals : 1710
Number of observations : 41040

Number of cores used : 4
Number of inter-person draws : 500 (halton)

LL(start) : -56893.52
LL(0) : -56893.52
LL(final) : -40875.55
Rho-square (0) : 0.2815
Adj.Rho-square (0) : 0.2811
AIC : 81797.1
BIC : 81995.42
Estimated parameters : 23
Time taken (hh:mm:ss) : 02:36:40.59
Iterations : 49
Min abs eigenvalue of hessian : 133.4308

Estimates:
Estimate Std.err. t.ratio(0) Rob.std.err. Rob.t.ratio(0)
asc_non_purchase 0.6827 0.0851 8.02 0.1388 4.92
mu_b_ttp -0.0009 0.0000 -26.25 0.0000 -22.11
sigma_b_ttp -0.0010 0.0000 -38.89 0.0000 -25.94
mu_b_deal 0.0318 0.0191 1.67 0.0191 1.67
sigma_b_deal -0.1576 0.0343 -4.59 0.0467 -3.37
mu_b_star 0.2047 0.0193 10.62 0.0206 9.93
sigma_b_star 0.2694 0.0160 16.85 0.0213 12.64
mu_b_ave_safe 0.4545 0.0184 24.73 0.0242 18.75
sigma_b_ave_safe 0.3086 0.0248 12.44 0.0321 9.60
mu_b_very_safe 0.7508 0.0220 34.06 0.0317 23.70
sigma_b_very_safe 0.5650 0.0198 28.49 0.0329 17.20
b_wellknown 0.1092 0.0143 7.64 0.0137 7.96
b_ave_loc 0.0790 0.0173 4.57 0.0166 4.75
b_very_loc 0.1584 0.0163 9.74 0.0174 9.13
b_ave_clean 0.2495 0.0166 15.01 0.0204 12.24
mu_b_very_clean 0.5087 0.0172 29.55 0.0223 22.85
sigma_b_very_clean -0.2061 0.0274 -7.53 0.0343 -6.00
mu_b_quiet_night 1.2397 0.0251 49.36 0.0390 31.75
sigma_b_quiet_night -0.6468 0.0256 -25.22 0.0338 -19.11
mu_b_quiet_allday 1.4383 0.0285 50.38 0.0441 32.60
sigma_b_quiet_allday 0.8464 0.0265 31.90 0.0395 21.43
mu_b_rev 0.2225 0.0087 25.64 0.0118 18.79
sigma_b_rev -0.2566 0.0075 -34.06 0.0124 -20.61

Overview of choices for model component "MNL"
option_1 option_2 option_3 non-purchase
Times available 41040 41040.00 41040.00 41040.00
Times chosen 12723 14113.00 11832.00 2372.00
Percentage chosen overall 31 34.39 28.83 5.78
Percentage chosen when available 31 34.39 28.83 5.78

WARNING: Availability not provided to 'apollo_mnl' (or some elements are NA).
Full availability assumed.


Classical covariance matrix:
asc_non_purchase mu_b_ttp sigma_b_ttp mu_b_deal
asc_non_purchase 0.0072 0 0 -1e-04
mu_b_ttp 0.0000 0 0 0e+00
sigma_b_ttp 0.0000 0 0 0e+00
mu_b_deal -0.0001 0 0 4e-04
sigma_b_deal -0.0001 0 0 0e+00
mu_b_star 0.0008 0 0 -2e-04
sigma_b_star -0.0002 0 0 0e+00
mu_b_ave_safe 0.0003 0 0 0e+00
sigma_b_ave_safe 0.0001 0 0 0e+00
mu_b_very_safe 0.0003 0 0 1e-04
sigma_b_very_safe 0.0001 0 0 0e+00
b_wellknown 0.0002 0 0 0e+00
b_ave_loc 0.0003 0 0 0e+00
b_very_loc 0.0004 0 0 0e+00
b_ave_clean 0.0001 0 0 0e+00
mu_b_very_clean 0.0003 0 0 0e+00
sigma_b_very_clean -0.0001 0 0 0e+00
mu_b_quiet_night 0.0004 0 0 1e-04
sigma_b_quiet_night -0.0001 0 0 0e+00
mu_b_quiet_allday 0.0003 0 0 1e-04
sigma_b_quiet_allday 0.0001 0 0 0e+00
mu_b_rev 0.0003 0 0 0e+00
sigma_b_rev 0.0001 0 0 0e+00
sigma_b_deal mu_b_star sigma_b_star mu_b_ave_safe
asc_non_purchase -0.0001 8e-04 -2e-04 3e-04
mu_b_ttp 0.0000 0e+00 0e+00 0e+00
sigma_b_ttp 0.0000 0e+00 0e+00 0e+00
mu_b_deal 0.0000 -2e-04 0e+00 0e+00
sigma_b_deal 0.0012 0e+00 0e+00 0e+00
mu_b_star 0.0000 4e-04 0e+00 0e+00
sigma_b_star 0.0000 0e+00 3e-04 0e+00
mu_b_ave_safe 0.0000 0e+00 0e+00 3e-04
sigma_b_ave_safe 0.0000 0e+00 0e+00 0e+00
mu_b_very_safe 0.0000 0e+00 0e+00 2e-04
sigma_b_very_safe 0.0000 0e+00 0e+00 0e+00
b_wellknown 0.0000 0e+00 0e+00 0e+00
b_ave_loc 0.0000 0e+00 0e+00 0e+00
b_very_loc 0.0000 0e+00 0e+00 0e+00
b_ave_clean 0.0000 0e+00 0e+00 0e+00
mu_b_very_clean 0.0000 0e+00 0e+00 0e+00
sigma_b_very_clean 0.0000 0e+00 0e+00 0e+00
mu_b_quiet_night 0.0000 0e+00 0e+00 0e+00
sigma_b_quiet_night 0.0000 0e+00 0e+00 0e+00
mu_b_quiet_allday 0.0000 0e+00 1e-04 0e+00
sigma_b_quiet_allday 0.0000 0e+00 0e+00 0e+00
mu_b_rev 0.0000 0e+00 0e+00 0e+00
sigma_b_rev 0.0000 0e+00 0e+00 0e+00
sigma_b_ave_safe mu_b_very_safe sigma_b_very_safe b_wellknown
asc_non_purchase 1e-04 3e-04 1e-04 2e-04
mu_b_ttp 0e+00 0e+00 0e+00 0e+00
sigma_b_ttp 0e+00 0e+00 0e+00 0e+00
mu_b_deal 0e+00 1e-04 0e+00 0e+00
sigma_b_deal 0e+00 0e+00 0e+00 0e+00
mu_b_star 0e+00 0e+00 0e+00 0e+00
sigma_b_star 0e+00 0e+00 0e+00 0e+00
mu_b_ave_safe 0e+00 2e-04 0e+00 0e+00
sigma_b_ave_safe 6e-04 0e+00 1e-04 0e+00
mu_b_very_safe 0e+00 5e-04 0e+00 1e-04
sigma_b_very_safe 1e-04 0e+00 4e-04 0e+00
b_wellknown 0e+00 1e-04 0e+00 2e-04
b_ave_loc 0e+00 1e-04 0e+00 0e+00
b_very_loc 0e+00 1e-04 0e+00 0e+00
b_ave_clean 0e+00 0e+00 0e+00 0e+00
mu_b_very_clean 0e+00 0e+00 0e+00 0e+00
sigma_b_very_clean 0e+00 0e+00 0e+00 0e+00
mu_b_quiet_night 0e+00 1e-04 0e+00 1e-04
sigma_b_quiet_night 0e+00 -1e-04 0e+00 0e+00
mu_b_quiet_allday 1e-04 1e-04 0e+00 0e+00
sigma_b_quiet_allday 0e+00 0e+00 0e+00 0e+00
mu_b_rev 0e+00 0e+00 0e+00 0e+00
sigma_b_rev 0e+00 0e+00 0e+00 0e+00
b_ave_loc b_very_loc b_ave_clean mu_b_very_clean
asc_non_purchase 3e-04 4e-04 1e-04 3e-04
mu_b_ttp 0e+00 0e+00 0e+00 0e+00
sigma_b_ttp 0e+00 0e+00 0e+00 0e+00
mu_b_deal 0e+00 0e+00 0e+00 0e+00
sigma_b_deal 0e+00 0e+00 0e+00 0e+00
mu_b_star 0e+00 0e+00 0e+00 0e+00
sigma_b_star 0e+00 0e+00 0e+00 0e+00
mu_b_ave_safe 0e+00 0e+00 0e+00 0e+00
sigma_b_ave_safe 0e+00 0e+00 0e+00 0e+00
mu_b_very_safe 1e-04 1e-04 0e+00 0e+00
sigma_b_very_safe 0e+00 0e+00 0e+00 0e+00
b_wellknown 0e+00 0e+00 0e+00 0e+00
b_ave_loc 3e-04 2e-04 0e+00 1e-04
b_very_loc 2e-04 3e-04 0e+00 0e+00
b_ave_clean 0e+00 0e+00 3e-04 1e-04
mu_b_very_clean 1e-04 0e+00 1e-04 3e-04
sigma_b_very_clean 0e+00 0e+00 0e+00 0e+00
mu_b_quiet_night 0e+00 0e+00 1e-04 1e-04
sigma_b_quiet_night 0e+00 0e+00 0e+00 0e+00
mu_b_quiet_allday 1e-04 0e+00 0e+00 1e-04
sigma_b_quiet_allday 0e+00 0e+00 0e+00 0e+00
mu_b_rev 0e+00 0e+00 0e+00 0e+00
sigma_b_rev 0e+00 0e+00 0e+00 0e+00
sigma_b_very_clean mu_b_quiet_night sigma_b_quiet_night mu_b_quiet_allday
asc_non_purchase -1e-04 4e-04 -1e-04 3e-04
mu_b_ttp 0e+00 0e+00 0e+00 0e+00
sigma_b_ttp 0e+00 0e+00 0e+00 0e+00
mu_b_deal 0e+00 1e-04 0e+00 1e-04
sigma_b_deal 0e+00 0e+00 0e+00 0e+00
mu_b_star 0e+00 0e+00 0e+00 0e+00
sigma_b_star 0e+00 0e+00 0e+00 1e-04
mu_b_ave_safe 0e+00 0e+00 0e+00 0e+00
sigma_b_ave_safe 0e+00 0e+00 0e+00 1e-04
mu_b_very_safe 0e+00 1e-04 -1e-04 1e-04
sigma_b_very_safe 0e+00 0e+00 0e+00 0e+00
b_wellknown 0e+00 1e-04 0e+00 0e+00
b_ave_loc 0e+00 0e+00 0e+00 1e-04
b_very_loc 0e+00 0e+00 0e+00 0e+00
b_ave_clean 0e+00 1e-04 0e+00 0e+00
mu_b_very_clean 0e+00 1e-04 0e+00 1e-04
sigma_b_very_clean 7e-04 0e+00 0e+00 0e+00
mu_b_quiet_night 0e+00 6e-04 -1e-04 3e-04
sigma_b_quiet_night 0e+00 -1e-04 7e-04 -1e-04
mu_b_quiet_allday 0e+00 3e-04 -1e-04 8e-04
sigma_b_quiet_allday 0e+00 1e-04 -3e-04 1e-04
mu_b_rev 0e+00 0e+00 0e+00 0e+00
sigma_b_rev 0e+00 0e+00 0e+00 0e+00
sigma_b_quiet_allday mu_b_rev sigma_b_rev
asc_non_purchase 1e-04 3e-04 1e-04
mu_b_ttp 0e+00 0e+00 0e+00
sigma_b_ttp 0e+00 0e+00 0e+00
mu_b_deal 0e+00 0e+00 0e+00
sigma_b_deal 0e+00 0e+00 0e+00
mu_b_star 0e+00 0e+00 0e+00
sigma_b_star 0e+00 0e+00 0e+00
mu_b_ave_safe 0e+00 0e+00 0e+00
sigma_b_ave_safe 0e+00 0e+00 0e+00
mu_b_very_safe 0e+00 0e+00 0e+00
sigma_b_very_safe 0e+00 0e+00 0e+00
b_wellknown 0e+00 0e+00 0e+00
b_ave_loc 0e+00 0e+00 0e+00
b_very_loc 0e+00 0e+00 0e+00
b_ave_clean 0e+00 0e+00 0e+00
mu_b_very_clean 0e+00 0e+00 0e+00
sigma_b_very_clean 0e+00 0e+00 0e+00
mu_b_quiet_night 1e-04 0e+00 0e+00
sigma_b_quiet_night -3e-04 0e+00 0e+00
mu_b_quiet_allday 1e-04 0e+00 0e+00
sigma_b_quiet_allday 7e-04 0e+00 0e+00
mu_b_rev 0e+00 1e-04 0e+00
sigma_b_rev 0e+00 0e+00 1e-04

Robust covariance matrix:
asc_non_purchase mu_b_ttp sigma_b_ttp mu_b_deal
asc_non_purchase 0.0193 0 0 2e-04
mu_b_ttp 0.0000 0 0 0e+00
sigma_b_ttp 0.0000 0 0 0e+00
mu_b_deal 0.0002 0 0 4e-04
sigma_b_deal -0.0001 0 0 -2e-04
mu_b_star 0.0014 0 0 -1e-04
sigma_b_star -0.0007 0 0 0e+00
mu_b_ave_safe 0.0011 0 0 0e+00
sigma_b_ave_safe 0.0007 0 0 0e+00
mu_b_very_safe 0.0016 0 0 1e-04
sigma_b_very_safe 0.0006 0 0 0e+00
b_wellknown 0.0005 0 0 0e+00
b_ave_loc 0.0005 0 0 1e-04
b_very_loc 0.0006 0 0 0e+00
b_ave_clean 0.0008 0 0 1e-04
mu_b_very_clean 0.0011 0 0 0e+00
sigma_b_very_clean -0.0004 0 0 0e+00
mu_b_quiet_night 0.0024 0 0 1e-04
sigma_b_quiet_night -0.0003 0 0 0e+00
mu_b_quiet_allday 0.0026 0 0 1e-04
sigma_b_quiet_allday 0.0003 0 0 0e+00
mu_b_rev 0.0005 0 0 0e+00
sigma_b_rev 0.0004 0 0 0e+00
sigma_b_deal mu_b_star sigma_b_star mu_b_ave_safe
asc_non_purchase -0.0001 0.0014 -7e-04 0.0011
mu_b_ttp 0.0000 0.0000 0e+00 0.0000
sigma_b_ttp 0.0000 0.0000 0e+00 0.0000
mu_b_deal -0.0002 -0.0001 0e+00 0.0000
sigma_b_deal 0.0022 0.0000 0e+00 0.0000
mu_b_star 0.0000 0.0004 -1e-04 0.0000
sigma_b_star 0.0000 -0.0001 5e-04 0.0000
mu_b_ave_safe 0.0000 0.0000 0e+00 0.0006
sigma_b_ave_safe 0.0001 0.0000 0e+00 0.0002
mu_b_very_safe 0.0000 0.0001 0e+00 0.0006
sigma_b_very_safe 0.0000 0.0000 0e+00 0.0001
b_wellknown 0.0000 0.0001 0e+00 0.0000
b_ave_loc 0.0000 0.0000 0e+00 0.0001
b_very_loc 0.0000 0.0000 0e+00 0.0001
b_ave_clean 0.0001 0.0000 0e+00 0.0002
mu_b_very_clean 0.0000 0.0001 0e+00 0.0002
sigma_b_very_clean 0.0000 0.0000 0e+00 0.0000
mu_b_quiet_night 0.0000 0.0001 0e+00 0.0004
sigma_b_quiet_night 0.0001 0.0000 -1e-04 0.0000
mu_b_quiet_allday 0.0001 0.0001 1e-04 0.0003
sigma_b_quiet_allday 0.0001 0.0000 0e+00 0.0000
mu_b_rev 0.0000 0.0000 1e-04 0.0000
sigma_b_rev -0.0001 0.0000 -1e-04 0.0000
sigma_b_ave_safe mu_b_very_safe sigma_b_very_safe b_wellknown
asc_non_purchase 7e-04 0.0016 0.0006 5e-04
mu_b_ttp 0e+00 0.0000 0.0000 0e+00
sigma_b_ttp 0e+00 0.0000 0.0000 0e+00
mu_b_deal 0e+00 0.0001 0.0000 0e+00
sigma_b_deal 1e-04 0.0000 0.0000 0e+00
mu_b_star 0e+00 0.0001 0.0000 1e-04
sigma_b_star 0e+00 0.0000 0.0000 0e+00
mu_b_ave_safe 2e-04 0.0006 0.0001 0e+00
sigma_b_ave_safe 1e-03 0.0004 0.0004 0e+00
mu_b_very_safe 4e-04 0.0010 0.0004 1e-04
sigma_b_very_safe 4e-04 0.0004 0.0011 0e+00
b_wellknown 0e+00 0.0001 0.0000 2e-04
b_ave_loc 0e+00 0.0001 0.0000 0e+00
b_very_loc 0e+00 0.0001 0.0000 1e-04
b_ave_clean 1e-04 0.0002 0.0000 0e+00
mu_b_very_clean 2e-04 0.0003 0.0000 0e+00
sigma_b_very_clean 1e-04 0.0000 0.0000 0e+00
mu_b_quiet_night 2e-04 0.0005 0.0000 1e-04
sigma_b_quiet_night 0e+00 0.0000 0.0000 0e+00
mu_b_quiet_allday 2e-04 0.0005 0.0000 1e-04
sigma_b_quiet_allday 1e-04 0.0000 0.0000 0e+00
mu_b_rev 0e+00 0.0000 0.0000 0e+00
sigma_b_rev 0e+00 0.0000 0.0000 0e+00
b_ave_loc b_very_loc b_ave_clean mu_b_very_clean
asc_non_purchase 5e-04 6e-04 8e-04 0.0011
mu_b_ttp 0e+00 0e+00 0e+00 0.0000
sigma_b_ttp 0e+00 0e+00 0e+00 0.0000
mu_b_deal 1e-04 0e+00 1e-04 0.0000
sigma_b_deal 0e+00 0e+00 1e-04 0.0000
mu_b_star 0e+00 0e+00 0e+00 0.0001
sigma_b_star 0e+00 0e+00 0e+00 0.0000
mu_b_ave_safe 1e-04 1e-04 2e-04 0.0002
sigma_b_ave_safe 0e+00 0e+00 1e-04 0.0002
mu_b_very_safe 1e-04 1e-04 2e-04 0.0003
sigma_b_very_safe 0e+00 0e+00 0e+00 0.0000
b_wellknown 0e+00 1e-04 0e+00 0.0000
b_ave_loc 3e-04 2e-04 0e+00 0.0001
b_very_loc 2e-04 3e-04 0e+00 0.0001
b_ave_clean 0e+00 0e+00 4e-04 0.0003
mu_b_very_clean 1e-04 1e-04 3e-04 0.0005
sigma_b_very_clean 0e+00 0e+00 0e+00 0.0000
mu_b_quiet_night 1e-04 1e-04 2e-04 0.0004
sigma_b_quiet_night 0e+00 0e+00 0e+00 0.0000
mu_b_quiet_allday 2e-04 2e-04 2e-04 0.0004
sigma_b_quiet_allday 0e+00 0e+00 0e+00 0.0000
mu_b_rev 0e+00 0e+00 0e+00 0.0000
sigma_b_rev 0e+00 0e+00 0e+00 0.0000

Let me know if you need the whole file, so I can email you.

Thanks for your patience!

Best,

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

Re: Problem of Hessian matrix and missing s.e

Post by stephanehess »

Xian

the model with Normals goes to a much better solution than the model with the lognormal. Part of the problem is clearly with your starting values. Your initial LL with the lognormal is terrible, so I think you need to adjust those starting values to be more in line with what you use with the Normals.

In addition however, I noticed that the parameters for the cost coefficient are much smaller than for other attributes, and it might be an idea to rescale your data, working in 100s or 1000s for cost. Having very different scales for individual parameters can hamper convergence

Best wishes

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Post Reply