How do you calculate degrees of freedom for a two sample z-test?

To calculate the degrees of freedom for a two-sample z-test, follow these steps:

1. Determine the sample sizes for both samples: Let's call them n1 and n2.
2. Calculate the sample variances for both samples: Let's call them s1^2 and s2^2.
3. Use the formula for calculating degrees of freedom: df = (s1^2/n1 + s2^2/n2)^2 / ((s1^2/n1)^2 / (n1-1) + (s2^2/n2)^2 / (n2-1)).

Here's an example to illustrate the calculation:

Suppose you have two samples: Sample 1 with size n1 = 20 and sample variance s1^2 = 36, and Sample 2 with size n2 = 25 and sample variance s2^2 = 64.

Using the formula, calculate the degrees of freedom:
df = [(36/20) + (64/25)]^2 / [((36/20)^2 / 19) + ((64/25)^2 / 24)]

Simplifying this equation will give you the degrees of freedom for the two-sample z-test.