Skip to content
Prev 134260 / 398498 Next

'simulate.p.value' for goodness of fit

I'm afraid I can't follow your examples, but you seem to me to be
mixing contingency table tests and goodness of fit tests in a somewhat
incoherent fashion.

Note that your ``x2()'' function does a contingency table test, and not
a goodness of fit test.

Note that in chisq.test(), if ``x'' is a matrix, then the ``p'' argument
is ignored.

For a goodness of fit test, the sampling in chisq.test ***is***  
multinomial.  It
uses the sample() function, as a quick glance at the code would have  
told you.

I haven't the time to plough through your code and figure out what
you're driving at, but I think that part of your problem could be
the degrees of freedom.  Under the contingency table test the
degrees of freedom are 1; under the goodness of fit test the
degrees of freedom are 3.  (The vector of probabilities is
*known* under the g.o.f. test, not estimated.)

		cheers,

			Rolf Turner
On 18/01/2008, at 7:59 AM, Bob wrote:

            
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}