Skip to content

Commit

Permalink
DOC: stats: Fixed some typos in the stats tutorial (includes fix for …
Browse files Browse the repository at this point in the history
…ticket #1896).
  • Loading branch information
WarrenWeckesser committed Apr 22, 2013
1 parent 18f226f commit c84b255
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions doc/source/tutorial/stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The main public methods for continuous RVs are:
* moment: non-central moments of the distribution


Lets take a normal RV as an example.
Let's take a normal RV as an example.

>>> norm.cdf(0)
0.5
Expand All @@ -129,7 +129,8 @@ Other generally useful methods are supported too:
To find the median of a distribution we can use the percent point
function ``ppf``, which is the inverse of the ``cdf``:

>>> norm..ppf(0.5)
>>> norm.ppf(0.5)
0.0

To generate a set of random variates:

Expand All @@ -141,7 +142,7 @@ Don't think that ``norm.rvs(5)`` generates 5 variates:
>>> norm.rvs(5)
7.131624370075814

This brings us, in fact, to topic of the next subsection.
This brings us, in fact, to the topic of the next subsection.


Shifting and Scaling
Expand Down Expand Up @@ -185,7 +186,7 @@ The uniform distribution is also interesting:
Finally, recall from the previous paragraph that we are left with the
problem of the meaning of ``norm.rvs(5)``. As it turns out, calling a
distribution like this, the first argument, i.e., the 5, gets passed
to set the ``loc`` parameter. Lets see:
to set the ``loc`` parameter. Let's see:

>>> np.mean(norm.rvs(5, size=500))
4.983550784784704
Expand Down Expand Up @@ -215,7 +216,7 @@ requires the shape parameter :math:`n`. Observe that setting
:math:`\lambda` can be obtained by setting the ``scale`` keyword to
:math:`1/\lambda`.

Lets check the number and name of the shape parameters of the gamma
Let's check the number and name of the shape parameters of the gamma
distribution. (We know from the above that this should be 1.)

>>> from scipy.stats import gamma
Expand Down Expand Up @@ -438,7 +439,7 @@ information about the distribution. Thus, as a cautionary example:
>>> quad(deterministic.pdf, -1e-1, 1e-1)
(4.163336342344337e-13, 0.0)

But this is not correct: the integral over this pdf should be 1. Lets make the
But this is not correct: the integral over this pdf should be 1. Let's make the
integration interval smaller:

>>> quad(deterministic.pdf, -1e-3, 1e-3) # warning removed
Expand Down Expand Up @@ -482,7 +483,7 @@ may be raised or the resulting numbers may be incorrect.

**An Example**

Lets do the work. First
Let's do the work. First

>>> npoints = 20 # number of integer support points of the distribution minus 1
>>> npointsh = npoints / 2
Expand Down Expand Up @@ -512,7 +513,7 @@ common methods of discrete distributions.

**Testing the Implementation**

Lets generate a random sample and compare observed frequencies with
Let's generate a random sample and compare observed frequencies with
the probabilities.

>>> n_sample = 500
Expand Down

0 comments on commit c84b255

Please sign in to comment.