This topic contains 8 replies, has 2 voices, and was last updated by Shengzhi Mao July 21, 2021 at 2:39 am.
May 18, 2021 at 7:16 am #1923
Recently I’m reading your answer and codes to exercise 10.6, which is based on Sommer (JME, 2016) “Fertility choice in a life cycle model with idiosyncratic uninsurable earnings risk”. I find that this exercise is quite interesting and important for us to deal with discrete and continuous choices simultaneously.
After learning the codes in your book, I read Sommer’s paper, which contained a popular method for calibrating all the parameters, i.e., the simulated method of moments. This SMM is very useful and powerful, and I really wanna learn this method. However, there are no codes about Sommer (JME,2016) posted online, and it’s hard to find any books teaching this method clearly with well-explained codes. So would you please share some materials now and add this SMM part to your book in the future edition? Do appreciate it!
Shengzhi MaoJune 28, 2021 at 8:20 am #1929
point well taken. This certainly is a useful addition to our book, and I put it on the list for a future edition. In the meanwhile, you might want to take a look at the codes to our paper “Bargaining over Babies: Theory, Evidence and Policy Implications”. There we use a simulated method of moment approach to calibrate parameters (although we no not calculate standard errors). But this model most importantly contains a solution routine called
simulated_annealingthat you can use to solve those parameter problems. The method uses stochastic simulation to overcome the problem of having multiple local optima in the RSS function.
Take a look, I hope this helps.
Thanks for the great suggestion,
FabianJuly 17, 2021 at 5:52 am #1934
Thank you for accepting my advice and also for sharing the paper “Bargaining over Babies: Theory, Evidence and Policy Implications”. Recently, I’ve read the paper and learned the simulated annealing method with online materials, which is quite interesting and useful.
Now I’m trying to run the Fortran codes of your paper. However, I got some problems with the toolbox.f90 file, which failed at line 3655 ( function log_gamma(x_in) ) with
Error: ‘log_gamma’ declared at (1) may shadow the intrinsic of the same name. In order to call the intrinsic, explicit INTRINSIC declarations may be required. [-Werror=intrinsic-shadow].
I checked the internet while did not find useful solutions.
Another problem comes from policy_analysis.f90, which fails at line 336 (middle = (left+right)/2d0) with
Error: ‘left’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
policy_analysis.f90:336:0: Error: ‘right’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
as well as line 345 (if(fmiddle <= tfr_increase .and. fright >= tfr_increase)then) with
Error: ‘fright’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
Hope you can give some hints for dealing with the errors. Thank you so much!
Shengzhi MaoJuly 19, 2021 at 10:44 am #1936
this is strange. Did you try running it through the provided make file? Or did you run it through geany? Running it through geany might get you into some trouble, because you are running the toolbox twice, i.e. the toolbox included into your installation and the toolbox that comes with AER code. Try using it without the toolbox.f90 file.
With regards to the policy_analysis.f90, you can add the code lines
right = left fright = fleft
directly after line 287, where fleft is computed. This should solve the error message, but has no impact on the results anyway.
FabianJuly 20, 2021 at 2:18 pm #1937
As you said, without running the toolbox.f90, and add the two code lines in policy_analysis.f90, I can compile all the codes in Geany now. However, I still get many errors when I build the fertdec.f90, which reports:
Undefined symbols for architecture x86_64: "___estimation_MOD_do_estimation", referenced from: _main in fertdec.o "___estimation_MOD_setup_estimation", referenced from: _main in fertdec.o "___globals_MOD_alpha", referenced from: _main in fertdec.o "___globals_MOD_beta", referenced from: _main in fertdec.o "___globals_MOD_dist_hc", referenced from: _basic_setup.3457 in fertdec.o _main in fertdec.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status
I just list some typical errors, and I guess they are due to some common problems. I’m running the codes on MacOS Sierra, version 10.12.4 with Geany version 1.37.1.
ShengzhiJuly 20, 2021 at 3:31 pm #1938
this is because you should actually run the codes through the
makefile. This would make your life much easier.
If you want to run the codes directly through geany, you would have to proceed in the following steps:
- Take all the
.f90codes from the folder
srcand copy them into the base folder of the replication directory (one folder up).
- Now open
fertdec.f90and include all respective
.f90files that contain modules. I suggest to use the following order
Include these statements right before the
This should allow you to run the entire code from geany. Let me know if it worked.
FabianJuly 20, 2021 at 6:06 pm #1939
Thank you very much. As you said, now I get way much fewer problems, but still have two errors:
Undefined symbols for architecture x86_64: "_omp_get_max_threads_", referenced from: ___simulated_annealing_MOD_sa_minsearch in fertdec.o "_omp_set_num_threads_", referenced from: ___simulated_annealing_MOD_sa_minsearch in fertdec.o ___estimation_MOD_do_estimation in fertdec.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status
I tried to rearrange the order of “include ‘simulated_annealing.f90′”, but still failed. After solving this problem, I guess it will be working.
ShengzhiJuly 20, 2021 at 7:21 pm #1940
it seems you are missing the -fopenmp compiler option. Maybe it would be a good idea to download and install the lates Fortran installation kit from our website. Then all settings should be set to get this going.
FabianJuly 21, 2021 at 2:39 am #1941
Thank you for your patience and guidance. It works perfectly now. I will work hard to learn the codes and this COOL method. Do appreciate it!
- Take all the
You must be logged in to reply to this topic.