Thread Subject: not sure about results of ttest and qqplot

Subject: not sure about results of ttest and qqplot

From: jenya polyakova

Date: 18 Mar, 2010 00:54:07

Message: 1 of 6

I plotted my two samples on the QQplot and the plot lies almost perfectly on 45deg line. But then I run ttest(x,y,0.05,'both') and it gives me H=1 (i.e. reject the null hypothesis that the means are equal). It has been a few years since I last used ttest. But my understanding it should have not rejected null hypothesis because the two samples x and y are almost identical (qqplot). Is this right? Thanks

Subject: not sure about results of ttest and qqplot

From: Wayne King

Date: 18 Mar, 2010 03:10:15

Message: 2 of 6

"jenya polyakova" <jenya56@yahoo.com> wrote in message <hnrtjf$q8e$1@fred.mathworks.com>...
> I plotted my two samples on the QQplot and the plot lies almost perfectly on 45deg line. But then I run ttest(x,y,0.05,'both') and it gives me H=1 (i.e. reject the null hypothesis that the means are equal). It has been a few years since I last used ttest. But my understanding it should have not rejected null hypothesis because the two samples x and y are almost identical (qqplot). Is this right? Thanks

Hi Jenya, are you plotting empirical quantiles of both samples on the same QQ plot? Because the QQ plot is just giving you information most directly about the distribution shape, not about the values of the parameters that characterize the distribution. For example:

 x= normrnd(100,2,100,1);
 qqplot(x)
 y = normrnd(105,1,100,1);
 qqplot(y)

The sample quantiles in both cases agree with the standard normal quantiles. However, if you look closely at the values they produce on the y-axis, you'll see a difference. Now if you plot them on the same QQ plot

clf;
qqplot(x); hold on;
qqplot(y);

Clearly the t-test will reject the null hypothesis that the means are equal.If you are plotting them separately and not paying attention to the y-axis values, you may miss that even though the QQplots look similar, a parameter test like the t-test will reject the null hypothesis. But at least you have established that your data meet the distributional requirements of the test.

Wayne

Subject: not sure about results of ttest and qqplot

From: jenya

Date: 18 Mar, 2010 06:27:25

Message: 3 of 6

But my means are almost equal. that is why I do not understand why it rejects it?
The mean for x is 0.3470 and the mean for y is 0.3428. Standard deviations are also almost the same. This is consistent with QQ-plot since normal distribution is fully characterized by mean and variance. But ttest is H=1 which is wrong?
Jenya

"Wayne King" <wmkingty@gmail.com> wrote in message <hns5in$p5j$1@fred.mathworks.com>...
> "jenya polyakova" <jenya56@yahoo.com> wrote in message <hnrtjf$q8e$1@fred.mathworks.com>...
> > I plotted my two samples on the QQplot and the plot lies almost perfectly on 45deg line. But then I run ttest(x,y,0.05,'both') and it gives me H=1 (i.e. reject the null hypothesis that the means are equal). It has been a few years since I last used ttest. But my understanding it should have not rejected null hypothesis because the two samples x and y are almost identical (qqplot). Is this right? Thanks
>
> Hi Jenya, are you plotting empirical quantiles of both samples on the same QQ plot? Because the QQ plot is just giving you information most directly about the distribution shape, not about the values of the parameters that characterize the distribution. For example:
>
> x= normrnd(100,2,100,1);
> qqplot(x)
> y = normrnd(105,1,100,1);
> qqplot(y)
>
> The sample quantiles in both cases agree with the standard normal quantiles. However, if you look closely at the values they produce on the y-axis, you'll see a difference. Now if you plot them on the same QQ plot
>
> clf;
> qqplot(x); hold on;
> qqplot(y);
>
> Clearly the t-test will reject the null hypothesis that the means are equal.If you are plotting them separately and not paying attention to the y-axis values, you may miss that even though the QQplots look similar, a parameter test like the t-test will reject the null hypothesis. But at least you have established that your data meet the distributional requirements of the test.
>
> Wayne

Subject: not sure about results of ttest and qqplot

From: Wayne King

Date: 18 Mar, 2010 09:14:04

Message: 4 of 6

"jenya " <jenya56@yahoo.com> wrote in message <hnsh4d$jl9$1@fred.mathworks.com>...
> But my means are almost equal. that is why I do not understand why it rejects it?
> The mean for x is 0.3470 and the mean for y is 0.3428. Standard deviations are also almost the same. This is consistent with QQ-plot since normal distribution is fully characterized by mean and variance. But ttest is H=1 which is wrong?
> Jenya
>
> "Wayne King" <wmkingty@gmail.com> wrote in message <hns5in$p5j$1@fred.mathworks.com>...
> > "jenya polyakova" <jenya56@yahoo.com> wrote in message <hnrtjf$q8e$1@fred.mathworks.com>...
> > > I plotted my two samples on the QQplot and the plot lies almost perfectly on 45deg line. But then I run ttest(x,y,0.05,'both') and it gives me H=1 (i.e. reject the null hypothesis that the means are equal). It has been a few years since I last used ttest. But my understanding it should have not rejected null hypothesis because the two samples x and y are almost identical (qqplot). Is this right? Thanks
> >
> > Hi Jenya, are you plotting empirical quantiles of both samples on the same QQ plot? Because the QQ plot is just giving you information most directly about the distribution shape, not about the values of the parameters that characterize the distribution. For example:
> >
> > x= normrnd(100,2,100,1);
> > qqplot(x)
> > y = normrnd(105,1,100,1);
> > qqplot(y)
> >
> > The sample quantiles in both cases agree with the standard normal quantiles. However, if you look closely at the values they produce on the y-axis, you'll see a difference. Now if you plot them on the same QQ plot
> >
> > clf;
> > qqplot(x); hold on;
> > qqplot(y);
> >
> > Clearly the t-test will reject the null hypothesis that the means are equal.If you are plotting them separately and not paying attention to the y-axis values, you may miss that even though the QQplots look similar, a parameter test like the t-test will reject the null hypothesis. But at least you have established that your data meet the distributional requirements of the test.
> >
> > Wayne

Hi Jenya, do you have a large N and small variances?
wayne

Subject: not sure about results of ttest and qqplot

From: Wayne King

Date: 18 Mar, 2010 10:22:04

Message: 5 of 6

"Wayne King" <wmkingty@gmail.com> wrote in message <hnsqss$j0m$1@fred.mathworks.com>...
> "jenya " <jenya56@yahoo.com> wrote in message <hnsh4d$jl9$1@fred.mathworks.com>...
> > But my means are almost equal. that is why I do not understand why it rejects it?
> > The mean for x is 0.3470 and the mean for y is 0.3428. Standard deviations are also almost the same. This is consistent with QQ-plot since normal distribution is fully characterized by mean and variance. But ttest is H=1 which is wrong?
> > Jenya
> >
> > "Wayne King" <wmkingty@gmail.com> wrote in message <hns5in$p5j$1@fred.mathworks.com>...
> > > "jenya polyakova" <jenya56@yahoo.com> wrote in message <hnrtjf$q8e$1@fred.mathworks.com>...
> > > > I plotted my two samples on the QQplot and the plot lies almost perfectly on 45deg line. But then I run ttest(x,y,0.05,'both') and it gives me H=1 (i.e. reject the null hypothesis that the means are equal). It has been a few years since I last used ttest. But my understanding it should have not rejected null hypothesis because the two samples x and y are almost identical (qqplot). Is this right? Thanks
> > >
> > > Hi Jenya, are you plotting empirical quantiles of both samples on the same QQ plot? Because the QQ plot is just giving you information most directly about the distribution shape, not about the values of the parameters that characterize the distribution. For example:
> > >
> > > x= normrnd(100,2,100,1);
> > > qqplot(x)
> > > y = normrnd(105,1,100,1);
> > > qqplot(y)
> > >
> > > The sample quantiles in both cases agree with the standard normal quantiles. However, if you look closely at the values they produce on the y-axis, you'll see a difference. Now if you plot them on the same QQ plot
> > >
> > > clf;
> > > qqplot(x); hold on;
> > > qqplot(y);
> > >
> > > Clearly the t-test will reject the null hypothesis that the means are equal.If you are plotting them separately and not paying attention to the y-axis values, you may miss that even though the QQplots look similar, a parameter test like the t-test will reject the null hypothesis. But at least you have established that your data meet the distributional requirements of the test.
> > >
> > > Wayne
>
> Hi Jenya, do you have a large N and small variances?
> wayne

Also, just to follow up Jenya, you used

ttest(x,y,0.05,'both')

did you really intend to do a paried-sample T-test? are your x and y independent samples, or dependent? If they are independent, you should use ttest2()

Wayne

Subject: not sure about results of ttest and qqplot

From: jenya polyakova

Date: 18 Mar, 2010 16:06:03

Message: 6 of 6

yes, Wayne, ttest2 did the magic. I should be more careful about reading documentations. Thanks!!

"Wayne King" <wmkingty@gmail.com> wrote in message <hnsusc$ij1$1@fred.mathworks.com>...
> "Wayne King" <wmkingty@gmail.com> wrote in message <hnsqss$j0m$1@fred.mathworks.com>...
> > "jenya " <jenya56@yahoo.com> wrote in message <hnsh4d$jl9$1@fred.mathworks.com>...
> > > But my means are almost equal. that is why I do not understand why it rejects it?
> > > The mean for x is 0.3470 and the mean for y is 0.3428. Standard deviations are also almost the same. This is consistent with QQ-plot since normal distribution is fully characterized by mean and variance. But ttest is H=1 which is wrong?
> > > Jenya
> > >
> > > "Wayne King" <wmkingty@gmail.com> wrote in message <hns5in$p5j$1@fred.mathworks.com>...
> > > > "jenya polyakova" <jenya56@yahoo.com> wrote in message <hnrtjf$q8e$1@fred.mathworks.com>...
> > > > > I plotted my two samples on the QQplot and the plot lies almost perfectly on 45deg line. But then I run ttest(x,y,0.05,'both') and it gives me H=1 (i.e. reject the null hypothesis that the means are equal). It has been a few years since I last used ttest. But my understanding it should have not rejected null hypothesis because the two samples x and y are almost identical (qqplot). Is this right? Thanks
> > > >
> > > > Hi Jenya, are you plotting empirical quantiles of both samples on the same QQ plot? Because the QQ plot is just giving you information most directly about the distribution shape, not about the values of the parameters that characterize the distribution. For example:
> > > >
> > > > x= normrnd(100,2,100,1);
> > > > qqplot(x)
> > > > y = normrnd(105,1,100,1);
> > > > qqplot(y)
> > > >
> > > > The sample quantiles in both cases agree with the standard normal quantiles. However, if you look closely at the values they produce on the y-axis, you'll see a difference. Now if you plot them on the same QQ plot
> > > >
> > > > clf;
> > > > qqplot(x); hold on;
> > > > qqplot(y);
> > > >
> > > > Clearly the t-test will reject the null hypothesis that the means are equal.If you are plotting them separately and not paying attention to the y-axis values, you may miss that even though the QQplots look similar, a parameter test like the t-test will reject the null hypothesis. But at least you have established that your data meet the distributional requirements of the test.
> > > >
> > > > Wayne
> >
> > Hi Jenya, do you have a large N and small variances?
> > wayne
>
> Also, just to follow up Jenya, you used
>
> ttest(x,y,0.05,'both')
>
> did you really intend to do a paried-sample T-test? are your x and y independent samples, or dependent? If they are independent, you should use ttest2()
>
> Wayne

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com