Hello all,
I'm new to regression analysis in general. I've read all the rules so I hope you can all bear with me and help me become better with STATA in general!
My first batch of questions:
Here is the dataset. The variables are:
gvkey: its a numerical code given by the mother dataset to each company
fyear: year. The dataset only includes one year.
tic: the public abbreviation of the company name
conm: company name
opinc: operating income of the company
assets: the assets a company has
ind: industry the company is in
return: operating income / assets
logassets: log(assets)
The first thing: I am trying to destring ind and it doesn't allow me. "destring ind, replace ind: contains nonnumeric characters; no replace".
I want to do this, as I want to try to regress return onto logassets with industry (ind) fixed effects. This code would be:
xtreg return logassets, fe [ind] ? Am I correct here? Also, do I have to do xtset before even if I have one year of the database?
Another queston, when I reg return logassets, I get the coefficient of the regression of logassets being .04. This means that for an increase of 1 in logassets, we would get an increase of .04 return. Correct?
After I get the fixed effects regression done, I would like to test adding a squared term into the regression. Would this be the correct way of doing it? reg return logassets logassets*logassets, or is it logassets^2?
Sorry if these are very basic questions! It's only my third week into this world! Hopefully I can grow to learn.
I'm new to regression analysis in general. I've read all the rules so I hope you can all bear with me and help me become better with STATA in general!
My first batch of questions:
Here is the dataset. The variables are:
gvkey: its a numerical code given by the mother dataset to each company
fyear: year. The dataset only includes one year.
tic: the public abbreviation of the company name
conm: company name
opinc: operating income of the company
assets: the assets a company has
ind: industry the company is in
return: operating income / assets
logassets: log(assets)
The first thing: I am trying to destring ind and it doesn't allow me. "destring ind, replace ind: contains nonnumeric characters; no replace".
I want to do this, as I want to try to regress return onto logassets with industry (ind) fixed effects. This code would be:
xtreg return logassets, fe [ind] ? Am I correct here? Also, do I have to do xtset before even if I have one year of the database?
Another queston, when I reg return logassets, I get the coefficient of the regression of logassets being .04. This means that for an increase of 1 in logassets, we would get an increase of .04 return. Correct?
After I get the fixed effects regression done, I would like to test adding a squared term into the regression. Would this be the correct way of doing it? reg return logassets logassets*logassets, or is it logassets^2?
Sorry if these are very basic questions! It's only my third week into this world! Hopefully I can grow to learn.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long gvkey int fyear str7 tic str29 conm float(opinc assets) str2 ind float(return logassets) 1004 2015 "AIR" "AAR CORP" 66.1 1442.1 "20" .04583593 7.273856 1045 2015 "AAL" "AMERICAN AIRLINES GROUP INC" 7284 48415 "20" .15044925 10.787565 1050 2015 "CECE" "CECO ENVIRONMENTAL CORP" 28.651 598.819 "20" .04784584 6.394959 1062 2015 "ASA" "ASA GOLD AND PRECIOUS METALS" -1.713 162.35 "40" -.010551278 5.089755 1072 2015 "AVX" "AVX CORP" 169.302 2409.819 "45" .07025506 7.787307 1075 2015 "PNW" "PINNACLE WEST CAPITAL CORP" 854.602 15028.258 "55" .05686634 9.617687 1076 2015 "AAN" "AARON'S INC" 244.117 2658.875 "25" .09181214 7.885658 1078 2015 "ABT" "ABBOTT LABORATORIES" 3372 41247 "35" .0817514 10.627334 1094 2015 "ACET" "ACETO CORP" 53.827 489.774 "35" .10990171 6.193944 1097 2015 "ACMTA" "ACMAT CORP -CL A" 1.214 73.518 "40" .016512964 4.29753 1104 2015 "ACU" "ACME UNITED CORP" 7.747 81.421 "20" .09514745 4.3996334 1117 2015 "BKTI" "BK TECHNOLOGIES" 1.43 39.449 "45" .036249332 3.675009 1121 2015 "AE" "ADAMS RESOURCES & ENERGY INC" -2.359 243.215 "10" -.009699238 5.493946 1161 2015 "AMD" "ADVANCED MICRO DEVICES" -319 3109 "45" -.10260534 8.042056 1166 2015 "ASMIY" "ASM INTERNATIONAL NV" 140.052 2254.303 "45" .06212652 7.720596 1177 2015 "AET" "AETNA INC" 4762.9 53424.1 "35" .08915264 10.886017 1186 2015 "AEM" "AGNICO EAGLE MINES LTD" 168.035 6683.18 "15" .02514297 8.807349 1209 2015 "APD" "AIR PRODUCTS & CHEMICALS INC" 1870.3 17438.1 "15" .10725366 9.766413 1210 2015 "AIRT" "AIR T INC" 6.285 52.155 "20" .12050618 3.95422 1224 2015 "EGN1" "ALABAMA GAS CORP" 89.2 1519 "55" .05872284 7.325808 1225 2015 "SO1" "ALABAMA POWER CO" 1563 21721 "55" .07195801 9.986034 1230 2015 "ALK" "ALASKA AIR GROUP INC" 1330 6533 "20" .2035818 8.784621 1234 2015 "ATRI" "ATRION CORP" 42.51 164.336 "35" .25867733 5.101913 1254 2015 "MATX" "MATSON INC" 212.1 1669.8 "20" .1270212 7.420459 1257 2015 "ALX" "ALEXANDER'S INC" 95.205 1447.808 "60" .06575803 7.277806 1266 2015 "ALCO" "ALICO INC" 32.702 460.58 "30" .07100178 6.132486 1274 2015 "Y" "ALLEGHANY CORP" 851.346 22846.33 "40" .03726401 10.036546 1300 2015 "HON" "HONEYWELL INTERNATIONAL INC" 7374 49316 "20" .1495255 10.806004 1327 2015 "SWKS" "SKYWORKS SOLUTIONS INC" 1026.7 3719.4 "45" .27603915 8.221317 1356 2015 "AA.3" "ALCOA INC" 1993 36528 "15" .05456088 10.505835 1380 2015 "HES" "HESS CORP" -2359 34195 "10" -.06898669 10.439835 1388 2015 "AMR1" "AMERICAN AIRLINES INC" 7258 50439 "20" .1438966 10.82852 1393 2015 "UHAL" "AMERCO" 773.111 8150.725 "20" .0948518 9.005862 1397 2015 "ABLT" "AMERICAN BILTRITE INC" .709 114.836 "15" .006174022 4.743505 1410 2015 "ABM" "ABM INDUSTRIES INC" 95.5 2149.8 "20" .04442273 7.67313 1414 2015 "PRI" "PRIMERICA INC" 324.488 10612.12 "40" .03057712 9.269752 1439 2015 "ECOL" "US ECOLOGY INC" 79.531 771.987 "20" .10302116 6.648968 1440 2015 "AEP" "AMERICAN ELECTRIC POWER CO" 3333.5 61683.1 "55" .05404235 11.029765 1447 2015 "AXP" "AMERICAN EXPRESS CO" 8968 161184 "40" .05563828 11.990302 1448 2015 "AXP1" "AMERICAN EXPRESS CREDIT CORP" 590 33285 "40" .017725702 10.412862 1449 2015 "AFL" "AFLAC INC" 4413 118296 "40" .03730473 11.680945 1487 2015 "AIG" "AMERICAN INTERNATIONAL GROUP" 5136 496943 "40" .01033519 13.11623 1491 2015 "HAIPF" "HADERA PAPER LTD" 9.077 656.126 "15" .013834233 6.486353 1526 2015 "ANAT" "AMERICAN NATIONAL INSURANCE" 268.688 23746.96 "40" .011314625 10.07521 1545 2015 "ARL" "AMERICAN REALTY INVESTORS" 22.982 1117.368 "60" .02056798 7.018731 1554 2015 "ASEI" "AMERICAN SCIENCE ENGINEERING" -2.23 171.229 "20" -.013023495 5.143002 1559 2015 "AMS" "AMERICAN SHARED HSPTL SERV" 3.219 54.114 "35" .05948553 3.991093 1562 2015 "AMSWA" "AMERICAN SOFTWARE -CL A" 13.527 136.724 "45" .09893655 4.917964 1585 2015 "AVD" "AMERICAN VANGUARD CORP" 11.524 443.539 "15" .025981933 6.094786 1598 2015 "AME" "AMETEK INC" 944.321 6664.53 "20" .14169356 8.804555 1602 2015 "AMGN" "AMGEN INC" 8603 71576 "35" .12019392 11.178515 1613 2015 "AP" "AMPCO-PITTSBURGH CORP" -4.222 506.156 "15" -.008341302 6.226845 1618 2015 "AXR" "AMREP CORP" -6.174 120.628 "20" -.05118215 4.792711 1632 2015 "ADI" "ANALOG DEVICES" 1064.392 7062.178 "45" .15071723 8.862509 1633 2015 "ALOG" "ANALOGIC CORP" 40.283 627.97 "35" .06414797 6.442492 1659 2015 "ANDE" "ANDERSONS INC" 42.624 2359.101 "30" .0180679 7.766036 1661 2015 "NBR" "NABORS INDUSTRIES LTD" 148.767 9537.84 "10" .015597557 9.163022 1678 2015 "APA" "APACHE CORP" -25913 18842 "10" -1.3752786 9.843843 1686 2015 "APOG" "APOGEE ENTERPRISES INC" 97.393 657.44 "20" .14813974 6.488354 1689 2015 "AEP1" "APPALACHIAN POWER" 710.8 11648.3 "55" .06102178 9.362915 1690 2015 "AAPL" "APPLE INC" 71230 290479 "45" .24521565 12.579287 1704 2015 "AMAT" "APPLIED MATERIALS INC" 1692 15308 "45" .11053044 9.636131 1706 2015 "ATU" "ACTUANT CORP -CL A" 142.207 1636.917 "20" .0868749 7.40057 1712 2015 "TREC" "TRECORA RESOURCES" 36.041 258.811 "15" .13925606 5.556098 1722 2015 "ADM" "ARCHER-DANIELS-MIDLAND CO" 2010 40157 "30" .05005354 10.600552 1742 2015 "PNW1" "ARIZONA PUBLIC SERVICE CO" 872.127 14982.182 "55" .05821095 9.614617 1743 2015 "ARCB" "ARCBEST CORP" 75.17 1262.909 "20" .05952131 7.141173 1745 2015 "ETR1" "ENTERGY ARKANSAS" 179.406 8747.774 "55" .02050876 9.076554 1773 2015 "ARW" "ARROW ELECTRONICS INC" 893.247 13021.93 "45" .068595596 9.47439 1783 2015 "ARTW" "ARTS WAY MFG INC" .005 31.332 "20" .00015958125 3.44464 1794 2015 "ASH" "ASHLAND GLOBAL HOLDINGS INC" 477 10064 "15" .04739666 9.21672 1820 2015 "ALOT" "ASTRONOVA INC" 6.043 77.963 "45" .07751113 4.3562346 1823 2015 "ATRO" "ASTRONICS CORP" 101.601 609.243 "20" .16676597 6.412217 1837 2015 "SO7" "SOUTHERN CO GAS" 804 14754 "55" .0544937 9.59927 1860 2015 "ATW" "ATWOOD OCEANICS" 607.51 4809.011 "10" .12632743 8.478247 1864 2015 "REX" "REX AMERICAN RESOURCES CORP" 31.021 414.685 "10" .07480618 6.027519 1878 2015 "ADSK" "AUTODESK INC" 1.3 5515.3 "45" .00023570794 8.615281 1891 2015 "ADP" "AUTOMATIC DATA PROCESSING" 2014 33110.5 "45" .06082663 10.407606 1906 2015 "AVHI" "A V HOMES INC" 22.171 742.016 "25" .02987941 6.609371 1913 2015 "AVY" "AVERY DENNISON CORP" 537.7 4133.7 "15" .13007717 8.326928 1919 2015 "AVT" "AVNET INC" 918.478 10799.953 "45" .08504463 9.287297 1920 2015 "AVP" "AVON PRODUCTS" 351.6 3879.5 "30" .09063024 8.263461 1926 2015 "AZZ" "AZZ INC" 123.188 983.371 "20" .12527114 6.890986 1932 2015 "BTI" "BRITISH AMER TOBACCO PLC" 6968.96 46472.02 "30" .14996034 10.746606 1949 2015 "BRT" "BRT APARTMENTS CORP" 7.567 835.879 "60" .009052745 6.728484 1968 2015 "BMI" "BADGER METER INC" 49.769 355.48 "45" .14000507 5.873469 1976 2015 "BHI" "BAKER HUGHES INC" 78 24080 "10" .0032392025 10.089137 1979 2015 "BCPC" "BALCHEM CORP -CL B" 95.742 881.223 "15" .10864673 6.781311 1982 2015 "PTVCB" "PROTECTIVE INSURANCE CORP" 35.639 1085.771 "40" .03282368 6.990046 1988 2015 "BLL" "BALL CORP" 799.9 9777 "15" .08181447 9.187788 2002 2015 "BPOP" "POPULAR INC" 1004.036 35769.535 "40" .028069586 10.484852 2005 2015 "BOH" "BANK OF HAWAII CORP" 325.198 15455.016 "40" .021041583 9.645689 2019 2015 "BK" "BANK OF NEW YORK MELLON CORP" 6860 393780 "40" .017420895 12.883548 2044 2015 "BCR" "BARD (C.R.) INC" 855 4942.9 "35" .17297538 8.505708 2049 2015 "B" "BARNES GROUP INC" 190.679 2061.866 "20" .09247886 7.631367 2052 2015 "BRN" "BARNWELL INDUSTRIES" -4.515 41.553 "10" -.1086564 3.72697 2055 2015 "ABX" "BARRICK GOLD CORP" 798 26308 "15" .03033298 10.177629 2080 2015 "BSET" "BASSETT FURNITURE INDS" 26.463 282.543 "25" .09366008 5.643831 2086 2015 "BAX" "BAXTER INTERNATIONAL INC" 735 20975 "35" .035041716 9.951087 2101 2015 "AIT" "APPLIED INDUSTRIAL TECH INC" 184.619 1434.968 "20" .12865722 7.268898 end
Comment