Open Jaletarfasa opened 1 year ago
This issue is discussed in the FAQ: http://biogeme.epfl.ch/#help It is probably due to the initial value of a scale parameter that is too close to zero.
Unlabelled format with three alternatives(1,2,3)represented with Concept,third alternative is the status quo;Attributes are water supply(levels 1,2,3),Water quality(two levels:1=yes,0=otherwise),and prices(5 levels:3,5,10,15 and 20).I want to apply mixed logit with error components and Quasi-Monte Carlo Simulation,code given below.Any help please.
df
with your datadatabase = db.Database("myDatabase", df)
chosen_alternative = database.variables["Chosen"]
ASC1 = ex.Beta('ASC1', 1, None, None, 0) ASC2 = ex.Beta('ASC2', 1, None, None, 0)
beta1_mean = ex.Beta('beta1_mean', 0, -1000, 1000, 0) # Mean of the distribution for beta1 beta1_stddev = ex.Beta('beta1_stddev', 0, None, None, 0) # Standard deviation of the distribution for beta1 beta1 = beta1_mean + beta1_stddev * ex.bioDraws('beta1', 'UNIFORM')
beta2_mean = ex.Beta('beta2_mean', 0, None, None, 0) # Parameter for water_quality beta2_stddev = ex.Beta('beta2_stddev', 0, None, None, 0) # Standard deviation of the distribution for beta2 beta2 = beta2_mean + beta2_stddev * ex.bioDraws('beta2', 'NORMAL')
beta3_mean = ex.Beta('beta3_mean', 0, None, None, 1) # Parameter for price_increase beta3_stddev = ex.Beta('beta3_stddev', 0, None, None, 0) # Standard deviation of the distribution for beta3 beta3 = beta3_mean + beta3_stddev * ex.bioDraws('beta3', 'UNIFORM')
V0 = beta1 water_supply + beta2 water_quality + beta3 price_increase V1 =ASC1 + beta1 water_supply + beta2 water_quality + beta3 price_increase V2 =ASC1 + beta1 water_supply + beta2 water_quality + beta3 * price_increase
V = {1: V0, 2: V1,3:V2}
av = {1:1,2:1,3:1} num_draws = 10 # Number of Halton draws draws = ex.bioDraws('draws', 'HALTON')
prob = models.logit(V, av, chosen_alternative)
logprob = ex.MonteCarlo(ex.log(prob))
biogeme = bio.BIOGEME(database, logprob)
results = biogeme.estimate()
parameters = results.getEstimatedParameters()
print(parameters)
Thank you so much Professor for the response.
Any help is greatly appreciated. I have difficulty estimating mixed logit model based on the following information and need help.I tried to go through the biogeme documentation and unable to see discussion related with unlabelled format modeling using mixed logit model. Unlabelled format with three alternatives(1,2,3)represented with Concept,third alternative is the status quo;Attributes are water supply(levels 1,2,3),Water quality(two levels:1=yes,0=otherwise),and prices(5 levels:3,5,10,15 and 20).I want to apply mixed logit with error components and Quasi-Monte Carlo Simulation,code given below.Any help please.
df
with your datadatabase = db.Database("myDatabase", df)
chosen_alternative = database.variables["Chosen"]
ASC1 = ex.Beta('ASC1', 1, None, None, 0) ASC2 = ex.Beta('ASC2', 1, None, None, 0)
beta1_mean = ex.Beta('beta1_mean', 0, -1000, 1000, 0) # Mean of the distribution for beta1 beta1_stddev = ex.Beta('beta1_stddev', 0, None, None, 0) # Standard deviation of the distribution for beta1 beta1 = beta1_mean + beta1_stddev * ex.bioDraws('beta1', 'UNIFORM')
beta2_mean = ex.Beta('beta2_mean', 0, None, None, 0) # Parameter for water_quality beta2_stddev = ex.Beta('beta2_stddev', 0, None, None, 0) # Standard deviation of the distribution for beta2 beta2 = beta2_mean + beta2_stddev * ex.bioDraws('beta2', 'NORMAL')
beta3_mean = ex.Beta('beta3_mean', 0, None, None, 1) # Parameter for price_increase beta3_stddev = ex.Beta('beta3_stddev', 0, None, None, 0) # Standard deviation of the distribution for beta3 beta3 = beta3_mean + beta3_stddev * ex.bioDraws('beta3', 'UNIFORM')
V0 = beta1 water_supply + beta2 water_quality + beta3 price_increase V1 =ASC1 + beta1 water_supply + beta2 water_quality + beta3 price_increase V2 =ASC1 + beta1 water_supply + beta2 water_quality + beta3 * price_increase
V = {1: V0, 2: V1,3:V2}
av = {1:1,2:1,3:1} num_draws = 10 # Number of Halton draws draws = ex.bioDraws('draws', 'HALTON')
conditions prob = models.logit(V, av, chosen_alternative)
logprob = ex.MonteCarlo(ex.log(prob))
biogeme = bio.BIOGEME(database, logprob)
results = biogeme.estimate()
parameters = results.getEstimatedParameters()
print(parameters)
On Thu, Jun 29, 2023 at 11:46 PM Michel Bierlaire @.***> wrote:
This issue is discussed in the FAQ: http://biogeme.epfl.ch/#help It is probably due to the initial value of a scale parameter that is too close to zero.
— Reply to this email directly, view it on GitHub https://github.com/michelbierlaire/mooc-discrete-choice/issues/2#issuecomment-1614265568, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4KWMRXONVJXGSNB53NNQ6LXNZ743ANCNFSM6AAAAAAZY2LPMU . You are receiving this because you authored the thread.Message ID: @.***>
while trying to estimate mixed logit model I encountered the following error.Any help is greatly appreciated. BiogemeError: The norm of the gradient is inf: g=[-1.79769313e+308 -1.79769313e+308 -1.79769313e+308 -1.79769313e+308 -1.79769313e+308]