what are degrees of freedom 
degrees of freedom are the maximum number of logically independent values which may vary in a data sample degrees of freedom are calculated by subtracting one from the number of items within the data sample understanding degrees of freedomdegrees of freedom are the number of independent variables that can be estimated in a statistical analysis and tell you how many items can be randomly selected before constraints must be put in place within a data set some initial numbers can be chosen at random however if the data set must add up to a specific sum or mean for example the number in the data set is constrained to evaluate the values of all other values in a data set then meet the set requirement examples of degrees of freedomexample 1 consider a data sample consisting of five positive integers the values of the five integers must have an average of six if four items within the data set are 3 8 5 and 4 the fifth number must be 10 because the first four numbers can be chosen at random the degree of freedom is four example 2 consider a data sample consisting of five positive integers the values could be any number with no known relationship between them because all five can be chosen at random with no limitations the degree of freedom is four example 3 consider a data sample consisting of one integer that integer must be odd because there are constraints on the single item within the data set the degree of freedom is zero degrees of freedom formulathe formula to determine degrees of freedom is d f n 1 where d f degrees of freedom n sample size begin aligned text d text f n 1 textbf where text d text f text degrees of freedom n text sample size end aligned df n 1where df degrees of freedomn sample size for example imagine a task of selecting ten baseball players whose batting average must average to 250 the total number of players that will make up our data set is the sample size so n 10 in this example 9 10 1 baseball players can be randomly picked with the 10th baseball player having a specific batting average to adhere to the 250 batting average constraint some calculations of degrees of freedom with multiple parameters or relationships use the formula df n p where p is the number of different parameters or relationships for example in a 2 sample t test n 2 is used because there are two parameters to estimate applying degrees of freedomin statistics degrees of freedom define the shape of the t distribution used in t tests when calculating the p value depending on the sample size different degrees of freedom will display different t distributions calculating degrees of freedom is critical when understanding the importance of a chi square statistic and the validity of the null hypothesis degrees of freedom also have conceptual applications outside of statistics consider a company deciding the purchase of raw materials for its manufacturing process the company has two items within this data set the amount of raw materials to acquire and the total cost of the raw materials the company freely decides one of the two items but their choice will dictate the outcome of the other because it can only freely choose one of the two it has one degree of freedom in this situation if the company decides the amount of raw materials it cannot decide the total amount spent by setting the total amount to spend the company may be limited in the amount of raw materials it can acquire chi square teststhere are two different kinds of chi square tests the test of independence which asks a question of relationship such as is there a relationship between gender and sat scores and the goodness of fit test which asks something like if a coin is tossed 100 times will it come up heads 50 times and tails 50 times for these tests degrees of freedom are utilized to determine if a null hypothesis can be rejected based on the total number of variables and samples within the experiment for example when considering students and course choice a sample size of 30 or 40 students is likely not large enough to generate significant data getting the same or similar results from a study using a sample size of 400 or 500 students is more valid t testto perform a t test you must calculate the value of t for the sample and compare it to a critical value the critical value will vary and you can determine the correct critical value by using a data set s t distribution with the degrees of freedom sets with lower degrees of freedom have a higher probability of extreme values and higher degrees of freedom such as a sample size of at least 30 will be much closer to a normal distribution curve smaller sample sizes will correspond with smaller degrees of freedom and result in fatter t distribution tails in the examples above many of the situations may be used as a 1 sample t test for instance example 1 where five values are selected but must add up to a specific average can be defined as a 1 sample t test this is because there is only one constraint being placed on the variable history of degrees of freedomthe earliest and most basic concept of degrees of freedom was noted in the early 1800s intertwined in the works of mathematician and astronomer carl friedrich gauss the modern usage and understanding of the term were expounded upon first by william sealy gosset an english statistician in his article the probable error of a mean published in biometrika in 1908 under a pen name to preserve his anonymity 1in his writings gosset did not specifically use the term degrees of freedom he did explain the concept throughout developing what would eventually be known as student s t distribution the term was not popular until 1922 english biologist and statistician ronald fisher began using the term degrees of freedom when he published reports and data on his work developing chi squares 1