(In the graphs below, the red line indicates the mean, the blue line the median, and the green line the mode.)
Plot generation code
> hist(x,breaks=10) # histogram with wide bars
> hist(x,breaks=50) # histogram with thin bars
> plot(density(x)) # density curve
> plot(cumsum(sort(x))) # cumulative distribution
> boxplot(x) # box plot
> qqnorm(x); qqline(x) # normal quantile plot
Original data
Calculation of z-scores> z = (x - mean(x)) / sd(x)
Sorted data
Measures of central tendency
Mode> Mode(x)
Median
> median(x)
Mean (manual calculation)
> (1/n) * sum(x)
Mean (automatic calculation)
> mean(x)
Measures of spread
Minimum> min(x)
Maximum
> max(x)
Range
> max(x) - min(x)
Quartiles (note the value at 50% is equal to the median shown above)
> quantile(x)
Interquartile range
> IQR(x)
Population variance (if the data would represent the full population)
> (1/n) * sum((x-mean(x))^2
Population standard deviation (if the data would represent the full population)
> sqrt((1/n) * sum((x-mean(x))^2)
Sample variance (manual calculation)
> (1/(n-1)) * sum((x-mean(x))^2
Sample variance (automatic calculation)
> var(x)
Sample standard deviation (manual calculation)
> sqrt((1/(n-1)) * sum((x-mean(x))^2)
Sample standard deviation (automatic calculation
> sd(x)
Stem and leaf diagram
> stem(x)