How can I find a p-value when dealing with a weighted sum of chi-square distributions?

4 views (last 30 days)
I am working with a test statistic that is distributed as a weighted sum of chi-square distributions. Given a particular value x, how can I find its associated p-value? I believe I can use something like 1-chi2cdf(x,d) when dealing with just one chi-square distribution with d degrees of freedom. But what can I do if I have a weighted sum of chi-square distributions?

Accepted Answer

Jeff Miller
Jeff Miller on 17 Aug 2019
Edited: Jeff Miller on 17 Aug 2019
I think you have to work out the distribution of the weighted sum and then check the p value in that. Here is an example, assuming that the different chi-squares in the weighted sum are independent.
cs10 = ChiSq(10); wt10 = 0.7;
cs20 = ChiSq(20); wt20 = 0.3;
x = 25;
cs10p = 1 - cs10.CDF(x);
cs20p = 1 - cs20.CDF(x);
wtavgp = wt10*cs10p + wt20*cs20p; % Here is the weighted average of p values.
[cs10p, cs20p, wtavgp]
ans =
0.0053455 0.20143 0.064171 % Of course the weighted avg of the p's is between the two p's.
% Now look at the distribution of the weighted sum
wtsumdist = Convolution(MultTrans(cs10,wt10),MultTrans(cs20,wt20)); % this is the distribution of the weighted sum
sumdistp = 1 - wtsumdist.CDF(x); % This is the p value in the weighted sum
[cs10p, cs20p, sumdistp]
ans =
0.0053455 0.20143 0.0042652
It might at first be surprising that the p value in the weighted sum distribution is less than the p values in the individual distributions, but this actually makes sense. Imagine that you had 100 identical chi-squares, all with weights 0.01. The weighted sum (i.e., average) would have very low variance relative to the individual chi-squares, and the p value of a score in the upper tail would be tiny in the average compared to what it would be in the individual ones.
Incidentally, I think the right p value would be the weighted average of p's if your test statistic were the weighted mixture of chi-squares:
wtmixdist = Mixture(wt10,cs10,wt20,cs20);
mixdistp = 1 - wtmixdist.CDF(x);
[cs10p, cs20p, mixdistp]
ans =
0.0053455 0.20143 0.064171
By the way, the computations in the example were done with Cupid

More Answers (1)

David Goodmanson
David Goodmanson on 16 Aug 2019
Edited: David Goodmanson on 19 Aug 2019
HI Michael,
Since this is a weighted sum instead of a weighted mixture (as I erroneously assumed), the calculation will be along the lines of what Jeff is saying below.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!