Jump to content

Degrees of freedom (statistics)

From Wikipedia, the free encyclopedia

Instatistics,the number ofdegrees of freedomis the number of values in the final calculation of astatisticthat are free to vary.[1]

Estimates ofstatistical parameterscan be based upon different amounts of information or data. The number of independent pieces of information that go into the estimate of a parameter is called the degrees of freedom. In general, the degrees of freedom of an estimate of a parameter are equal to the number of independentscoresthat go into the estimate minus the number of parameters used as intermediate steps in the estimation of the parameter itself. For example, if thevarianceis to be estimated from a random sample ofindependent scores, then the degrees of freedom is equal to the number of independent scores (N) minus the number of parameters estimated as intermediate steps (one, namely, the sample mean) and is therefore equal to.[2]

Mathematically, degrees of freedom is the number ofdimensionsof the domain of arandom vector,or essentially the number of "free" components (how many components need to be known before the vector is fully determined).

The term is most often used in the context oflinear models(linear regression,analysis of variance), where certain random vectors are constrained to lie inlinear subspaces,and the number of degrees of freedom is the dimension of thesubspace.The degrees of freedom are also commonly associated with the squared lengths (or "sum of squares" of the coordinates) of such vectors, and the parameters ofchi-squaredand other distributions that arise in associated statistical testing problems.

While introductory textbooks may introduce degrees of freedom as distribution parameters or through hypothesis testing, it is the underlying geometry that defines degrees of freedom, and is critical to a proper understanding of the concept.

History

[edit]

Although the basic concept of degrees of freedom was recognized as early as 1821 in the work of German astronomer and mathematicianCarl Friedrich Gauss,[3]its modern definition and usage was first elaborated by English statisticianWilliam Sealy Gossetin his 1908Biometrikaarticle "The Probable Error of a Mean", published under the pen name "Student".[4]While Gosset did not actually use the term 'degrees of freedom', he explained the concept in the course of developing what became known asStudent's t-distribution.The term itself was popularized by English statistician and biologistRonald Fisher,beginning with his 1922 work on chi squares.[5]

Notation

[edit]

In equations, the typical symbol for degrees of freedom isν(lowercaseGreek letter nu). In text and tables, the abbreviation "d.f." is commonly used.R. A. Fisherusednto symbolize degrees of freedom but modern usage typically reservesnfor sample size. When reporting the results ofstatistical tests,the degrees of freedom are typically noted beside the test statistic as either subscript or in parentheses.[6]

Of random vectors

[edit]

Geometrically, the degrees of freedom can be interpreted as the dimension of certain vector subspaces. As a starting point, suppose that we have a sample of independent normally distributed observations,

This can be represented as ann-dimensionalrandom vector:

Since this random vector can lie anywhere inn-dimensional space, it hasndegrees of freedom.

Now, letbe thesample mean.The random vector can be decomposed as the sum of the sample mean plus a vector of residuals:

The first vector on the right-hand side is constrained to be a multiple of the vector of 1's, and the only free quantity is.It therefore has 1 degree of freedom.

The second vector is constrained by the relation.The firstn− 1 components of this vector can be anything. However, once you know the firstn− 1 components, the constraint tells you the value of thenth component. Therefore, this vector hasn− 1 degrees of freedom.

Mathematically, the first vector is theoblique projectionof the data vector onto thesubspacespannedby the vector of 1's. The 1 degree of freedom is the dimension of this subspace. The second residual vector is the least-squares projection onto the (n− 1)-dimensionalorthogonal complementof this subspace, and hasn− 1 degrees of freedom.

In statistical testing applications, often one is not directly interested in the component vectors, but rather in their squared lengths. In the example above, theresidual sum-of-squaresis

If the data pointsare normally distributed with mean 0 and variance,then the residual sum of squares has a scaledchi-squared distribution(scaled by the factor), withn− 1 degrees of freedom. The degrees-of-freedom, here a parameter of the distribution, can still be interpreted as the dimension of an underlying vector subspace.

Likewise, the one-samplet-teststatistic,

follows aStudent's tdistribution withn− 1 degrees of freedom when the hypothesized meanis correct. Again, the degrees-of-freedom arises from the residual vector in the denominator.

In structural equation models

[edit]

When the results of structural equation models (SEM) are presented, they generally include one or more indices of overall model fit, the most common of which is aχ2statistic. This forms the basis for other indices that are commonly reported. Although it is these other statistics that are most commonly interpreted, thedegrees of freedomof theχ2are essential to understanding model fit as well as the nature of the model itself.

Degrees of freedom in SEM are computed as a difference between the number of unique pieces of information that are used as input into the analysis, sometimes called knowns, and the number of parameters that are uniquely estimated, sometimes called unknowns. For example, in a one-factor confirmatory factor analysis with 4 items, there are 10 knowns (the six unique covariances among the four items and the four item variances) and 8 unknowns (4 factor loadings and 4 error variances) for 2 degrees of freedom. Degrees of freedom are important to the understanding of model fit if for no other reason than that, all else being equal, the fewer degrees of freedom, the better indices such asχ2will be.

It has been shown that degrees of freedom can be used by readers of papers that contain SEMs to determine if the authors of those papers are in fact reporting the correct model fit statistics. In the organizational sciences, for example, nearly half of papers published in top journals report degrees of freedom that are inconsistent with the models described in those papers, leaving the reader to wonder which models were actually tested.[7]

Of residuals

[edit]

A common way to think of degrees of freedom is as the number of independent pieces of information available to estimate another piece of information. More concretely, the number of degrees of freedom is the number of independent observations in a sample of data that are available to estimate a parameter of the population from which that sample is drawn. For example, if we have two observations, when calculating the mean we have two independent observations; however, when calculating the variance, we have only one independent observation, since the two observations are equally distant from the sample mean.

In fitting statistical models to data, the vectors of residuals are constrained to lie in a space of smaller dimension than the number of components in the vector. That smaller dimension is the number ofdegrees of freedom for error,also calledresidual degrees of freedom.

Example

[edit]

Perhaps the simplest example is this. Suppose

arerandom variableseach withexpected valueμ,and let

be the "sample mean." Then the quantities

are residuals that may be consideredestimatesof theerrorsXiμ.The sum of the residuals (unlike the sum of the errors) is necessarily 0. If one knows the values of anyn− 1 of the residuals, one can thus find the last one. That means they are constrained to lie in a space of dimensionn− 1. One says that there aren− 1 degrees of freedom for errors.

An example which is only slightly less simple is that ofleast squaresestimation ofaandbin the model

wherexiis given, but eiand henceYiare random. Letandbe the least-squares estimates ofaandb.Then the residuals

are constrained to lie within the space defined by the two equations

One says that there aren− 2 degrees of freedom for error.

Notationally, the capital letterYis used in specifying the model, while lower-caseyin the definition of the residuals; that is because the former are hypothesized random variables and the latter are actual data.

We can generalise this to multiple regression involvingpparameters and covariates (e.g.p− 1 predictors and one mean (=intercept in the regression)), in which case the cost indegrees of freedom of the fitisp,leavingn - pdegrees of freedom for errors

In linear models

[edit]

The demonstration of thetand chi-squared distributions for one-sample problems above is the simplest example where degrees-of-freedom arise. However, similar geometry and vector decompositions underlie much of the theory oflinear models,includinglinear regressionandanalysis of variance.An explicit example based on comparison of three means is presented here; the geometry of linear models is discussed in more complete detail by Christensen (2002).[8]

Suppose independent observations are made for three populations,,and.The restriction to three groups and equal sample sizes simplifies notation, but the ideas are easily generalized.

The observations can be decomposed as

whereare the means of the individual samples, and is the mean of all 3nobservations. In vector notation this decomposition can be written as

The observation vector, on the left-hand side, has 3ndegrees of freedom. On the right-hand side, the first vector has one degree of freedom (or dimension) for the overall mean. The second vector depends on three random variables,,and.However, these must sum to 0 and so are constrained; the vector therefore must lie in a 2-dimensional subspace, and has 2 degrees of freedom. The remaining 3n− 3 degrees of freedom are in the residual vector (made up ofn− 1 degrees of freedom within each of the populations).

In analysis of variance (ANOVA)

[edit]

In statistical testing problems, one usually is not interested in the component vectors themselves, but rather in their squared lengths, or Sum of Squares. The degrees of freedom associated with a sum-of-squares is the degrees-of-freedom of the corresponding component vectors.

The three-population example above is an example ofone-way Analysis of Variance.The model, or treatment, sum-of-squares is the squared length of the second vector,

with 2 degrees of freedom. The residual, or error, sum-of-squares is

with 3(n−1) degrees of freedom. Of course, introductory books on ANOVA usually state formulae without showing the vectors, but it is this underlying geometry that gives rise to SS formulae, and shows how to unambiguously determine the degrees of freedom in any given situation.

Under the null hypothesis of no difference between population means (and assuming that standard ANOVA regularity assumptions are satisfied) the sums of squares have scaled chi-squared distributions, with the corresponding degrees of freedom. The F-test statistic is the ratio, after scaling by the degrees of freedom. If there is no difference between population means this ratio follows anF-distributionwith 2 and 3n− 3 degrees of freedom.

In some complicated settings, such as unbalancedsplit-plotdesigns, the sums-of-squares no longer have scaled chi-squared distributions. Comparison of sum-of-squares with degrees-of-freedom is no longer meaningful, and software may report certain fractional 'degrees of freedom' in these cases. Such numbers have no genuine degrees-of-freedom interpretation, but are simply providing anapproximatechi-squared distribution for the corresponding sum-of-squares. The details of such approximations are beyond the scope of this page.

In probability distributions

[edit]

Several commonly encountered statistical distributions (Student'st,chi-squared,F) have parameters that are commonly referred to asdegrees of freedom.This terminology simply reflects that in many applications where these distributions occur, the parameter corresponds to the degrees of freedom of an underlying random vector, as in the preceding ANOVA example. Another simple example is: ifare independent normalrandom variables, the statistic

follows a chi-squared distribution withn− 1 degrees of freedom. Here, the degrees of freedom arises from the residual sum-of-squares in the numerator, and in turn then− 1 degrees of freedom of the underlying residual vector.

In the application of these distributions to linear models, the degrees of freedom parameters can take onlyintegervalues. The underlying families of distributions allow fractional values for the degrees-of-freedom parameters, which can arise in more sophisticated uses. One set of examples is problems where chi-squared approximations based oneffective degrees of freedomare used. In other applications, such as modellingheavy-taileddata, a t orF-distribution may be used as an empirical model. In these cases, there is no particulardegrees of freedominterpretation to the distribution parameters, even though the terminology may continue to be used.

In non-standard regression

[edit]

Many non-standard regression methods, includingregularized least squares(e.g.,ridge regression),linear smoothers,smoothing splines,andsemiparametric regression,are not based onordinary least squaresprojections, but rather onregularized(generalizedand/or penalized) least-squares, and so degrees of freedom defined in terms of dimensionality is generally not useful for these procedures. However, these procedures are still linear in the observations, and the fitted values of the regression can be expressed in the form

whereis the vector of fitted values at each of the original covariate values from the fitted model,yis the original vector of responses, andHis thehat matrixor, more generally, smoother matrix.

For statistical inference, sums-of-squares can still be formed: the model sum-of-squares is;the residual sum-of-squares is.However, becauseHdoes not correspond to an ordinary least-squares fit (i.e. is not an orthogonal projection), these sums-of-squares no longer have (scaled, non-central) chi-squared distributions, and dimensionally defined degrees-of-freedom are not useful.

Theeffective degrees of freedomof the fit can be defined in various ways to implementgoodness-of-fit tests,cross-validation,and otherstatistical inferenceprocedures. Here one can distinguish betweenregression effective degrees of freedomandresidual effective degrees of freedom.

Regression effective degrees of freedom

[edit]

For the regression effective degrees of freedom, appropriate definitions can include thetraceof the hat matrix,[9]tr(H), the trace of the quadratic form of the hat matrix, tr(H'H), the form tr(2HHH'), or theSatterthwaite approximation,tr(H'H)2/tr(H'HH'H).[10] In the case of linear regression, the hat matrixHisX(X'X)−1X ',and all these definitions reduce to the usual degrees of freedom. Notice that

the regression (not residual) degrees of freedom in linear models are "the sum of the sensitivities of the fitted values with respect to the observed response values",[11]i.e. the sum ofleverage scores.

One way to help to conceptualize this is to consider a simple smoothing matrix like aGaussian blur,used to mitigate data noise. In contrast to a simple linear or polynomial fit, computing the effective degrees of freedom of the smoothing function is not straightforward. In these cases, it is important to estimate the Degrees of Freedom permitted by thematrix so that the residual degrees of freedom can then be used to estimate statistical tests such as.

Residual effective degrees of freedom

[edit]

There are corresponding definitions of residual effective degrees-of-freedom (redf), withHreplaced byIH.For example, if the goal is to estimate error variance, the redf would be defined as tr((IH)'(IH)), and the unbiased estimate is (with),

or:[12][13][14][15]

The last approximation above[13]reduces the computational cost fromO(n2) to onlyO(n). In general the numerator would be the objective function being minimized; e.g., if the hat matrix includes an observation covariance matrix, Σ, thenbecomes.

General

[edit]

Note that unlike in the original case, non-integer degrees of freedom are allowed, though the value must usually still be constrained between 0 andn.[16]

Consider, as an example, thek-nearest neighboursmoother, which is the average of theknearest measured values to the given point. Then, at each of thenmeasured points, the weight of the original value on the linear combination that makes up the predicted value is just 1/k.Thus, the trace of the hat matrix isn/k.Thus the smooth costsn/keffective degrees of freedom.

As another example, consider the existence of nearly duplicated observations. Naive application of classical formula,np,would lead to over-estimation of the residuals degree of freedom, as if each observation were independent. More realistically, though, the hat matrixH=X(X' Σ−1X)−1X 'Σ−1would involve an observation covariance matrix Σ indicating the non-zero correlation among observations.

The more general formulation of effective degree of freedom would result in a more realistic estimate for, e.g., the error variance σ2,which in its turn scales the unknown parameters'a posterioristandard deviation; the degree of freedom will also affect the expansion factor necessary to produce anerror ellipsefor a givenconfidence level.

Other formulations

[edit]

Similar concepts are theequivalent degrees of freedominnon-parametric regression,[17]thedegree of freedom of signalin atmospheric studies,[18][19]and thenon-integer degree of freedomin geodesy.[20][21]

The residual sum-of-squareshas ageneralized chi-squared distribution,and the theory associated with this distribution[22]provides an alternative route to the answers provided above.[further explanation needed]

See also

[edit]

References

[edit]
  1. ^"Degrees of Freedom".Glossary of Statistical Terms.Animated Software.Retrieved2008-08-21.
  2. ^Lane, David M."Degrees of Freedom".HyperStat Online.Statistics Solutions.Retrieved2008-08-21.
  3. ^Walker, H. M. (April 1940)."Degrees of Freedom"(PDF).Journal of Educational Psychology.31(4): 253–269.doi:10.1037/h0054588.
  4. ^Student (March 1908)."The Probable Error of a Mean".Biometrika.6(1): 1–25.doi:10.2307/2331554.JSTOR2331554.
  5. ^Fisher, R. A. (January 1922)."On the Interpretation of χ2 from Contingency Tables, and the Calculation of P".Journal of the Royal Statistical Society.85(1): 87–94.doi:10.2307/2340521.JSTOR2340521.
  6. ^Cichoń, Mariusz (2020-06-01)."Reporting statistical methods and outcome of statistical analyses in research articles".Pharmacological Reports.72(3): 481–485.doi:10.1007/s43440-020-00110-5.ISSN2299-5684.
  7. ^Cortina, J. M., Green, J. P., Keeler, K. R., & Vandenberg, R. J. (2017). Degrees of freedom in SEM: Are we testing the models that we claim to test?. Organizational Research Methods, 20(3), 350-378.
  8. ^Christensen, Ronald (2002).Plane Answers to Complex Questions: The Theory of Linear Models(Third ed.). New York: Springer.ISBN0-387-95361-2.
  9. ^Trevor Hastie,Robert Tibshirani,Jerome H. Friedman (2009),The elements of statistical learning: data mining, inference, and prediction,2nd ed., 746 p.ISBN978-0-387-84857-0,doi:10.1007/978-0-387-84858-7,[1](eq.(5.16))
  10. ^Fox, J. (2000).Nonparametric Simple Regression: Smoothing Scatterplots.Quantitative Applications in the Social Sciences. Vol. 130. SAGE Publications. p. 58.ISBN978-0-7619-1585-0.Retrieved2020-08-28.
  11. ^Ye, J. (1998), "On Measuring and Correcting the Effects of Data Mining and Model Selection",Journal of the American Statistical Association,93 (441), 120–131.JSTOR2669609(eq.(7))
  12. ^Clive Loader (1999),Local regression and likelihood,ISBN978-0-387-98775-0,doi:10.1007/b98858,(eq.(2.18), p. 30)
  13. ^abTrevor Hastie, Robert Tibshirani (1990),Generalized additive models,CRC Press, (p. 54) and (eq.(B.1), p. 305))
  14. ^Simon N. Wood (2006),Generalized additive models: an introduction with R,CRC Press, (eq.(4,14), p. 172)
  15. ^David Ruppert, M. P. Wand, R. J. Carroll (2003),Semiparametric Regression,Cambridge University Press (eq.(3.28), p. 82)
  16. ^James S. Hodges (2014),Richly Parameterized Linear Models,CRC Press.[2]
  17. ^Peter J. Green, B. W. Silverman (1994),Nonparametric regression and generalized linear models: a roughness penalty approach,CRC Press (eq.(3.15), p. 37)
  18. ^Clive D. Rodgers (2000),Inverse methods for atmospheric sounding: theory and practice,World Scientific (eq.(2.56), p. 31)
  19. ^Adrian Doicu, Thomas Trautmann, Franz Schreier (2010),Numerical Regularization for Atmospheric Inverse Problems,Springer (eq.(4.26), p. 114)
  20. ^D. Dong, T. A. Herring and R. W. King (1997), Estimating regional deformation from a combination of space and terrestrial geodetic data,J. Geodesy,72 (4), 200–214,doi:10.1007/s001900050161(eq.(27), p. 205)
  21. ^H. Theil (1963), "On the Use of Incomplete Prior Information in Regression Analysis",Journal of the American Statistical Association,58 (302), 401–414JSTOR2283275(eq.(5.19)–(5.20))
  22. ^Jones, D.A. (1983) "Statistical analysis of empirical models fitted by optimisation",Biometrika,70 (1), 67–88

Further reading

[edit]
[edit]