5
$\begingroup$

I posted this question already on Stack Overflow (here) but it was suggested to ask this question here on StackExchange. So, I have a question concerning different outputs when changing the type-argument in the margins-package in R. Here is a reproducible example:

library(margins)
x <- glm(am ~ cyl + hp * wt, data = mtcars, family = binomial)
me <- margins(x, type = "response") 
me2 <- margins(x, type = "link")
summary(me)
summary(me2)

Both summaries yield different outputs in level but as well as in significance. So my question is, why is the p-value different for both types? And which version is preferable? This is the respective output:

> summary(me)
 factor     AME     SE       z      p   lower  upper
    cyl  0.0216 0.0493  0.4377 0.6616 -0.0750 0.1181
     hp  0.0027 0.0023  1.1596 0.2462 -0.0018 0.0072
     wt -0.5158 0.2685 -1.9209 0.0547 -1.0421 0.0105

> summary(me2)
 factor      AME     SE       z      p    lower  upper
    cyl   0.5156 1.1695  0.4409 0.6593  -1.7765 2.8077
     hp   0.0515 0.0357  1.4430 0.1490  -0.0185 0.1215
     wt -12.2426 7.6784 -1.5944 0.1108 -27.2920 2.8067

This is the package's manual:

https://cran.r-project.org/web/packages/margins/vignettes/Introduction.html#Average_Marginal_Effects_and_Average_Partial_Effects

They explain that the type "response" returns partial effects, i.e. the contribution of each variable on the outcome scale, conditional on the other variables involved in the link function transformation of the linear predictor, and that type "link" returns true marginal effects, i.e. the marginal contribution of each variable on the scale of the linear predictor.

So, I somehow get that calculating the significance of a linear coefficient is the t-statistic of this exact coefficient divided by its standard error. This should reflect the significance level of the average partial effect. This term might differ if I have to transform the coefficient first to the response scale (e.g. exponential function for exponential link). But nevertheless, I think I do not quite understand the difference between true marginal effects and partial effects and their respective interpretation. Which one should I actually use? The margins-package's vignette states that there is some debate but I cannot imagine any advantages nor disadvantages. Any help would be appreciated. Thank you!

$\endgroup$

1 Answer 1

2
$\begingroup$

This is taken directly from the website introducing the margins package.

In an ordinary least squares regression, there is really only one way of examining marginal effects (that is, on the scale of the outcome variable). In a generalized linear model (e.g., logit), however, it is possible to examine true “marginal effects” (i.e., the marginal contribution of each variable on the scale of the linear predictor) or “partial effects” (i.e., the contribution of each variable on the outcome scale, conditional on the other variables involved in the link function transformation of the linear predictor). The latter are the default in margins(), which implicitly sets the argument margins(x, type = "response") and passes that through to prediction() methods. To obtain the former, simply set margins(x, type = "link").

The linear predictor here is the $\eta = X \beta$ function.

Source: https://cran.r-project.org/web/packages/margins/vignettes/Introduction.html

$\endgroup$
1
  • $\begingroup$ Thanks for your answer. I already read this part in the manual. My confusion is more why a transformation yields a different significant level. This leaves room for p-hacking and I just want to know which one is preferrable in a theoretical point of view. $\endgroup$
    – Irazall
    Commented Nov 30, 2021 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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