IQSS / Zelig

A statistical framework that serves as a common interface to a large range of models
http://zeligproject.org
109 stars 43 forks source link

Use printCoefmat in show method #166

Closed cchoirat closed 7 years ago

cchoirat commented 7 years ago

Instead of

    Estimate<-as.vector(imp.q)
        Std.Error<-as.vector(imp.se)
        zvalue<-Estimate/Std.Error
        Pr.z<-2*(1-pnorm(abs(zvalue)))
        stars<-rep("",am.k)
        stars[Pr.z<.05]<-"."
        stars[Pr.z<.01]<-"*"
        stars[Pr.z<.001]<-"**"
        stars[Pr.z<.0001]<-"***"

        results<-data.frame(Estimate,Std.Error,zvalue,Pr.z,stars,row.names=names(coeflist[[1]]))
        names(results)<-c("Estimate","Std.Error","z value","Pr(>|z|)","")
        print(results, digits=max(3, getOption("digits") - 3))
        cat("---\nSignif. codes:  '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n")
        cat("\n")
        cat("For results from individual imputed datasets, use summary(x, subset = i:j)\n")
christophergandrud commented 7 years ago

First attempt: 1af88d5f876f37c62dc2ce27fc5731f17b90300d

Though stars and digits don't seem to be working.

cchoirat commented 7 years ago

Likely because of https://github.com/IQSS/Zelig/blob/master/R/model-zelig.R#L762-L764.

On Wed, Mar 1, 2017 at 4:29 PM, Christopher Gandrud < notifications@github.com> wrote:

First attempt: 1af88d5 https://github.com/IQSS/Zelig/commit/1af88d5f876f37c62dc2ce27fc5731f17b90300d

Though stars and digits don't seem to be working.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IQSS/Zelig/issues/166#issuecomment-283476290, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-wZcaZe6nTgMgPVGX3IXwbwRguaFAGks5rheM_gaJpZM4Lpp7d .

christophergandrud commented 7 years ago

From 3f74a0d9102ea3e7e37588449634b475fa02a2ab:

library(mice)
library(Amelia)
library(Zelig)
imp <- amelia(nhanes)
mod <- zelig(age ~ hyp, data = imp, model = 'poisson')
combine_coef_se(mod)

summary(mod)

## Model: Combined Imputations 
## 
##             Estimate Std.Error z value Pr(>|z|)
## (Intercept)   -0.023     0.485     0.0      1.0
## hyp            0.471     0.356     1.3      0.2
## 
## For results from individual imputed datasets, use summary(x, subset = i:j)
## Next step: Use 'setx' method

using printCoefMat