Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to make a contingency table and chi-square test?


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: How to make a contingency table and chi-square test?
Date   Sun, 14 Apr 2013 11:35:48 +0100

What you want to do is very unclear.

You sketch a 2 x 2 table, with "institute" and "individual" as the two
rows. But "institute" and "individual" are not categories of a binary
or dichotomous variable; they are measured variables with many
distinct values. In fact, many, many distinct values, so many that any
command based directly or indirectly on -tabulate- will fail.

Also, _none_ of the commands you tried include -institute-,
-individual- _and_ -female-, so quite why you expect an analysis of
all three to emerge is unclear.

Perhaps what you are trying to get is something like

gen dominant = individual > institute
label def dominant 1 individual 0 institute
label val dominant dominant

tab dominant female , chi2

but

0. That chi-square test throws most of the information in the variables away.

1. I guess you have so many values that virtually anything will
qualify as highly significant.

2. The chi-square test would ignore all panel and time dependence
structure, and its P-value can't be taken literally. This may not
matter because of #0 and #1.

I'd suggest concentrating on _measuring_ effects, not testing for them.

Nick
njcoxstata@gmail.com


On 14 April 2013 08:03, 李 梦佳 <limengjia626@163.com> wrote:
> Dear statalist,
>
> How to make a contingency table of my following panel data and report the chi-square value?
>
> fund code       female  institute       individual      time
> ----------------+-------------------------------------------------------
> 000001.OF       0               0.234   0.766           200506
> 000002.OF       1               0.201   0.799           200506
> ⋯⋯
> 000001.OF       0               0.283   0.717           201012
> 000002.OF       1               0.256   0.744           201012
>
> I wish to make a contingency table like the following and test whether females attracts more individual investors than institute investors, as well as whether females attract more institute/individual investors than males.
>                         Male    Female
> ----------------+----------------------------
> institute          f1           f2
> individual      f3              f4
>
> (Basically, f1+f2+f3+f4=1. I just wish to test whether f1=f2, f1=f3, f3=f4, f2=f4 at the same time using chi-square)
>
> I tried the following codes but failed:
>
> . tabulate institute individual
> too many values
> r(134);
>
> . tab institute individual, ch
> too many values
> r(134);
>
> . symmetry institute female
> too many values
> r(134);
>
> . symmetry institute female, exact
> too many values
> r(134);
>
> . symmetry institute female, contrib
> too many values
> r(134);
>
> Could anyone kindly enlighten me how to do this?
>
> Many thanks,
> Mengjia
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index