I have issues with interpreting results as those: lm(formula = LN_CO2_T + ROA ~ SIZE + factor(IND)) , because I do not fully grasp what factor() does.

Can somebody help me? I know it is probably a basic question and I thought that it only uses all entries of the named variable (IND in this case) but I tried it out and got different results.

For intrepration issues: ROA is Return on Assets, LN_CO2_T is natural logarithm of the amount of CO2 emissions of company in metric tons, SIZE is firmsize and IND means industry (e.g. manufacturing, services)

           Estimate Std. Error t value Pr(>|t|)    
(Intercept)  31.1829654  2.2306583  13.979  < 2e-16 ***
LN_CO2_T     -0.2932257  0.1119609  -2.619 0.008955 ** 
SIZE         -1.1426992  0.1647169  -6.937 7.24e-12 ***
factor(IND)2  0.4498207  0.8426553   0.534 0.593591    
factor(IND)3  0.4292806  0.7134041   0.602 0.547489    
factor(IND)4 -1.3315596  0.7396336  -1.800 0.072121 .  


EDIT: With great help vom Mr. Verhagen, I solved my issue, but I got a new one by deleting the intercept with -1.

See this:

lm(formula = ROA ~ LN_CO2_D + factor(YEAR) - 1)
             Estimate Std. Error t value Pr(>|t|)    
LN_CO2_D         -0.74969    0.06208  -12.08   <2e-16 ***
factor(YEAR)2010 17.26102    0.98069   17.60   <2e-16 ***
factor(YEAR)2011 17.11592    0.97696   17.52   <2e-16 ***
factor(YEAR)2012 16.11046    0.97598   16.51   <2e-16 ***
factor(YEAR)2013 15.74590    0.95850   16.43   <2e-16 ***
factor(YEAR)2014 16.06625    0.95061   16.90   <2e-16 ***
factor(YEAR)2015 15.95324    0.95308   16.74   <2e-16 ***
factor(YEAR)2016 15.80328    0.94983   16.64   <2e-16 ***
factor(YEAR)2017 16.77392    0.94770   17.70   <2e-16 ***


lm(formula = ROA ~ LN_CO2_D + factor(YEAR))

             Estimate Std. Error t value Pr(>|t|)    
(Intercept)      17.26102    0.98069  17.601   <2e-16 ***
LN_CO2_D         -0.74969    0.06208 -12.076   <2e-16 ***
factor(YEAR)2011 -0.14510    0.71416  -0.203   0.8390    
factor(YEAR)2012 -1.15056    0.71261  -1.615   0.1067    
factor(YEAR)2013 -1.51512    0.69834  -2.170   0.0303 *  
factor(YEAR)2014 -1.19477    0.69453  -1.720   0.0857 .  
factor(YEAR)2015 -1.30778    0.69578  -1.880   0.0605 .  
factor(YEAR)2016 -1.45774    0.69454  -2.099   0.0361 *  
factor(YEAR)2017 -0.48709    0.69331  -0.703   0.4825    

Why those drastical changes? (I simply mixed Industries with Years here, but this should be no problem)

  • $\begingroup$ Can you give us the actual meaning of the IND values 1, 2, 3 and 4? That would facilitate the interpretation. Also, what does LN_CO2_T mean? $\endgroup$ – Isabella Ghement Aug 11 at 19:12
  • $\begingroup$ Thanks for your answer and sorry for missing out this explanation, I added it above. Think of IND 1,2,3,4 as 1:Power (as solar, atom) 2: consumer goods 3: machineries 4: transport. $\endgroup$ – Tw3Ak3r Aug 11 at 19:43
  • 1
    $\begingroup$ There are no drastic changes, because in the second output the intercept represents the 2010 category and every other coefficient represents the difference for other categories relative to the 2010 category. So the coefficient for the factor2011 should be interpreted as intercept + coefficient = 17.26-0.145=17.11 which is the same as the coefficient in the first versions where each category has it's own value directly. $\endgroup$ – Mark Verhagen Aug 11 at 20:22
  • $\begingroup$ Ok, well, thanks! I am confused now. What is the intercept, if I dont use "-1" ? And is there a way of using factor() for all values "inside" it (so 2010-2017) without using -1 and by that distorting the outcome? $\endgroup$ – Tw3Ak3r Aug 11 at 20:36

The coefficient for factor(IND)2 refers to the coefficient for whenever your industry variable is category 2, factor(IND)3 refers to the coefficient for whenever your industry variable is category 3 etc.

You should interpret these results as being an increase or decrease relative to the intercept. The fourth category seems to have a small decrease relative to the mean, statistically significant at the 10% level. The others are not statistically different from the baseline group.

I cannot tell from your code whether you explicitly included an intercept (because I also do not see the LN_CO2_T variable in the call you describe). I suspect you have four industry categories and the first one is the intercept. The interpretation then is that for categories 1-3 there does NOT seem to be a statistically significant difference, whereas the fourth industry has a (marginally significant) lower estimate.

In other words, the factor(IND) call adds a dummy for each of the categories that are present in the IND variable. It is the same as 'One Hot Encoding' a categorical variable. Depending on your call, one of these dummy variables will automatically be substituted for the intercept. As I mentioned, my guess is that this is the first category and your IND variable indeed has four categories. This then means that the first category is substituted for a column of ones, and the other three categories are 'One Hot Encoded' and represent the difference between each of these categories and the first one, but I can't be sure from your call.

As an example, evaluate the following code:

values <- c(rep(10, 25), rep(20, 25), rep(30, 25), rep(40, 25))
groups <- c(rep("A", 25), rep("B", 25), rep("C", 25), rep("D", 25))
df <- as.data.frame(values, groups)            

lm(values ~ factor(groups))

lm(values ~ factor(groups) - 1)

In the first call, the factor automatically turns the first category ("A") into the intercept and shows the relative difference of the three others ("B", "C" and "D"):

lm(formula = values ~ factor(groups))

    (Intercept)  factor(groups)B  factor(groups)C  factor(groups)D  
             10               10               20               30  

Whereas in the second, I choose to omit the intercept and therefore each category is explicitly listed

lm(formula = values ~ factor(groups) - 1)

factor(groups)A  factor(groups)B  factor(groups)C  factor(groups)D  
             10               20               30               40  
  • $\begingroup$ Thanks for your thorough answer! You are right, there are 4 industries and I am sorry for omitting and explanation for CO2, I added it above. Your statement with "-1" answered all my questions and showed me, why my own testing did not work, it omitted the first value. However, new issues arived: I quickly ran some test and saw that using "-1" drastically changes significance and coefficients. Can you explain what omitting the intercept does? Does it just start at 0,0 then? $\endgroup$ – Tw3Ak3r Aug 11 at 19:53
  • $\begingroup$ Yes the significance now represents relative to 0. Therefore, everything is significant. I suspect you are interested in whether the coefficients are statistically different from one another. Then it makes sense not to exclude the intercept if you have a logical baseline case, or you have to test the coefficients against one another explicitly. $\endgroup$ – Mark Verhagen Aug 11 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.