"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 zscore into a pvalue’s? And is there any way to use a 1tailed distribution (rather than the default 2 tails)?
> >
> > Hi Chris, I'm assuming that you assume your zscores 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 zscores are normally distributed, you can use normcdf() to obtain both one and twotailed pvalues.
> >
> > For example:
> >
> > Assume you have a zscore of 1.96. If you have a negative z, you can take the absolute value.
> >
> > onetailed = 1normcdf(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 = 1normcdf(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
