I have the following issue. In particular, I am running a regression aimed at finding cross price elasticities of demand. On the left hand side I have put quantities of sold products in each market (called atc) excluding the quantity sold in the ith market at time t, while on the right have put average prices for all the products, average prices excepts for a particular type of good and other controls.
When I put the i.time variables estimations become very very little in magnitude, while if I avoid putting year dummies (i.Year in regression), the estimations stays reasonable:
Code:
xtreg log_stdunits_excludedatc log_average_priceatcrec log_average_priceatc L.recalls L2.recalls share_generic mean_agefirm_b mean_agefirm_squared hhi nprod L.nprod numero_imprese inflow_ratio outflow_ratio newmolatc newmolmarket i.Year, fe
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(idatc idproduct Year) double tot_sales float(nprod recalls) long stdunits 1 1371 2006 283099.0679145482 . 0 3984 1 1371 2006 2137713.2412671754 . 0 29831 1 1371 2006 282038.16821586766 . 0 9870 1 1371 2006 73107.30899500764 . 0 1012 1 1371 2006 114747.95003352147 . 0 3910 1 1371 2006 28888.36168177663 . 0 1040 1 1371 2006 1700503.931185867 . 0 23886 1 1371 2006 1063107.914242075 . 0 14926 1 1371 2006 1641609.3936547572 . 0 56690 1 1371 2006 2958075.2010738957 . 0 41133 1 1371 2006 61526.58841856969 . 0 867 1 1371 2006 676813.2072848553 . 0 9547 1 1371 2006 19490.92546842926 . 0 700 1 1371 2006 717946.033227489 . 0 24645 1 1371 2006 414556.1390957428 . 0 5728 1 1371 2006 198681.29400545819 . 0 6820 1 1371 2006 265949.4699249363 . 0 9115 1 1371 2006 420862.52932076284 . 0 14670 1 1371 2006 1222994.8578643617 . 0 42405 1 1371 2006 150863.40704940853 . 0 5230 1 1371 2006 211617.28998341982 1 0 7210 1 1371 2006 601682.6788045941 . 0 8311 1 1371 2006 313318.11714363087 . 0 5042 1 1371 2006 187707.8150204552 . 0 2571 1 1371 2006 30507.2255365758 . 0 1035 1 1371 2006 406826.46821049287 . 0 5661 1 1371 2006 70189.04973291139 . 0 2680 1 1371 2006 228735.59330300856 . 0 3595 1 1371 2006 107802.30749146779 . 0 1682 1 1371 2006 945458.8098559394 . 0 13103 1 1371 2006 16621.292778905594 . 0 575 1 1371 2006 58320.17996210856 . 0 2160 1 1371 2007 3473413.7770261588 . 0 46919 1 1371 2007 419813.16801459354 . 0 14365 1 1371 2007 442814.8552934684 . 0 6950 1 1371 2007 1418754.101313512 . 0 19330 1 1371 2007 110589.80697540545 . 0 4240 1 1371 2007 2107383.2203740776 . 0 71265 1 1371 2007 1592850.1837691874 . 0 21834 1 1371 2007 847535.5477872799 . 0 29885 1 1371 2007 5080156.300675048 . 0 70321 1 1371 2007 975204.4585407786 . 0 16378 1 1371 2007 574851.2242465352 1 0 19460 1 1371 2007 709154.3219373834 . 0 9531 1 1371 2007 769972.7008051975 . 0 26480 1 1371 2007 583678.6217424704 . 0 9256 1 1371 2007 973062.7556985387 . 0 13417 1 1371 2007 810463.8904529461 . 0 10968 1 1371 2007 674983.0034110936 . 0 22970 1 1371 2007 2194223.295374352 . 0 74715 1 1371 2007 355627.0049954344 . 0 11940 1 1371 2007 1853564.6432545276 . 0 62160 1 1371 2007 3997936.457009877 . 0 54396 1 1371 2007 389682.487435829 . 0 13165 1 1371 2007 143114.61942174466 . 0 5825 1 1371 2007 1810059.9087916543 . 0 25050 1 1371 2007 132620.27762532711 . 0 5315 1 1371 2007 870382.2657067247 . 0 11844 1 1371 2007 328116.525089062 . 0 10900 1 1371 2007 4517580.100610766 . 0 61823 1 1371 2007 2405073.738445344 . 0 82965 1 1371 2007 2072992.6911181498 . 0 29168 1 1371 2007 847584.3441529287 . 0 14007 1 1371 2007 81265.82139024901 . 0 2885 1 1371 2008 1112742.1363276907 . 0 16051 1 1371 2008 1335460.8045881372 . 0 15689 1 1371 2008 7171845.246430401 . 0 84618 1 1371 2008 463061.4802199194 . 0 15380 1 1371 2008 422365.91759554786 . 0 14280 1 1371 2008 1057965.0382711447 1 0 13622 1 1371 2008 2531388.2770605995 . 0 80510 1 1371 2008 165785.16995903387 . 0 7015 1 1371 2008 2488734.7779668486 . 0 84630 1 1371 2008 258175.56714135053 . 0 10580 1 1371 2008 1223801.7822947246 . 0 15042 1 1371 2008 243513.03432108622 . 0 10490 1 1371 2008 977369.5571925384 . 0 14738 1 1371 2008 6648973.294298902 . 0 82057 1 1371 2008 239077.8657575488 . 0 10200 1 1371 2008 2401679.700303086 . 0 79935 1 1371 2008 467541.2870705166 . 0 15780 1 1371 2008 968537.4040756717 . 0 34290 1 1371 2008 502517.9451066027 . 0 15880 1 1371 2008 1009138.8196934436 . 0 15484 1 1371 2008 2380848.088415352 . 0 80830 1 1371 2008 3349821.8600815693 . 0 41541 1 1371 2008 3139908.580246103 . 0 40437 1 1371 2008 997188.7488235512 . 0 35160 1 1371 2008 6206430.214999475 . 0 78647 1 1371 2008 5842204.77964792 . 0 75428 1 1371 2008 1019354.6118262211 . 0 36735 1 1371 2008 2898586.4130829647 . 0 38190 1 1371 2008 1122359.7523300855 . 0 17658 1 1371 2008 1139787.6945592295 . 0 14740 1 1371 2008 1083504.132124063 . 0 36965 1 1371 2008 2620719.0447707204 . 0 35206 1 1371 2009 289266.714846794 . 0 8480 1 1371 2009 921089.0605733572 . 0 29320 1 1371 2009 234874.48374411932 . 0 6725 1 1371 2009 282012.93486690253 . 0 10905 end
Code:
*GENERATING THE PRICE VARIABLE: egen tot_sales_prod = sum(tot_sales), by(idpr Year) egen tot_stdunits_sold = sum(stdunits), by(idpr Year) gen price_it = tot_sales_prod/tot_stdunits_sold //questo è dunque il prezzo del prodotto i-esimo al tempo t nel j-esimo ATC *PREZZO MEDIO IN ATC egen nprod_atc = sum(nprod), by(idatc Year) sort idpr Year egen average_priceatc = sum(price_it), by(idatc Year) replace average_priceatc = average_priceatc/nprod_atc *PREZZO MEDIO PRODOTTI RECALLED IN ATC gen price_itrec = price_it if recalls == 1 *bys idpr Year: gen price_rec = price_itrec if _n==1 egen average_priceatcrec = sum(price_itrec), by(idatc Year) bys idpr Year: gen nprod_rec = nprod if recalls == 1 egen nprod_atcrec = sum(nprod_rec), by(idatc Year) replace average_priceatcrec = average_priceatcrec/nprod_atcrec egen stdunits_byatc = sum(stdunits), by(idatc Year) //totale quantità vendute in un settore ATC in un anno egen stdunits_excludedatc = sum(stdunits_byatc), by(Year) replace stdunits_excludedatc = stdunits_excludedatc - stdunits_byatc //Q-i collapse (sum) inflow outflow nprod tot_sales number_generic_products (first) stdunits_excludedatc stdunits_byatc average_priceatcrec average_priceatc numero_imprese hhi_market_shares birthatc newmolmarket newmolatc molecule (max) recalls mean_agef sales_medie_in_atc ,by (idatc Year)
ending up with a database that looks like:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(idatc Year log_stdunits_excludedatc log_average_priceatcrec log_average_priceatc recalls share_generic_products mean_agefirm_byatc hhi_market_shares) double nprod float numero_imprese 1 2004 35.981094 . 7.713727 0 0 26 .004167896 4 2 1 2005 35.575157 . 7.64516 0 0 27 .004558048 4 2 1 2006 35.587387 . 7.438164 0 0 41.5 .0044406555 6 4 1 2007 35.676964 . 7.499528 0 0 42.5 .0042789304 6 4 1 2008 35.711056 . 7.524543 0 0 43.5 .004413414 6 4 1 2009 35.799248 7.552197 7.674545 1 0 44.5 .004427353 6 4 1 2010 35.745865 . 8.038763 1 0 38 .003945276 5 3 1 2011 35.676376 . 7.927717 0 0 39 .0046393434 5 3 1 2012 35.563297 8.035208 7.978195 1 0 40 .004816207 5 3 1 2013 35.630085 . 7.969995 0 0 53 .004745062 6 4 1 2014 35.610718 . 8.164169 0 0 54 .004753592 6 4 1 2015 35.600933 . 8.205233 0 0 55 .004489763 7 4 2 2004 35.981094 . 7.16918 0 0 26 .008566235 2 2 2 2005 35.575157 . 7.071523 0 0 27 .009925952 2 2 2 2006 35.587387 . 7.025406 0 0 28 .010252055 2 2 2 2007 35.676964 . 7.051993 0 0 29 .010169175 2 2 2 2008 35.711056 . 7.016289 0 0 30 .010987393 2 2 2 2009 35.799248 . 7.112101 0 0 31 .011288014 2 2 2 2010 35.745865 . 7.292902 0 0 32 .011513832 2 2 2 2011 35.676376 . 7.347687 0 0 33 .013378995 2 2 2 2012 35.563297 . 7.37845 0 0 34 .015324473 2 2 2 2013 35.630085 . 7.108617 0 0 53 .016024394 3 3 2 2014 35.610718 . 7.377864 0 0 54 .013345306 3 3 2 2015 35.600933 . 7.37461 0 0 55 .015822435 3 3 3 2004 35.981094 . 7.414496 0 0 26 .0021833705 8 2 3 2005 35.575157 . 7.391232 0 0 27 .00237829 8 2 3 2006 35.587387 . 7.582196 0 0 28 .0021117325 8 2 3 2007 35.676964 . 7.740317 0 0 29 .0019178848 8 2 3 2008 35.711056 . 7.86745 0 0 30 .001815863 8 2 3 2009 35.799248 6.789703 7.888294 1 0 31 .0019451687 8 2 3 2010 35.745865 . 7.929351 0 0 32 .002103498 8 2 3 2011 35.676376 . 7.77253 0 0 33 .0026291385 8 2 3 2012 35.563297 . 7.812467 0 0 34 .002758383 8 2 3 2013 35.630085 . 7.720561 0 0 53 .002770265 10 3 3 2014 35.610718 . 7.956896 0 0 54 .002591062 10 3 3 2015 35.600933 7.534721 8.04753 1 0 55 .002792704 10 3 4 2004 35.981094 . 5.705176 0 0 26 .06177981 2 2 4 2005 35.575157 . 5.786872 0 0 27 .06244527 2 2 4 2006 35.587387 . 5.511223 0 0 28 .07142357 2 2 4 2007 35.676964 . 4.834372 0 0 29 .09930084 2 2 4 2008 35.711056 . 4.4292336 0 0 33 .25 1 1 5 2004 35.981094 6.510842 6.510842 1 0 36.5 .06007193 2 2 5 2005 35.575157 . 7.173539 0 0 37.5 .02749308 2 2 5 2006 35.587387 . 7.28569 0 0 34 .022064144 3 3 5 2007 35.676964 . 7.479922 0 0 35 .01459916 3 3 5 2008 35.711056 . 7.531468 0 0 36 .012107332 3 3 5 2009 35.799248 . 7.521716 0 0 37 .012009476 3 3 5 2010 35.745865 . 7.918536 0 0 39.5 .011699162 2 2 5 2011 35.676376 . 7.828494 0 0 40.5 .012485907 2 2 5 2012 35.563297 7.362233 7.798896 1 0 41.5 .01379533 2 2 5 2013 35.630085 . 7.888734 0 0 42.5 .014391284 2 2 5 2014 35.610718 . 8.292177 0 0 43.5 .012323422 2 2 5 2015 35.600933 . 8.221308 0 0 44.5 .009703988 3 2 6 2004 35.981094 4.4711576 5.977108 1 0 26 .011904498 10 2 6 2005 35.575157 . 5.910118 0 0 30 .015151516 8 1 6 2006 35.587387 . 4.973515 0 0 28 .023803595 9 2 6 2007 35.676964 . 4.3932858 0 0 29 .03185365 9 2 6 2008 35.711056 . 2.58777 0 0 33 .5 2 1 6 2014 35.610718 . 3.1304505 0 0 39 .5 2 1 7 2004 35.981094 . 4.718914 0 0 43.4 .01982041 7 5 7 2005 35.575157 . 5.300344 0 0 44.33333 .02139801 5 3 7 2006 35.587387 . 5.361012 0 0 45 .019296557 6 4 7 2007 35.676964 . 5.750676 0 0 42.75 .020653456 6 4 7 2008 35.711056 . 5.584686 0 0 42.6 .017288417 7 5 7 2009 35.799248 . 5.366903 0 0 44.33333 .013171094 8 6 7 2010 35.745865 . 5.516974 0 0 44.6 .015195938 7 5 7 2011 35.676376 . 5.41384 0 0 45.6 .018320879 6 5 7 2012 35.563297 . 5.250489 0 0 46.6 .017336143 7 5 7 2013 35.630085 . 5.491025 0 0 39.83333 .01528222 8 6 7 2014 35.610718 . 5.924159 0 0 40.83333 .012558142 8 6 7 2015 35.600933 . 5.809888 0 0 41.83333 .015655823 8 6 8 2004 35.981094 . 2.6009986 0 .755102 30.05263 .0007513542 49 19 8 2005 35.575153 3.187353 2.461279 1 .7777778 29.78261 .0007597606 54 23 8 2006 35.587383 1.7914797 2.3146522 1 .7777778 33.68182 .0006061014 54 22 8 2007 35.67696 1.6069216 2.367644 1 .7959183 36.190475 .0005923105 49 21 8 2008 35.711056 . 2.307815 0 .7843137 34.434784 .0006107487 51 23 8 2009 35.799248 2.318052 2.2017508 1 .8 31.47619 .000698589 50 21 8 2010 35.745865 1.9583555 2.2654514 1 .8297873 33.409092 .000805097 47 22 8 2011 35.676376 2.649832 2.424821 1 .8333333 33.458332 .0008036423 48 24 8 2012 35.563297 . 2.3849816 0 .8461539 32.51852 .000797744 52 27 8 2013 35.630085 2.496214 2.422803 1 .8490566 32.133335 .0007741255 53 30 8 2014 35.610718 2.556842 2.367291 1 .8545455 31.612904 .0007761238 55 31 8 2015 35.600933 . 2.6329734 0 .84 32.566666 .0008143 50 30 9 2004 35.981094 . 2.999619 0 .7894737 25.444445 .001452793 19 18 9 2005 35.575153 . 2.914782 0 .8095238 23.7 .0010553995 21 20 9 2006 35.587383 1.5934396 3.059399 1 .7727273 28.809525 .0008989101 22 21 9 2007 35.67696 . 2.801913 0 .7916667 28.26087 .0007429485 24 23 9 2008 35.711052 1.776728 2.5792575 1 .8148148 26.576923 .0009601246 27 26 9 2009 35.799248 1.8980135 2.615121 1 .8333333 28.07143 .0010202948 30 28 9 2010 35.745865 4.2987285 3.034376 1 .8214286 31.03846 .0009500422 28 26 9 2011 35.676376 2.3731878 2.962849 1 .84375 29.8 .0007599415 32 30 9 2012 35.563297 . 3.332112 0 .8484849 29.96774 .0009812912 33 31 9 2013 35.63008 . 3.431292 0 .8484849 28.32258 .001225363 33 31 9 2014 35.610718 1.0804652 3.603707 1 .8571429 28.51515 .001361299 35 33 9 2015 35.60093 -1.1017476 4.0940733 1 .8571429 29.51515 .003004181 35 33 10 2004 35.981094 . 3.434949 0 .6666667 39.4 .002841735 12 5 10 2005 35.575157 . 3.1274395 0 .7777778 40.83333 .001406077 18 6 10 2006 35.587387 . 3.145717 0 .8 36.42857 .0008751631 20 7 10 2007 35.67696 . 3.01695 0 .8461539 36.375 .0008789319 26 8 10 2008 35.711056 2.2715757 2.889355 1 .8571429 33.9 .0011085472 28 10 end
Federico
0 Response to i.time
Post a Comment