[R] categorical data analysis

David Winsemius dwinsemius at comcast.net
Wed May 7 04:37:16 CEST 2008


raymond chiruka <rtchiruka at yahoo.com> wrote in
news:485562.78562.qm at web33008.mail.mud.yahoo.com: 

> i am trying to carry out a categorical data analysis but my problem
> is that when in i use the chi squared  test some of my  expected
> values are less than 5. is there a  test that can handle this
> situation. the data is not a 2*2 table. its more from the social
> sciences where you have from strongly agree to strongly disagree. i
> know i can collapse vthe tables but there is a loss of information .
> is the a test vthat i can for this kind of data. thanks in advancde.
 
In addition to Snow's suggestion of fisher.test, you may want to look 
more closely at:
?chisq.test

# read information on simulate.p.value
# uses same algorithm (Patefield) as fisher.test
# from help examples:

x <- c(89,37,30,28,2)
p <- c(0.40,0.20,0.20,0.19,0.01)
                                # Expected count in category 5
                                # is 1.86 < 5 ==> chi square approx.
chisq.test(x, p = p)            #      maybe doubtful, but is ok!
chisq.test(x, p = p, simulate.p.value = TRUE)

-- 
David Winsemius



More information about the R-help mailing list