【问题标题】:Regression Output from probitmfxprobitmfx 的回归输出
【发布时间】:2021-05-25 23:47:03
【问题描述】:

我正在尝试为 probitmfx 函数的边际效应和 p 值生成一个很好的回归表,其中 p 值在每个协变量的边际效应下报告。我希望它看起来像的图片示例在这里Similar Output from Stata。 我按照here 的建议尝试了观星功能,但如果我没有 OLS / probit,这似乎不起作用。

data_T1 <- read_dta("xxx")
#specification (1)
T1_1 <- probitmfx(y ~ x1 + x2 + x3, data=data_T1)
#specification (1)
T1_2 <- probitmfx(y ~ x1 + x2 + x3 + x4 + x5, data=data_T1)
#this is what I tried but does not work
table1 <- stargazer(coef=list(T1_1$mfxest[,1], T1_2$mfxest[,1]),
p=list(T1_2$mfxest[,4],T1_2$mfxest[,4]), type="text")

有什么建议可以在 R 中设计这样的表格吗?

【问题讨论】:

    标签: r output regression non-linear-regression marginal-effects


    【解决方案1】:

    你大概可以使用parameters包来制作一张漂亮的桌子:

    代码:

    library(mfx)
    library(parameters)
    
    # simulate some data
    set.seed(12345)
    n <- 1000
    x <- rnorm(n)
    
    # binary outcome
    y <- ifelse(pnorm(1 + 0.5 * x + rnorm(n)) > 0.5, 1, 0)
    
    data <- data.frame(y, x)
    mod <- probitmfx(formula = y ~ x, data = data)
    
    print_html(model_parameters(mod))
    

    要在 Rmarkdown 中使用的 HTML 表格:

    【讨论】:

      猜你喜欢
      • 2021-05-19
      • 2018-08-29
      • 2022-01-12
      • 2016-02-28
      • 2020-08-18
      • 1970-01-01
      • 1970-01-01
      • 2017-01-25
      • 2019-05-26
      相关资源
      最近更新 更多