1
$\begingroup$

When not working with surveys, you do a variance test with var.test(). What do you do when you want to account for complex survey design?

$\endgroup$
4
  • 1
    $\begingroup$ What is your intended application of the variance test? What does var.test do -- what software is it? It can't refer to the base var.test in [R], because that's scarcely relevant to anything involving surveys. It's just a single F test to compare variances of two independent samples. $\endgroup$
    – whuber
    Commented Aug 24, 2023 at 20:43
  • $\begingroup$ I am trying to see whether two variances that come from two distributions are equal. Yes, when I refert to var.test, I am talking about R. And the fact that it does not involve surveys is my problem. My question is if there is another command or method to get the same test accounting for complex survey design. $\endgroup$ Commented Aug 24, 2023 at 20:48
  • $\begingroup$ Please describe the test you are looking for. It is difficult to imagine how a single F test of just two independent variances might be applicable to any "complex" survey. What is it you are aiming to do? $\endgroup$
    – whuber
    Commented Aug 24, 2023 at 20:57
  • $\begingroup$ I have five datasets that come from five different surveys and I am analyzing a variable of a z-score of child height-for-age. I want to do two things: 1. Within each survey compare the variance of the z-score among different age groups. 2. Compare the variance of the z-score of each age group with their counterparts in the other surveys. When I say "compare" I mean see whether the variances are statistically different from each other. $\endgroup$ Commented Aug 24, 2023 at 21:16

1 Answer 1

3
$\begingroup$

Operationally, you can do this in the survey package for R if you have a replicate-weights design. For example, with one of the build-in datasets

> vars<-svyby(~api00, ~comp.imp, svyvar, design=rclus1,covmat=TRUE)
> vars
    comp.imp        V1       se
No        No  9194.255 2789.933
Yes      Yes 11939.531 1609.814
> svycontrast(vars, quote(log(Yes)-log(No)))
           nlcon     SE
contrast 0.26128 0.2605

The call to svyvar computes the variances (and their correlation) and the call to svycontrast estimates the difference in logarithms of the variances (equivalent to estimating their ratio) and gives a standard error estimate. You can now use a Normal reference distribution and compare this difference to zero. In this example there is no real evidence of a difference.

If your survey comes with design meta-data instead of replicate weights, you can use as.svrepdesign to create some replicate weights for it.

(I will also note that @whuber wasn't just being annoying: people do variance tests for different reasons. These would translate differently to survey data and some of them wouldn't be appropriate at all.)

$\endgroup$
2
  • $\begingroup$ Thank you! But how do I calculate the p-value from that? You say that I should use the Normal as reference, but how and why? What distirbution does a ratio of logarithms follow? $\endgroup$ Commented Aug 28, 2023 at 14:37
  • $\begingroup$ The Normal distribution: estimate/SE is (approximately) N(0,1), so use pnorm to get a p-value $\endgroup$ Commented Aug 29, 2023 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.