Income Volatility and Portfolio Choice Yongsung Chang, Jay Hong, Marios Karabarbounis, Yicheng Wang, Tao Zhang Contacts: yongsung.chang@gmail.com, jayhong@snu.ac.kr, marios.karabarbounis@rich.frb.org, wangyc@phbs.pku.edu.cn, and tao.zhang@frisch.uio.no. Apr. 2021 -------------------------------------------------------------------------------- The replication files are organized into two main zipped files: (1) Empirical_Analysis -- contains all the codes to replicate the empirical parts of the paper (and the resulting figures used in the paper are also contained separately in the zipped file "Figures_files_for_paper") (2) Model -- contains the codes to solve the model. We provide all the details/explanations for each part below. ======================================================== Empirical analysis ======================================================== -------------------- Description of Code for empirical analysis -------------------- Overview: We have access to the confidential Norwegian adminstration data sets through the Frisch data center at the University of Oslo; all the original data sets come from Norwegian Statistics Bureau and are maintained and secured at the remote computers at Frisch data center. For any researcher, as long as they have access to those underlying Norwegian adminstration data sets, our code can be applied. Below we describe the details of our code that generate all of the empirical results in the paper. In general, the procedure is to use SAS program (SAS 9.0) and Stata (any version later than Stata 12) interactively, to read,transform, clear, select and merge all the needed samples. This is because underlying data sets are too large and using Stata alone would be very slow. In the following we describe all the details when using each code file. The describe mainly follows the order of using code files in the empirical analysis. ---a1_read_income_tax_by_year.do: For each year's income tax records (1994 - 2014), read the original data, rename all variables (from Norwegian names to English names) and define variables for all years so that later on they are used. ---a2_read_wealth_tax_by_year.do: For each year's wealth tax records (1994 - 2014), read the original data, rename all variables (from Norwegian names to English names) and define variables for all years so that later on they are used. ---a3_read_employee_employer_by_year: For each year's matched employer-employee records (1994 - 2014), read the original data, rename all variables (from Norwegian names to English names) and define variables for all years so that later on they are used. Note that in some years, some variables are numerical while in other years they are character variables. ---a1_data_read_merge_individual.sas: After using Stata do files to deal with all the basic cleaning samples and defining variables, we use SAS programs to merge all individual-level data records (1994 - 2014), including individual income tax records, wealth records, matched employer-employee records, demographic information records, marriage information, family-parents-children information. See the paper appendix for more details on this process. ---a2_data_read_merge_spouse.sas: Based on unique individual IDs and marriage information, we can match individuals with their spouses, if any. Further, since for any individual available, we already merged a big file; now we can further bring in the spouse's information. ---a3_data_read_merge_family.sas: Similarly, based on unique individual IDs and family-parents-children information, we can match individuals with their parents and children (if any). --- b3_firm_shocks.sas: used to match individuals with employers' firm characteristics (firms' information on firm ID, income statement variables and a few balance sheet variables from Norwegian Statistics Bureau). ---a4_read_clean_children_information.do: use this do file to simplify each individual' children information, such as the number of young children in the household. After this, we can maintain a wide panel stata structure in stata, and for each (i,t) we only have one line in the data set. ---a4_sas_variable_sample_ss.sas, and a5_basic_data_cleaning.do b1_baseline_sample_selection.do : used to select samples. See the paper appendix for all the details on sample selection. --- Table_figures_main_summaries.do b1_baseline_sample_stats.do: generate summary statistics for the whole sample, and also for the selected samples or the samples used for robustness analysis (Table 1, Table 2, Figure 2, Table 6, Table A1 in Appendix, and Tables O1, O2, O3, and Figures O1, O2, O3 in the Online appendix). Figures O5 and O6 in the Online appendix are generated from Table_figures_main_summaries.do. --- Table_figures_main_summaries.do also generate Figure 3, Figure 4, Table 5 in the main text. ---Table_figures_main_regress.do generates the benchmark results for OLS and IV (Table 4), and also for the events analysis (Table 3) --- Table_figures_main_iv_hetero.do Table_figures_main_iv_robust.do generate the results for regressions: generate the results in Table A4, A5, A6, A7. --- Table_figures_taustar.do provides the analysis for using all time t or using just tau-star as defined in the text. ---Table_figures_Aggregateshocks.do generates the correlations between individual variables and aggregate variables (gdp growth and vix index), as in Table 6. --- Additional analysis results: Table_figures_RR_ymo4050.do analyzes the results for different age groups. Table_figures_RR.do provides additional information (first stages, non-linear analysis, and so on) Lastly, we also provide several ado files that we have used in the remote computer station: _gcorr.ado binscatter.ado coefplot.ado outreg2.ado pshare.ado sumdist.ado. Please see the descriptions in those files for usages. ======================================================== MODEL ======================================================== -------------------- Description of Codes -------------------- The code to solve the model was written in Fortran. We used the Intel Fortran compiler. The Fortran codes use the Intel MKL library and OpenMP. Random numbers are generated via calls to the Fortran intrinsic subroutine, RANDOM_NUMBER, as implemented by the Intel Fortran compiler. On each call to the program, the seed is set internally at the same value. ------------------- Overview of Files ------------------- 1) Main program: Income_volatility_portfolio25Jul20 -- This is the main program 2) Modules: -- mod_bounds_updating: updates the bounds of parameters for the calibration -- mod_polfuncs: solves for the policy functions: consumption, bonds, and stocks -- mod_start_calibration: performs the model???s calibrations -- module_g: makes grid -- module_gini: computes Gini -- module_main_code: the main code that puts together all other codes (used when doing simulated method of moments) -- module_mainforcal: the main code that puts together all other codes (used when doing calibration) -- module_NM: Nelder-Mead optimization code -- module_read: reads and writes files -- module_upd: updates beliefs -- module_LP: does linear interpolation -- simulation_mod: simulates life cycle based on policy functions 3) txt. files: -- Data_moments: empirical targets for calibration (see main text) -- input_age_prod_and_unempl: life cycle productivity profile and unemployment probability -- input_params: values for model parameters -- input_specification: main file to set what version of model to run -- smm_coordinates: file useful for simulated method of moments -- ss_numbers: social security data -- surv_prob: data on survival probability by age ------------------------------- Instructions on How to Run Code ------------------------------- The file input_specification chooses what model to run. In order to run the benchmark model one needs to set PIM=1 and all other model specifications such as iid SV, ARCH, GARCH, adj_cost, bond_only equal to zero. If one needs to run the model with imperfect information then it should set PIM=0 and all other model specifications equal to zero. If one needs to run the model with adjustment costs but perfect information then needs to set PIM=1 and adj_costs=1 while all other model specifications equal to zero. All files are saved in a folder ???Results??? which is attached as part of the files. It is best if the folder exists already when running the code. The code will create a separate file for each model specification. The expected run time for the code is about 10-15 minutes in an Intel i7-7600U CPU@2.80GHZ with 2Cores.