Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Unequal p-values when using tcdf and regstats

Asked by Ben on 28 May 2012

Hi,

I noticed some inconsistencies with tcdf and regstats and wonder if I am missing something or if this is a bug of some kind. This relates to the statisticsl toolbox.

To illustrate:

a_predicted = [92.9536;93.0658;93.0670;93.2834;93.2858;93.4251;93.4267;93.5773; 93.5789;93.7254;93.7271;93.8718;93.8734;94.0277;94.0293;94.2216];
a_predictor1 = [84.2436;88.1282;88.1718;92.1000;92.0696;89.3000;89.3359;92.6000;92.6352;95.8000;95.7978;95.6000;95.5848;94.2000;94.2315;97.1000];
a_predictor2 = [133.9558;130.0221;129.9779;126.0000;125.7500;103.0000;102.9457;98.0000;98.0220;100.0000;100.0330;103.0000;103.6304;161.0000;161.5978;216.0000];
a_regstat = regstats(a_predicted, [a_predictor1 a_predictor2], 'linear');

Now, a_regstat.tstat.pval(2) results in 5.1918e-06 But 1-tcdf(a_regstat.tstat.t(2),13) results in 2.5959e-06 which seems to be half the regstats pval.

Why is that?

0 Comments

Ben

Tags

1 Answer

Answer by Wayne King on 28 May 2012
Accepted answer

That is because the pvalue 5.1918e-06 is for a two-tailed hypothesis test.

   1-tcdf(a_regstat.tstat.t(2),13)

is only giving you the result for 1 tail of the t-distribution. If you double that result (the t-distribution is symmetric), you'll see the agreement.

1 Comment

Ben on 28 May 2012

Thanks, it wasn't obvious from regstats documentation, or I just missed it.

Wayne King

Contact us