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: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with 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
irinikalk
Posts: 5
Joined: 31 Jul 2020, 21:14

error: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with estimation!"

Post by irinikalk »

Hi,
when using the Apollo package to estimate a binary choice model I get the error: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with estimation!" I have checked my code and looked into a few forums to try and find where my mistake is but I can't seem to find it. I posted the code below hoping that someone can help me. Thank you in advance!!

-Irini

rm(list=ls())
install.packages("apollo")
library(apollo)
database <- read.csv2("Dutch_daten.csv")
str(database)
database$cost <- as.numeric(as.character(database$cost))
database$ivtt <- as.numeric(as.character(database$ivtt))
database$rpovt <- as.numeric(as.character(database$rpovt))

### Initialise code
apollo_initialise()

### Set core controls
apollo_control= list(
modelName="ApolloNetherlands_Exc",
modelDescr="BinaryChoiceModel",
indivID = "idx.alt"
)

### Define model parameters for specification 0

apollo_beta <- c(b0_rail =0,
b1_cost = 0,
b2_time = 0)
apollo_fixed = c()

### GROUP AND VALIDATE INPUTS
apollo_inputs = apollo_validateInputs()

### DEFINE MODEL AND LIKELIHOOD FUNCTION
apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){


apollo_attach(apollo_beta, apollo_inputs)
on.exit(apollo_detach(apollo_beta, apollo_inputs))


P = list()


V <- list()

V[['rail']] <- b0_rail + b1_cost*cost+ b2_time*(ivtt+rpovt)
V[['car']] <- b1_cost*cost+ b2_time*(ivtt+rpovt)

mnl_settings = list(
alternatives = c(car=1, rail=2),
avail = list(car=1, rail=1),
choiceVar = idx.alt,
V = V
)

P[["model"]]=apollo_mnl(mnl_settings, functionality)


P = apollo_panelProd(P, apollo_inputs, functionality)

P = apollo_prepareProb(P, apollo_inputs, functionality)
return(P)
}

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

model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
stephanehess
Site Admin
Posts: 1042
Joined: 24 Apr 2020, 16:29

Re: error: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with estimation!"

Post by stephanehess »

Hi

is this the only error you receive. Normally, Apollo will provide you with more detail of why the estimation fails. Just scroll up in the output.

But it seems quite clear that your model cannot be estimated as you have two alternatives and include the same attribute with the same parameter in both alternatives. So neither b1_cost nor b2_time will have an impact on the choice probabilities as only differences in utility matter.

Best wishes

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
irinikalk
Posts: 5
Joined: 31 Jul 2020, 21:14

Re: error: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with estimation!"

Post by irinikalk »

Hi Stephane,

I changed my utility functions to:

V[['rail']] <- b0_rail + b1_cost*cost_rail + b2_time*(ivtt_rail +rpovt_rail)
V[['car']] <- b1_cost*cost_car + b2_time*(ivtt_car + rpovt_car)

But I get the same problem. What am I doing wrong now? I simply can't find my mistake.
I am sorry for asking again but I am very new to Apollo.

Kind regards
Irini
stephanehess
Site Admin
Posts: 1042
Joined: 24 Apr 2020, 16:29

Re: error: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with estimation!"

Post by stephanehess »

Can you please post the entire output as there is likely an earlier error message
--------------------------------
Stephane Hess
www.stephanehess.me.uk
irinikalk
Posts: 5
Joined: 31 Jul 2020, 21:14

Re: error: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with estimation!"

Post by irinikalk »

> rm(list=ls())
> library(apollo)
>
> netherlands <- read.delim("netherlands.dat")
> netherlands$mode <- as.factor(netherlands$choice)
> levels(netherlands$mode) <- c("car", "rail", "car", "rail")
> netherlands$idx.alt <- as.numeric(netherlands$mode)
> levels(netherlands$idx.alt) <- c(car=1, rail=2)
>
> database <- na.omit(netherlands)
>
> rm(netherlands)
>
>
> ### Initialise code
> apollo_initialise()
Apollo ignition sequence completed
>
> ### Set core controls
> apollo_control= list(
+ modelName="ApolloNetherlands_Exc",
+ modelDescr="BinaryChoiceModel",
+ indivID = "idx.alt"
+ )
>
> ### Define model parameters for specification 0
>
> apollo_beta <- c(b0_rail =0,
+ b1_cost = 0,
+ b2_time = 0)
> apollo_fixed = c()
>
> ### GROUP AND VALIDATE INPUTS
> apollo_inputs = apollo_validateInputs()
Missing setting for mixing, set to default of FALSE
Missing setting for nCores, set to default of 1
Missing setting for workInLogs, set to default of FALSE
Missing setting for seed, set to default of 13
Missing setting for HB, set to default of FALSE
Several observations per individual detected based on the value of idx.alt.
Setting panelData set to TRUE.
All checks on apollo_control completed.
All checks on data completed.
>
> ### DEFINE MODEL AND LIKELIHOOD FUNCTION
> apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){
+
+
+ apollo_attach(apollo_beta, apollo_inputs)
+ on.exit(apollo_detach(apollo_beta, apollo_inputs))
+
+
+ P = list()
+
+
+ V <- list()
+
+ V[['rail']] <- b0_rail + b1_cost*cost_rail + b2_time*(ivtt_rail+rpovt_rail)
+ V[['car']] <- b1_cost*cost_car + b2_time*(ivtt_car+rpovt_car)
+
+ mnl_settings = list(
+ alternatives = c(rail=1, car=2),
+ avail = list(rail=1, car=1),
+ choiceVar = idx.alt,
+ V = V
+ )
+
+ P[["model"]]=apollo_mnl(mnl_settings, functionality)
+
+
+ P = apollo_panelProd(P, apollo_inputs, functionality)
+
+ P = apollo_prepareProb(P, apollo_inputs, functionality)
+ return(P)
+ }
>
> # ################################################################# #
> #### MODEL ESTIMATION ####
> # ################################################################# #
>
> model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
Validating inputs of likelihood function (apollo_probabilities)

Overview of choices for model component "MNL"
rail car
Times available 1739.00 1739.00
Times chosen 1251.00 488.00
Percentage chosen overall 71.94 28.06
Percentage chosen when available 71.94 28.06

Testing likelihood function
Log-likelihood calculation fails at starting values!
Affected individuals:
ID LL
1 -Inf
Error in apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, :
Not proceeding with estimation
stephanehess
Site Admin
Posts: 1042
Joined: 24 Apr 2020, 16:29

Re: error: "apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, : Not proceeding with estimation!"

Post by stephanehess »

Hi

Apollo shows you that there is a problem at the starting values for the first person. Is there something different about that person, maybe something odd in the data? Or do you maybe have a very large number of observations for that person in which case you might need to use the workInLogs option (see the manual)

Log-likelihood calculation fails at starting values!
Affected individuals:
ID LL
1 -Inf
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Post Reply