Some tools for statistics:
    I. Random Numbers 
   II. Tools for Distributions 
  III. Histograms

Sampling random numbers from a uniform p.d.f.

The function RandomReal[], with no arguments, generates a random real number from a uniform probability distribution between 0 and 1

RandomReal[]

To sample many random numbers, use the Table[ ]  function.  For example, to generate a list of 10 random numbers :

Table[RandomReal[],{i,1,10}]

OR, equivalently, use

RandomReal[1,10]

For integers, use the function RandomInteger[]. With no arguments, generates random 0’s and 1’s.  See second example for 10 random integers between 20 and 30 (inclusive).

RandomInteger[]

RandomInteger[{20,30},10]

Mean and Standard Deviation

a = RandomInteger[{20,30},100]

Mean[a]

Mean[a]//N

StandardDeviation[a]//N

Normal Distribution

Specify a normal distribution with a mean of 10 and  standard deviation of 1 with function NormalDistribution[10,1].

?NormalDistribution

Sampling a normal distribution:

RandomVariate[NormalDistribution[10,2]]

fakeData =Table[RandomVariate[NormalDistribution[10,2]],{i,1,15}]

OR, equivalently,

fakeData = RandomVariate[NormalDistribution[10,2],15]

Mean[fakeData]

StandardDeviation[fakeData]

Probabitiy Density Function - Eq. (3.7) on p. 24 of Hughes and Hase

PDF[NormalDistribution[μ,σ],x]

PDF[NormalDistribution[10,2],10.]

Plot[PDF[NormalDistribution[10,2],x],{x,0,20}]

Integrate[PDF[NormalDistribution[10,2],x],{x,-∞,∞}]

Find the probability that x lies between μ - σ and μ + σ :

Integrate[PDF[NormalDistribution[10,2],x],{x,8,12}]//N

Cumulative Distribution Function

CDF[NormalDistribution[10,2],x]  is the integral of the Probability Density Function from  –∞ to x

CDF[NormalDistribution[10,2],8.]

CDF[NormalDistribution[10,2],10.]

Plot[CDF[NormalDistribution[10,2],x],{x,0,20}]

Shortcuts:

Note: I can "construct" a specific distribution and give it a name :

f= NormalDistribution[10,2];

RandomVariate[f]

Plot[PDF[f,x],{x,0,20}]

Poisson Distribution

Specify a Poisson distribution with a mean of μ : PoissonDistribution[μ].

?PoissonDistribution

Sampling a Poisson distribution:

RandomVariate[PoissonDistribution[5]]

fakeData =Table[Random[PoissonDistribution[5]],{i,1,10000}];

Or, equivalently,

RandomVariate[PoissonDistribution[5],10]

Mean[fakeData]//N

StandardDeviation[fakeData]//N

Sqrt[5]//N

Probabitiy Distribution Function - Eq. (3.11) on p. 29 of Hughes and Hase

PDF[PoissonDistribution[μ],x]

PDF[PoissonDistribution[5],6]

%//N

ListPlot[Table[PDF[PoissonDistribution[5],i],{i,0,10}]]

Cumulative Distribution Function

CDF[PoissonDistribution[5],n]  is the sum of the Probability Distribution Function from  0 to n

CDF[PoissonDistribution[5],2]

CDF[PoissonDistribution[5],2]//N

CDF[PoissonDistribution[5],15]//N

ListPlot[Table[CDF[PoissonDistribution[5],i],{i,0,10}]]

Binomial Distribution

Specify a Binomial distribution for n trials with a probability of success in each trial of p: BinomialDistribution[n,p].

?BinomialDistribution

Sampling a Binomial distribution:

RandomVariate[BinomialDistribution[2,.4]]

fakeData =Table[RandomVariate[BinomialDistribution[2,.4]],{i,1,50}]

OR, equivalently

fakeData = RandomVariate[BinomialDistribution[2,.4],50]

Mean[fakeData]//N

StandardDeviation[fakeData]//N

Probabitiy Distribution Function

PDF[BinomialDistribution[n,p],ν]

PDF[BinomialDistribution[2,.4],0]

PDF[BinomialDistribution[2,.4],1]

PDF[BinomialDistribution[2,.4],2]

Cumulative Distribution Function

CDF[BinomialDistribution[2.,.4],n] is the sum of the Probability Distribution Function from  0 to n

CDF[BinomialDistribution[2,.4],0]

CDF[BinomialDistribution[2,.4],1]

CDF[BinomialDistribution[2,.4],2]

Histograms

data = Table[RandomVariate[NormalDistribution[10,2]],{i,1,100}]

Histogram letting Mathematica pick bins:

Histogram[data]

Histogram with user selected bins.  There are many options - see the "More Information" section of the Help page. Here are some examples:

Histogram[data,{3}]    (* Bins of width 3 *)

Histogram[data,{{3,5,7,9,11,12,13,14,15,16}}]   (* User specified bins *)

If the data is already binned, you can simply plot it using BarChart[ ].  For example, if in taking data you record no samples with values below 7, 3 samples in the range  -7 -> -5,  5 samples in the range -5 ->-3,  4 samples in the range -3 -> -1, etc., you can make a histogram as follows:

hist5data={0,3,5,4,2,1,1,0,0};
labels = {-8,-6,-4,-2,0,2,4,6,8};

Data is already binned, so we don' t have to use Histogram[] function; just plot data using BarChart[]

BarChart[hist5data,ChartLabels->labels]