简体   繁体   English

通过texreg或stargazer显示Amelia,多重插补的结果

[英]Show the Result of Amelia, Multiple Imputation, by texreg or stargazer

I would like to know how to export the outcome of Multiple Imputation Amelia summary to tex or html by texreg or stargazer . 我想知道如何通过texregstargazer将多重插补Amelia摘要的结果导出到tex或html。 However, both type of packages show the error. 但是,两种类型的软件包都显示错误。

library(Amelia)
library(Zelig)
library(texreg)
library(stargazer)

mi <-amelia(x = d,m = 5)
summary(mi)
lmi <- zelig(y ~ x1+x2,
 data = m, model = "logit")
summary(lmi)
mi2 <-amelia(x = d,m = 5)
summary(mi2)
lmi2 <- zelig(y ~ x1+x2,
 data = m2, model = "logit")
summary(lmi2)

stargazer(lmi,lmi2, title="hogehoge", omit.stat=c("f","ser"), align=T, no.space=T)

>Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
>‘result’ is not a valid field or method name for reference class “Zelig-logit”

models <- list(lmi,lmi2)
texreg(l=models,file="texreg.tex", caption="texreg",
    digits=3, booktabs=T, dcolumn=T, center=T, use.packages=F, caption.above=T, custom.model.names=c("model1", "model2"))

>Error in (function (classes, fdef, mtable)  :
>unable to find an inherited method for function ‘extract’ for signature ‘"Zelig-logit"’

How can I show the result of multiple imputation by R? 如何显示R的多重插补结果?

PS 聚苯乙烯

> summary(lmi)
Model: Combined Imputations 
                    Estimate Std.Error  z value  Pr(>|z|)    
(Intercept)         -4.15186   0.41048 -10.1147 0.000e+00 ***
x1                   9.76225   0.18356  12.4336 0.000e+00 ***
x2                   1.76719   0.18031  10.9489 0.000e+00 ***
---
Signif. codes:  '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

For results from individual imputed datasets, use summary(x, subset = i:j)
Next step: Use 'setx' method

lmi2 is similar to lmi. lmi2与lmi类似。

Not all model objects are currently supported in either package, and I guess that is the case for the models you are using. 两种软件包中目前都不支持所有模型对象,我想您正在使用的模型就是这种情况。 If stargazer does not support your model object I'm not aware of a solution. 如果观星者不支持您的模型对象,那么我不知道解决方案。 However, texreg is extensible: you can write a simple function to extract what you need from the model object and then the normal texreg commands will work with that extract function. 但是,texreg是可扩展的:您可以编写一个简单的函数从模型对象中提取所需的内容,然后普通的texreg命令将与该提取函数一起使用。 This is clearly explained in this article on texreg, see section six. 这篇关于texreg的文章对此进行了清楚的解释,请参见第六部分。

The author of texreg also wrote out an example of how to write an extract function in answer to a question I asked here , and wrote an even more comprehensive review of how to extend texreg here . texreg的作者也写出来的如何写在回答我提出的问题的提取功能相关的例子在这里 ,并写了如何扩展texreg一个更全面的审查这里 I would advise you to write extract functions that work with your model objects and then you can use texreg. 我建议您编写与模型对象一起使用的提取函数,然后再使用texreg。

texreg now handles Zelig objects and works with Amelia, Mice and Mi through Zelig. texreg现在可以处理Zelig对象,并通过Zelig与Amelia,Mice和Mi合作。 Use the function to_zelig_mi to create data object that Zelig will recognize. 使用函数to_zelig_mi创建Zelig将识别的数据对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM