[R] help with simple goodness of fit test

jgant john.gant at gmail.com
Mon Oct 15 22:38:58 CEST 2007


Hello,
I've read the other posts with regard to "chisq.test" and "goodness of fit"
and am still missing something.
1. I create a simple vector of randomly generated lognormal values with
mean=0 and sd=1;
>d1 <- rlnorm(100,meanlog=0,sdlog=1);
2. I also create a vector of probabilities that are expected for a lognormal
distribution. I suspect this is the culprit.
>pr <- dlnorm(d1,meanlog=0,sdlog=1);
3. I perform the chi-square test on the random data and expected
probabilities.
>c <- chisq.test(d1,p=pr,rescale.p=TRUE);

The output is as follows:
Warning message:
Chi-squared approximation may be incorrect in: chisq.test(d1, p = pr,
rescale.p = TRUE) 
> c;

	Chi-squared test for given probabilities

data:  d1 
X-squared = 156992.7, df = 99, p-value < 2.2e-16

I'd expect the "goodness of fit" test to pass, with a high p value. Can
someone tell me why things seem incorrect. Again I apologize for the
simpleton request.

Thanks,
John
-- 
View this message in context: http://www.nabble.com/help-with-simple-goodness-of-fit-test-tf4630125.html#a13221078
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list