[R] Noncentral t & F distributions

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Dec 10 22:09:24 CET 2006


Alan Arnholt wrote:
> Dear List:
>
> The square of the noncentral t-statistic with noncentrality parameter 
> \delta is a noncentral F with noncentrality parameter \lambda=\delta^2. 
> So, t^2_{\nu,\delta} = F_{1,\nu,\lambda=\delta^2}.  Consequently, it 
> should follow that t^2_{1-\alpha/2,\nu,\delta} = 
> f_{1-alpha,1,\vu,\lambda=\delta^2}.  However, this is not what is 
> happening with the following code.  The central distributions agree as 
> they should but the noncentral distributions do not.  Am I missing 
> something or is there a bug in the code?
>
>   
You're missing something: The noncentral t is not symmetric, so there's 
no obvious relation between qf(1-alpha), qt(alpha/2) and qt(1-alpha/2)

>> alpha <- 0.05
>> nu <- 10
>> NCP <- c(0,1,2,3)
>> TV <- (qt(1-alpha/2,nu,NCP))^2
>> FV <- qf(1-alpha,1,nu,NCP^2)
>> rbind(TV,FV)
>>     
>         [,1]      [,2]     [,3]     [,4]
> TV 4.964603 12.535179 24.58013 41.71937
> FV 4.964603  9.285829 18.98771 32.97855
>   
>> TV <- (qt(1-alpha/2,nu,NCP))^2
>> FV <- qf(1-alpha/2,1,nu,NCP^2)
>> rbind(TV,FV)
>>     
>         [,1]     [,2]     [,3]     [,4]
> TV 4.964603 12.53518 24.58013 41.71937
> FV 6.936728 12.56450 24.58023 41.71937
>   

> rbind(pt(sqrt(FV),nu,NCP,lower=F),  pt(-sqrt(FV),nu,NCP))

      [,1]         [,2]         [,3]       [,4]

[1,] 0.025 0.0496216546 4.999922e-02 5.0000e-02

[2,] 0.025 0.0003783451 7.776214e-07 7.8153e-10

> colSums(rbind(pt(sqrt(FV),nu,NCP,lower=F),  pt(-sqrt(FV),nu,NCP)))

[1] 0.05 0.05 0.05 0.05


> Thanks,
>
> Alan-
>
>   
>> version
>>     
>                 _
> platform       i386-pc-mingw32
> arch           i386
> os             mingw32
> system         i386, mingw32
> status
> major          2
> minor          4.0
> year           2006
> month          10
> day            03
> svn rev        39566
> language       R
> version.string R version 2.4.0 (2006-10-03)
>
>
> Alan T. Arnholt
> Associate Professor
> Dept. of Mathematical Sciences
> Appalachian State University
> TEL: 828 262 2863
> FAX: 828 265 8617
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list