search for: r2dtable

Displaying 20 results from an estimated 31 matches for "r2dtable".

2017 Aug 25
2
Are r2dtable and C_r2dtable behaving correctly?
It is not about "really arge total number of observations", but: set.seed(4711);tabs <- r2dtable(1e6, c(2, 2), c(2, 2)); A11 <- vapply(tabs, function(x) x[1, 1], numeric(1));table(A11) A11 0 1 2 166483 666853 166664 There are three possible matrices, and these come out in proportions 1:4:1, the one with all cells filled with ones being most common. Cheers, Jari O. ______...
2017 Aug 24
3
Are r2dtable and C_r2dtable behaving correctly?
...d debug chisq.test(). I noticed then that the simulated statistics returned by the following call tmp <- .Call(C_chisq_sim, sr, sc, B, E) were all the same, very small numbers. This, at first, seemed strange to me. So I decided to do some simulations myself, and started playing around with the r2dtable() function. Problem is, using my row and column marginals, r2dtable() always returns the same matrix. Let's provide a minimal example: rr <- c(209410, 276167) cc <- c(25000, 460577) ms <- r2dtable(3, rr, cc) I have tested this code in two machines and it always returned the same list...
2017 Aug 25
0
Are r2dtable and C_r2dtable behaving correctly?
> On 25 Aug 2017, at 11:23 , Jari Oksanen <jari.oksanen at oulu.fi> wrote: > > It is not about "really arge total number of observations", but: > > set.seed(4711);tabs <- r2dtable(1e6, c(2, 2), c(2, 2)); A11 <- vapply(tabs, function(x) x[1, 1], numeric(1));table(A11) > > A11 > 0 1 2 > 166483 666853 166664 > > There are three possible matrices, and these come out in proportions 1:4:1, the one with all cells filled with ones being > mo...
2017 Aug 25
0
Are r2dtable and C_r2dtable behaving correctly?
...simulated statistics returned by the > following call > tmp <- .Call(C_chisq_sim, sr, sc, B, E) > were all the same, very small numbers. This, at first, seemed strange to > me. So I decided to do some simulations myself, and started playing around > with the r2dtable() function. Problem is, using my row and column > marginals, r2dtable() always returns the same matrix. Let's provide a > minimal example: > rr <- c(209410, 276167) > cc <- c(25000, 460577) > ms <- r2dtable(3, rr, cc) > I have tested this cod...
2017 Aug 25
1
Are r2dtable and C_r2dtable behaving correctly?
> On 25 Aug 2017, at 10:30 , Martin Maechler <maechler at stat.math.ethz.ch> wrote: > [...] > https://stackoverflow.com/questions/37309276/r-r2dtable-contingency-tables-are-too-concentrated > > >> set.seed(1); system.time(tabs <- r2dtable(1e6, c(100, 100), c(100, 100))); A11 <- vapply(tabs, function(x) x[1, 1], numeric(1)) > user system elapsed > 0.218 0.025 0.244 >> table(A11) > > 34 35...
2003 Dec 13
0
chisq.test() and r2dtable() freezing on certain inputs (PR#5701)
...(src/appl/rcont.c) line 70: MM> yes, that's correct. However, as I have found out now, the real reason *is* integer overflow (in multiplication), as I had guessed originally (but didn't believe anymore for a while after your exp() underflow diagnosis). Note that this also affects r2dtable(), and e.g., the following gives a segmentation fault: M <- 50000 ; r2dtable(1, c(2*M,3), M+1:2) Further, even if I protect against the exp() underflow, I can still see examples which "freeze", i.e. end in an infinite loop. ------- The fix is to ensure that integer multiplications...
2003 Apr 22
4
fisher exact vs. simulated chi-square
...r reports p=.02337. The normal chi-square test complains about "approximation may be incorrect", because there is a column with cells with very small values. I therefore tried the chi-square with simulated p-values, but this still gives p=.04037. I also simulated the p-value myself, using r2dtable, getting the same result, p=0.04 (approx). Why is this substantially higher than what the fisher exact says? Do the two tests make different assumptions? I noticed that the discrepancy gets smaller when I increase the number of observations for column A3. Does this mean that the simulated chi-squa...
2004 Feb 17
2
Generating 2x2 contingency tables
Hello R-users, I would like to generate two-way contingency tables with zero in one cell. I tried to use the function r2dtable but I could not force one cell to have zero value. Any Idea? Best regards.. Mahmoud [[alternative HTML version deleted]]
2011 Jul 07
4
Simulating from the null distribution of a 2 x 3 table
Dear all, I want to simulate from the null distribution of the following 2 x 3 table, 2 5 10 4 8 5 I am using a chi-squared test. Anyone has any idea how to do this? -- Thanks, Jim. [[alternative HTML version deleted]]
2012 Jan 24
2
Null models of species co-occurrence
I am currently testing species co-occurrence patterns using null models and the oecosimu() function within the vegan() package. My issue is that none of the methods appear to be the ones that I want. The methods listed are r0, r1, r2, r2dtable, swap, tswap. However, I want to know how to go about implementing fixed row algorithms, as suggested in Gotelli 2000 in Ecology. Also, the null models created seem to be incredibly dependent on the 1) burnin and 2) thin values. These are the 1) Number of null communities discarded before proper...
2009 Feb 24
2
Simulating contingency table (Basic question, help please)
I'd like to carry out a Monte Carlo simulation test where given data is a contingency table. I think this is something to do with using rmultinonom(), but I'm not sure how to code this, to simulate contingency tables. Could anyone please help with how to use R to simulate contingency tables like this? -- View this message in context:
2005 Feb 09
6
randomisation
Dear useRs I am looking for a way to randomise the values within a matrix: the conditions are that the sums of the rows and the sums of the columns should remain the same as in the original matrix. Any help would be appreciated Cheers Yann
2005 Jan 18
1
chi-square and error bars?
This may sound crazy but... I have data like this... > results.matrix [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 949 93 2 11 26 20 7 6 10 5 0 3 [2,] 1233 124 24 35 58 57 17 21 31 19 11 21 Which is the result of binning (summing) the response variables of an underlying (nearly) continious range of predictor
2010 Jan 19
1
(no subject)
I am considering testing: Ho: Odds Ratio =1 H1: Odds Ratio <>1 How can I generate data from the null distribution for a specific configuration of a Fisher exact test? Jim [[alternative HTML version deleted]]
2006 Oct 16
2
Generate a random bistochastic matrix
Please, I would like to generate a random bistochastic matrix, that is a squared matrix of non-negative numbers with each row and each column sum to 1, for example : .2 .3 .5 .6 .3 .1 .2 .4 .4 I don't know of to code this. Do you have any idea ? Thanks Florent Bresson ___________________________________________________________________________ Demandez ?
2008 Sep 17
1
Exact test in nxm contingency table
Hello, I am trying to find a permutation test that works on a general nxm table. The data set is small enough to have cells with too small counts to make chi2-approximation invalid. If the table was a 2x2 contingency table I would like to use a Fsher exact test (fisher.test) but that wont work in this general table. Does there exist a general function for this test. Best regards, Magnus
2003 Dec 09
1
pdfs for printed edition of R reference manual
Hi, This message is to let the R developers know that the pdfs for the first two volumes of the printed edition of R reference manual are available at, http://www.network-theory.co.uk/R/base/vol1.pdf http://www.network-theory.co.uk/R/base/vol2.pdf I've divided the manual into "core commands" of the base package (control flow, and related programming commands, etc) in Volume 1
2007 Apr 27
4
Randomising matrices
I would like to be able to randomise presence-absence (i.e. binary) matrices whilst keeping both the row and column totals constant. Is there a function in R that would allow me to do this? I'm working with vegetation presence-absence matrices based on field observations. The matrices are formatted to have sites as rows and species as columns. The presence of a species on a site is
2020 Oct 10
0
R 4.0.3 is released
...thanks to bug report and patch PR#17124 from Alex Bertram. * rank(x) and hence sort(x) now work when x is an object (as per is.object(x)) of type "raw" _and_ provides a valid `[` method, e.g., for gmp::as.bigz(.) numbers. * chisq.test(*, simulate.p.value=TRUE) and r2dtable() now work correctly for large table entries (in the millions). Reported by Sebastian Meyer and investigated by more helpers in PR#16184. * Low-level socket read/write operations have been fixed to correctly signal communication errors. Previously, such errors could le...
2020 Oct 10
0
R 4.0.3 is released
...thanks to bug report and patch PR#17124 from Alex Bertram. * rank(x) and hence sort(x) now work when x is an object (as per is.object(x)) of type "raw" _and_ provides a valid `[` method, e.g., for gmp::as.bigz(.) numbers. * chisq.test(*, simulate.p.value=TRUE) and r2dtable() now work correctly for large table entries (in the millions). Reported by Sebastian Meyer and investigated by more helpers in PR#16184. * Low-level socket read/write operations have been fixed to correctly signal communication errors. Previously, such errors could le...