Changes

Jump to navigation Jump to search
Main Project here: [[Estimating Unobserved Complementarities between Entrepreneurs and Venture Capitalists]]
 
==Important contractions==
 
*GMM: Generalized Method of Moments
*MSM: Method of Simulated Moments
*MLE: Maximum Likelihood Estimation
*GA: Genetic Algorithm
*SE: Standard Error
==How to run==
First, apparently, you need a gurobi license, which can be obtained (free) [http://www.gurobi.com/registration/academic-license-reg here].
In master.m, edit the options section to reflect what you want the code to do. Then run it.
'''task:''' Can take the values {'data', 'monte', 'monte_data'}.
'''estimator:''' Can take the values {'MLE', 'MSM', 'compare'}.(other estimators removed in readjusted code)* MSM stands for Markov State Model* MLE stands for Maximum Likelihood Estimation* compare** compare is valid only under task='monte''''use_solver:''' Can take the values {'fminunc', 'ga', 'patternsearch', 'cmaes'}.* GA stands for genetic algorithm* fminunc* patternsearch* cmaes'''error_type''' (currently hard coded as 1): 1 for match specific errors, with the error distribution following an exchangeable structure. var(e) = sig^2, and cov(e,e'other solvers removed in readjusted code) = 1/4*sig^2. 2 for agent specific errors, with the error structure of match <i, j> as sig*ei*ej.
'''error_type''' (currently hard coded as 1 and isn't fully written to support 2): 1 for match specific errors, with the error distribution following an exchangeable structure. var(e) = sig^2, and cov(e,e') = 1/4*sig^2. 2 for agent specific errors, with the error structure of match <i, j> as sig*ei*ej. ===strip_mastergmm_2stage_estimation.m===Seems to be a version Does the majority of masterthe work for this problem.m that only uses Runs the GA, saves the parameters task = results to 'monte_dataempirics_match_specific_1st_stage_ga', use_solver = then runs it again with different globals, and saves it to 'gaempirics_match_specific_2nd_stage_ga'. ===nonlinearcons_msm.m=== Constraints on GA. For [c, ceq] = nonlinearcons_msm(x), GA constrains x such that c ≤ 0 and estimator ceq = 'MSM' (which apparently 0. c and ceq are row vectors when there are multiple constraints. ceq is unused for our purposes. ===msmf_corr_coeff.m=== This is the only values that work for masterfitness function. Takes a vector and returns a scalar. GA minimizes this function. ===moments.m, but unverified)=== Generates the moments needed for the GMM.
==Location/Structure of Data==
'''empirics_match_specific_2nd_stage_ga''':
'''empirics_match_specific_1st_stage_cmaesempirics_match_specific_with_se''':
'''empirics_match_specific_2nd_stage_cmaestype_(error_type)_monte_mktsize_(mktsize)_K_(K)_S_(S)_rep_(montenn)''':
'''empirics_match_specific_with_se''': Saved if task = 'data'=Bugs==
'''type_Simulated moments matrix dimension mismatch. This bug (also in the adjusted code) does not allow the "optimal stage" to complete.   Assignment has more non-singleton rhs dimensions than non-singleton subscripts Error in gmm_2stage_estimation (line 65) EV(:, :, m) = EV(error_type:, :, m)_monte_mktsize_+ temp2; Error in master (mktsizeline 513)_K_ gmm_2stage_estimation; This is caused because temp2 is 166x166 in monte_data, but nm = M = 1, so EV is 1x1. nm is set to size(KM0, 1)_S_, but M0 is sometimes a scalar? This is solved by commenting out mkt_resample.m line 107: % M0 = moments(M, 1, S, K, pv', asg, H, HK, G, FF, Hu, Hd, z1, z2, psa, ps1, ps2, N1, N2)_rep_ because it returns a scalar, but should return a 166x1 vector. Better fix notes:The problem is narrowed down to the section of mkt_resample.m before the call to moments. Somehow the parameters to moments are changed such that it returns a scalar. Solution found (montennI think):monte_M cannot be set to 1. For values greater than 1, the program seems to work. It doesn't crash, anyway. ==Profiling== Ran first iteration with task='monte', use_solver='ga', estimator='MSM', gurobi output disabled (took 42 sec to finish 1st iteration) [[File:Unobserved comp profile monte.png]] Monte_data and monte run much faster than data, because data is so large. ==Notes== There is a lot of unused code. For example, monte_std and monte_x seem to only be assigned, not used.

Navigation menu