object '"validate"' not found error in MNL_SP
Posted: 15 Jun 2023, 23:59
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: I receive the following:
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:
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
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:
despite the fact that after running theError in apollo_probabilities(apollo_beta, apollo_inputs, functionality = "validate") :
object '"validate"' not found
Code: Select all
apollo_inputs = apollo_validateInputs()
.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)
All example codes are running on my very new laptop..
Any help will be appreciated!
Anat