# Fligner-Killeen Test in R Programming

• Last Updated : 12 Oct, 2020

The Fligner-Killeen test is a non-parametric test for homogeneity of group variances based on ranks. It is useful when the data are non-normally distributed or when problems related to outliers in the dataset cannot be resolved. It is also one of the many tests for homogeneity of variances which is most robust against departures from normality. There are several solutions to test for the equality (homogeneity) of variance across groups, including:

• F-test
• Bartlett’s test
• Levene’s test
• Fligner-Killeen test

It is very much easy to perform these tests in R programming. In this article let’s perform the Fligner-Killeen test in R.

#### Statistical Hypotheses for Fligner-Killeen test

A hypothesis is a statement about the given problem. Hypothesis testing is a statistical method that is used in making a statistical decision using experimental data. Hypothesis testing is basically an assumption that we make about a population parameter. It evaluates two mutually exclusive statements about a population to determine which statement is best supported by the sample data. To know more about the statistical hypothesis please refer to Understanding Hypothesis Testing. For Fligner-Killeen test the statistical hypotheses are:

• Null Hypothesis: All populations variances are equal
• Alternative Hypothesis: At least two of them differ

#### Implementation in R

The R provides a function fligner.test() which is available in stats package that can be used to compute the Fligner-Killeen test. The syntax for this function is given below:

Syntax:

fligner.test(formula, dataset)

Parameters:

formula: a formula of the form values ~ groups

dataset: a matrix or data frame

#### Examples of Fligner-Killeen test

Fligner-Killeen test with one independent variable:

Consider the R’s inbuilt PlantGrowth dataset that gives the dried weight of three groups of ten batches of plants, wherever every group of ten batches got a different treatment. The weight variable gives the weight of the batch and the group variable gives the treatment received either ctrl, trt1 or trt2. To view the data set please type below command:

## R

 `print``(PlantGrowth)`

Output:

```    weight group
1    4.17  ctrl
2    5.58  ctrl
3    5.18  ctrl
4    6.11  ctrl
5    4.50  ctrl
6    4.61  ctrl
7    5.17  ctrl
8    4.53  ctrl
9    5.33  ctrl
10   5.14  ctrl
11   4.81  trt1
12   4.17  trt1
13   4.41  trt1
14   3.59  trt1
15   5.87  trt1
16   3.83  trt1
17   6.03  trt1
18   4.89  trt1
19   4.32  trt1
20   4.69  trt1
21   6.31  trt2
22   5.12  trt2
23   5.54  trt2
24   5.50  trt2
25   5.37  trt2
26   5.29  trt2
27   4.92  trt2
28   6.15  trt2
29   5.80  trt2
30   5.26  trt2
```

As mentioned above, the Fligner-Killeen test is useful when the data are non-normally distributed or when problems related to outliers in the dataset cannot be resolved. Here let’s consider only one independent variable. To perform the test, use the below command:

## R

 `# R program to illustrate``# Fligner-Killeen test`` ` `# Import required package``library``(stats)`` ` `# Using fligner.test()``result = ``fligner.test``(weight ~ group, PlantGrowth)`` ` `# print the result``print``(result)`

Output:

```Fligner-Killeen test of homogeneity of variances

data:  weight by group
Fligner-Killeen:med chi-squared = 2.3499, df = 2, p-value = 0.3088
```

Fligner-Killeen test with multiple independent variables:

If one wants to do the test with multiple independent variables then the interaction() function must be used to collapse multiple factors into a single variable containing all combinations of the factors. Here let’s take the R’s inbuilt ToothGrowth data set.

## R

 `# R program to illustrate``# Fligner-Killeen test`` ` `# Import required package``library``(stats)`` ` `# Using fligner.test()``result = ``fligner.test``(len ~ ``interaction``(supp, dose), ``                      ``data = ToothGrowth)`` ` `# print the result``print``(result)`

Output:

```Fligner-Killeen test of homogeneity of variances

data:  len by interaction(supp, dose)
Fligner-Killeen:med chi-squared = 7.7488, df = 5, p-value = 0.1706
```

My Personal Notes arrow_drop_up