Script to calculate Basic Statistics¶
Equation for the mean: $\mu_x = \sum_{i=1}^{N}\frac{x_i}{N}$¶
Equation for the standard deviation: $\sigma_x = \sqrt{\sum_{i=1}^{N}\left(x_i - \mu \right)^2}\frac{1}{N-1}$¶
Instructions:
(1) The objective is to write a chunk of code that can compute the basic statistics on a new data set. In this case, the data set will be a single list array.
(2) Use 'for' loops to help yourself compute the average and standard deviation.
(3) Use for loops and conditional operators to count the number of samples within $1\sigma$ of the mean.
Note: It is not acceptable to use the pre-programmed routines for mean and st. dev., e.g. numpy.mean()
Write your code using instructions in the cells below.¶
In [1]:
# Put your Header information here. Name, creation date, version, etc.
In [3]:
# Create a list variable that contains at least 25 elements. You can create this list any number of ways.
# This will be your sample.
In [4]:
# Pretend you do not know how long x is; compute it's length, N, without using functions or modules.
In [5]:
# Compute the mean of the elements in list x.
In [6]:
# Compute the std deviation, using the mean and the elements in list x.
In [7]:
# Use the 'print' command to report the values of average (mu) and std. dev. (sigma).
In [8]:
# Count the number of values that are within +/- 1 std. deviation of the mean.
# A normal distribution will have approx. 68% of the values within this range.
# Based on this criteria is the list normally distributed?
In [9]:
# Use print() and if statements to report a message about whether the data is normally distributed.
In [ ]:
In [ ]: