We use a generating function approach to examine the errors on quantit
ies related to counts in cells extracted from galaxy surveys. The meas
urement error, related to the finite number of sampling cells, is dist
inguished from the ''cosmic error,'' due to the finiteness of the surv
ey. While the measurement error can be circumvented through the applic
ation of a proper algorithm, the cosmic error is an irrecoverable prop
erty of any survey. Using the hierarchical model and assuming locally
Poisson behavior, we identify three contributions to the cosmic error:
1. The finite volume effect is proportional to the average of the two
-point correlation function over the whole survey. It accounts for pos
sible fluctuations of the density field at scales larger than the samp
le size. 2. The edge effect is related to the geometry of the survey.
It accounts for the fact that objects near the boundary carry less sta
tistical weight than those further away from it. 3. The discreteness e
ffect is due to the fact that the underlying smooth random held is sam
pled with finite number of objects. This is the ''shot noise'' error.
To check the validity of our results, we measured the factorial moment
s of order N less than or equal to 4 in a large number of small subsam
ples randomly extracted from a hierarchical sample realized by Raighle
y-Levy random walks. The measured statistical errors are in excellent
agreement with our predictions. The probability distribution of errors
is increasingly skewed when the order N and/or the cell size increase
s. This suggests that ''cosmic errors'' tend to be systematic: it is l
ikely to underestimate the true value of the factorial moments. Our st
udy of the various regimes showed that the errors strongly depend on t
he clustering of the system, i.e., on the hierarchy of underlying corr
elations. The Gaussian approximation is valid only in the weakly nonli
near regime, otherwise it severely underestimates the true errors. We
study the concept of ''number of statistically independent cells '' (r
e)defined as the number of sampling cells required to have the measure
ment error of same order as the cosmic error. This number is found to
depend highly on the statistical object under study and is generally q
uite different from the number of cells needed to cover the survey vol
ume. In light of these findings we advocate high oversampling for meas
urements of counts in cells. As a preliminary application to realistic
situations, we study contour plots of the cosmic error expected in ty
pical three-dimensional galaxy catalogs.