P. Duchesne, P. Lafaye de Micheaux, Computing the distribution of quadratic forms: Further comparisons between the Liu-Tang-Zhang approximation and exact methods, Computational Statistics and Data Analysis, Volume 54, (2010), 858-862
H. Liu, Y. Tang, H.H. Zhang, A new chi-square approximation
to the distribution of non-negative definite quadratic forms in
non-central normal variables, Computational Statistics and Data Analysis, Volume 53, (2009), 853-856
Examples
# Some results from Liu et al. (2009)
# Q1 from Liu et al.
round(liu(2,c(0.5,0.4,0.1),c(1,2,1),c(1,0.6,0.8)),6)
round(liu(6,c(0.5,0.4,0.1),c(1,2,1),c(1,0.6,0.8)),6)
round(liu(8,c(0.5,0.4,0.1),c(1,2,1),c(1,0.6,0.8)),6)
# Q2 from Liu et al.
round(liu(1,c(0.7,0.3),c(1,1),c(6,2)),6)
round(liu(6,c(0.7,0.3),c(1,1),c(6,2)),6)
round(liu(15,c(0.7,0.3),c(1,1),c(6,2)),6)
# Q3 from Liu et al.
round(liu(2,c(0.995,0.005),c(1,2),c(1,1)),6)
round(liu(8,c(0.995,0.005),c(1,2),c(1,1)),6)
round(liu(12,c(0.995,0.005),c(1,2),c(1,1)),6)
# Q4 from Liu et al.
round(liu(3.5,c(0.35,0.15,0.35,0.15),c(1,1,6,2),c(6,2,6,2)),6)
round(liu(8,c(0.35,0.15,0.35,0.15),c(1,1,6,2),c(6,2,6,2)),6)
round(liu(13,c(0.35,0.15,0.35,0.15),c(1,1,6,2),c(6,2,6,2)),6)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(CompQuadForm)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/CompQuadForm/liu.Rd_%03d_medium.png", width=480, height=480)
> ### Name: liu
> ### Title: Liu's method
> ### Aliases: liu
> ### Keywords: distribution htest
>
> ### ** Examples
>
> # Some results from Liu et al. (2009)
> # Q1 from Liu et al.
> round(liu(2,c(0.5,0.4,0.1),c(1,2,1),c(1,0.6,0.8)),6)
[1] 0.457753
> round(liu(6,c(0.5,0.4,0.1),c(1,2,1),c(1,0.6,0.8)),6)
[1] 0.031079
> round(liu(8,c(0.5,0.4,0.1),c(1,2,1),c(1,0.6,0.8)),6)
[1] 0.006883
>
> # Q2 from Liu et al.
> round(liu(1,c(0.7,0.3),c(1,1),c(6,2)),6)
[1] 0.955046
> round(liu(6,c(0.7,0.3),c(1,1),c(6,2)),6)
[1] 0.407587
> round(liu(15,c(0.7,0.3),c(1,1),c(6,2)),6)
[1] 0.02234
>
> # Q3 from Liu et al.
> round(liu(2,c(0.995,0.005),c(1,2),c(1,1)),6)
[1] 0.347946
> round(liu(8,c(0.995,0.005),c(1,2),c(1,1)),6)
[1] 0.033475
> round(liu(12,c(0.995,0.005),c(1,2),c(1,1)),6)
[1] 0.006748
>
> # Q4 from Liu et al.
> round(liu(3.5,c(0.35,0.15,0.35,0.15),c(1,1,6,2),c(6,2,6,2)),6)
[1] 0.956315
> round(liu(8,c(0.35,0.15,0.35,0.15),c(1,1,6,2),c(6,2,6,2)),6)
[1] 0.415248
> round(liu(13,c(0.35,0.15,0.35,0.15),c(1,1,6,2),c(6,2,6,2)),6)
[1] 0.046228
>
>
>
>
>
>
> dev.off()
null device
1
>