Re: [R] style question

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Sun, 03 Apr 2011 17:57:36 -0400

On May 1, 2008, at 1:46 PM, Sebastián Daza wrote:

> 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:#)"))

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
===============================================


>
> 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.
>
> --
> Sebastián Daza
> sebastian.daza_at_gmail.com
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 03 Apr 2011 - 22:11:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 03 Apr 2011 - 22:20:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive