**************************************************************************************** ** This program is written for Stata v10. The program inputs and formats the data ** ** required for the logit regression in "Halting FOreclosures by Changing the Rules: ** ** The Mortgage Foreclosure Moratoria during the Great Depression" by Dave Wheelock ** ** Program written by Craig Aubuchon ** **************************************************************************************** ***************************************************************************************** *** Note: To infile data, the commands below assume the data comes from a *.csv fle *** *** with the names of the variables on the first row, data beginning in the second *** *** row. To run the program and replicate the data, each worksheet of the attatched *** *** data file should be saved as a separate *.csv file with the same name *** *** and remove the source notation from the top of every page. *** *** For help, see 'infile' in the Stata help manual. *** ***************************************************************************************** clear capture log close log using MortgageLaw, replace set more off ******************************************************* ** Infile Moratorium Data and Population Census Data ** ******************************************************* cd "WORKING DIRECTORY" insheet using "State Mortgage Law.csv", comma names label var popd30 "Population per Square Mile in 1930" label var farmpop "Population on Farms in 1930" * Create New Variables generate Per_Farm_Mortgaged = mortgaged_farms / all_owned_farms label var Per_Farm_Mortgaged "Percent of Farms Mortgaged" generate FederallyHeld_Debt = (amtclosed17_20 + amtclosed21_24 + amtclosed25_28 + amtclosed29_32) / farm_mortgage_debt label var FederallyHeld_Debt "Federally Held Mortgage Debt" * Create the variables for percent of nonfarm (urban and rural) owned homes and percent of owned farm homes generate NFhomes = ( ownedurban + ownedruralnf ) / ( totalurban + totalruralnf ) generate Fhomes = ( ownedruralfarm / totalruralfarm ) label var NFhomes "percent of owned nonfarm homes" label var Fhomes "percent of owned farm homes" keep state stateab stateid moratorium medianhvalue popd30 farmpop Per_Farm_Mortgaged FederallyHeld_Debt NFhomes Fhomes save mortgagelaw, replace clear ********************************** *** Data on Farm Foreclosures *** ********************************** insheet using farmfo1929_32.csv, comma names rename v1 state rename v2 stateab label var f1932 "Farm Foreclosures 1932" label var f_avg_1929_32 "Avg Farm Foreclosures 1929 to 1932" save farmfo, replace clear ********************************************************************* *** Merge Data Sets by State ID to get full data set for analysis *** ********************************************************************* merge stateab using mortgagelaw farmfo, sort * Drop Alaska, Hawaii and District of Columbia drop if stateab == "DC" | stateab == "AK" | stateab == "HI" drop _merge _merge1 _merge2 save moratorium_data, replace * Create Correlation Matrix and Summary Statistics. This data can be best read in the log file. describe correlate moratorium f1932 f_avg_1929_32 medianhvalue popd30 farmpop Per_Farm_Mortgaged FederallyHeld_Debt NFhomes Fhomes, means ******************************************************************* ** Logit model is used with dependent variable 0 or 1 and is of ** ** the form log ( xB / (1 - xB) ). ** ** See 'help logit' for details. ** ** the command 'mfx' is the marginal effects in the logit model ** ******************************************************************* clear capture log close log using MortgageLogit, replace set more off cd "WORKING DIRECTORY" use moratorium_data ***************** ** Model 1 ** ***************** * This model replicates Alston's 1984 AER paper logit moratorium f1932 Per_Farm_Mortgaged FederallyHeld_Debt mfx predict double resid1, residual label var resid1 "Pearson Residual Model 1" outsheet stateab stateid resid1 using "Model 1 Residuals" ***************************************************************** ** Create Regional Dummy Variables and Interaction Variables ** ***************************************************************** generate midwest = 1 if stateab == "ND" | stateab == "SD" | stateab == "NE" | stateab == "KS" | stateab == "MN" | stateab == "IA" | stateab == "MO" | stateab == "WI" | stateab == "IL" | stateab == "MI" | stateab == "IN" | stateab == "OH" replace midwest = 0 if midwest ==. generate west = 1 if stateab == "WA" | stateab == "OR" | stateab == "CA" | stateab == "MT" | stateab == "ID" |stateab =="NV" |stateab=="AZ"|stateab=="WY"|stateab=="UT"|stateab=="CO"|stateab=="NM" replace west = 0 if west ==. generate south = 1 if stateab=="TX"|stateab=="OK"|stateab=="AR"|stateab=="LA"|stateab=="MS"|stateab=="MS"|stateab=="AL"|stateab=="TN"|stateab=="KY"|stateab=="WV"|stateab=="VA"|stateab=="DE"|stateab=="MD"|stateab=="NC"|stateab=="SC"|stateab=="GA"|stateab=="FL" replace south = 0 if south ==. generate northeast = 1 if stateab=="PA"|stateab=="NJ"|stateab=="CT"|stateab=="NY"|stateab=="RI"|stateab=="MA"|stateab=="ME"|stateab=="NH"|stateab=="VT" replace northeast = 0 if northeast ==. * asssert is a logical command that will return 'false' and stop the program if the statement is untrue assert midwest == 1 | west == 1 | south == 1 | northeast == 1 * Interaction Terms * generate f1932_farmpop = f1932 * farmpop save moratoriumlogit, replace ***************** ** Model Test ** ***************** * Same as Model 1 (alston 1984) plus NFhomes (percent owned nonfarm homes) * This model is used to do a likelihood ratio test for the significance of the dummy variables logit moratorium f1932 Per_Farm_Mortgaged FederallyHeld_Debt NFhomes mfx predict double residTEST, residual label var resid8 "Pearson Residual Model 8" * This command stores the estimates, and will be used later to calculate the Likelihood Ratio Test * The name 'MTest' represents 'Model Test' estimates store MTest ***************** ** Model 2 ** ***************** * Same as Model 1 (alston 1984) plus four census dummy regions plus NFhomes (percent owned nonfarm homes) logit moratorium f1932 Per_Farm_Mortgaged FederallyHeld_Debt midwest west south NFhomes mfx predict double resid2, residual label var resid2 "Pearson Residual Model 2" estimates store M2 ***************** ** Model 3 ** ***************** * Same as Model 2 plus interaction term logit moratorium f1932 f1932_farmpop Per_Farm_Mortgaged FederallyHeld_Debt NFhomes mfx predict double resid3, residual label var resid13 "Pearson Residual Model 3" estimates store M3 ***************** ** Model 4 ** ***************** * Same as Model 1 (alston 1984) plus interaction of f1932 with Farmpop, regional dummies and NFhomes logit moratorium f1932 f1932_farmpop Per_Farm_Mortgaged FederallyHeld_Debt NFhomes midwest west south mfx predict double resid4, residual label var resid12 "Pearson Residual Model 4" estimates store M4 ********************************************************************************************* ** Calculate Likelihood Ratio between Models Test and 2, Models 3 and 4 ** ** The Likelihood Ratio Tests significance of the presence of the regional dummy variables ** ** See help 'lrtest' for more information ** ********************************************************************************************* lrtest MTEST M2, stats lrtest M3 M4, stats save mortgagelogit, replace ********************************************************************************************* ** The following two programs are written for SAS v9.1 and use the SAS mapping software. ** ** To run the program, you will need the SAS US Map. ** ********************************************************************************************* /* This program will create the SAS state map for Average Farm foreclosures from 1929 to 1932 */ /* This data comes from the data file 'farmfo1929_32'. /* Original data source is USDA, , Bureau of Ag. Economics, circular no. 209: "The Farm Real Estate Situation, 1930-31" (by B. R. Stauber) */ libname maps 'D:\SAS'; data failures; input stname $2. y1929 y1930 y1931 y1932 avg; cards; AL 9.7 9.7 22.6 27 17.25 AZ 20.4 19.3 25.4 32.1 24.3 AR 16 16.3 18.6 32.7 20.9 CA 15 12 22.6 30.2 19.95 CO 21.6 18.8 20.3 27.5 22.05 CT 3 3.2 4.5 8.9 4.9 DE 9.9 5.6 10 14.5 10 FL 6 8 4 6.7 6.175 GA 17.4 18.5 27.4 26.8 22.525 ID 20.9 20.9 20.8 28.2 22.7 IL 16.7 17.2 20.1 29.8 20.95 IN 15.7 20.5 19.9 30.1 21.55 IA 25.2 25.1 24.8 52.5 31.9 KS 13 14.8 20 36 20.95 KY 11.6 12.6 12.1 17.9 13.55 LA 14 14.2 14.4 23.5 16.525 ME 11 9.6 10.1 14.6 11.325 MD 13.6 13.4 10.6 22.3 14.975 MA 6.2 7.4 4 8.1 6.425 MI 17.1 21.2 20.7 30.6 22.4 MN 26.4 27.9 31.2 42.9 32.1 MS 14.4 14.3 20.4 34.1 20.8 MO 21.7 24.6 23.7 42.1 28.025 MT 21.1 25.1 31.1 34.6 27.975 NE 15.7 15.9 21.8 34.4 21.95 NV 9.8 12 21 25 16.95 NH 4.6 5.4 3.7 7.4 5.275 NJ 4 5.4 6.4 11 6.7 NM 12.4 12.4 22.3 20.1 16.8 NY 12 11.6 11.6 12.9 12.025 NC 15 15 20 32.6 20.65 ND 32 30.1 34.1 54 37.55 OH 13.3 13.5 16.4 21.6 16.2 OK 14.3 18.2 22.4 30.5 21.35 OR 10 11.2 13.4 22.3 14.225 PA 5.6 8.4 7.4 12.2 8.4 RI 5.5 2.3 2 4 3.45 SC 22.2 25 32 28.8 27 SD 27.2 27.1 33.2 49.2 34.175 TN 9.6 8.8 10.9 23 13.075 TX 8.5 9.6 12.8 23.6 13.625 UT 9.5 8.3 16.1 17.2 12.775 VT 8 8.5 6.1 9.7 8.075 VA 10.6 10.4 15.2 29.3 16.375 WA 13.9 13.4 18.6 24 17.475 WV 6.6 7.5 9 12.9 9 WI 16.5 16.4 20.2 28.3 20.35 WY 17.8 17.3 20.1 26.3 20.375 run; data mapdata1; set failures; state=stfips(stname); if 0.00