# FTEST: help and advice

Consult the reference manual for further details and worked examples.
W.G.Bardsley, University of Manchester, U.K.

The F distribution

If A and B are two independent chi-square variables with m and n degrees of freedom respectively, the random variable X, defined as X = (A/m)/(B/n), is said to be F distributed with parameters m and n, i.e. X is distributed F(m,n).
Clearly m > 0, n > 0 and F >= 0.
If pdf(x) = the probability density function the, cdf(x), or cumulative distribution function, is the integral of pdf(u) between u = 0 and u = x.
Upper and lower tail probabilities are defined for an alpha (0 =< alpha =< 1) and some X-value ( e.g. X = X-critical ) by

         lower tail probability = P(X =< X-critical) = 1 - alpha
         upper tail probability = P(X >= X-critical) = alpha

where P(E) = probability of event E in the sample space. Sometimes percentage points 100(1 - alpha)% or 100*alpha% are preferred.

Option 1

You input m and n for all subsequent calculations except for options 6 and 7 (which set m and n automatically). Option 1 is selected to change m and/or n.

Option 2

You input x-values and the program calculates probability density functions, i.e. pdf(x) values.

Option 3

You input x-values and the program calculates cumulative distribution functions, i.e. cdf(x) values.

Option 4

You input significance levels alpha and obtain x-critical values such that P(X >= x-critical) = alpha, i.e. inverses of the F distribution.

Option 5

You input measured values V1, V2, ..., VK and the program calculates probability integral transforms W1, W2, ...,WK under the null hypothesis that V is F(m,n) distributed. Kolmogorov-Smirnov and chi-square tests are performed on the transforms to test the hypothesis that W is uniformly distributed on the interval (0,1), which is equivalent to the null hypothesis.
Use MAKMAT/EDITMT to prepare/edit files (like ftest.tf1).)

Option 6

The F test for excess variance
Model discrimination can be performed using a variance ratio

         VR = [(Q1 - Q2)/(M2 - M1)]/[Q2/(NPTS - M2)], where
         Q1 = (wtd) sum of squares after fitting model 1,
         Q2 = (wtd) sum of squares after fitting model 2,
         M1 = no. of parameters estimated in model 1,
         M2 = no. of parameters estimated in model 2, and
         NPTS = number of experimental measurements.

Under H0: the experimental error (after weighting) is of the constant variance type and the models are linear and nested, VR should be distributed F(M2 - M1, NPTS - M2). If the error is not of a constant variance type then weights equal to standard deviations of measurements should be used, i.e. the Q values are weighted sums of squares. The test will only be approximate for nonlinear models. The variance ratio test for equality of variance with two independent samples is performed by program TTEST.

What to do if replicates have been used

Often replicates are used to calculate standard errors for weighting or for curve fitting to means of replicates which complicates the F test.
There are three cases.

1. You have i measurements in all and Q1,Q2 are the sums of i squared (wtd) residuals, i.e. NPTS = i. This is correct.
2. You have j sets of means each with k replicates so Q1,Q2 are sums over j sets of squared (weighted ?) differences between mean values and best-fit values. Leave Q1 and Q2 alone but set NPTS equal to j multiplied by k.
3. You have j sets of means each with different numbers of replicates say k1, k2,..., kj and the Q1, Q2 values were constructed by fitting mean values as in 2. Whatever you do will lead to biased F statistics.

Option 7

The 1-, 2- and 3-way Analysis of Variance
For one way analysis of variance, you can type in or prepare a data matrix file if all columns have equal length. However, if you want greater versatility, make files of individual columns. Once you have read in a set of data files (not necessarily of equal column length) you can edit to suppress/restore selected columns. You can try variance stabilising transforms such as:- log(x), sqrt(x), arcsin(sqrt(x)),without altering the original data. After doing the usual analysis a Kruskall-Wallis one way nonparametric ANOVA by ranks is always performed.Print out the file anova1.tf1 for an example of a 1-way ANOVA library file. For a two way analysis of variance you should prepare a matrix of data using MAKMAT.After doing the usual analysis a Friedman nonparametric ANOVA by ranks is always performed. Examine the file anova2.tf1 to see how to prepare data for a 2-way ANOVA. For a three way analysis of variance you should make a 2n by n matrix of data using MAKMAT, with the top n by n submatrix set up with numbers 1 to n (corresponding to A, B, C,etc.) for the Latin Square key, as in the 3-way ANOVA data file anova3.tf1.

Test files

The full set of AVOVA and MANOVA test files can be viewed from the main [View] option. Here is a description of some of these.
ftest.tf1
This is a set of F(m,n) pseudo random numbers with parameters m = 2 and n = 5. First choose option 1 to set the degrees of freedom equal to 2 and 5. Then read this test file into option 5 to see how the program is used to test if a set of numbers do come from an F distribution.

anova1.tf1
This is a library file to explore 1 way analysis of variance. Choose option 7 then read in this test file to see how to use this program to do 1 way ANOVA interactively, by selecting the columns to be included and the variance stabilising transform to employ (dividing by 100 to normalise in this case). There is a similar version of this data in file anova1.TFL. Note how nonparametric analysis is done automatically.

anova2.tf1 and anova3.tf1
Use these files to find out how to do 2-way and 3-way ANOVA.