我想使用stargazer()报告边际影响,以代替通常的估计影响
当估计边际效应时,结果变成一个向量,如果它是glm / lm对象,我将无法以实用的方式报告,并且使用的信息种类也一样。
这是一个简单的例子:
library(dplyr)
library(stargazer)
#we create a toy data frame
pikachu <- data.frame(
employed=c(0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,1,0,1,0),
highiq=c(1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,0,0,0,1,0,0,0,1,0),
income=set.seed(6)%>%
c(rnorm(25,mean = 600,sd=400)))
#and run a probit regression
reg01 <- glm(employed ~ income + highiq,
family = binomial(link="probit"),
data = pikachu)
#next we estimate the marginal effects
ProbitScalar <- mean(dnorm(predict(reg01, type = "link")))
meffects <- ProbitScalar * coef(reg01)
#then we report the marg. effects
stargazer(meffects, type = "text")
我希望能够代表边际效应,就像可以代表通常的结果(glm类对象)一样。最好包含SE和重要性。
#desired result's form:
stargazer(reg01, type = "text")