Package CompQuadForm

Similar documents
Package spcov. R topics documented: February 20, 2015

Package BNN. February 2, 2018

Package unbalhaar. February 20, 2015

Package darts. February 19, 2015

Package comparec. R topics documented: February 19, Type Package

Package netcoh. May 2, 2016

Package ShrinkCovMat

Package SEMModComp. R topics documented: February 19, Type Package Title Model Comparisons for SEM Version 1.0 Date Author Roy Levy

Package CPE. R topics documented: February 19, 2015

Package scio. February 20, 2015

Package BayesNI. February 19, 2015

Package SimSCRPiecewise

Package EnergyOnlineCPM

Package covtest. R topics documented:

Package severity. February 20, 2015

Package ltsbase. R topics documented: February 20, 2015

Package R1magic. April 9, 2013

Package SpatialNP. June 5, 2018

Package Grace. R topics documented: April 9, Type Package

Package MiRKATS. May 30, 2016

Package invgamma. May 7, 2017

Package CCP. R topics documented: December 17, Type Package. Title Significance Tests for Canonical Correlation Analysis (CCA) Version 0.

Package rgabriel. February 20, 2015

Package penmsm. R topics documented: February 20, Type Package

Package dhsic. R topics documented: July 27, 2017

Package mixture. R topics documented: February 13, 2018

Package skellam. R topics documented: December 15, Version Date

Package ICGOR. January 13, 2017

Package alabama. March 6, 2015

Package NORMT3. February 19, 2015

Package emg. R topics documented: May 17, 2018

Package LIStest. February 19, 2015

Package R1magic. August 29, 2016

Package icmm. October 12, 2017

Package CoxRidge. February 27, 2015

Package sscor. January 28, 2016

Package Blendstat. February 21, 2018

Package CovSel. September 25, 2013

Package generalhoslem

Package HIMA. November 8, 2017

Package JointModel. R topics documented: June 9, Title Semiparametric Joint Models for Longitudinal and Counting Processes Version 1.

Package MultisiteMediation

Package basad. November 20, 2017

Package jmcm. November 25, 2017

Package flexcwm. R topics documented: July 11, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.0.

Package factorqr. R topics documented: February 19, 2015

Package survidinri. February 20, 2015

Package gma. September 19, 2017

Package DTK. February 15, Type Package

Package HMMcopula. December 1, 2018

Package horseshoe. November 8, 2016

Package idmtpreg. February 27, 2018

Package RZigZag. April 30, 2018

Package flexcwm. R topics documented: July 2, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.1.

Package rarhsmm. March 20, 2018

Package ssanv. June 23, 2015

Package goftest. R topics documented: April 3, Type Package

Package GORCure. January 13, 2017

Package sbgcop. May 29, 2018

Package locfdr. July 15, Index 5

Package NonpModelCheck

Package ChIPtest. July 20, 2016

On the Distribution of a Quadratic Form in Normal Variates

Package EMVS. April 24, 2018

Package gtheory. October 30, 2016

Package beam. May 3, 2018

Package nmw. October 20, 2017

Package TSF. July 15, 2017

Package zic. August 22, 2017

Package mmm. R topics documented: February 20, Type Package

Package GPfit. R topics documented: April 2, Title Gaussian Processes Modeling Version Date

Package TwoStepCLogit

Package semgof. February 20, 2015

Package metansue. July 11, 2018

Package metafuse. October 17, 2016

Package asypow. February 15, 2013

Package threg. August 10, 2015

Package gsarima. February 20, 2015

Package bivariate. December 10, 2018

Package threeboost. February 20, 2015

Package pfa. July 4, 2016

Package mlmmm. February 20, 2015

Package RootsExtremaInflections

Package ICBayes. September 24, 2017

Package flora. R topics documented: August 29, Type Package. Title flora: taxonomical information on flowering species that occur in Brazil

Package crossreg. February 19, 2015

Package elhmc. R topics documented: July 4, Type Package

Package mbvs. August 28, 2018

Package spef. February 26, 2018

Package pearson7. June 22, 2016

Package bmem. February 15, 2013

Package blme. August 29, 2016

Package codadiags. February 19, 2015

Package weightquant. R topics documented: December 30, Type Package

Package spatial.gev.bma

Package HDtest. R topics documented: September 13, Type Package

Package OGI. December 20, 2017

Package milineage. October 20, 2017

Package monmlp. R topics documented: December 5, Type Package

Package complex.surv.dat.sim

Transcription:

Type Package Package CompQuadForm April 12, 2017 Title Distribution Function of Quadratic Forms in Normal Variables Version 1.4.3 Date 2017-04-10 Author P. Lafaye de Micheaux Maintainer P. Lafaye de Micheaux <lafaye@unsw.edu.au> Description Computes the distribution function of quadratic forms in normal variables using Imhof's method, Davies's algorithm, Farebrother's algorithm or Liu et al.'s algorithm. License GPL (>= 2) LazyLoad yes NeedsCompilation yes Repository CRAN Date/Publication 2017-04-12 14:28:23 UTC R topics documented: davies............................................ 1 farebrother.......................................... 3 imhof............................................ 5 liu.............................................. 6 Index 9 davies Davies method Description Distribution function (survival function in fact) of quadratic forms in normal variables using Davies s method. 1

2 davies Usage davies(q, lambda, h = rep(1, length(lambda)), delta = rep(0, length(lambda)), sigma = 0, lim = 10000, acc = 0.0001) Arguments q lambda h delta sigma lim acc value point at which distribution function is to be evaluated the weights λ 1, λ 2,..., λ n, i.e. distinct non-zero characteristic roots of AΣ respective orders of multiplicity n j of the λs non-centrality parameters δj 2 (should be positive) coefficient σ of the standard Gaussian maximum number of integration terms. Realistic values for lim range from 1,000 if the procedure is to be called repeatedly up to 50,000 if it is to be called only occasionally error bound. Suitable values for acc range from 0.001 to 0.00005 which should be adequate for most statistical purposes. Details Value Computes P [Q > q] where Q = r j=1 λ jx j + σx 0 where X j are independent random variables having a non-central chi 2 distribution with n j degrees of freedom and non-centrality parameter delta 2 j for j = 1,..., r and X 0 having a standard Gaussian distribution. trace vector, indicating performance of procedure, with the following components: 1: absolute value sum, 2: total number of integration terms, 3: number of integrations, 4: integration interval in main integration, 5: truncation point in initial integration, 6: standard deviation of convergence factor term, 7: number of cycles to locate integration parameters ifault fault indicator: 0: no error, 1: requested accuracy could not be obtained, 2: round-off error possibly significant, 3: invalid parameters, 4: unable to locate integration parameters Qq P [Q > q] Author(s) Pierre Lafaye de Micheaux (<lafaye@dms.umontreal.ca>) and Pierre Duchesne (<duchesne@dms.umontreal.ca>) References 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 Davies R.B., Algorithm AS 155: The Distribution of a Linear Combination of chi-2 Random Variables, Journal of the Royal Statistical Society. Series C (Applied Statistics), 29(3), p. 323-333, (1980)

farebrother 3 Examples # Some results from Table 3, p.327, Davies (1980) round(1 - davies(1, c(6, 3, 1), c(1, 1, 1))$Qq, 4) round(1 - davies(7, c(6, 3, 1), c(1, 1, 1))$Qq, 4) round(1 - davies(20, c(6, 3, 1), c(1, 1, 1))$Qq, 4) round(1 - davies(2, c(6, 3, 1), c(2, 2, 2))$Qq, 4) round(1 - davies(20, c(6, 3, 1), c(2, 2, 2))$Qq, 4) round(1 - davies(60, c(6, 3, 1), c(2, 2, 2))$Qq, 4) round(1 - davies(10, c(6, 3, 1), c(6, 4, 2))$Qq, 4) round(1 - davies(50, c(6, 3, 1), c(6, 4, 2))$Qq, 4) round(1 - davies(120, c(6, 3, 1), c(6, 4, 2))$Qq, 4) round(1 - davies(20, c(7, 3), c(6, 2), c(6, 2))$Qq, 4) round(1 - davies(100, c(7, 3), c(6, 2), c(6, 2))$Qq, 4) round(1 - davies(200, c(7, 3), c(6, 2), c(6, 2))$Qq, 4) round(1 - davies(10, c(7, 3), c(1, 1), c(6, 2))$Qq, 4) round(1 - davies(60, c(7, 3), c(1, 1), c(6, 2))$Qq, 4) round(1 - davies(150, c(7, 3), c(1, 1), c(6, 2))$Qq, 4) round(1 - davies(70, c(7, 3, 7, 3), c(6, 2, 1, 1), c(6, 2, 6, 2))$Qq, 4) round(1 - davies(160, c(7, 3, 7, 3), c(6, 2, 1, 1), c(6, 2, 6, 2))$Qq, 4) round(1 - davies(260, c(7, 3, 7, 3), c(6, 2, 1, 1), c(6, 2, 6, 2))$Qq, 4) round(1 - davies(-40, c(7, 3, -7, -3), c(6, 2, 1, 1), c(6, 2, 6, 2))$Qq, 4) round(1 - davies(40, c(7, 3, -7, -3), c(6, 2, 1, 1), c(6, 2, 6, 2))$Qq, 4) round(1 - davies(140, c(7, 3, -7, -3), c(6, 2, 1, 1), c(6, 2, 6, 2))$Qq, 4) # You should sometimes play with the 'lim' parameter: davies(0.00001,lambda=0.2) imhof(0.00001,lambda=0.2)$qq davies(0.00001,lambda=0.2, lim=20000) farebrother Ruben/Farebrother method Description Distribution function (survival function in fact) of quadratic forms in normal variables using Farebrother s algorithm.

4 farebrother Usage farebrother(q, lambda, h = rep(1, length(lambda)), delta = rep(0, length(lambda)), maxit = 100000, eps = 10^(-10), mode = 1) Arguments q lambda h delta maxit eps Details Value value point at which distribution function is to be evaluated the weights λ 1, λ 2,..., λ n, i.e. the distinct non-zero characteristic roots of AΣ vector of the respective orders of multiplicity m i of the λs the non-centrality parameters δ i (should be positive) the maximum number of term K in equation below the desired level of accuracy mode if mode > 0 then β = mode λ min otherwise β = β B = 2/(1/λ min + 1/λ max ) Computes P[Q>q] where Q = n j=1 λ jχ 2 (m j, δj 2). P[Q<q] is approximated by k = 0K 1 a k P [χ 2 (m+ 2k) < q/β] where m = n j=1 m j and β is an arbitrary constant (as given by argument mode). dnsty the density of the linear form ifault the fault indicator. -i: one or more of the constraints λ i > 0, m i > 0 and δ 2 i 0 is not satisfied. 1: non-fatal underflow of a 0. 2: one or more of the constraints n > 0, q > 0, maxit > 0 and eps > 0 is not satisfied. 3: the current estimate of the probability is greater than 2. 4: the required accuracy could not be obtained in maxit iterations. 5: the value returned by the procedure does not satisfy 0 RUBEN 1. 6: dnsty is negative. 9: faults 4 and 5. 10: faults 4 and 6. 0: otherwise. Qq P [Q > q] Author(s) Pierre Lafaye de Micheaux (<lafaye@dms.umontreal.ca>) and Pierre Duchesne (<duchesne@dms.umontreal.ca>) References 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 Farebrother R.W., Algorithm AS 204: The distribution of a Positive Linear Combination of chisquared random variables, Journal of the Royal Statistical Society, Series C (applied Statistics), Vol. 33, No. 3 (1984), p. 332-339

imhof 5 Examples # Some results from Table 3, p.327, Davies (1980) 1 - farebrother(1, c(6, 3, 1), c(1, 1, 1), c(0, 0, 0))$Qq imhof Imhof method. Description Usage Distribution function (survival function in fact) of quadratic forms in normal variables using Imhof s method. imhof(q, lambda, h = rep(1, length(lambda)), delta = rep(0, length(lambda)), epsabs = 10^(-6), epsrel = 10^(-6), limit = 10000) Arguments q lambda h delta epsabs epsrel limit value point at which the survival function is to be evaluated distinct non-zero characteristic roots of AΣ respective orders of multiplicity of the λs non-centrality parameters (should be positive) absolute accuracy requested relative accuracy requested determines the maximum number of subintervals in the partition of the given integration interval Details Let X = (X 1,..., X n ) be a column random vector which follows a multidimensional normal law with mean vector 0 and non-singular covariance matrix Σ. Let µ = (µ 1,..., µ n ) be a constant vector, and consider the quadratic form The function imhof computes P [Q > q]. Q = (x + µ) A(x + µ) = m λ r χ 2 h r;δ r. The λ r s are the distinct non-zero characteristic roots of AΣ, the h r s their respective orders of multiplicity, the δ r s are certain linear combinations of µ 1,..., µ n and the χ 2 h r;δ r are independent χ 2 -variables with h r degrees of freedom and non-centrality parameter δ r. The variable χ 2 h,δ is defined here by the relation χ 2 h,δ = (X 1 + δ) 2 + h i=2 X2 i, where X 1,..., X h are independent unit normal deviates. r=1

6 liu Value Qq P [Q > q] abserr estimate of the modulus of the absolute error, which should equal or exceed abs(i - result) Author(s) Pierre Lafaye de Micheaux (<lafaye@dms.umontreal.ca>) and Pierre Duchesne (<duchesne@dms.umontreal.ca>) References 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 J. P. Imhof, Computing the Distribution of Quadratic Forms in Normal Variables, Biometrika, Volume 48, Issue 3/4 (Dec., 1961), 419-426 Examples # Some results from Table 1, p.424, Imhof (1961) # Q1 with x = 2 round(imhof(2, c(0.6, 0.3, 0.1))$Qq, 4) # Q2 with x = 6 round(imhof(6, c(0.6, 0.3, 0.1), c(2, 2, 2))$Qq, 4) # Q6 with x = 15 round(imhof(15, c(0.7, 0.3), c(1, 1), c(6, 2))$Qq, 4) liu Liu s method Description Distribution function (survival function in fact) of quadratic forms in normal variables using Liu et al. s method. Usage liu(q, lambda, h = rep(1, length(lambda)), delta = rep(0, length(lambda)))

liu 7 Arguments q value point at which the survival function is to be evaluated lambda distinct non-zero characteristic roots of AΣ, i.e. the λ i s h respective orders of multiplicity h i s of the λ s delta non-centrality parameters δ i s (should be positive) Details New chi-square approximation to the distribution of non-negative definite quadratic forms in noncentral normal variables. Computes P [Q > q] where Q = n j=1 λ jχ 2 (h j, δ j ). This method does not work as good as the Imhof s method. Thus Imhof s method should be recommended. Value Qq P [Q > q] Author(s) Pierre Lafaye de Micheaux (<lafaye@dms.umontreal.ca>) and Pierre Duchesne (<duchesne@dms.umontreal.ca>) References 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)

8 liu # 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)

Index Topic distribution davies, 1 farebrother, 3 imhof, 5 liu, 6 Topic htest davies, 1 farebrother, 3 imhof, 5 liu, 6 davies, 1 farebrother, 3 imhof, 5 liu, 6 ruben (farebrother), 3 9