Question: ` ` ` In [ ] : import pandas as pd import matplotlib.pyplot as plt data = pd . read _ csv ( .
In : import pandas as pd
import matplotlib.pyplot as plt
data pdreadcsvalleghenyCensusTractIncomeprocessed.csv
data datadataType "Households"Census Tract","Mean income dollars
printNumber of Census Tracts: d lendata
dataMean income dollarshist
pltxlabelAvg Annual Household Income $fontsize
pltylabelNumber of Census Tracts",fontsize
data.head
If I take a random sample of Census Tracts, what is the probability that the sample's expected value falls between $ and $
Previously, we answered this kind of question by referring to the following plot of the normal distribution. We will discuss how to calculate these probabilities for any interval on the distribution in a future module. But, for now, know that the area under the curve is representing the probability that the sample mean falls within an interval. For example, the probability that the sample mean is between the population mean and standard error above the mean ie between and sigma in the plot is
For now, I want you to use the Scipy Python package to answer this question with an exact probability. Scipy is a Python package designed for scientific computing and it contains many useful functions for statistics and machine learning. The "scipy.stats.norm" is a Python class for representing the Normal Distribution given an expected value and the standard deviation.
In : # Here is an example using scipy.stats.norm to calculate the probability that the sample mean is below given that the populatic
import scipy
popExpectedValue
standardError
N scipy.stats.normlocscale
p Ncdf
printProbability the expected value of the sample is below is f p
Use the cell below to answer the question about Allegheny County Census Tracts: If I take a random sample of Census Tracts, what is the probability that the sample's expected value falls between $ and $
In : import scipy
def calculateincomedistributiondata:
# your code here
raise NotImplementedError
return #your code here.
calculateincomedistributiondata
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
