import numpy as np
import pandas as pd
import numpy.matlib
import matplotlib as plt
import seaborn as sns
from scipy.optimize import fsolve
import pyblp
from ipywidgets import IntProgress
from IPython.display import display
import time
T = 1000 # number of geographical markets
J = 4 # number of firms
n_sims = 5000 # number of different types of consumers
# Model parameters
beta1 = 2.0 # quality
beta2 = 1/2 # length
beta3 = np.random.normal(4, 4, size=(n_sims, 1)) # Shape (5000, 1)
alpha = -2.0 # price
gamma1 = 1 # observable cost shifter
gamma2 = 1/5 # length
gamma3 = 1 # roof
gamma4 = 1/5; # unobservable quality
X = np.absolute(np.random.standard_normal(size=(T, J)), dtype=np.float64) # Shape (1000, 4)
W = np.absolute(np.random.standard_normal(size=(T, J)), dtype=np.float64) # Shape (1000, 4)
l = np.matlib.repmat(np.random.uniform(5, 10, size=(1, 4)), 1000, 1).astype('float64') # Shape (1000, 4)
xi = np.random.normal(0, 4, size=(T, J)).astype('float64') # Shape (1000, 4)
roof = np.matlib.repmat([1,1,0,0], 1000, 1).astype('float64') # Shape (1000, 4)
mc = gamma1*W + gamma2*l + gamma3*roof + gamma4*xi; # Shape (1000, 4)
p0 = np.random.uniform(5, 10, size=(1, J)).astype('float64') # Shape (1, 4)
P_eq = np.zeros((T, J)).astype('float64') # Shape (1000, 4)
ms_share_eq = np.zeros((T, J)).astype('float64') # Shape (1000, 4)
own_derivative = np.zeros((T, J)).astype('float64') # Shape (1000, 4)
def ms_share(beta1, beta2, beta3, alpha, X, xi, roof, l, p):
J = X.size
Si = beta3.size
delta = np.matlib.repmat(beta1*X + beta2*l + alpha*p + xi, Si, 1) # Shape (5000, 4)
mu = numpy.kron(beta3, np.ones((1,4)))*np.matlib.repmat(roof, Si, 1) # Shape (5000, 4) * Shape (5000, 4)
denominator = np.transpose(np.matlib.repmat(1 + np.sum(np.exp(delta + mu), 1), J, 1)) # Shape (5000, 4)
ms_share = np.mean(np.exp(delta + mu)/denominator,0); # Shape (4,)
return ms_share
def partial(beta1, beta2, beta3, alpha, X, xi, roof, l, p):
J = X.size
Si = beta3.size
delta = np.matlib.repmat(beta1*X + beta2*l + alpha*p + xi, Si, 1) # Shape (5000, 4)
mu = numpy.kron(beta3, np.ones((1,4)))*np.matlib.repmat(roof, Si, 1) # Shape (5000, 4) * Shape (5000, 4)
denominator = np.transpose(np.matlib.repmat(1 + np.sum(np.exp(delta + mu), 1), J, 1)) # Shape (5000, 4)
ds_dp = np.mean(alpha*(np.exp(delta + mu)*denominator - np.exp(2*(delta + mu)))/numpy.square(denominator),0) # Shape (4,)
return ds_dp
f = IntProgress(min=0, max=T) # instantiate the bar
display(f) # display the bar
start = time.time()
for t in range(0, T):
def F(p):
return (p - mc[t,:] + ms_share(beta1, beta2, beta3, alpha, X[t,:], xi[t,:], roof[t,:], l[t,:], p)/partial(beta1, beta2, beta3, alpha, X[t,:], xi[t,:], roof[t,:], l[t,:], p))
P_eq[t] = fsolve(F, p0)
ms_share_eq[t] = ms_share(beta1, beta2, beta3, alpha, X[t,:], xi[t,:], roof[t,:], l[t,:], P_eq[t])
f.value += 1 # increment the progress bar
run_time = time.time() - start
print("Simulation took ", run_time, " seconds.")
Simulation took 124.41976189613342 seconds.
prices = P_eq.flatten()
shares = ms_share_eq.flatten()
lenght = l.flatten()
quality = X.flatten()
roof = roof.flatten()
cost_shifter = W.flatten()
firm_ids = np.matlib.repmat([1,2,3,4], 1, T).flatten()
market_ids = np.repeat(np.arange(1,1001),J)
# creating the Numpy array
array = np.column_stack((prices,shares,lenght,quality,roof,cost_shifter,firm_ids,market_ids))
# creating a list of index names
column_values = ['prices', 'shares', 'lenght',
'quality', 'roof', 'cost_shifter', 'firm_ids', 'market_ids']
product_data = pd.DataFrame(array,
columns = column_values)
product_data
prices | shares | lenght | quality | roof | cost_shifter | firm_ids | market_ids | |
---|---|---|---|---|---|---|---|---|
0 | 3.746268 | 0.224708 | 7.395573 | 0.982069 | 1.0 | 0.524319 | 1.0 | 1.0 |
1 | 4.247649 | 0.164825 | 7.674426 | 0.182237 | 1.0 | 0.701554 | 2.0 | 1.0 |
2 | 2.572942 | 0.199453 | 7.673151 | 1.200611 | 0.0 | 0.150566 | 3.0 | 1.0 |
3 | 5.222777 | 0.385471 | 6.314065 | 2.896511 | 0.0 | 2.025345 | 4.0 | 1.0 |
4 | 7.681624 | 0.642609 | 7.395573 | 0.087829 | 1.0 | 0.124139 | 1.0 | 2.0 |
... | ... | ... | ... | ... | ... | ... | ... | ... |
3995 | 3.765716 | 0.335493 | 6.314065 | 0.874694 | 0.0 | 0.941792 | 4.0 | 999.0 |
3996 | 2.503812 | 0.184847 | 7.395573 | 1.234886 | 1.0 | 0.054585 | 1.0 | 1000.0 |
3997 | 5.731664 | 0.523512 | 7.674426 | 1.114122 | 1.0 | 0.900762 | 2.0 | 1000.0 |
3998 | 2.972281 | 0.144991 | 7.673151 | 0.739671 | 0.0 | 0.519267 | 3.0 | 1000.0 |
3999 | 2.656460 | 0.007271 | 6.314065 | 1.427184 | 0.0 | 1.614740 | 4.0 | 1000.0 |
4000 rows × 8 columns
product_data.describe()
prices | shares | lenght | quality | roof | cost_shifter | firm_ids | market_ids | |
---|---|---|---|---|---|---|---|---|
count | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 |
mean | 3.692265 | 0.209987 | 7.264304 | 0.801251 | 0.500000 | 0.785194 | 2.500000 | 500.500000 |
std | 1.448905 | 0.178423 | 0.560325 | 0.591217 | 0.500063 | 0.598119 | 1.118174 | 288.711081 |
min | -0.398600 | 0.000002 | 6.314065 | 0.000665 | 0.000000 | 0.000141 | 1.000000 | 1.000000 |
25% | 2.667577 | 0.048503 | 7.125196 | 0.342449 | 0.000000 | 0.312288 | 1.750000 | 250.750000 |
50% | 3.592307 | 0.168883 | 7.534362 | 0.676624 | 0.500000 | 0.648436 | 2.500000 | 500.500000 |
75% | 4.610023 | 0.342669 | 7.673470 | 1.145937 | 1.000000 | 1.135429 | 3.250000 | 750.250000 |
max | 9.641079 | 0.795578 | 7.674426 | 3.558058 | 1.000000 | 3.562289 | 4.000000 | 1000.000000 |
product_data_matlab = pd.read_excel('data/boat_data.xlsx')
product_data_matlab.describe()
prices | shares | lenght | quality | cost_shifter | roof | firm_ids | market_ids | |
---|---|---|---|---|---|---|---|---|
count | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 | 4000.000000 |
mean | 3.595558 | 0.203365 | 7.092398 | 0.807797 | 0.817279 | 0.500000 | 2.500000 | 500.500000 |
std | 1.192879 | 0.154447 | 1.381030 | 0.620608 | 0.608630 | 0.500063 | 1.118174 | 288.711081 |
min | 0.755311 | 0.000038 | 5.780847 | 0.000170 | 0.000676 | 0.000000 | 1.000000 | 1.000000 |
25% | 2.651863 | 0.069219 | 6.064973 | 0.316657 | 0.338122 | 0.000000 | 1.750000 | 250.750000 |
50% | 3.549439 | 0.176221 | 6.626017 | 0.677656 | 0.711473 | 0.500000 | 2.500000 | 500.500000 |
75% | 4.460009 | 0.310952 | 7.653442 | 1.162209 | 1.144165 | 1.000000 | 3.250000 | 750.250000 |
max | 8.494363 | 0.727793 | 9.336710 | 4.356226 | 4.121269 | 1.000000 | 4.000000 | 1000.000000 |
sns.histplot(data=product_data, x="prices", color = 'red')
sns.histplot(data=product_data_matlab, x="prices")
<AxesSubplot:xlabel='prices', ylabel='Count'>
sns.histplot(data=product_data, x="shares", color = 'red')
sns.histplot(data=product_data_matlab, x="shares")
<AxesSubplot:xlabel='shares', ylabel='Count'>
# Cost shifter
product_data = product_data.rename(columns={'cost_shifter': 'demand_instruments0'})
# Comp cost shifter
product_data['demand_instruments1']= product_data.groupby(['market_ids'])['demand_instruments0'].transform("sum") - product_data['demand_instruments0']
# Comp quality
product_data['demand_instruments2']= product_data.groupby(['market_ids'])['quality'].transform("sum") - product_data['quality']
product_formulations = (
pyblp.Formulation('-1 + quality + lenght + prices + roof'), ## Linear demand parameters
pyblp.Formulation('-1 + roof') ## Random coef variabels
)
n_sim = 1000
mc_integration = pyblp.Integration('monte_carlo', size = n_sim, specification_options={'seed': 0}) ## Monte carlo simulation for integration in the inner loop
problem = pyblp.Problem(product_formulations, product_data, integration = mc_integration) ## Formulate problem
bfgs = pyblp.Optimization('bfgs', {'gtol': 1e-4}) ## Use Broyden–Fletcher–Goldfarb–Shanno algorithm within PyBlp
initial_sigma = np.array([4]) ## Just a guess
Initializing the problem ... Initialized the problem after 00:00:00. Dimensions: ========================================== T N F I K1 K2 MD ---- ---- --- ------- ---- ---- ---- 1000 4000 4 1000000 4 1 6 ========================================== Formulations: ============================================================ Column Indices: 0 1 2 3 ----------------------------- ------- ------ ------ ---- X1: Linear Characteristics quality lenght prices roof X2: Nonlinear Characteristics roof ============================================================
# Solve in parallel
with pyblp.parallel(6):
results = problem.solve(
initial_sigma, # Initial sigmas
optimization=bfgs, ## Artelys Knitro is best practice but commercial
method='1s' ## 1 Step GMM
)
Starting a pool of 6 processes ... Started the process pool after 00:00:00. Solving the problem ... Nonlinear Coefficient Initial Values: ===================== Sigma: roof ------ ------------- roof +4.000000E+00 ===================== Starting optimization ... At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. GMM Optimization Objective Fixed Point Contraction Clipped Objective Objective Gradient Step Iterations Evaluations Iterations Evaluations Shares Value Improvement Norm Theta ---- ------------ ----------- ----------- ----------- ------- ------------- ------------- ------------- ------------- 1 0 1 10485 31992 0 +2.804638E+00 +8.728490E-02 +4.000000E+00 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 0 2 10563 32253 0 +2.797013E+00 +7.625139E-03 +8.743310E-02 +4.087285E+00 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 0 3 10658 32463 0 +2.766387E+00 +3.062565E-02 +8.799084E-02 +4.436424E+00 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 0 4 10881 33281 0 +2.642464E+00 +1.239231E-01 +8.912370E-02 +5.832983E+00 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 0 5 12864 39264 0 +2.178618E+00 +4.638466E-01 +7.230909E-02 +1.141922E+01 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 1 6 20042 60941 0 +1.703994E+00 +4.746233E-01 +1.617493E-02 +2.890749E+01 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 2 7 18987 57773 0 +1.676621E+00 +2.737321E-02 +9.106201E-04 +2.571062E+01 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 3 8 19013 57822 0 +1.676535E+00 +8.604121E-05 +8.515005E-06 +2.551991E+01 Optimization completed after 00:02:39. Computing the Hessian and estimating standard errors ... Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. Computed results after 00:01:04. Problem Results Summary: =============================================================================================== GMM Objective Gradient Clipped Weighting Matrix Covariance Matrix Step Value Norm Hessian Shares Condition Number Condition Number ---- ------------- ------------- ------------- ------- ---------------- ----------------- 1 +1.676535E+00 +8.515005E-06 +3.981741E+09 0 +2.940013E+02 +1.696781E+08 =============================================================================================== Cumulative Statistics: =========================================================================== Computation Optimizer Optimization Objective Fixed Point Contraction Time Converged Iterations Evaluations Iterations Evaluations ----------- --------- ------------ ----------- ----------- ----------- 00:03:43 Yes 4 9 113493 345789 =========================================================================== Nonlinear Coefficient Estimates (Robust SEs in Parentheses): ======================= Sigma: roof ------ --------------- roof +2.551991E+01 (+2.077616E+02) ======================= Beta Estimates (Robust SEs in Parentheses): ================================================================== quality lenght prices roof --------------- --------------- --------------- --------------- +4.468851E+00 +1.225829E+00 -4.311586E+00 +8.676607E+00 (+2.526187E+01) (+7.329748E+00) (+2.396996E+01) (+4.834692E+01) ================================================================== Terminating the pool of 6 processes ... Terminated the process pool after 00:00:00.
updated_problem = results.compute_optimal_instruments(method='approximate').to_problem()
with pyblp.parallel(6):
updated_results = updated_problem.solve(
results.sigma,
results.pi,
optimization=bfgs,
method='1s'
)
Computing optimal instruments for theta ... Computed optimal instruments after 00:00:03. Optimal Instrument Results Summary: ======================= Computation Error Term Time Draws ----------- ---------- 00:00:03 1 ======================= Re-creating the problem ... Re-created the problem after 00:00:00. Dimensions: ========================================== T N F I K1 K2 MD ---- ---- --- ------- ---- ---- ---- 1000 4000 4 1000000 4 1 5 ========================================== Formulations: ============================================================ Column Indices: 0 1 2 3 ----------------------------- ------- ------ ------ ---- X1: Linear Characteristics quality lenght prices roof X2: Nonlinear Characteristics roof ============================================================ Starting a pool of 6 processes ... Started the process pool after 00:00:00. Solving the problem ... Nonlinear Coefficient Initial Values: ===================== Sigma: roof ------ ------------- roof +2.551991E+01 ===================== Starting optimization ... At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. GMM Optimization Objective Fixed Point Contraction Clipped Objective Objective Gradient Step Iterations Evaluations Iterations Evaluations Shares Value Improvement Norm Theta ---- ------------ ----------- ----------- ----------- ------- ------------- ------------- ------------- ------------- 1 0 1 19013 57822 0 +1.872271E+04 +1.883825E+03 +2.551991E+01 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 0 2 18231 55488 0 +1.686852E+04 +1.854193E+03 +1.787845E+03 +2.450991E+01 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. The fixed point computation of delta failed to converge. This problem can sometimes be mitigated by increasing the maximum number of fixed point iterations, increasing the fixed point tolerance, choosing more reasonable initial parameter values, setting more conservative parameter or share bounds, or using different iteration or optimization configurations. 1 0 3 18442 56084 0 +1.042099E+04 +6.447523E+03 +1.404028E+03 +2.046991E+01 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 1 4 11765 35934 0 +4.128221E+02 +1.000817E+04 +2.750264E+02 +8.526087E+00 1 2 5 10880 33306 0 +6.741213E-01 +4.121480E+02 +1.084285E+01 +5.616556E+00 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 3 6 10862 33242 0 +1.105892E-03 +6.730154E-01 +4.383667E-01 +5.497141E+00 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 4 7 10852 33206 0 +9.056044E-09 +1.105883E-03 +1.254342E-03 +5.492110E+00 At least one error was encountered. As long as the optimization routine does not get stuck at values of theta that give rise to errors, this is not necessarily a problem. If the errors persist or seem to be impacting the optimization results, consider setting an error punishment or following any of the other suggestions below: Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. 1 5 8 10865 33241 0 +1.289038E-16 +9.056044E-09 +1.496594E-07 +5.492095E+00 Optimization completed after 00:02:43. Computing the Hessian and estimating standard errors ... Encountered a numerical error when computing delta. This problem is often due to prior problems, overflow, or nonpositive shares, and can sometimes be mitigated by choosing smaller initial parameter values, setting more conservative bounds on parameters or shares, rescaling data, removing outliers, changing the floating point precision, or using different optimization, iteration, or integration configurations. Errors encountered: divide by zero. Computed results after 00:01:01. Problem Results Summary: =============================================================================================== GMM Objective Gradient Clipped Weighting Matrix Covariance Matrix Step Value Norm Hessian Shares Condition Number Condition Number ---- ------------- ------------- ------------- ------- ---------------- ----------------- 1 +1.289038E-16 +1.496594E-07 +8.686955E+01 0 +2.160509E+08 +7.884913E+03 =============================================================================================== Cumulative Statistics: =========================================================================== Computation Optimizer Optimization Objective Fixed Point Contraction Time Converged Iterations Evaluations Iterations Evaluations ----------- --------- ------------ ----------- ----------- ----------- 00:03:44 Yes 6 9 110910 338323 =========================================================================== Nonlinear Coefficient Estimates (Robust SEs in Parentheses): ======================= Sigma: roof ------ --------------- roof +5.492095E+00 (+6.738935E-01) ======================= Beta Estimates (Robust SEs in Parentheses): ================================================================== quality lenght prices roof --------------- --------------- --------------- --------------- +2.053695E+00 +5.236543E-01 -2.016543E+00 +4.051410E+00 (+1.437110E-01) (+6.196048E-02) (+1.616838E-01) (+2.728084E-01) ================================================================== Terminating the pool of 6 processes ... Terminated the process pool after 00:00:00.