# t test Type II error %

#### joeb33050

##### Member
How is this calculated? Many searches, no answers.
Thanks;
joe b.

#### Karabiner

##### TS Contributor

In addition, maybe the search term power analysis could be useful.

With kind regards

Karabiner

#### joeb33050

##### Member
I find lotsa assuming beta error = .2, and Daniel Soper estimator.
So, I figured out how to calculate t test TYPE II error.

#### joeb33050

##### Member
The method seems to work, finding beta error in t land is simple.
Convert alpha to x units, inches etc
Form the beta distribution in x units with x alpha.
Convert the beta x unit distribution to t units.
Solve for t </= t alpha beta.

Would someone look at the explanation? I'll email it.
Thanks;
joe b.

#### obh

##### Active Member
Beta is the probability that you won't reject an incorrect H0.
You calculate the critical values based on the H0 distribution assumption, then you should calculate the probability to be in the acceptance area base on the H1 distribution assumption (if you use t-distribution it is a non-central t)

#### joeb33050

##### Member
Correct, I found out HOW. Need a critic to point out error/s in the HOW. ??

#### obh

##### Active Member
So please write the equations ...

#### obh

##### Active Member
Hi Joe,

what t-test are you trying to calculate?
You should write what is the H0 distribution, whats is the critical value, what is the H1 distribution

You are doing the left tail. (one tail not two tails)
I prefer to calculate only the priori test power, in this case, you calculates the other avg(x) based on the "change" that you want the test to identify:
change=avg(x1)-avg(x2)
In the z-test the H1 also has the normal distribution, but in the t-test the H1 has the non-central t distribution,

#### obh

##### Active Member
what t-test are you trying to calculate?
In the t-test the H1 has the non-central t distribution,

#### joeb33050

##### Member
"what t-test are you trying to calculate?" 2 sample right tail
What is H1; is it H beta? non central? does this mean mu 2 ain't = mu beta? Isn't that what TYPE II error is about? Do you have any questions about my explanation?
"In the t-test the H1 has the non-central t distribution"

#### joeb33050

##### Member
I didn't explain clearly. My analysis is based on two t distributions with v1 = v2 and mu1 not equal to mu 2. I think of an x axis with a center at zero; and two identical t distributions, free to slide, sitting on the x axis. I can position each anywhere on the x axis. When they are exactly congruent = Ho. The x axis is graduated in inches or pounds or IQ or ????????
No non-central t distribution involved or required. t describes samples of x1-x2 taken from 1 = one distribution.
Does that help?

#### obh

##### Active Member
Hi Joe,

You show me calculations instead of defining what you test.

If both populations distriibute normally (or similar),
and you estimate the mean and standard deviations, (that why using t distribution)
and your hypotheses are as following:

H0: mu1 = mu2
H1: mu1! = mu2 (or for one tail mu1 > mu2)

Then you need to use non-central t distribution for the H1

#### obh

##### Active Member
If you know the populations means: mu1 not equal to mu 2, you don't need to run a test
So I assume you know the averages, and try to understand if based on the samples you may conclude for the populations...

If you know the population standard deviation σ, you should use the z test.
If you don't know the population standard deviation you should estimate S and use a t-test.
In this case, the null assumption distributes non-central t.

You can look at the following video:

#### joeb33050

##### Member
Well, obh, I have failed to explain. You and I are talking about different things in different languages. I surrender. Back to the subject:
“Power” is the probability of rejecting Ho: µ 1 = µ 2 when Ho: is false.

The β error is the probability of accepting Ho when Ho is false.

Thus, power = 1 – β error.

In the example above, power = 1 - .2820 = .7180, 71.8%.

The non-central t distribution can be ignored.

I am beginning to suspect that the mathematical edifice constructed about t testing, β error and power was built on the premise that β error in t testing cannot be easily calculated; and that that premise is incorrect.

#### fed2

##### Active Member
In the standard sample size equations out there the non centrality parameter is actually ignored. In fact t is often replaced with normal dist altogether. It is non-central though, but who has the time for that with all these great stats posts too read.

#### obh

##### Active Member
Hi Joe,

Usually, you start a question with the data like ave(x1)=39, avg(x2)=44 n1= n2= ..
I assume it should be average, not μ since if you know μ1 and μ2 you wouldn't run the t-test...

Despite the fact that I can't see the input data, it looks like your calculation was correct if H1 distribution would be central t.
not sure because I can't see the question's data
But it should be non-central ...

If you don't believe it... you may try to calculate the beta using simulation, and see what distribution will give you the correct beta...
It is very easy to do a simulation in R

#### Dason

So as had been said before it's perfectly possible to do the power calculation. It requires the non-central T distribution to do so. No amount of 'shifting' the T distribution will be able to match the non-central T exactly so you're fighting a losing battle by taking this approach.

Your results might be close in some cases but they won't be exact.

#### Dason

Maybe it might help if I illustrate *why* it's not just a shift.

First let's start by looking at the test statistic:

t = (xbar1 - xbar2)/(Sp*sqrt(1/n1 + 1/n2)) hopefully the terminology is clear enough here. I'm going to make a slight simplification and just define

SE = (Sp*sqrt(1/n1 + 1/n2))

so that our original reduces to

t = (xbar1 - xbar2)/SE

Great. Now under the null hypothesis that the two means are equal this has a central T distribution with v=n1+n2-2 degrees of freedom right? The main thing to note is that the numerator here (xbar1 - xbar2) has expected value of 0 since under the null hypothesis the means are equal. There are lots of other properties but this is the important one for our purposes.

Now let's consider what happens under the alternative hypothesis

t = (xbar1 - xbar2)/SE

Well the numerator xbar1-xbar2 doesn't have an expected value of 0 anymore. And I'm sure this whole time you've been saying "yes of course and that's why we apply the shift!". But I'm going to show why that isn't quite right. But let's try that approach and see what happens - can we get the expected value of the numerator to be 0? Sort of! We can subtract the expected and then add the expected value right? Let's give it a try

t = ((xbar1 - xbar2) - (mu1-mu2) + (mu1-mu2))/SE
= ((xbar1 - xbar2) - (mu1-mu2))/SE + (mu1-mu2)/SE

Nice. Now we have this broken into two pieces and the first one ((xbar1 - xbar2) - (mu1-mu2))/SE does have an expected value of 0 in the numerator and hey it *does* have a central T distribution. So you might be thinking - yes this is all proving my point because now we have a central T and then we're just adding something to it - that's basically a shift right? Wrong.

Let's look at what we're adding here:
(mu1 - mu2)/SE

The big hiccup here is the SE in the denominator. If that was a constant then this whole term would be constant and the idea of just shifting the T distribution would work perfectly. Unfortunately for us in this situation SE contains the pooled estimate of the standard deviation. Which means that whole term is a random variable itself. And that whole term *isn't* a central T distribution either. If SE was constant (like it is in the case for a Z-test) then this would all work and that's how we go about calculating power for a Z-test. It's just that the math ends up being trickier for this T-test situation.

Fortunately for us though we do have an answer for the overall question: Under the alternative our t-statistic follows a non-central T distribution. Proving that piece is left as an exercise for the reader but hopefully this provided some insight into why we can't just shift the central T to do power calculations here.