[R] How to compute a P-value for a complex mixture of chi-squared distributions in R
peter dalgaard
pdalgd at gmail.com
Thu May 22 16:57:09 CEST 2014
On 22 May 2014, at 14:44 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> On 01/06/2013, 12:26 AM, Tiago V. Pereira wrote:
>> Hello, R users!
>>
>> I am struggling with the following problem:
>>
>> I need to compute a P-value for a mixture of two chi-squared
>> distributions. My P-value is given by:
>>
>> P = 0.5*prob(sqrt(chi2(1)) <= x) + 0.5*prob(sqrt(chi2(2)) <= x)
>
> Isn't this simply
>
> 0.5*pchisq(x^2, df=1) + 0.5*pchisq(x^2, df=2)
>
...as suggested by yours truly in 2011! ( :-o ???!!!)
On Jun 12, 2011, at 03:36 , Thomas Lumley wrote:
> On Sun, Jun 12, 2011 at 12:44 PM, Tiago Pereira
> <tiago.pereira at mbe.bio.br> wrote:
>
>> The test I am working on has an asymptotic 0.5*chi2(1)+0.5*chi2(2)
>> distribution, where numbers inside parenthesis stand for the degrees of
>> freedom. Is is possible to compute quickly in R the cumulative distribution
>> of that distribution?
>>
>
> There appear to be pchibar() functions in both the ibdreg and ic.infer
> packages that should do want you want. Simulation is also fairly
> efficient.
Assuming that you mean a 50-50 mixture of the two, it should also work just to take the average of the two CDFs. The integral is a linear operator after all.
--
Peter Dalgaard
Center for Statistics, Copenhagen Business School
> ?
>
> Duncan Murdoch
>
>>
>> In words, I need to compute the p-value for 50–50 mixture of the square
>> root of a chi-squared random variable with 1 degree of freedom and the
>> square root of a chi-squared with two degrees of freedom.
>>
>> Although I can quickly simulate data, the P-values I am looking for are at
>> the tail of the distribution, that is, alpha levels below 10^-7. Hence,
>> simulation is not efficient.
>>
>> Are you aware of smart approach?
>>
>>
>> All the best,
>>
>> Tiago
>>
>> ______________________________________________
>> R-help at r-project.org 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.
>>
>
> ______________________________________________
> R-help at r-project.org 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.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list