From: condor on
"Tom Lane" <tlaneATmathworksDOTcom(a)nospam.com> wrote in message <hu64rn$5oo$1(a)fred.mathworks.com>...
> >> When stepwisefit has 3 predictors, it's not possible to compute the
> >> significance of a 4th one >
> > I don't understand why... Because of 5 observations I should have a
> > maximum number of predictors of 4 + the constant term, isn't it?
> > As written above, the r-squared is almost alway near to 1 (from 0.995 to
> > 1). The number of predictors used vary from 1 to 3 (+constat term), what
> > is strange is that on 20,000 regressions I did, I haven't found one with 4
> > predictors (+constat term)?
>
> In the process of deciding whether to add a predictor, we (the stepwisefit
> function) computes F statistics that compare:
>
> 1. The reduction in error sum of squares that results from adding the
> predictor.
>
> 2. The remaining error sum of squares after adding the predictor.
>
> If adding a new predictor will saturate the model, we're guaranteed that #1
> is 100% of the error sum of squares, and #2 is zero. So we can't
> meaningfully test one against the other.
>
> -- Tom
>
SO you mean that if n is the number of observations and k the number of factors we should always have n>k (never n>=k) right? And this because we heed to have at least one degree of freedom in order to test a model against another?
From: Tom Lane on
> SO you mean that if n is the number of observations and k the number of
> factors we should always have n>k (never n>=k) right? And this because we
> heed to have at least one degree of freedom in order to test a model
> against another?

That is correct, stepwisefit can only produce models with k<n, because it
needs at least on degree of freedom for error for testing.

-- Tom


From: condor on
"Tom Lane" <tlaneATmathworksDOTcom(a)nospam.com> wrote in message <hu8ip9$8tv$1(a)fred.mathworks.com>...
> > SO you mean that if n is the number of observations and k the number of
> > factors we should always have n>k (never n>=k) right? And this because we
> > heed to have at least one degree of freedom in order to test a model
> > against another?
>
> That is correct, stepwisefit can only produce models with k<n, because it
> needs at least on degree of freedom for error for testing.
>
> -- Tom
>

Wondeful, thanks very much