Displaying 20 results from an estimated 10000 matches similar to: "Simulating from the null distribution of a 2 x 3 table"
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:
2003 Apr 22
4
fisher exact vs. simulated chi-square
Dear All,
I have a problem understanding the difference between the outcome of a
fisher exact test and a chi-square test (with simulated p.value).
For some sample data (see below), fisher 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
2011 Apr 08
4
Fast version of Fisher's Exact Test
Is anyone aware of a fast way of doing fisher's exact test for a series of 2
x 2 tables in R? The fisher.test is really slow if n1=1000 and n2 = 1000.
--
Thanks,
Jim.
[[alternative HTML version deleted]]
2008 Jan 17
1
'simulate.p.value' for goodness of fit
R Help on 'chisq.test' states that
"if 'simulate.p.value' is 'TRUE', the p-value is computed by Monte
Carlo simulation with 'B' replicates.
In the contingency table case this is done by random sampling from
the set of all contingency tables with given marginals, and works
only if the marginals are positive...
In the
2017 Aug 24
3
Are r2dtable and C_r2dtable behaving correctly?
Hello,
While doing some enrichment tests using chisq.test() with simulated
p-values, I noticed some strange behaviour. The computed p-value was
extremely small, so I decided to dig a little deeper and 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,
2007 Nov 22
5
testing independence of categorical variables
hi,
is there a way of calculating of measuring dependence between two
categorical variables. i tried using the chi square test to test for
independence but i got error saying that the lengths of the two
vectors don't match. Suppose X and Y are two factors. X has 5 levels
and Y has 7 levels. This is what i tried doing
>temp<-chisq.test(x,y)
but got error "the lengths of the two
2007 Oct 12
2
Automating binning for chisq.test()
The standard chisq.test() and fisher.test() functions, when applied to
two distributions (to determine whether the same underlying
distribution applies to both) requires one to pre-bin the
distributions.
Is there a library function (either built-in or in a package) that
acts more like the ks.test() function, in that one can simply pass the
two distributions and have it do the necessary binning as
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
2011 May 12
3
assigning creating missing rows and values
I have a dataset where I have missing times (11:00 and 16:00). I would like
the outputs to include the missing time so that the final time vector looks
like "realt" and has the previous time's value. Ex. If meas at time 15:30 is
0.45, then the meas for time 16:00 will also be 0.45.
meas are the measurements and times are the times at which they were taken.
meas<-runif(18)
2011 May 26
4
predictive accuracy
I am trying to develop a prognostic model using logistic regression. I
built a full , approximate models with the use of penalization - design
package. Also, I tried Chi-square criteria, step-down techniques. Used
BS for model validation.
The main purpose is to develop a predictive model for future patient
population. One of the strong predictor pertains to the study design
and would not
2011 Aug 30
3
Simulating distribution of max of two die
Hallo
I am teaching a very elementary intro course about R, and want to show
the students how to find the distribution of the maximum of rolling
two balanced die. Is there perhaps a more elegant way to do this,
other than the way I am using below? (I would like to show them two
ways - the one shown here, and perhaps and improved/elegant approach
(showing off the "beauty" of R.
2011 Sep 15
1
Questions on 'lme' function, urgent!
Hi Dear all,
I have some gene expression data samples from different tissue types
-----------------------------------------------
- 120 samples from blood (B)
- 20 samples from Liver (L)
- 15 samples from Kidney (K)
- 6 samples from heart (H)
-----------------------------------------------
All the samples are from different individuals, so there are in total 161
individuals from which the DNA was
2008 Nov 16
3
chisq.test with simulate.p.value=TRUE (PR#13292)
Full_Name: Reginaldo Constantino
Version: 2.8.0
OS: Ubuntu Hardy (32 bit, kernel 2.6.24)
Submission from: (NULL) (189.61.88.2)
For many tables, chisq.test with simulate.p.value=TRUE gives a p value that is
obviously incorrect and inversely proportional to the number of replicates:
> data(HairEyeColor)
> x <- margin.table(HairEyeColor, c(1, 2))
>
2010 Jan 06
2
Generating data from Null Distribution
Hello everyone,
Can someone tell me exactly how to generate data from a null distribution
for the fisher exact test? I know I have to use the hypergrometric but
exactly what commands do I use?
Jim
[[alternative HTML version deleted]]
2004 Oct 09
2
Is it safe? Cochran etc
I have the following contingency table
dat <- matrix(c(1,506,13714,878702),nr=2)
And I want to test if their is an association between events
A:{a,not(a)} and B:{b,not(b)}
| b | not(b) |
--------+-----+--------+
a | 1 | 13714 |
--------+-----+--------+
not(a) | 506 | 878702 |
--------+-----+--------+
I am worried that prop.test and chisq.test are not valid given the
2009 Jan 23
5
Stat textbook recommendations?
Hello,
I'm looking for a textbook that can explain some of the math behind
the intro-to-intermediate stuff like ANOVA, multiple regression, non-
parametric tests, etc.
A little background: I took an intro stats course last year and
would like to further my education. Being as that was the highest
(and only) stats class the local community college offers, it looks
like I'm on
2006 Jun 30
2
Query : Chi Square goodness of fit test
I want to calculate chi square test of goodness of fit to test,
Sample coming from Poisson distribution.
please copy this script in R & run the script
The R script is as follows
########################## start
#########################################
No_of_Frouds<-
c(4,1,6,9,9,10,2,4,8,2,3,0,1,2,3,1,3,4,5,4,4,4,9,5,4,3,11,8,12,3,10,0,7)
N <- length(No_of_Frouds)
# Estimation of
2001 Oct 21
3
generating a gamma random variable
Dear R People,
This question has nothing to do with R directly, but it is a simulation
question. I need to generate a random variable distributed as
gamma(\alpha,\beta), with the additional proviso that it must be a
function of random variable(s) which do not depend on \alpha, \beta. In
this case, I have \alpha = (T-1)/2, where T is a positive integer.
So, it seems reasonable to first simulate
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
2002 Sep 30
5
Chi-Square Distribution Plots
Dear list
I have a vector of values that allegedly have a chi-squared distribution. I
want to create a plot that shows the values I have obtained, and the
chi-squared distribution curve for the specified number of degrees of freedom
to show what should have been obtained.
At the moment I am plotting the values I have obtained as a histogram and
somehow want to put on to this plot the