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

Thread Subject:
Z score to P values

Subject: Z score to P values

From: Chris Allen

Date: 11 Dec, 2010 11:50:23

Message: 1 of 4

Is there a function (possibly in the stats toolbox) that will convert a z-score into a p-value’s? And is there any way to use a 1-tailed distribution (rather than the default 2 tails)?

Subject: Z score to P values

From: Wayne King

Date: 11 Dec, 2010 13:00:19

Message: 2 of 4

"Chris Allen" <allencpRemoveThis@cardiff.ac.uk> wrote in message <idvohu$n28$1@fred.mathworks.com>...
> Is there a function (possibly in the stats toolbox) that will convert a z-score into a p-value’s? And is there any way to use a 1-tailed distribution (rather than the default 2 tails)?

Hi Chris, I'm assuming that you assume your z-scores follow a normal distribution, because you can easily have 0 mean, unit standard deviation random variables that do not follow a Gaussian distribution.

If your z-scores are normally distributed, you can use normcdf() to obtain both one- and two-tailed p-values.

For example:

Assume you have a z-score of 1.96. If you have a negative z, you can take the absolute value.

onetailed = 1-normcdf(1.96,0,1)
twotailed = 2*onetailed

Note if you entered a negative z value, the above would not be correct, that's why I said take the absolute value.

Wayne

Subject: Z score to P values

From: Chris Allen

Date: 11 Dec, 2010 13:26:03

Message: 3 of 4

Thats great.
Thanks.
Chris.

"Wayne King" <wmkingty@gmail.com> wrote in message <idvsl3$p7o$1@fred.mathworks.com>...
> "Chris Allen" <allencpRemoveThis@cardiff.ac.uk> wrote in message <idvohu$n28$1@fred.mathworks.com>...
> > Is there a function (possibly in the stats toolbox) that will convert a z-score into a p-value’s? And is there any way to use a 1-tailed distribution (rather than the default 2 tails)?
>
> Hi Chris, I'm assuming that you assume your z-scores follow a normal distribution, because you can easily have 0 mean, unit standard deviation random variables that do not follow a Gaussian distribution.
>
> If your z-scores are normally distributed, you can use normcdf() to obtain both one- and two-tailed p-values.
>
> For example:
>
> Assume you have a z-score of 1.96. If you have a negative z, you can take the absolute value.
>
> onetailed = 1-normcdf(1.96,0,1)
> twotailed = 2*onetailed
>
> Note if you entered a negative z value, the above would not be correct, that's why I said take the absolute value.
>
> Wayne

Subject: Z score to P values

From: Wayne King

Date: 11 Dec, 2010 17:38:04

Message: 4 of 4

"Chris Allen" <allencpRemoveThis@cardiff.ac.uk> wrote in message <idvu5b$hus$1@fred.mathworks.com>...
> Thats great.
> Thanks.
> Chris.
>
> "Wayne King" <wmkingty@gmail.com> wrote in message <idvsl3$p7o$1@fred.mathworks.com>...
> > "Chris Allen" <allencpRemoveThis@cardiff.ac.uk> wrote in message <idvohu$n28$1@fred.mathworks.com>...
> > > Is there a function (possibly in the stats toolbox) that will convert a z-score into a p-value’s? And is there any way to use a 1-tailed distribution (rather than the default 2 tails)?
> >
> > Hi Chris, I'm assuming that you assume your z-scores follow a normal distribution, because you can easily have 0 mean, unit standard deviation random variables that do not follow a Gaussian distribution.
> >
> > If your z-scores are normally distributed, you can use normcdf() to obtain both one- and two-tailed p-values.
> >
> > For example:
> >
> > Assume you have a z-score of 1.96. If you have a negative z, you can take the absolute value.
> >
> > onetailed = 1-normcdf(1.96,0,1)
> > twotailed = 2*onetailed
> >
> > Note if you entered a negative z value, the above would not be correct, that's why I said take the absolute value.
> >
> > Wayne

Hi Chris, just an add on, a colleague of mine, obviously much wiser than me, pointed out that the way I told you:

onetailed = 1-normcdf(1.96,0,1);

could prove susceptible to numerical effects when the term inside the normcdf() function was close to 1. He rightly suggested that:

normcdf(-abs(z),0,1)

is a better way to do it.

Wayne
 

Tags for this Thread

No tags are associated with this thread.

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.

Contact us