【问题标题】:Is there a way that can I extract the values from this output summary?有没有办法可以从这个输出摘要中提取值?
【发布时间】:2021-03-27 13:29:28
【问题描述】:

如何提取 ('Estimate', 'std.Error', 'Pr (> | z |)' 的值>) 从输出结果中,并将它们放在下面数据示例中的表格格式中?

require(GJRM)
set.seed(123)
x1 <- sample(1:100, size = 20)
bid1 <- sample(c(5, 10, 20, 30), size = 20, replace = T)
bid2 <- sample(c(5, 10, 20, 30), size = 20, replace = T)
ans1 <- sample(c(1,0), size = 20, replace = T)
ans2 <- sample(c(1,0), size = 20, replace = T)
df <- cbind(x1, bid1, bid2, ans1, ans2)
df <- as.data.frame(df)
treat.eq <- ans1 ~ bid1 + x1
out.eq <- ans2 ~ bid2 + x1
f.list <- list(treat.eq, out.eq)
mr <- c("probit", "probit")
## Model
bvp <- gjrm(f.list, data=df, Model="B", margins= mr)
summary(bvp)

【问题讨论】:

    标签: r statistics summary


    【解决方案1】:

    数据存在于model$tableP1model$tableP2 中:

    library(GJRM)
    bvp <- gjrm(f.list, data=df, Model="B", margins= mr)
    model <- summary(bvp)
    model$tableP1
    
    #               Estimate Std. Error   z value  Pr(>|z|)
    #(Intercept)  0.83797602 0.79822170  1.049804 0.2938084
    #bid1        -0.04682910 0.03137645 -1.492492 0.1355702
    #x1          -0.01065357 0.00993613 -1.072205 0.2836278
    
    model$tableP2
    
    #                Estimate Std. Error    z value  Pr(>|z|)
    #(Intercept)  0.434060433 0.64213719  0.6759621 0.4990647
    #bid2        -0.012464492 0.02930301 -0.4253656 0.6705702
    #x1          -0.005763137 0.01025844 -0.5617947 0.5742559
    

    【讨论】:

    • 是的!谢谢!
    • 很遗憾我不能这样做,因为我的声誉分数不够。我的分数低于 15
    • 哇!对此感到抱歉。我现在做到了。现在好吗?谢谢
    猜你喜欢
    • 2021-10-31
    • 2020-04-30
    • 1970-01-01
    • 2020-02-12
    • 2022-01-05
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多