How to do a levene's test without a grouping variable? I have a list of people who did a test before and after an intervention. And I want to compare their pre- and post-scores. Now before I do t-tests, I have to check for heteroscedasticity with a levene test, is that correct? So the syntax for a levene test is 
levene.test(y, group)

But I don't have a variable "group" for each case. I just have a pre-score and a post-score for each of my cases. How can I fit that into the levene test command? I want to compare pre- and post-scores, like they are two different groups. Is there a way I can use that command, without manually restructuring my data file?
 A: You make y with c(before, after) and group with c(rep(0, length(before)), rep(1, length(after))), so this is pretty easy to structure.
However, I see a few reasons not to bother with this test.
1) What will you do if the test comes back and says that the variances are unequal? What about if the test does not report a significant difference? Would you accept the null hypothesis of equal variances? How do account for the compound uncertainty in having multiple tests, an adjustment like Bonferroni? My suggestion is to skip this variance test and go straight to the Welch t-test, which assumes unequal variances and accounts for the unequal variances. This is the default in R.
2) You have before and after data, so your data seem paired. Consider finding the differences and then doing a one-sample test on those differences. This sounds like what you want: a paired test, not a two-sample test. 
I would do a paired test for your particular data. For unpaired samples, I would skip the variance test and go straight to the Welch test.
