ds-statistics Flashcards
What is the variance? what is formula of the random discrete variable and continous?
The variance of a random variable X is defined as the expected value of the squared deviation of X from its mean m.
Calculate the variance of the following attached data? Please insert the numpy code sniped with solution.
data = np.array([0, 1, 2,]) p = np.array([0.97, 0.02, 0.01])
Initial data
data = np.array([0, 1, 2,])
p = np.array([0.97, 0.02, 0.01])
Calculate weighted average
average = np.average(data, weights=p)
calculate variance
variance = np.sum(((data - average)**2) * p).round(3)
Convert to sigma standard deviation
sigma = np.sqrt(variance).round(3)
print(‘variance is ‘, variance, ‘and std is’, sigma)
[out] variance is 0.058 and std is 0.241
What happens when you add a random variable a to the Variance (x)? What happens when you multiply by a random variable b? Write the functions.
Hence, by adding, or subtracting, a value a to a random variable, its variance doesn’t change.
But when you multiply it with a random variable b, its variance becomes the original variance times b squared.
what happens with the variance when 2 random variables X and Y are added together?
What is the generalized expression for variance of many, uncorrelated, random variables?
see image
What happens with the standard deviation of the resulting sum of random variables?
The resulting sum of random variables is always smaller than the sum of the standard deviations for the separate random variables.
It makes sense, some variability will cancel out when random variables are combined.
Given a random variable X with Var(X)=1, what is Var(2X+1)?
4
What is the expected value of a random variable X?
It’s simply another denominator for mean, often denoted as greek letter mu.
The random variable X has a probability distribution:
data = np.array([-10, 2, 10]) p = np.array([0.3, 0.5, 0.2])
What is the expected value of X or E[X]?
np.average(data, weights=p)
[out] 0