Categories &

Functions List

Function Reference: regression_ftest

statistics: h = regression_ftest (y, x)

statistics: h = regression_ftest (y, x, keep)

statistics: h = regression_ftest (…, Name, Value)

statistics: [h, p, stats] = regression_ftest (…)

F-test for nested linear regression models.

Fit the full linear model of the response y on every column of x, and a reduced model on the columns of x indexed by keep, both by least squares, and test the null hypothesis that the columns the reduced model leaves out add nothing to it. keep holds column indices or a logical mask; left out or empty, the reduced model has no predictors and the test is of every column of x together. Both models include a constant term unless 'Intercept' is false. y must be a vector with one element per row of x, and neither may contain missing values.

The test decision is returned in h, which is 1 when the null hypothesis is rejected at the significance level alpha and 0 otherwise, and the p-value in p. stats is a structure with the following fields:

fstatthe F statistic.
df1its numerator degrees of freedom, the number of coefficients the reduced model leaves out.
df2its denominator degrees of freedom, the residual degrees of freedom of the full model.
betafullthe coefficients of the full model, the constant first where there is one.
betareducedthose of the reduced model.
ssefullthe residual sum of squares of the full model.
ssereducedthat of the reduced model.
CohensF2Cohen’s f^2, the effect size of the columns tested.
CohensF2CIits 100 (1 - alpha)% confidence interval.

The degrees of freedom come from the ranks of the two designs. Cohen’s f^2 is taken, as Cohen defines it, from the noncentrality of the F statistic, lambda = f^2 (df1 + df2 + 1): the point estimate from max (F df1 (df2 - 2) / df2 - df1, 0), unbiased for the noncentrality before its truncation at zero, and the interval by inverting the noncentral F distribution. Where the interval would need a noncentrality above 10^5, where ncfcdf loses accuracy, it is NaN.

The following Name/Value pairs are accepted:

'Alpha'the significance level of h and the level of the confidence interval. Default is 0.05.
'Intercept'whether both models include a constant term. Default is true.

The same tests, and any linear hypothesis on the coefficients, are available from a fitted LinearModel through its coefTest method.

See also: regression_ttest, regress, fitlm

Source Code: regression_ftest