*********************************************** * This file estimates production functions ************************************************ log using pf3, replace set trace off set more off capture drop _all set mem 100m set matsize 400 *set mem 210m *set virtual on *set matsize 800 ****************************************************** * READ DATA AND CREATES SOME NEW VARIABLES use D:/drive-e/moretti/stata/data, clear gen x = coll6 gen x80 = coll680 gen Dx = coll6 - coll680 gen ind3_st = ind3*1000 +fst gen ind2_st = ind2*1000 +fst keep if obs30 > 20 ****************************************************** * BASE MODEL areg logVA80 x80 logL180 logL480 logK80 mu, cluster(smsa80) absorb(ind3) areg logVA x logL1 logL4 logK mu, cluster(smsa80) absorb(ind3) areg logVA80 x80 logL180 logL480 logK80 mu , cluster(smsa80) absorb(ind3) areg logVA x logL1 logL4 logK mu , cluster(smsa80) absorb(ind3) reg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(fst) areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3) areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) ****************************************** * MODEL THAT ALLOWS TECHNOLOGY TO VARY BY INDUSTRY xi: reg DlogVA Dx i.ind2|DlogL1 i.ind2|DlogL4 i.ind2|DlogK mu , cluster(smsa80) xi: areg DlogVA Dx i.ind2|DlogL1 i.ind2|DlogL4 i.ind2|DlogK mu , cluster(smsa80) absorb(ind3_st) ************************************* * TRANSLOG PRODUCTION FUNCTION g logL1sq = logL1*logL1 g logL4sq = logL4*logL4 g logKsq = logK*logK g logL1_K = logL1*logK g logL4_K = logL4*logK g logL1_L4 = logL1*logL4 g logL1sq8 = logL180*logL180 g logL4sq8 = logL480*logL480 g logKsq8 = logK80*logK80 g logL1_K8 = logL180*logK80 g logL4_K8 = logL480*logK80 g logL1_L8 = logL180*logL480 g DlogL1sq = DlogL1*DlogL1 g DlogL4sq = DlogL4*DlogL4 g DlogKsq = DlogK*DlogK g DlogL1_K = DlogL1*DlogK g DlogL4_K = DlogL4*DlogK g DlogL1_L = DlogL1*DlogL4 areg logVA80 x80 logL180 logL1sq8 logL480 logL4sq8 logK80 logKsq8 logL1_K8 logL4_K8 logL1_L8 mu , cluster(smsa80) absorb(ind3) areg logVA x logL1 logL1sq logL4 logL4sq logK logKsq logL1_K logL4_K logL1_L4 mu , cluster(smsa80) absorb(ind3) reg DlogVA Dx DlogL1 DlogL1sq DlogL4 DlogL4sq DlogK DlogKsq DlogL1_K DlogL4_K DlogL1_L4 mu , cluster(smsa80) areg DlogVA Dx DlogL1 DlogL1sq DlogL4 DlogL4sq DlogK DlogKsq DlogL1_K DlogL4_K DlogL1_L4 mu, cluster(smsa80) absorb(fst) areg DlogVA Dx DlogL1 DlogL1sq DlogL4 DlogL4sq DlogK DlogKsq DlogL1_K DlogL4_K DlogL1_L4 mu, cluster(smsa80) absorb(ind3) areg DlogVA Dx DlogL1 DlogL1sq DlogL4 DlogL4sq DlogK DlogKsq DlogL1_K DlogL4_K DlogL1_L4 mu, cluster(smsa80) absorb(ind3_st) * Translog Technology varies by industry xi: reg DlogVA Dx i.ind2|DlogL1 i.ind2|DlogL1sq i.ind2|DlogL4 i.ind2|DlogL4sq i.ind2|DlogK i.ind2|DlogKsq i.ind2|DlogL1_K i.ind2|DlogL4_K i.ind2|DlogL1_L4 mu, cluster(smsa80) xi: areg DlogVA Dx i.ind2|DlogL1 i.ind2|DlogL1sq i.ind2|DlogL4 i.ind2|DlogL4sq i.ind2|DlogK i.ind2|DlogKsq i.ind2|DlogL1_K i.ind2|DlogL4_K i.ind2|DlogL1_L4 mu, cluster(smsa80) absorb(ind3_st) *********************************** * HI-TECH: * The definition of high tech is from the * Amer. Electr. Association gen ht=0 replace ht =1 if ind==3571 replace ht =1 if ind==3572 replace ht =1 if ind==3575 replace ht =1 if ind==3577 replace ht =1 if ind==3578 replace ht =1 if ind==3579 replace ht =1 if ind==3651 replace ht =1 if ind==3652 replace ht =1 if ind==3661 replace ht =1 if ind==3663 replace ht =1 if ind==3669 replace ht =1 if ind==3671 replace ht =1 if ind==3672 replace ht =1 if ind==3675 replace ht =1 if ind==3676 replace ht =1 if ind==3677 replace ht =1 if ind==3678 replace ht =1 if ind==3679 replace ht =1 if ind==3674 replace ht =1 if ind==3821 replace ht =1 if ind==3822 replace ht =1 if ind==3823 replace ht =1 if ind==3824 replace ht =1 if ind==3825 replace ht =1 if ind==3826 replace ht =1 if ind==3829 replace ht =1 if ind==3827 replace ht =1 if ind==3861 replace ht =1 if ind==3812 replace ht =1 if ind==3844 replace ht =1 if ind==3845 summarize ind ht gen Dx_ht = Dx*ht gen Dx_lt = Dx*(1-ht) * base reg DlogVA Dx Dx_ht DlogL1 DlogL4 DlogK mu , cluster(smsa80) areg DlogVA Dx Dx_ht DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(fst) areg DlogVA Dx Dx_ht DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind2) areg DlogVA Dx Dx_ht DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3) areg DlogVA Dx Dx_ht DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) * firm effects *areg DlogVA Dx Dx_ht DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(fid) *areg DlogVA Dx DlogL1 DlogL4 DlogK mu if ht==1, cluster(smsa80) absorb(fid) * city*year effects areg DlogVA Dx_ht DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(smsa80) xi: areg DlogVA Dx_ht DlogL1 DlogL4 DlogK mu i.ind2, cluster(smsa80) absorb(smsa80) xi: areg DlogVA Dx_ht DlogL1 DlogL4 DlogK mu i.ind3, cluster(smsa80) absorb(smsa80) ***************************************************** * ESTIMATES SEPATE COEFFICIENTS * BY SHARE OF COLLEGE GRADUATES IN PLANT and BY * SHARE OF NON-PRODUCTION WORKERS * wages of production and non production *gen f1 = ow/sw * number of hours worked by production and non production workers gen f1 = ph2/(ph+ph2) summarize f1 gen q1 =0 gen q2 =0 gen q3 =0 gen q4 =0 *replace q1 =Dx if f1 <= 0.25 *replace q2 =Dx if f1>0.25 & f1 <= 0.50 *replace q3 =Dx if f1>0.50 & f1 <= 0.75 *replace q4 =Dx if f1>0.75 replace q1 =Dx if f1 <= 0.33 replace q2 =Dx if f1>0.33 & f1 <= 0.66 replace q3 =Dx if f1>0.66 reg DlogVA q1 q2 q3 DlogL1 DlogL4 DlogK mu if f1 ~= ., cluster(smsa80) areg DlogVA q1 q2 q3 DlogL1 DlogL4 DlogK mu if f1 ~= ., cluster(smsa80) absorb(ind3_st) replace f1 = exp(logL4)/(exp(logL1)+exp(logL4)) summ f1, detail gen Q1 =0 gen Q2 =0 gen Q3 =0 gen Q4 =0 *replace Q1 =Dx if f1 <= 0.25 *replace Q2 =Dx if f1>0.25 & f1 <= 0.50 *replace Q3 =Dx if f1>0.50 & f1 <= 0.75 *replace Q4 =Dx if f1>0.75 replace Q1 =Dx if f1 <= 0.33 replace Q2 =Dx if f1>0.33 & f1 <= 0.66 replace Q3 =Dx if f1>0.66 *replace Q1 =Dx if f1 <= 0.33 *replace Q2 =Dx if f1>0.33 & f1 <= 0.40 *replace Q3 =Dx if f1>0.40 & f1 <= 0.47 *replace Q4 =Dx if f1>0.47 reg DlogVA Q1 Q2 Q3 DlogL1 DlogL4 DlogK mu if f1 ~=., cluster(smsa80) areg DlogVA Q1 Q2 Q3 DlogL1 DlogL4 DlogK mu if f1 ~=., cluster(smsa80) absorb(ind3_st) ***************************************** * ESTIMATE SEPARATE COEFFICIENTS * BY SIZE & MULTIUNIT STATUS gen small =0 gen medium =0 gen large =0 *gen v_large =0 replace small =1 if te <=10 replace medium =1 if te>10 & te<=50 replace large =1 if te>50 *replace v_large =1 if te >73 summ te, detail reg DlogVA Dx DlogL1 DlogL4 DlogK mu if small ==1, cluster(smsa80) reg DlogVA Dx DlogL1 DlogL4 DlogK mu if medium==1, cluster(smsa80) reg DlogVA Dx DlogL1 DlogL4 DlogK mu if large==1, cluster(smsa80) * reg DlogVA Dx DlogL1 DlogL4 DlogK mu if v_large==1, cluster(smsa80) reg DlogVA Dx DlogL1 DlogL4 DlogK mu if mu==0, cluster(smsa80) reg DlogVA Dx DlogL1 DlogL4 DlogK mu if mu==1, cluster(smsa80) summ te if mu==0 summ te if mu==1 ************************************************************* * THE DEPENDENT VARIABLE IS * SHIPMENT INSTEAD OF VA sort ppn drop _merge merge ppn using e:\moretti2\lrd\gs82_subset g logy80 = log(tvs) drop _merge tvs keep if DlogVA ~=. sort ppn merge ppn using e:\moretti2\lrd\gs92_subset g logy = log(tvs) g Dlogy = logy - logy80 drop _merge tvs keep if DlogVA ~=. areg logy80 x80 logL180 logL480 logK80 mu , cluster(smsa80) absorb(ind3) areg logy x logL1 logL4 logK mu , cluster(smsa80) absorb(ind3) reg Dlogy Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) ***************************************************************** * COEFF VARIES OVER TIME reg DlogVA Dx DlogL1 logL1 DlogL4 logL4 DlogK logK mu , cluster(smsa80) ****************************************************** * COEFF ON L4 VARIES ACROSS CITIES *xi: areg logVA80 x80 logL180 i.smsa80|logL480 logK80 mu, cluster(smsa80) absorb(ind3) *xi: areg logVA x logL1 i.smsa80|logL4 logK mu, cluster(smsa80) absorb(ind3) xi: reg DlogVA Dx DlogL1 i.smsa80|DlogL4 DlogK mu, cluster(smsa80) xi: reg DlogVA Dx DlogL1 i.smsa80|DlogL4 i.smsa80|logL4 DlogK mu, cluster(smsa80) xi: reg DlogVA Dx i.smsa80|DlogL1 i.smsa80|DlogL4 DlogK mu, cluster(smsa80) **************************************************** * L1 L2 L3 L4 clear use E:/moretti/stata/data2, clear *gen x = medu6 *gen x80 = medu680 *gen Dx = medu6 - medu680 gen x = coll6 gen x80 = coll680 gen Dx = coll6 - coll680 gen ind3_st = ind3*1000 +fst gen ind2_st = ind2*1000 +fst keep if obs30 > 20 areg logVA80 x80 logL180 logL280 logL380 logL480 logK80 mu , cluster(smsa80) absorb(ind3) areg logVA x logL1 logL2 logL3 logL4 logK mu , cluster(smsa80) absorb(ind3) reg DlogVA Dx DlogL1 DlogL2 DlogL3 DlogL4 DlogK mu , cluster(smsa80) areg DlogVA Dx DlogL1 DlogL2 DlogL3 DlogL4 DlogK mu , cluster(smsa80) absorb(fst) areg DlogVA Dx DlogL1 DlogL2 DlogL3 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3) areg DlogVA Dx DlogL1 DlogL2 DlogL3 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) * L2 L3 L4 (where L2 is drop out + hs grad) gen L1 = exp(logL1) gen L2 = exp(logL2) replace logL2 = log(L1 + L2) gen L180 = exp(logL180) gen L280 = exp(logL280) replace logL280 = log(L180 + L280) replace DlogL2 = logL2 - logL280 reg DlogVA Dx DlogL2 DlogL3 DlogL4 DlogK mu , cluster(smsa80) areg DlogVA Dx DlogL2 DlogL3 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) ********************************************************** * PRODUCTION - NON PRODUCTION use E:/moretti/Cm/st828792, clear drop if yr ~= 92 gen logH1 = log(ph) gen ph2 = (ph/pw)*(te-pw) gen logH2 = log(ph2) keep ppn logH1 logH2 sort ppn save tmp, replace use E:/moretti/Cm/st828792, clear drop if yr ~= 82 gen logH180 = log(ph) gen ph2 = (ph/pw)*(te-pw) gen logH280 = log(ph2) keep ppn logH180 logH280 sort ppn merge ppn using tmp drop _merge sort ppn save tmp, replace use E:/moretti/stata/data, clear gen x = coll6 gen x80 = coll680 gen Dx = coll6 - coll680 gen ind3_st = ind3*1000 +fst gen ind2_st = ind2*1000 +fst keep if obs30 > 20 drop _merge sort ppn merge ppn using tmp gen DlogH1 = logH1 - logH180 gen DlogH2 = logH2 - logH280 reg DlogVA Dx DlogH1 DlogH2 DlogK mu, cluster(smsa80) areg DlogVA Dx DlogH1 DlogH2 DlogK mu, cluster(smsa80) absorb(ind3_st) ********************************************************** * CITY SIZE AND OTHER CITY CHARACTERISTICS drop _merge drop obs* sort smsa80 merge smsa80 using E:/moretti/imported/berkeley/data/smsa8090 g Dobs = obs90-obs80 reg DlogVA Dx DlogL1 DlogL4 DlogK mu Dobs, cluster(smsa80) areg DlogVA Dx DlogL1 DlogL4 DlogK mu Dobs, cluster(smsa80) absorb(ind3_st) reg DlogVA Dx DlogL1 DlogL4 DlogK mu Dobs DNblack DNcitiz DNsex, cluster(smsa80) areg DlogVA Dx DlogL1 DlogL4 DlogK mu Dobs DNblack DNcitiz DNsex, cluster(smsa80) absorb(ind3_st) ***************************************** * CITY and FIRM EFFECTS areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(smsa80) areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(fid) ********************************************************** * INDUSTRIES OUTSIDE MANUFACTURING drop _merge sort smsa80 merge smsa80 using E:/moretti/imported/medu_l31 g Dx1 = educ41 - educ4801 g Dx2 = educ42 - educ4802 g Dx3 = educ43 - educ4803 g Dx4 = educ44 - educ4804 g Dx6 = educ46 - educ4806 g Dx7 = educ47 - educ4807 g Dx8 = educ48 - educ4808 summ educ4* Dx* areg logVA80 educ4801 educ4802 educ4803 educ4804 educ4806 educ4807 educ4808 logL180 logL480 logK80 mu , cluster(smsa80) absorb(ind3) areg logVA educ41 educ42 educ43 educ44 educ46 educ47 educ48 logL1 logL4 logK mu , cluster(smsa80) absorb(ind3) reg DlogVA Dx1 Dx2 Dx3 Dx4 Dx6 Dx7 Dx8 DlogL1 DlogL4 DlogK mu , cluster(smsa80) areg DlogVA Dx1 Dx2 Dx3 Dx4 Dx6 Dx7 Dx8 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(fst) areg DlogVA Dx1 Dx2 Dx3 Dx4 Dx6 Dx7 Dx8 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3) areg DlogVA Dx1 Dx2 Dx3 Dx4 Dx6 Dx7 Dx8 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) reg DlogVA Dx1 DlogL1 DlogL4 DlogK mu , cluster(smsa80) reg DlogVA Dx2 DlogL1 DlogL4 DlogK mu , cluster(smsa80) reg DlogVA Dx3 DlogL1 DlogL4 DlogK mu , cluster(smsa80) reg DlogVA Dx4 DlogL1 DlogL4 DlogK mu , cluster(smsa80) reg DlogVA Dx6 DlogL1 DlogL4 DlogK mu , cluster(smsa80) reg DlogVA Dx7 DlogL1 DlogL4 DlogK mu , cluster(smsa80) reg DlogVA Dx8 DlogL1 DlogL4 DlogK mu , cluster(smsa80) areg DlogVA Dx1 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) areg DlogVA Dx2 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) areg DlogVA Dx3 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) areg DlogVA Dx4 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) areg DlogVA Dx6 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) areg DlogVA Dx7 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) areg DlogVA Dx8 DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st) ********************************************************** ********************************************************** * RE-WEIGHTING BY FIRM SIZE ********************************************************** ********************************************************** * First, creates the weights based on the 1982 distribution of * total employment (TE) clear use D:/drive-e/moretti/sas/weights drop if te ==0 | te ==. g size = 1 if te <=10 replace size = 2 if te >10 & te <=20 replace size = 3 if te >20 & te <=30 replace size = 4 if te >30 & te <=40 replace size = 5 if te >40 & te <=50 replace size = 6 if te >50 & te <=60 replace size = 7 if te >60 & te <=70 replace size = 8 if te >70 & te <=80 replace size = 9 if te >80 & te <=90 replace size = 10 if te >90 sort size collapse (count) W = te, by(size) sort size save tmp, replace summ use D:/drive-e/moretti/stata/data, clear gen x = coll6 gen x80 = coll680 gen Dx = coll6 - coll680 gen ind3_st = ind3*1000 +fst gen ind2_st = ind2*1000 +fst keep if obs30 > 20 g size = 1 if te <=10 replace size = 2 if te >10 & te <=20 replace size = 3 if te >20 & te <=30 replace size = 4 if te >30 & te <=40 replace size = 5 if te >40 & te <=50 replace size = 6 if te >50 & te <=60 replace size = 7 if te >60 & te <=70 replace size = 8 if te >70 & te <=80 replace size = 9 if te >80 & te <=90 replace size = 10 if te >90 drop _merge sort size merge size using tmp summ summ [weight = W] reg DlogVA Dx DlogL1 DlogL4 DlogK mu [weight =W], cluster(smsa80) areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(fst) areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3) areg DlogVA Dx DlogL1 DlogL4 DlogK mu , cluster(smsa80) absorb(ind3_st)