Robin Hankin
2002-Jun-13 04:46 UTC
[R] possum sleeping: thanks and fisher.test() FEXACT error
Dear helplist Many many thanks to everyone who helped me. The trick was to use tabulate() or, better, tab <- rep(0,50) names(tab) <- 1:50 tab[names(table(sleeps))] <- table(c) My original dataset was a list of 50 trees and a length 12 vector recording which tree a certain possum slept in on 12 nights. As Professor Ripley points out, a Monte-Carlo simulation is easy to set up, and it shows that chi-squared is inapplicable. If H0 is that the animal chooses randomly from amongst these 50 trees then the number of sleeps in each tree is multinomial with n=50 and p_i=12/50 for i=1:50 (H0 is biologically reasonable: the 50 trees were those in which a possum slept on at least one occasion). The next step is to check whether the five animals have different preferences. I have an array called alldata which has 50 rows (one per tree) and five columns (one per animal). But, in R-1.5.0, R> fisher.test(alldata[,2:5]) Error in fisher.test(alldata[, 2:5]) : FEXACT error 30. Stack length exceeded in f3xact. This problem should not occur. what am I doing wrong here? R> dput (alldata) structure(c(0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 4, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 2, 2, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 8, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0), .Dim = c(50, 5), .Dimnames = list(NULL, c("x14", "x88", "x82", "x90", "x98"))) -- Robin Hankin, Lecturer, School of Geographical and Environmental Science Private Bag 92019 Auckland New Zealand r.hankin at auckland.ac.nz tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042 as of: Thu Jun 13 16:19:00 NZST 2002 This (linux) system up continuously for: 287 days, 23 hours, 01 minutes -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._