Stata's permute and weighted regression I want to do a permutation test for a command where I'm using weights. E.g.:
 permute treatment _b[treatment]: reg y x treatment [pweight=w]

permute doesn't allow for weights, but can be forced to ignore that. The help-file only has the vague statement that: "permute is not suited for weighted estimation, thus permute should not be used with weights or svy".
Is anyone here able to explain why weights might be problematic for permutation tests?
 A: Permutation tests do resampling from the observed units in the dataset, or in the subsample selected (if using if statements). As such:


*

*they could perfectly accommodate frequency weights [fweight]. First, the command should internally expand the sample (process which is unequivocal, as there is just one expanded sample). Then, it should do permutation from that expanded sample. THerefore, it is a limitation of the command and not of the theory that frequency weights are not allowed. Actually, a trivial workaround in this setting is to expand the sample yourself (using expand fweight_varname) and then run the permutation test. If you do this, you can also use preserve...restore to avoid creating a huge dataset. In any case, this confirms that the permute test could easily implement frequency weights.

*in principle, they could also accommodate sampling weights [pweight]. The difference is more theoretical than anything. Sampling weights often come from a probabilistic analysis (e.g. a regression), and as such, they are random variables, with a distribution. In consequence, it is quite a strong assumption that those weights do in fact represent with certainty a given population, which is the case under permutation tests. However, this could again be easily implemented, as informally you can transform pweight into fweight (which is hardly a good advice anyway). I imagine this is why permute does not accept sampling weights.
Note however that the fact that force is available might be an indication that Stata programmers know these options are possible, but do not want to assert a method that they might think is not always robust, leaving to the researcher the task of proving that robustness. 
Interestingly, the same is true for bootstrap. It "does not" accept weights, although the force option is there. 
