Formatting an anova table using latex

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Formatting an anova table using latex

Michael Kubovy
Hi r-helpers,

When I issue the command

latex(anova(raw1.lmer0, raw1.lmer, raw1.lmerI), file = 'raw1.tex',  
rownamesTexCmd = c('baR', 'addit', 'multip'), longtable = F, dcolumn  
= T, booktabs = T, t able.env = F, colheads = NULL, colnamesTexCmd = c
('', 'df', 'aic', 'bic', 'logl', 'chisq', 'chisqdf', 'prchisq'))

I get:

% latex.default(anova(raw1.lmer0, raw1.lmer, raw1.lmerI), file =  
"raw1.tex",      rownamesTexCmd = c("baR", "addit", "multip"),  
longtable = F,      dcolumn = T, booktabs = T, table.env = F,  
rowheads = NULL,      colheads = NULL, colnamesTexCmd = c("", "df",  
"aic", "bic",          "logl", "chisq", "chisqdf", "prchisq"))
%
\newcolumntype{.}{D{.}{.}{-1}}
\begin{center}
\begin{tabular}{l.......}\toprule
\multicolumn{1}{l}{\ }&
\multicolumn{1}{c}{\df }&
\multicolumn{1}{c}{\aic }&
\multicolumn{1}{c}{\bic }&
\multicolumn{1}{c}{\logl }&
\multicolumn{1}{c}{\chisq }&
\multicolumn{1}{c}{\chisqdf }&
\multicolumn{1}{c}{\prchisq }
\\ \midrule
\baR   raw1.lmer0 &    4 &    434 &    446 &    -213 &     &     &    \\
\addit   raw1.lmer &    5 &    436 &    451 &    -213 &    0.021 &    
~1 &    0.89\\
\multip   raw1.lmerI &    6 &    438 &    456 &    -213 &    0.114  
&    ~1 &    0.74\\
\bottomrule
\end{tabular}

\end{center}

Can you tell me how to suppress 'raw1.lmer0', 'raw1.lmer', and  
'raw1.lmerI' in the first column?



_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Formatting an anova table using latex

Dieter Menne
Michael Kubovy <kubovy <at> virginia.edu> writes:

>
>
> When I issue the command
>
> latex(anova(raw1.lmer0, raw1.lmer, raw1.lmerI), file = 'raw1.tex',  
> rownamesTexCmd = c('baR', 'addit', 'multip'), longtable = F, dcolumn  
> = T, booktabs = T, t able.env = F, colheads = NULL, colnamesTexCmd = c
> ('', 'df', 'aic', 'bic', 'logl', 'chisq', 'chisqdf', 'prchisq'))
...
> Can you tell me how to suppress 'raw1.lmer0', 'raw1.lmer', and  
> 'raw1.lmerI' in the first column?
>

rowname = NULL

(note: it's not "rownames", which is a bit confusing)

Dieter

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Formatting an anova table using latex

Michael Kubovy
Thanks Dieter,

Unfortunately this doesn't work.

rowname = NULL

suppresses row names altogether. I want to substitute different row  
names by writing

rownamesTexCmd = c('baR', 'addit', 'multip')

When I do this without writing rowname = NULL, my row names appear  
first, followed by the default row names from anova.

On Mar 13, 2006, at 12:34 PM, Dieter Menne wrote:

> Michael Kubovy <kubovy <at> virginia.edu> writes:
>
>> When I issue the command
>>
>> latex(anova(raw1.lmer0, raw1.lmer, raw1.lmerI), file = 'raw1.tex',
>> rownamesTexCmd = c('baR', 'addit', 'multip'), longtable = F, dcolumn
>> = T, booktabs = T, t able.env = F, colheads = NULL, colnamesTexCmd  
>> = c
>> ('', 'df', 'aic', 'bic', 'logl', 'chisq', 'chisqdf', 'prchisq'))
> ...
>> Can you tell me how to suppress 'raw1.lmer0', 'raw1.lmer', and
>> 'raw1.lmerI' in the first column?
>
> rowname = NULL
>
> (note: it's not "rownames", which is a bit confusing)
>
> Dieter

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Formatting an anova table using latex

Dieter Menne
Michael Kubovy <kubovy <at> virginia.edu> writes:

>
>
> Unfortunately this doesn't work.
>
> rowname = NULL
>
> suppresses row names altogether. I want to substitute different row  
> names ....
>

This example works for me. Take into account that rownamesTexCmd adds
the leading \, so you cannot use it to add visible text.

Dieter

-------
library(nlme)
library(Hmisc)

fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)
fm2 <- update(fm1, random = pdDiag(~age))
an = anova(fm1, fm2)


latex(an, file ="",#'raw1.tex',
rownamesTexCmd = c("bfseries", "textit" ),
rowname = c('baR', 'addit' ),
longtable = F,
dcolumn= T, booktabs = T, table.env = F, colheads = NULL,
colnamesTexCmd = c
('', 'df', 'aic', 'bic', 'logl', 'chisq', 'chisqdf', 'prchisq'))

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html