Re: Calculation of critical p-, z-, t- and F-values



Hello David;

I thought I try the Mathematica equivalence commands to your R commands.

I just started to learn R as well. But I find that with Mathematica, I can
also do analytical analysis, and not just numerical, which can be very
useful to me, which is not so easily done in R. But R seems to be quite good
in statistics and has many more functions in statistics than Mathematica (as
can be expected :)

Below I show the Mathematrica commands below your R commands. I was able to
find Mathematica command equivalent to each one of the R commands.

I am using version 6 (new version of Mathematica) where they have added many
new statistics functions to the system. I use the student version of
Mathematica (about $130 US)

"David Winsemius" <doe_snot@xxxxxxxxxxx> wrote in message
news:Xns99E7E5D6B97A7dwtttttt@xxxxxxxxxxxxxxxxx

All one needs to do in R is execute very simple procedures. If you cannot
remember all the distribution functions, all you need to do is type:
help.search("distribution")

Typing qnorm(0.975) will produce the desired quantile of the inverse
Normal.

Quantile[NormalDistribution[0, 1], 975/1000]
Sqrt[2]*InverseErf[19/20]

N[%] <----- This say to convert the above output to a number
1.9599639845400538

The OP desired a method for "critical values for z,
p, t and F for a significance level (e. g. 99 %)". I don't know what he
meant by "p" but the corresponding values to the t from qt(<quantile>,
<degrees of freedom>) and for the F distribution would be obtained by
typing qf(<quantile>,<df1>,<df2> ).

qt(0.975,60)
[1] 2.000298

Quantile[StudentTDistribution[60], 975/1000]
2*Sqrt[15*(-1 + 1/InverseBetaRegularized[1, -(19/20), 30, 1/2])]

N[%]
2.0002978220142507

qt(0.975,120)

[1] 1.979930

Quantile[StudentTDistribution[120], 975/1000]
2*Sqrt[30*(-1 + 1/InverseBetaRegularized[1, -(19/20), 60, 1/2])]

N[%]
1.9799304050824413

# if you wanted the critical values for 10 through 60 df in steps of 10
this would work:

qt(0.975,seq(10,60,10))
[1] 2.228139 2.085963 2.042272 2.021075 2.008559 2.000298


Table[Quantile[StudentTDistribution[k], 0.975], {k, 10, 60, 10}]
{2.2281388519862735, 2.0859634472658626, 2.042272456301236,
2.0210753903062715, 2.008559112100758, 2.0002978220142507}

qt(0.975,Inf)
[1] 1.959964

With Infinity for degrees of Freedom, Mathematica does not evaluate it, but
I could put large values ok
(Might be some limiting issue involved. I do not know how R does it).

Quantile[StudentTDistribution[100000000], 0.975]
1.959964074411019


You would find that qf(2*p - 1, 1, df)) was identical to qt(p, df)^2).


The above is valid when assuming 1-2p<0 :

r1 = Quantile[StudentTDistribution[df], p];
r2 = Quantile[FRatioDistribution[1, df], 2*p - 1];
Assuming[1 - 2*p < 0, FullSimplify[ r1^2 - r2] ]

Out[154]= 0

Not very steep if you ask me. Installation is simple enough for an old doc
to do it without much pain ever since version 1.8.

--
David Winsemius, MD, MPH


Nasser


.



Relevant Pages

  • Re: Calculation of critical p-, z-, t- and F-values
    ... I thought I try the Mathematica equivalence commands to your R commands. ... in statistics and has many more functions in statistics than Mathematica (as ... Can you control the accuracy of the calculation? ...
    (sci.stat.math)
  • Re: An exact simplification challenge - 57 (arctangents) - ProudEarthling,go and defeat all
    ... I found there *is* such a command in Mathematica - 'TimeConstraint'. ... TimeConstraint works with some commands but not all commands. ... However, the limit is placed on a particular transformation Mathematica uses, so using a time constraint of 10 seconds does not mean Mathematica will return its best result found in 10 seconds, but it will not use any one transformation for more than 10 seconds. ...
    (sci.math.symbolic)
  • Re: M-p or M-n ??
    ... >> Try the Alt key. ... At least in Mathematica the commands that are labeled ... I misunderstood what was supposed to happen. ...
    (alt.os.linux.redhat)
  • Groups & Mathematica
    ... Is there a package about group theory for Mathematica? ... Maple has a lot of commands for that.) ... Prev by Date: ...
    (sci.math.symbolic)
  • A New Series of Books and Software for Scientists, Experts, Teachers and Students
    ... you will find information about new books in computer algebra (Maple, ... Mathematica) and statistics that can be useful for you. ...
    (sci.math.symbolic)