[R] Test if a sample mean of integers with range -inf; inf is different from zero

Petr Savicky savicky at cs.cas.cz
Fri May 4 12:38:42 CEST 2012


On Fri, May 04, 2012 at 11:29:51AM +0200, Kay Cichini wrote:
> Hi all,
> 
> how would you test  if a sample mean of integers with range -inf;inf  is
> different from zero:
> 
> # my sample of integers:
> c <- c(-3, -1, 0, 1, 0, 3, 4, 10, 12)
> 
> # is mean of c <> 0?:
> mean(c)

Hi.

It is better to use a name of a vector different from "c", which
is a function, which you also use.

Testing, whether the sample mean is zero is simple, since one can use

  mean(c) == 0

or 

  sum(c) == 0

which are equivalent even in the inaccurate computer arithmetic.

So, i think, you are asking for a statistical test, whether the
true distribution mean is zero on the basis of a sample. Testing
this requires some additional information on the distribution.
If we do not know anything about the distribution except that the
values are integers, then the sample mean can be arbitrarily large
even if the distribuition mean is zero. Consider, for example,
a uniform distribution on {-M, M} for some very large integer M.
Observing a large sample mean does not allow to reject the null
hypothesis on any level, since a large mean may have large probability
even if the null hypothesis is true.

If there is no bound on the values, then testing anything concerning
the mean may not be possible, since the expected may not exist. Do you
have a reason to think that the true distribution has an expected value?

An example of an integer random variable without an expected value is

  s*X

where s is uniform on {-1, 1} and X has value 2^i with probability 2^-i
for i a positive integer.

Hope this helps.

Petr Savicky.



More information about the R-help mailing list