Im trying to use Tukey's HSD but I don't know how to get the qk part of the formula?

To use Tukey's Honest Significant Difference (HSD) test, you need to find the critical value, also known as qk. The qk value depends on the significance level (α), the number of groups (k), and the degrees of freedom within groups (dfw).

To obtain qk:

1. Determine the number of groups (k) and the degrees of freedom within groups (dfw). The degrees of freedom within groups can be calculated by subtracting the number of groups from the total sample size.

2. Choose the desired significance level (α) for your test. Common choices are 0.05 or 0.01.

3. Look up the critical value in the q-table for the appropriate degree of freedom within groups (dfw) and number of groups (k) at the chosen significance level (α). The q-table provides critical values specific to Tukey's HSD test.

Here's an example of how to find qk:

Suppose you have conducted a one-way analysis of variance (ANOVA) with 4 groups, each containing 10 observations. This results in a total sample size of 40.

1. Determine the degrees of freedom within groups (dfw): dfw = n - k = 40 - 4 = 36.

2. Choose a significance level (α), let's say α = 0.05.

3. Refer to the appropriate q-table, such as this one: http://faculty.washington.edu/stuve/B511/tables/qtable.html

4. Locate the row that corresponds to dfw = 36.

5. Look for the column that corresponds to k = 4. In this example, four means four groups.

6. Find the value where the row and column intersect, which is the critical value qk.

For α = 0.05, dfw = 36, and k = 4, the critical value qk is approximately 3.833.

Remember that qk represents the minimum mean difference required to be considered statistically significant, considering the number of groups and the degrees of freedom within groups.