有没有一种方法可以从此输出摘要中提取值?
Is there a way that can I extract the values from this output summary?
如何提取 ('Estimate', 'std. Error', 的值'Pr (> | z |)') 从输出结果中提取,并将它们置于下面数据示例中的 table 格式?
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)
数据存在于 model$tableP1
和 model$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
如何提取 ('Estimate', 'std. Error', 的值'Pr (> | z |)') 从输出结果中提取,并将它们置于下面数据示例中的 table 格式?
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)
数据存在于 model$tableP1
和 model$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