[R] Chi-Square Goodness-of-Fit test

Ethan Johnsons ethan.johnsons at gmail.com
Tue Dec 5 06:24:44 CET 2006


If we use this data as an example, does ks.test still valid?

E.Coli Group	Observed	Expected
A	57	77.9
B	330	547.1
C	2132	2126.7
D	4584	4283.3
E	4604	4478.5
F	2119	2431.1
G	659	684.1
H	251	107.2

thx

ej

On 12/4/06, Don McKenzie <dmck at u.washington.edu> wrote:
>
> in R v 2.4
>
> > x <- rnorm(50)
> > y <- rnorm(50)
> > ks.test(x,y,"rnorm")
>
>  Two-sample Kolmogorov-Smirnov test
>
> data:  x and y
> D = 0.08, p-value = 0.9977
> alternative hypothesis: two.sided
>
> **********
>
> > x <- rnorm(50)
> > y <- runif(50)
> > ks.test(x,y,"rnorm")
>
>  Two-sample Kolmogorov-Smirnov test
>
> data:  x and y
> D = 0.46, p-value = 3.801e-05
> alternative hypothesis: two.sided
> ******************
>
>
>
> On Dec 4, 2006, at 7:02 PM, Simon Blomberg wrote:
>
> See pearson.test in the nortest package. Also, read the notes section in
> ?pearson.test. You may not really want to do this test.
>
> HTH,
>
> Simon.
>
> Ethan Johnsons wrote:
> Do you know/have a function that takes a vector x and provides a
> returned p-value that uses the Chi-Square Goodness-of-Fit test to test
> the goodness of fit of a standard normal distribution.
>
> Awaiting your positive reply.
>
> Thx
>
> ej
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>
> --
> Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
> Centre for Resource and Environmental Studies
> The Australian National University
> Canberra ACT 0200
> Australia
> T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
> F: +61 2 6125 0757
> CRICOS Provider # 00120C
>
> The combination of some data and an aching desire for
> an answer does not ensure that a reasonable answer
> can be extracted from a given body of data.
> - John Tukey.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> Don McKenzie, Research Ecologist
> Pacific WIldland Fire Sciences Lab
> US Forest Service
>
> Affiliate Assistant Professor
> College of Forest Resources
> CSES Climate Impacts Group
> University of Washington
>
> 206.732.7824
> dmck at u.washington.edu
> donaldmckenzie at fs.fed.us
>
>
>
>




More information about the R-help mailing list