[R] Question About lm()
Rolf Turner
r@turner @end|ng |rom @uck|@nd@@c@nz
Thu Feb 10 22:08:30 CET 2022
On Wed, 9 Feb 2022 23:16:13 -0800
David Winsemius <dwinsemius using comcast.net> wrote:
> The models are NOT equivalent. Why would you’ll think they were?
'Scuse me, David, but they *are* "equivalent". They are simply
different parametrisations of the same model. *However* the different
parametrisations imply, according to the conventions of lm(), different
*null* models.
For yResp ~ xCat + xCont, the null model is yResp ~ 1.
For yResp ~ -1 + xCat + xCont, the null model is yResp ~ 0.
For the first null model, the residual sum of squares is
ssr1 = sum((yResp-mean(yResp))^2).
For the second null model, the residual sum of squares is
ssr2 = sum(yResp^2).
Thus for the first parametrisation one gets
RSquared = 1 - ssr1/ssr
and for the second parametrisation one gets
RSquared = 1 - ssr2/ssr
in both cases "ssr" is the sum of squares of the residuals from the
full model (which is of course the same in both cases).
I hope that this clarifies things a bit for the OP.
One further comment: RSquared is a bit of a dubious concept; it is
particularly dubious for models with no intercept. Caveat utilitor.
cheers,
Rolf
--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-help
mailing list