Skip to content

Number rows of jacobian appropriately #89

Open
@leeper

Description

@leeper

Make sure that the numbering of rows in the jacobian() attribute is correct:

  • align numbering of jacobian to numbering of .at column and at 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]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions