Contingency table question

30 views
Skip to first unread message

JSS

unread,
May 30, 2012, 11:06:45 PM5/30/12
to ded...@googlegroups.com
Hi,

Deducer is great, really enjoying the feature set, especially the robust plot builder.  The price is pretty nice, too. ;)  I've been using various stat packages for years and it is nice to finally see something like this.  I've always wanted to get into R and this is motivating me to actually try.  Anyway...

I had a question about the contingency table analysis.  Is there any way to define a column as a frequency column to summarize the frequency of a particular set of conditions instead of having each data point have an individual row? 
For instance, if I have a data set in which I have 5 of organism 1 with status 1 and 15 of organism 1 with status 2, and  8  of organism 2 with status 1 and 23 with status 2 could I basically summarize that with 4 rows and 3 columns (the final being the frequency) or do I need a row for each data point? 

Helios De Rosario

unread,
May 31, 2012, 6:37:40 AM5/31/12
to ded...@googlegroups.com
Hi,

You can do that with the function xtabs. It's not included among Deducer dialogs, but it's fairly easy to use. If your data frame DF has the variables "organism", "status", and "freq", just type:

xtabs(freq~organism+status, data=DF)

Helios

JSS

unread,
May 31, 2012, 10:48:51 PM5/31/12
to ded...@googlegroups.com
Hi, thanks! 

 That answered my question, though from that it does sound like I can't have the GUI take care of my tests then :( which is too bad but I like being able to explore a bit with R and Deducer is helping me learn quite a bit, so that is good!  

Btw, is there any way to force Deducer to give the more conservative p-value from Fisher's exact test (and other tests if it is using the "middle" p value in many others)

Ian Fellows

unread,
May 31, 2012, 11:15:25 PM5/31/12
to ded...@googlegroups.com
for the chi-squared, you can select "conservative" and monte-carlo,
and that will give you the level alpha p-value. You can't do that for
the fisher's exact test, but you can change it in the command line
with the conservative=TRUE option:

tables<-add.fishers.exact(tables,conservative=TRUE)



ian
Reply all
Reply to author
Forward
0 new messages