Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Typesetting contingency table

810 views
Skip to first unread message

Tom??

unread,
Sep 30, 2004, 5:10:37 PM9/30/04
to
Hi,

I'm typesetting latex documents containing a lot of contingency
tables. About half of these tables are really simple ones (just
values and requencies etc.), but the other ones are really
complex (labels for variables, marginal totals, etc.)

I've tried to nest the common latex tables, but it didn't work
as well as I'd like, so I use latex tables for the easy ones
and Adobe Illustrator for the more complicated. But is has
serious disadvantages:

1) it really isn's flexible and fast to typeset
2) there are significant differences in the appearance

Is there some latex package that can be used to typeset these
complicated tables? I've found only the "sgame" package,
intended for the symmetric games, but it's suitable only for
the simple ones.

thanks in advance
Tomas

Dong Hoon

unread,
Oct 1, 2004, 4:01:13 AM10/1/04
to
On Thu, 30 Sep 2004, Tom?? wrote:

> I'm typesetting latex documents containing a lot of contingency
> tables. About half of these tables are really simple ones (just
> values and requencies etc.), but the other ones are really
> complex (labels for variables, marginal totals, etc.)

>[...]


> Is there some latex package that can be used to typeset these
> complicated tables? I've found only the "sgame" package,
> intended for the symmetric games, but it's suitable only for
> the simple ones.

could you just give an example (online .pdf for instance) of such a
complex table?

Tom??

unread,
Oct 1, 2004, 6:30:49 PM10/1/04
to
> could you just give an example (online .pdf for instance) of
> such a complex table?

Sure I can - I've placed two tables (which I consider complex) here:

http://www.fuzzy.cz/latex/contingency-rxs.pdf
http://www.fuzzy.cz/latex/contingency-2x2.pdf

The first one is probably the most complex contingency table I use,
that means table with:

- "r" rows, "s" columns
- variable names ("X" and "Y")
- column and row labels ("1", "2", etc.)
- marginal totals (n(i,*) on the right side for rows and n(*,j)
at the bottom for columns)
- total ("n" in the bottom right corner)

This table has some "blank" rows/column to demonstrate a common
structure of a contingency table.

The second one is a common 2x2 contingency table, which has the same
structure, but has exactly 2 rows and 2 columns (and no blank rows
or columns). This is the table I'd like to typeset using latex,
because I use it really often (when compared to the previous complex
table). But of course it'd be really nice to achieve the same look
for the complex tables too.

PS: Both tables comes from Adobe Illustrator.

Igor Pechtchanski

unread,
Oct 1, 2004, 10:18:08 PM10/1/04
to

I'm not sure if you can get the first table easily, but the second table
seems pretty easy to typeset using the standard {tabular} environment
(with the help of the multirow package). Does the code below do what you
want? Note: extra commands defined for brevity only. You can control the
thickness of inner lines by adding or removing extra '|'s and '\hline's.
You can also add colors using the colortbl package.

\footnotesize\sffamily\bfseries
\newcommand{\M}{\textmd}
\newcommand{\B}{$\bullet$}
\newcommand{\MC}{\multicolumn}
\newcommand{\MR}{\multirow}
\setlength{\doublerulesep}{.9\arrayrulewidth}
\addtolength{\tabcolsep}{2pt}
\begin{tabular}%
{|cl||c|c||c|}
\hline
& & \MC{2}{c||}{Y} & \\
& & 0 & 1 & \\
\hline\hline
& 0 & \M{n(0,0)} & \M{n(0,1)} & n(0,\B) \\
\cline{2-5}
\MR{-2}{*}{X} & 1 & \M{n(1,0)} & \M{n(1,1)} & n(1,\B) \\
\hline\hline
& & n(\B,0) & n(\B,1) & n \\
\hline
\end{tabular}

Sorry if this is too simplistic. HTH,
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pech...@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ ig...@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing." -- Dr. Jubal Harshaw

Tom??

unread,
Oct 2, 2004, 8:31:12 AM10/2/04
to
Thanks, this looks great!

I didn't know the multirow package, hopefully I'll be able to
typeset the complicated one this way too.

Tomas

0 new messages