2
$\begingroup$

I'm trying to run a multiple regression on a dataset in R. The structure of the data that I want to use for the regression is as followed (only showing the variables I want to use):

str(output)
 'data.frame':  30000 obs. of  12 variables:
  $ user_id            : num  4.22e+07 2.02e+08 2.67e+08 1.47e+09 1.51e+09 ...
  $ comments           : int  15 27 111 32 243 89 16 31 15 24 ...
  $ likes              : int  217 2232 2331 447 2747 885 473 1284 1537 313 ...
  $ labels             : Factor w/ 3 levels "0","1","2": 2 2 2 2 2 2 2 2 2 2 ...
  • user_id = every user has an unique id
  • comments = number of comments for a certain post
  • likes = number of likes for a certain post
  • labels = category of the post. 0 = "no ad", 1 = "ad", 2 ="camouflaged ad"

The goal is to compare the performance of instagram posts (measured by number of likes and comments) depending on their label. The label indicates the category of the post: 0 = "no ad", 1 = "ad", 2 = "camouflaged ad". Can I simply run a regression with the given variables?

I would like to do something like this:

multipleModel_likes <- lm(log(likes + 0.0001) ~ labels + log(comments + 0.0001),
data=output)
summary(multipleModel_likes)

This model gives me the following results:

Call:
lm(formula = log(likes + 1e-04) ~ labels + log(comments + 1e-04), 
    data = output)

Residuals:
     Min       1Q   Median       3Q      Max 
-14.1750  -0.7812  -0.0522   0.7762   6.8443 

Coefficients:
                      Estimate Std. Error t value Pr(>|t|)    
(Intercept)           4.964666   0.007129  696.40   <2e-16 ***
labels1               1.045436   0.038732   26.99   <2e-16 ***
labels2               1.040179   0.103788   10.02   <2e-16 ***
log(comments + 1e-04) 0.242941   0.001632  148.88   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.202 on 29996 degrees of freedom
Multiple R-squared:  0.4486,    Adjusted R-squared:  0.4486 
F-statistic:  8136 on 3 and 29996 DF,  p-value: < 2.2e-16

How can I interpret this outcome, especially for the labels coefficients? For my understanding a 1% increase in comments would lead to a 0.2429% increase in likes. But what about the labels?

Furthermore, I would like to add fixed effects to the regression.

reg.4 <- plm(log(likes + 0.0001) ~ labels + log(comments+0.0001), 
effect='individual', index=c('user_id'), data=output)
summary(reg.4)

This regression gives me the following results:

Oneway (individual) effect Within Model

Call:
plm(formula = log(likes + 1e-04) ~ labels + log(comments + 1e-04), 
    data = output, effect = "individual", index = c("user_id"))

Unbalanced Panel: n = 1262, T = 1-9267, N = 30000

Residuals:
      Min.    1st Qu.     Median    3rd Qu.       Max. 
-13.796690  -0.328306  -0.012954   0.319846   4.671108 

Coefficients:
                       Estimate Std. Error  t-value  Pr(>|t|)    
labels1               0.0376018  0.0300516   1.2512  0.210857    
labels2               0.2025108  0.0717769   2.8214  0.004785 ** 
log(comments + 1e-04) 0.1407572  0.0013785 102.1071 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Total Sum of Squares:    25649
Residual Sum of Squares: 18809
R-Squared:      0.2667
Adj. R-Squared: 0.23444
F-statistic: 3483.62 on 3 and 28735 DF, p-value: < 2.22e-16

Is this the correct way to run this? Again I am struggling to interpret the coefficients. Would be great if anyone could explain that to me!

Thank you a lot in advance for your answers!

Edit: Showing the distribution of the data with a scatterplot and two density plots.

  • Red = No ad
  • Blue = Ad
  • Green = Camouflaged ad

Scatterplot

Density plot likes

Density plot comments

$\endgroup$
  • $\begingroup$ About the interpretation of label: All else being equal, observations with label 1 typically have $exp(1.045436) - 1 \approx 184\%$ more likes as observations with label 0. $\endgroup$ – Michael M Jun 12 '18 at 20:31
  • 1
    $\begingroup$ @MichaelM - great thank you for your answer! So also for the fixed effects model I could interpret that an observation with label1 has exp(0.0376018)−1 ≈ 3.8% more likes as observations with label0 (or ≈ 22% more with label2). Is my interpretation that 1% increase in comments leads to 0.1407% increase in likes correct? Again, thanks a lot for your help! $\endgroup$ – bnjmn_j Jun 12 '18 at 20:46
  • $\begingroup$ Yes, that's it. For large effects, it is worth to use the exact calculation exp(.) - 1. For small you can use the linear approximation. Side note: Better write "mixed effects model" or "panel regression" instead of "fixed effects model". $\endgroup$ – Michael M Jun 12 '18 at 20:57
0
$\begingroup$

R has selected label = 0 as base level to which compare those two category values.

In case of ad label, it means that it will get about exp(2)-1 likes more than "no ad" category. Meaning almost +200%.

Check your target variables distribution, is it heavily right skewed? Perhaps some other method, such as gamma regression is in order...

$\endgroup$
  • $\begingroup$ Thank you for your answer! I will edit the post to add info on the distribution. $\endgroup$ – bnjmn_j Jun 12 '18 at 20:18

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.