Question: EXERCISE 2 PLEASE!!!!!!! In a jupyter notebook named chisquared.ipynb, write some python code to confirm an assertion made in lecture: Suppose I draw a set
EXERCISE PLEASE!!!!!!!
In a jupyter notebook named chisquared.ipynb, write some python code to confirm an
assertion made in lecture: Suppose I draw a set of random variables from a normal
Gaussian distribution with mean and width If I define as the weighted sumof
squares deviation from the mean:
Then will follow a distribution with degrees of freedom.
represents the gamma function, but it is easier to generate the PDF directly using
scipy.stats.chi
For starters, have your code do the following
Set data points, and But note that the distribution
doesn't depend on and
Perform or so trials in which you sample using
numpy.random.normal. Calculate for each trial.
Plot the values in a histogram, using the densityTrue option.
Now, use scipy.stats.chik to superimpose the appropriate PDF on your "data" to
confirm they agree.
Here are a few other things to try.
Vary and confirm they have no impact on the distribution.
Vary N confirm that the assertion still holds.
Suppose that, instead of taking as fixed, we determine by taking the mean of the
data points. Since we have determined from the data, the number of degrees of
freedom drops to Recompute and plot the distribution of Q and confirm that
scipy.stats.chiN now describes the data.
Exercise
In a jupyter notebook named chisquared.ipynb, write some python code to confirm an
assertion made in lecture: Suppose I draw a set of random variables from a normal
Gaussian distribution with mean and width If I define as the weighted sumof
squares deviation from the mean:
Then will follow a distribution with degrees of freedom.
represents the gamma function, but it is easier to generate the PDF directly using
scipy.stats.chi
For starters, have your code do the following
Set data points, and But note that the distribution
doesn't depend on and
Perform or so trials in which you sample N RVs using
numpy.random.normal. Calculate for each trial.
Plot the values in a histogram, using the densityTrue option.
Now, use scipy.stats.chik to superimpose the appropriate PDF on your "data" to
confirm they agree.
Here are a few other things to try.
Vary and confirm they have no impact on the distribution.
Vary N confirm that the assertion still holds.
Suppose that, instead of taking as fixed, we determine by taking the mean of the
data points. Since we have determined from the data, the number of degrees of
freedom drops to Recompute and plot the distribution of Q and confirm that
scipy.stats.chi
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
