0
$\begingroup$

In R, gls object contains "residuals" and the summary(gls) object contains residuals. Both differ from each other. Which is the one I should use for checking the normality?

> shapiro.test(summary(m)$residuals)

    Shapiro-Wilk normality test

data:  summary(m)$residuals
W = 0.92493, p-value = 0.5622

> shapiro.test(m$residuals)

    Shapiro-Wilk normality test

data:  m$residuals
W = 0.92671, p-value = 0.000242

Let's make it model agnostic.

EDIT: just answered. The residuals from the model are just 5 quantiles of the raw residuals.

$\endgroup$
1
  • $\begingroup$ Ah, just saw your edit.. seems like you figured it out! $\endgroup$
    – doubled
    Commented Jun 28, 2020 at 2:52

1 Answer 1

1
$\begingroup$

You're probably used to the summary(object) function from the base, in which case the residuals of the object are equivalent to the residuals of the summary of the object (indeed, summary just stores the residuals in the class summary.lm). But with gls, you're probably using summary.gls() which, as mentioned in the documentation (see here), defines the residual component as:

residuals
if more than five observations are used in the gls fit, a vector with the minimum, first quartile, median, third quartile, and maximum of the residuals distribution; else the residuals.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.