Open
Description
Make sure that the numbering of rows in the jacobian()
attribute is correct:
- align numbering of
jacobian
to numbering of.at
column andat
specification attribute - add a test for correct numbering
- add an example of using the
jacobian
attribute somewhere
Possible example (from Trenton Mize):
webuse::webuse("auto")
m <- lm(price ~ mpg * factor(foreign), data = auto)
marg <- margins(m, at = list(foreign = c("0", "1")), variables = "mpg")
# difference in AMEs
diff(marg$AME)
## mpg
## 78.88826
# standard error of difference
vc <- vcov(marg)
sqrt(sum(diag(vc)) - 2*vc[1,2])
## [1] 112.7029
Stata equivalent:
sysuse auto
reg price c.mpg##i.foreign
margins, dydx(mpg) at(foreign=(0 1)) post
lincom _b[mpg:1bn._at] - _b[mpg:2._at]