Skip to content

style question

2 messages · Sebastián Daza, David Winsemius

#
Hi everyone,
I am trying to build a table putting standard errors horizontally. I 
haven't been able to do it.

library(memisc)
berkeley <- aggregate(Table(Admit,Freq)~.,data=UCBAdmissions)

berk0 <- glm(cbind(Admitted,Rejected)~1,data=berkeley,family="binomial")
berk1 <- 
glm(cbind(Admitted,Rejected)~Gender,data=berkeley,family="binomial")
berk2 <- 
glm(cbind(Admitted,Rejected)~Gender+Dept,data=berkeley,family="binomial")

setCoefTemplate(est.se=c(est = "($est:#)($se:#)"))

mtable(berk0,berk1,berk2,
+         coef.style="est.se",
+         summary.stats=c("Deviance","AIC","N"))
Error in dim(ans) <- newdims :
   dims [product 1] do not match the length of object [2]

Thank you in advance.
#
On May 1, 2008, at 1:46 PM, Sebasti?n Daza wrote:

            
I'm not a skilled user of that package but just looking at the value  
of the last four leaves of the list you created makes me wonder if you  
meant to do something like the `ci.se.horizontal` variant?

$ci.se.horizontal
     est         se
est "($est:#)"  "(($se:#))"
ci  "[($lwr:#)" "($upr:#)]"

$ci.p
         est           p         lwr         upr
  "($est:#)"  "(($p:#))" "[($lwr:#)" "($upr:#)]"

$ci.p.horizontal
     est         se
est "($est:#)"  "(($p:#))"
ci  "[($lwr:#)" "($upr:#)]"

$est.se   # Your addition doesn't really look like the others in the  
list
               est
"($est:#)($se:#)"


This runs without error:

 > mtable(berk0,berk1,berk2,
          coef.style="ci.se.horizontal",
          summary.stats=c("Deviance","AIC","N"))

On the other hand maybe you wanted this, (note a two item list):
tt<-
setCoefTemplate(est.se=list(est = "($est:#)", se="($se:#)"))

 > tt['est.se']
$est.se
        est         se
"($est:#)"  "($se:#)"

 > mtable(berk0,berk1,berk2,
+          coef.style="est.se",
+          summary.stats=c("Deviance","AIC","N"))

Calls:
berk0: glm(formula = cbind(Admitted, Rejected) ~ 1, family = "binomial",
     data = berkeley)
berk1: glm(formula = cbind(Admitted, Rejected) ~ Gender, family =  
"binomial",
     data = berkeley)
berk2: glm(formula = cbind(Admitted, Rejected) ~ Gender + Dept, family  
= "binomial",
     data = berkeley)

===============================================
                       berk0    berk1    berk2
-----------------------------------------------
(Intercept)           -0.457   -0.220    0.582
                        0.031    0.039    0.069
Gender: Female/Male            -0.610    0.100
                                 0.064    0.081
Dept: B/A                               -0.043
                                          0.110
Dept: C/A                               -1.263
                                          0.107
Dept: D/A                               -1.295
                                          0.106
Dept: E/A                               -1.739
                                          0.126
Dept: F/A                               -3.306
                                          0.170
-----------------------------------------------
Deviance              877.056  783.607   20.204
AIC                   947.996  856.547  103.144
N                    4526     4526     4526
===============================================
David Winsemius, MD
West Hartford, CT