I am fitting a linear regression model $$Y = \beta_0+ \beta_1 Z + \beta_2 X+\epsilon$$ Response $Y$ and covariate $X$ are continuous variables and $Z$ is a 0/1 dichotomous treatment group indicator, all are $N \times 1$ vectors. $\epsilon$ is a $N \times 1$ vector of normally distributed i.i.d. random errors with expectation 0 and unknown variance $\sigma^2$.
My goal is to obtain the joint distribution of 30 t-test statistics under the null hypothesis. This is to achive adjusted p-values for 30 correlated tests each corresponding to a separate response variabale $Y$. For this purpose, I want to obatin the permutation distribution of the t-test for the coefficient $\beta_1$. In permutations, which one of the following is correct:
(1) Randomly permute $Y$, and obtain the distribution of $\beta_1$ accross 1000 permutations
(2) Randomly permute $Z$, and obtain the distribution of $\beta_1$ accross 1000 permutations
(3) Let $Z(X)$ be the vector of residuals from fitting $Z$ on $X$, and let $Y(X)$ be the residuals from fitting $Y$ on $X$.
Then permute $Y(X)$ 1000 times and record the 1000 regression coefficients of $Z(X)$ when regressing $Y(X)$ on $Z(X)$.
(4) Permute $Y(X)$ 1000 times and record the 1000 regression coefficients, where $Y(X)$ is regressed on $Z$. This would be same as comparing the means of the "X-adjusted values" of $Y$ in the 2 groups.
I would think (3) is the correct way as it preserves the relationships of $X$ to $Y$ and $Z$. Thus before permutation I should clear the effect of $X$ from both $Z$ and $Y$. But (4) also does not sound completely unreasonable to me. I cannot find a good reference where this is appropriately discussed.