The usage of ncx2cdf.m



There seems to be a contrast in the results reported with the
function ncx2cdf.m

This function basically estimates the probability that the sum of the
squares of Gaussian random variables with non-zero means and the same
variance sigma^2 is less than some value. The following lines of code
compare the Monte-Carlo simulation with the theoretical value,

M = randn(4,1)
% Generating the X sequence
X = diag(M)*ones(4,1000000) + sqrt(1) *
complex(randn(4,1000000),randn(4,1000000));
X1 = [real(X);imag(X)];clear X
X2 = abs(X1).^2;
% Computing the sum of the squares
X3 = sum(X2,1);
XL = length(find(X3<C))/length(X3)

% Theoretical value
M = mean(X1,2);M=frob(M);
XT2 = ncx2cdf(C,8,M)

Note that I am generating a non-zero mean Gaussian random vector with
mean M (which is the sum of the squares of the mean). The results are
very good in terms of XL(Monte-Carlo simulation estimate) and
XT2(Theoretical estimate)

Now, I am encountering a problem of normalization. Note the entity X
is composed of real and complex parts which have variance 1, but when
I put some non-zero variance i.e.

M = randn(4,1)
% Generating the X sequence
X = diag(M)*ones(4,1000000) + sqrt(.5) *
complex(randn(4,1000000),randn(4,1000000)); % sqrt(.5) is just an
example, it could be anything in general
X1 = [real(X);imag(X)];clear X
X2 = abs(X1).^2;
% Computing the sum of the squares
X3 = sum(X2,1);
XL = length(find(X3<C))/length(X3)

% Theoretical value
M = mean(X1,2);M=frob(M);
?????????????????????
What should be my input to the part of the program designated by
question marks, so that I may procure a theoretical estimate of XL,
for any arbitrary sigma^2
The answer which gives me somewhat correct answers is
ncx2cdf(C/sqrt(.5),8,M), but the estimate is not as good as in the
central chi-square case. Is it my fault that I am making some error
with respect to normalization, or is there some accuracy error with
the function! Could you kindly clarify the issues!
.



Relevant Pages

  • Re: Variance of SBM Powers
    ... Daniel Mayost wrote: ... What is the variance of integral_0^T_^2*dt), where Wis a Weiner process, of course. ... The Riemann sum for the integral is: ... sum of multiples of squares of independent normals. ...
    (sci.math)
  • Re: a rigid transformation problem
    ... Do you mean sum of the squares? ... Using a numeric solver. ... I still have doubts about the usefullness of the Optimization package. ...
    (sci.math)
  • Re: "...the sum of squares removed by fitting..."
    ... the author uses the phrase "the sum of squares removed by fitting", ... Standard regression theory shows that the sum of squares removed ... Another phrase for the "error sum of squares" is the ...
    (sci.stat.math)
  • Re: Another Error in Afonsos Confidence Interval Code
    ... soma2 is the raw sum of squares of those numbers ... of squares to the usual corrected sum of squares. ... I have tried repeatedly to get Afonso to address, ... claiming about simulating confidence intervals. ...
    (sci.stat.math)
  • Re: Another Error in Afonsos Confidence Interval Code
    ... soma2 is the raw sum of squares of those numbers ... of squares to the usual corrected sum of squares. ... I have tried repeatedly to get Afonso to address, ... IF bb> b THEN maior = bb ...
    (sci.stat.math)