Re: Calculation of critical p-, z-, t- and F-values
- From: "Nasser Abbasi" <nma@xxxxxxxxx>
- Date: Wed, 14 Nov 2007 01:34:10 -0800
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
.
- Follow-Ups:
- Re: Calculation of critical p-, z-, t- and F-values
- From: iandjmsmith
- Re: Calculation of critical p-, z-, t- and F-values
- References:
- Calculation of critical p-, z-, t- and F-values
- From: schuetz-daniel
- Re: Calculation of critical p-, z-, t- and F-values
- From: Nasser Abbasi
- Re: Calculation of critical p-, z-, t- and F-values
- From: schuetz-daniel
- Re: Calculation of critical p-, z-, t- and F-values
- From: Nasser Abbasi
- Re: Calculation of critical p-, z-, t- and F-values
- From: Karl Ove Hufthammer
- Re: Calculation of critical p-, z-, t- and F-values
- From: Barry W Brown
- Re: Calculation of critical p-, z-, t- and F-values
- From: David Winsemius
- Calculation of critical p-, z-, t- and F-values
- Prev by Date: Going backwards
- Next by Date: Re: Calculation of critical p-, z-, t- and F-values
- Previous by thread: Re: Calculation of critical p-, z-, t- and F-values
- Next by thread: Re: Calculation of critical p-, z-, t- and F-values
- Index(es):
Relevant Pages
|