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.

object '"validate"' not found error in MNL_SP

Report bugs or highlight issues with Apollo functions. At a minimum, please include the part of the output where you believe the bug is manifested. Ideally, please share your model file.
Post Reply
manes
Posts: 16
Joined: 15 Jun 2023, 13:13
Location: Israel
Contact:

object '"validate"' not found error in MNL_SP

Post by manes »

Hi,
I'm new to this forum. I just quit Stata after the recent (and excellent) advanced CMC course in Leeds.
I have followed all three steps prior to posting this Q.
I'm running a very basic MNL model (I have not included any covariates other than the atts of the alts.)
I can't figure out why I keep receiving the following error message:
Error in apollo_probabilities(apollo_beta, apollo_inputs, functionality = "validate") :
object '"validate"' not found
despite the fact that after running the

Code: Select all

apollo_inputs = apollo_validateInputs()
I receive the following:
Several observations per individual detected
based on the value of ID. Setting panelData in apollo_control set to TRUE.
All checks on apollo_control completed.
All checks on database completed.
.
This is the data: https://www.dropbox.com/s/p5mdvvdeec2w9 ... 1.csv?dl=0
It includes 2404 observations of 601 respondents making 4 SP choice tasks, each choice task is between ICE and Hybrid vehicle.

This is the code:

Code: Select all

setwd("C:/Users/Anat/Dropbox/Rfiles/radiation")
rm(list = ls())
library ("apollo")
apollo_initialise()
apollo_control = list(
modelName       = "MNL_A",
 indivID         = "ID",
  outputDirectory = "output"
)

database=read.csv("data_wide_mnl1.csv",header=TRUE)
apollo_beta=  c(asc_ice     =0, 
                    asc_hybrid   = 0,
                    b_cost       = 0,
                    b_radiation  = 0,
                    b_safety     = 0,
                    b_hp         = 0,
                    b_trunk       =0,
                    b_emission    =0)

apollo_fixed = c("asc_ice")
apollo_inputs = apollo_validateInputs()

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[["ice"]]  =    asc_ice  +  b_cost* ice_cost +   b_radiation * ice_radiation  + b_safety*ice_safety +    beta_hp*ice_hp +      
                      b_trunk*ice_trunk+  b_emission*ice_emission 
V[["hybrid"]] = asc_hybrid  + b_cost*hybrid_cost + b_radiation*hybrid_radiation + b_safety*hybrid_safety + beta_hp*hybrid_hp + 
                      b_trunk*hybrid_trunk+ b_emission*hybrid_emission 
  
 mnl_settings = list(
 alternatives  = c(hybrid=1, ice=2),
 choiceVar     = choice,
utilities     = 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 = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
I might have an issue with scaling the data (I have 000' vars and 1-10 vars) but I don't think that this is the problem..
All example codes are running on my very new laptop..
Any help will be appreciated!
Anat
Anat Tchetchik
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: object '"validate"' not found error in MNL_SP

Post by stephanehess »

Hi Anat

are you by any chance running R4.3.0 or another very recent version. The R team made a change that led to this rather unhelpful error message. If you upgrade to R4.3.1, you will get the right messages

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
manes
Posts: 16
Joined: 15 Jun 2023, 13:13
Location: Israel
Contact:

Re: object '"validate"' not found error in MNL_SP

Post by manes »

Thank you Stephane,
It seems that I have a problem.
I uninstall both R and R studio and then re-install R 4.3.1 and R studio.
I then run

Code: Select all

 install.packages("apollo")
and receive:
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Anat/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/co ... _0.2.9.zip'
Content type 'application/zip' length 2174096 bytes (2.1 MB)
downloaded 2.1 MB
I'm not sure how to go from here, will try to sort it out.
Anat
Anat Tchetchik
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: object '"validate"' not found error in MNL_SP

Post by stephanehess »

Hi Anat

if you reinstalled RStudio, then you may need to reinstall Rtools too as it says. Did you try that?

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
manes
Posts: 16
Joined: 15 Jun 2023, 13:13
Location: Israel
Contact:

Re: object '"validate"' not found error in MNL_SP

Post by manes »

yes, I have R4.3.1, Rtools43, and RStudio 0.2.9 all installed (by this order)
After validate returns:
All checks on apollo_control completed. All checks on database completed
The error is:
Testing likelihood function...
Error in apollo_probabilities(apollo_beta, apollo_inputs, functionality = "validate") :
object 'hybrid_radiation' not found
It's weird since hybrid_radiation does exist in the database, I didn't touch anything.
this is my V specification:

Code: Select all

V=list()
V[["hybrid"]] = asc_hybrid  + b_cost*hybrid_cost + b_radiation* hybrid_radiation + b_safety*hybrid_safety + beta_hp*hybrid_hp + 
                      b_trunk*hybrid_trunk+ b_emission*hybrid_emission 
V[["ice"]]  = asc_ice  +          b_cost* ice_cost +   b_radiation * ice_radiation +        b_safety*ice_safety +    beta_hp*ice_hp +      
                    b_trunk*ice_trunk+  b_emission*ice_emission 
and that's a screenshots of the database:
Image
Anat Tchetchik
manes
Posts: 16
Joined: 15 Jun 2023, 13:13
Location: Israel
Contact:

Re: object '"validate"' not found error in MNL_SP

Post by manes »

I found the mistake! just a simple syntax... thank you, Stephan, I was that close to give up (:
Anat Tchetchik
Sanesk
Posts: 3
Joined: 10 Jul 2023, 07:29

Re: object '"validate"' not found error in MNL_SP

Post by Sanesk »

Hi, I found the same question that "validate"' not found. How did you solve it?
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: object '"validate"' not found error in MNL_SP

Post by stephanehess »

Hi

did you update to the new version of R?

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Sanesk
Posts: 3
Joined: 10 Jul 2023, 07:29

Re: object '"validate"' not found error in MNL_SP

Post by Sanesk »

Yes. I have R4.3.1
Sanesk
Posts: 3
Joined: 10 Jul 2023, 07:29

Re: object '"validate"' not found error in MNL_SP

Post by Sanesk »

Oh I see, I launched the wrong version. Thank you!
Post Reply