6
$\begingroup$

I’ve got a couple variables that are negatively skewed, so I transformed them by squaring them, which normalized them. I wanted to run a t-test on the transformed variables but I’m a bit confused as to which mean to use. Here is what my data looks like (note that the U.S. Pop. mean comes from the manual for scoring a survey, so the data to get that mean is not available, only the mean itself, hence one sample t-test instead of two sample t-test):

     U.S. Pop. mean   Our Sample Mean  Mean of variables squared  Sqr rt of mean
PF            81.18             73.61                    6215.28           78.83
RP            80.53             70.28                    5913.92           76.90

I understand why the square root of the mean from the variables I squared for the transformation is different from the non-squared mean (because of the underlying calculations involved), but for the sake of doing a t-test and comparing the U.S. population mean to the sample mean we have, do I use the square root of the mean from the squared variables and compare it to the U.S. Population mean, or do I square the U.S. Population mean and compare it to the mean of the squared variables. Visually:

Either this:
Ho = 81.18^2  vs. 6215.28

Or:
Ho = 81.18  vs. 78.83

Or something else?

$\endgroup$

2 Answers 2

9
$\begingroup$

I don't think squaring will necessarily do what you want even if it makes things look normal.

If you want to test equality of a population mean to a hypothesized mean then by testing a transformed variable you can be highly likely to reject when the original population mean is the one given in the null (that is, you will be likely to reject true nulls).

Consider some random variable $X$ which has some distribution with $\mu=\mu_0$ and non-zero variance.

Let $Y=X^2$.

$E(Y)=E(X^2) = E(X)^2 +\text{Var}(X)=\mu_0^2+\sigma^2_X$

Consequently, a test of $H_0^*:\mu_Y=\mu_0^2$ should reject (and in large samples will become essentially certain to, even though the original hypothesis $H_0:\mu_X=\mu_0$ was true.

Beware of mixing hypothesis tests and transformations unless you actually understand how they behave!


Illustration

Here's a sample from a somewhat left-skew distribution with population mean 5:

sample from a left skewed distribution with mean 5

By chance, the sample mean came out really close to the population mean:

> mean(y)
[2] 5.000247

Now we square it. How does the mean compare with 25?

> mean(y^2)
[1] 27.97773

Almost 28 (the population variance of Y was about 3, so this is to be expected)

So if we test whether the population mean of $Y^2$ is 25 ... we're likely to reject. (In this particular sample the p-value would only be about 0.08)


Code was requested; unfortunately I didn't keep the code I used to generate the example; this is vaguely similar to the example in that it's left skew with mean 5 and variance is substantial (though not as large as in the original):

n=100;x=ifelse(runif(n)<.5,pmax(runif(n),runif(n),runif(n))*5,runif(n,5,7.5))

Here's the results from a sample of 1000 rather than 100 with that code:

> mean(x);var(x);mean(x^2)
[1] 4.985436
[1] 2.35402
[1] 27.20623

> mean(x)^2+var(x)*(1-1/length(x))  # adjust for Bessel's correction 
[1] 27.20623

(The adjustment to undo Bessel's correction on samples makes it work like the algebra for the population)


[How relevant would this be to a two sample case? If the two populations from which the samples were drawn don't have the same variance, the means of their squares will be different. This is quite different from the usual issue with different variance and the equal-variance t-test -- the test in this case is much more impacted.]


So what to do? We have to start with the precise hypothesis of interest and figure out a reasonable way to (at least to a good approximation) test that.

It appears the null is definitely equality of means.

There are several options I see:

  1. Use the t-test as is; depending on how skewed and heavy-tailed the distribution is, significance level and power may not be so badly impacted.

  2. Come up with a suitable parametric model for the variables in question.

  3. A permutation test is possible but may present difficulties; under the usual assumptions it would be necessary to assume symmetry under the null (this doesn't imply that the sample should look symmetric, only that if the null were true that it should be expected to be symmetric).

  4. A form of bootstrap test might be employed; it may be reasonable if sample sizes were fairly large for the two variables.

$\endgroup$
9
  • $\begingroup$ I'm not sure I'm following your example. Any chance you could provide the full code for the example you give, or at least a few more details such as sample size, and the variance of y^2, so I can check that I'm understanding your calculations? $\endgroup$ Commented Sep 14, 2017 at 8:33
  • $\begingroup$ Sorry, it was just a quick illustrative example, the heart of it is the algebra showing the formula for the expected square in terms of square of expected plus variance; I'll create some similar code and put it up (I have also added a couple of sentence to explain how this could be relevant to the two sample case.) ... some code is now there $\endgroup$
    – Glen_b
    Commented Sep 14, 2017 at 8:49
  • $\begingroup$ The formula should be $E(Y)=E(X^2) = E(X)^2+\text{Var}(X)=\mu_0^2+\sigma^2_X$ $\endgroup$
    – arezaie
    Commented Sep 14, 2017 at 11:14
  • $\begingroup$ I think you gave me a more complicated answer than I needed, though the underlying calculations are nice to see. My takeaway from everything you said was no, I can't use a t-test on my squared or square-rooted variables. I will probably go with a Sign test then. Thanks. $\endgroup$
    – lady8506
    Commented Sep 14, 2017 at 13:42
  • $\begingroup$ @lady8506, a sign test has the same potential issues. Eg, if your data are strongly negatively skewed, then most of your data will be above your mean. You don't know the US population distribution, but if it were similarly skewed, most of it would be above its mean. So when you test the proportion of your data above the US pop mean, you could easily get a type 1 error, if the null is true. How much data do you have? Do you know the US population variance? It's possible that 1 of the strategies discussed would work for you. $\endgroup$ Commented Sep 14, 2017 at 13:49
4
$\begingroup$

As @user20637 points on the the comment below, the result of a t-test of your squared data against the squared US population mean will not necessarily imply that your data are shifted relative to the US population. You cannot assess that from what you have. Instead, you are just testing if your mean is above a fixed point. Beyond that, you are just making assumptions.

If you have enough data, and can assume that the distribution of your data is a good representation of the population distribution from which they were drawn, you could bootstrap your mean to get a better test.

Another possibility would be to run a set of sensitivity analyses and report the range of results. For example, what if the reported value is the population mean, but the population distribution were as skewed as yours? Other possibilities exist.

You could also be upfront about the assumptions you are making about the population by using a Bayesian analysis.

$\endgroup$
3
  • 2
    $\begingroup$ But the mean of her squared data is 6215.28. I think she should be testing against mean(US population squared), but we don't know that. As she remarks, this is not identical to (mean US population)squared. I don't think she can do it, maybe go non-parametric, or follow Peter Flom in stats.stackexchange.com/questions/38967/… and do both $\endgroup$
    – user20637
    Commented Sep 13, 2017 at 16:03
  • $\begingroup$ It is correct that I do not know the distribution of the U.S. population norm since that data is not available, but for analysis purposes, we would like to see if the data we have collected from our survey participants is significantly different from the mean of U.S. population. After transforming our data to normalize it, I'm now unsure which mean to compare against the U.S. population mean, or if I should transform (square) the U.S. population mean, too. $\endgroup$
    – lady8506
    Commented Sep 13, 2017 at 16:07
  • $\begingroup$ @user20637, thanks for the catch, I seem to have misread the question. $\endgroup$ Commented Sep 13, 2017 at 16:09

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.