- status: open --> open-fixed
The standard deviation calculation was reported as a
bug. After I looked into it, it is not a bug. As reported,at
location: ...\src\para_library.c, line: 3779, stddev = sqrt
(fabs((*pss - (*ps)*(*ps)/nb)/(nb*(nb-1)))) was
considered wrong, because the Standard Deviation =
Sqrt { [Sum (x^2) (Sum (x)^2)/n] / (n 1)}
But, in fact variable name stddev does not stand for
standard deviation and PARASOL dose not return the
value of standard deviation, instead, it use stddev to
calculate the confidence interval with student T value.
The details will be shown below:
It seems that the original code is reasonable and there
is no bug in function blocked_stat_outputer (), which is
located at 3779 of para_library.c, but the variable name
stddev is confusing for the readers.
Before we verify the function, we must be cleared at
the following two equations:
Student t value:
t = (x-u)/(s/sqrt (n)) (1)
where x and s are the sample mean and standard
deviation of a random sample of size n from a normal
population with the mean u and variance q .
Standard deviation:
s = sqrt{[ sum(x^2) - [(sum(x)^2)/n]]/(n-1)} (2)
The original code in line 3779 of /src/para_library.c is:
stddev = sqrt(fabs((*pss - (*ps)*(*ps)/nb)/nb*(nb-
1))), which is actually not the standard deviation. It is
the standard deviation divided by square root of n.
seddev = s/sqrt(n) = {sqrt{[ sum(x^2) - [(sum(x)
^2)/n]]/(n-1)} }/sqrt(n),
and the function blocked_stat_outputer (), output
t1*stddev and t2*stddev, which are two student t
values t1 and t2, times which is called stddev in the
code.
Therefore, from equation (1), we get:
t*stddev = [(x-u)/s/sqrt(n)]*s/sqrt(n) = x-u = t*s/sqrt
(n)
Recall the proposition of 100*(1-a)% confidence interval
for u,
(x - t*s/sqrt(n), x + t*s/sqrt(n))
where the upper bound for u is x + t*s/sqrt(n)
The function blocked_stat_outputer() output (mean,
t1*stddev, t2*stddev), which can be interpreted as
(x ,t1*s/sqrt(n) , t2*s/sqrt(n) ). It shows two types of
confidence interval for u.
Therefore, the original code is theoretically reasonable.