Skip to content

Commit

Permalink
DOC/TST: fixed from docstring styles/typos and moved therandom seed t…
Browse files Browse the repository at this point in the history
…o the setup methods of the tests
  • Loading branch information
phobson committed Dec 22, 2013
1 parent 7f129d2 commit 394d29c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
31 changes: 15 additions & 16 deletions statsmodels/graphics/gofplots.py
Expand Up @@ -197,14 +197,12 @@ def ppplot(self, xlabel=None, ylabel=None, line=None, other=None,
Parameters
----------
ax : Matplotlib AxesSubplot instance, optional
If given, this subplot is used to plot in instead of a new figure
being created.
xlabel, ylabel : str or None, optional
User-provided lables for the x-axis and y-axis. If None (default),
other values are used depending on the status of the kwarg `other`.
line : str {'45', 's', 'r', q'} or None, optional
Options for the reference line to which the data is compared:
- '45' - 45-degree line
- 's' - standardized line, the expected order statistics are scaled
by the standard deviation of the given sample and have the mean
Expand All @@ -220,6 +218,9 @@ def ppplot(self, xlabel=None, ylabel=None, line=None, other=None,
instance. If an array-like object is provided, it will be turned
into a `ProbPlot` instance using default parameters. If not provided
(default), the theoretical quantiles are used.
ax : Matplotlib AxesSubplot instance, optional
If given, this subplot is used to plot in instead of a new figure
being created.
**plotkwargs : additional matplotlib arguments to be passed to the
`plot` command.
Expand Down Expand Up @@ -263,16 +264,13 @@ def ppplot(self, xlabel=None, ylabel=None, line=None, other=None,
return fig

def qqplot(self, xlabel=None, ylabel=None, line=None, other=None,
ax=None, **plotkwargs):
ax=None, **plotkwargs):
"""
Q-Q plot of the quantiles of x versus the quantiles/ppf of a
distribution or the quantiles of another `ProbPlot` instance.
Parameters
----------
ax : Matplotlib AxesSubplot instance, optional
If given, this subplot is used to plot in instead of a new figure
being created.
xlabel, ylabel : str or None, optional
User-provided lables for the x-axis and y-axis. If None (default),
other values are used depending on the status of the kwarg `other`.
Expand All @@ -293,6 +291,9 @@ def qqplot(self, xlabel=None, ylabel=None, line=None, other=None,
instance. If an array-like object is provided, it will be turned
into a `ProbPlot` instance using default parameters. If not provided
(default), the theoretical quantiles are used.
ax : Matplotlib AxesSubplot instance, optional
If given, this subplot is used to plot in instead of a new figure
being created.
**plotkwargs : additional matplotlib arguments to be passed to the
`plot` command.
Expand Down Expand Up @@ -332,8 +333,8 @@ def qqplot(self, xlabel=None, ylabel=None, line=None, other=None,

return fig

def probplot(self, ax=None, xlabel=None, ylabel=None, line=None,
exceed=False, **plotkwargs):
def probplot(self, xlabel=None, ylabel=None, line=None,
exceed=False, ax=None, **plotkwargs):
"""
Probability plot of the unscaled quantiles of x versus the
probabilities of a distibution (not to be confused with a P-P plot).
Expand All @@ -343,16 +344,12 @@ def probplot(self, ax=None, xlabel=None, ylabel=None, line=None,
Parameters
----------
ax : Matplotlib AxesSubplot instance, optional
If given, this subplot is used to plot in instead of a new figure
being created.
xlabel, ylabel : str or None, optional
User-provided lables for the x-axis and y-axis. If None (default),
other values are used depending on the status of the kwarg `other`.
line : str {'45', 's', 'r', q'} or None, optional
Options for the reference line to which the data is compared:
- '45' - 45-degree line
- 's' - standardized line, the expected order statistics are scaled
by the standard deviation of the given sample and have the mean
Expand All @@ -362,15 +359,17 @@ def probplot(self, ax=None, xlabel=None, ylabel=None, line=None,
- None - by default no reference line is added to the plot.
- If True a reference line is drawn on the graph. The default is to
fit a line via OLS regression.
exceed : boolean, optional
excced : boolean, optional
- If False (default) the raw sample quantiles are plotted against
the theoretical quantiles, show the probability that a sample
will not exceed a given value
- If True, the theoretical quantiles are flipped such that the
figure displays the probability that a sample will exceed a
given value.
ax : Matplotlib AxesSubplot instance, optional
If given, this subplot is used to plot in instead of a new figure
being created.
**plotkwargs : additional matplotlib arguments to be passed to the
`plot` command.
Expand Down
5 changes: 4 additions & 1 deletion statsmodels/graphics/tests/test_gofplots.py
@@ -1,5 +1,4 @@
import numpy as np
np.random.seed(5)
from numpy.testing import dec

import statsmodels.api as sm
Expand Down Expand Up @@ -111,6 +110,7 @@ def test_probplot_pltkwargs(self):

class TestProbPlotLongely(BaseProbplotMixin):
def setup(self):
np.random.seed(5)
self.data = sm.datasets.longley.load()
self.data.exog = sm.add_constant(self.data.exog, prepend=False)
self.mod_fit = sm.OLS(self.data.endog, self.data.exog).fit()
Expand All @@ -121,6 +121,7 @@ def setup(self):

class TestProbPlotRandomNormalMinimal(BaseProbplotMixin):
def setup(self):
np.random.seed(5)
self.data = np.random.normal(loc=8.25, scale=3.25, size=37)
self.prbplt = sm.ProbPlot(self.data)
self.line = None
Expand All @@ -129,6 +130,7 @@ def setup(self):

class TestProbPlotRandomNormalWithFit(BaseProbplotMixin):
def setup(self):
np.random.seed(5)
self.data = np.random.normal(loc=8.25, scale=3.25, size=37)
self.prbplt = sm.ProbPlot(self.data, fit=True)
self.line = 'q'
Expand All @@ -137,6 +139,7 @@ def setup(self):

class TestProbPlotRandomNormalLocScale(BaseProbplotMixin):
def setup(self):
np.random.seed(5)
self.data = np.random.normal(loc=8.25, scale=3.25, size=37)
self.prbplt = sm.ProbPlot(self.data, loc=8.25, scale=3.25)
self.line = '45'
Expand Down

0 comments on commit 394d29c

Please sign in to comment.