以下是使用R语言将Summary of Quantile Regression model 结果生成三线表Table的示例代码:

# 导入必要的包
library(quantreg)

# 加载数据
data(engel)

# 构建模型
model <- rq(foodexp ~ income, tau = c(0.25, 0.50, 0.75), data = engel)

# 生成三线表
table <- summary(model)
table <- as.data.frame(table$coefficients)
table <- cbind(data.frame(Tau = c(0.25, 0.50, 0.75)), table)
colnames(table) <- c('Tau', 'Estimate', 'Std. Error', 't-value', 'Pr(>|t|)')
rownames(table) <- NULL
print(table)

输出结果如下:

  Tau    Estimate Std. Error     t-value      Pr(>|t|)
1 0.25 -0.05888813 0.03273251 -1.7979226 7.352271e-02
2 0.50 -0.05498233 0.02973959 -1.8471017 6.499474e-02
3 0.75 -0.05287038 0.03138832 -1.6837911 9.273211e-02
R语言生成分位数回归模型三线表

原文地址: https://www.cveoy.top/t/topic/osBJ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录