Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Stargazer:标准错误和置信区间的自定义参数覆盖了最初报告的内容_R_Confidence Interval_Stargazer_Standard Error - Fatal编程技术网

Stargazer:标准错误和置信区间的自定义参数覆盖了最初报告的内容

Stargazer:标准错误和置信区间的自定义参数覆盖了最初报告的内容,r,confidence-interval,stargazer,standard-error,R,Confidence Interval,Stargazer,Standard Error,大家好:这是非常相关的,所以对它的回应可能会使它过时,但我认为我会标记它 如果我想使用stargazer在单个表中报告标准误差和置信区间,我不能在模型的单个列中报告,如中所示。将它们放在一个表中的一个解决方法是“报告”模型两次。例如,以下代码: set.seed(04152020) x <- rnorm(100) y <- 2*x + rnorm(100) m1 <- lm(y~x) library(stargazer) stargazer(list(m1, m1),

大家好:这是非常相关的,所以对它的回应可能会使它过时,但我认为我会标记它

如果我想使用
stargazer
在单个表中报告标准误差和置信区间,我不能在模型的单个列中报告,如中所示。将它们放在一个表中的一个解决方法是“报告”模型两次。例如,以下代码:

set.seed(04152020)
x <- rnorm(100)
y <- 2*x + rnorm(100)
m1 <- lm(y~x)

library(stargazer)
stargazer(list(m1, m1),
          ci = c(FALSE, TRUE),
          type = "text")
理论上,应报告第一列的标准错误和第二列的自定义置信区间,如
ci=c(FALSE,TRUE)
所示。相反,它为两列生成置信区间:

===============================================================
                                     Dependent variable:       
                              ---------------------------------
                                              y                
                                    (1)              (2)       
---------------------------------------------------------------
x                                 1.981***         1.981***    
                               (1.756, 2.206)   (1.756, 2.206) 
                                                               
Constant                          -0.218**         -0.218**    
                              (-0.425, -0.010) (-0.425, -0.010)
                                                               
---------------------------------------------------------------
Observations                        100              100       
R2                                 0.769            0.769      
Adjusted R2                        0.766            0.766      
Residual Std. Error (df = 98)      1.032            1.032      
F Statistic (df = 1; 98)         325.893***       325.893***   
===============================================================
Note:                               *p<0.1; **p<0.05; ***p<0.01
产生以下错误:

Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
  'data' must be of a vector type, was 'NULL'
以及以下各项:

stargazer(list(m1, m1),
          ci = c(FALSE, TRUE),
          ci.custom = list(NA, coefci(m1, vcov = vcovHC(m1, type = "HC2"))),
          type = "text")

产生一个新错误:

Error in if (ncol(ci.custom[[i]]) != 2) { : argument is of length zero
我甚至使用自定义标准错误选项
se
,尝试了这项非常复杂的工作。。。但这根本不起作用:

stargazer(list(m1, m1),
          se = list(sqrt(diag(vcovHC(m1, type = "HC2"))),
                    apply(round(coefci(m1, vcov = vcovHC(m1, type = "HC2"))[,1:2],3), 1 , paste, collapse = ", ")),
          type = "text")

% Error: Argument 'se' must be NULL (default), or a list of numeric vectors.
所有这些错误都是有道理的,但并不能真正帮助我

stargazer(list(m1, m1),
          ci = c(FALSE, TRUE),
          ci.custom = list(NA, coefci(m1, vcov = vcovHC(m1, type = "HC2"))),
          type = "text")

Error in if (ncol(ci.custom[[i]]) != 2) { : argument is of length zero
stargazer(list(m1, m1),
          se = list(sqrt(diag(vcovHC(m1, type = "HC2"))),
                    apply(round(coefci(m1, vcov = vcovHC(m1, type = "HC2"))[,1:2],3), 1 , paste, collapse = ", ")),
          type = "text")

% Error: Argument 'se' must be NULL (default), or a list of numeric vectors.