[R] chisq.test(): standardized (adjusted) Pearson residuals
David Winsemius
dwinsemius at comcast.net
Sat Aug 20 17:58:57 CEST 2011
On Aug 20, 2011, at 3:43 AM, peter dalgaard wrote:
>
> On Aug 19, 2011, at 20:40 , David Winsemius wrote:
>
>>
>> On Aug 19, 2011, at 1:28 PM, Stephen Davies wrote:
>>
>>> I'm using chisq.test() on a matrix of categorical data, and I see
>>> that the
>>> "residuals" attribute of the returned object will give me the
>>> Pearson residuals.
Actually they are not an attribute in the R sense, but rather a list
value.
>>> That's cool. However, what I'd really like is the standardized
>>> (adjusted)
>>> Pearson residuals, which have a N(0,1) distribution. Is there a
>>> way to do that
>>> in R (other than by me programming it myself?)
>>
>> ?scale
>
> chisq.test(...)$stdres, more likely.
Agree that does have a much greater chance of keeping the questioner
in the mainstream of statistics terminology and is most likely what he
was looking for, but do not think the result will in general have an
N(1,0) distribution. I believe the correct statement is that
standardized residuals would (in the statistical "asymptotic" sense)
have an N(1,0) distribution if and when the null hypothesis of
marginal homogeneity were true, but should not be N(1,0) in any case
when an alternate hypothesis holds. My error was in taking the
questioner's request at face value.
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list