├── CHANGES.md
├── CONTRIBUTING.rst
├── COPYRIGHTS.txt
├── INSTALL.txt
├── LICENSE
├── LICENSE.txt
├── README.md
├── README.rst
├── README_l1.txt
├── docs
├── en
│ ├── GLMNotes.lyx
│ ├── GLMNotes.pdf
│ ├── Makefile
│ ├── README.md
│ ├── fix_longtable.py
│ ├── make.bat
│ ├── source
│ │ ├── _static
│ │ │ ├── blogger.png
│ │ │ ├── blogger_sm.png
│ │ │ ├── bullet.gif
│ │ │ ├── closelabel.png
│ │ │ ├── examples.css
│ │ │ ├── facebox.css
│ │ │ ├── facebox.js
│ │ │ ├── gettingstarted_0.png
│ │ │ ├── images
│ │ │ │ ├── anova.png
│ │ │ │ ├── categorical_interaction_plot.png
│ │ │ │ ├── chi2_fitting.png
│ │ │ │ ├── contrasts.png
│ │ │ │ ├── discrete_overview.png
│ │ │ │ ├── distributed_estimation.png
│ │ │ │ ├── exponential_smoothing.png
│ │ │ │ ├── fairs_data.png
│ │ │ │ ├── formulas_intro.png
│ │ │ │ ├── generic_mle.png
│ │ │ │ ├── glm_formulas.png
│ │ │ │ ├── glm_overview.png
│ │ │ │ ├── glm_weights.png
│ │ │ │ ├── gls.png
│ │ │ │ ├── influence_glm_logit.png
│ │ │ │ ├── kde_overview.png
│ │ │ │ ├── markov_autoregression.png
│ │ │ │ ├── markov_regression.png
│ │ │ │ ├── mixed_lm.png
│ │ │ │ ├── ols.png
│ │ │ │ ├── pca_fertility_factors.png
│ │ │ │ ├── plots_boxplots.png
│ │ │ │ ├── prediction.png
│ │ │ │ ├── quantile_regression.png
│ │ │ │ ├── recursive_ls.png
│ │ │ │ ├── regression_diagnostics.png
│ │ │ │ ├── regression_plots.png
│ │ │ │ ├── rlm.png
│ │ │ │ ├── rlm_overview.png
│ │ │ │ ├── statespace_arma0.png
│ │ │ │ ├── statespace_concentrated_scale.png
│ │ │ │ ├── statespace_cycles.png
│ │ │ │ ├── statespace_dfm_coincident.png
│ │ │ │ ├── statespace_local_linear_trend.png
│ │ │ │ ├── statespace_sarimax_internet.png
│ │ │ │ ├── statespace_sarimax_stata.png
│ │ │ │ ├── statespace_seasonal.png
│ │ │ │ ├── statespace_structural_harvey_jaeger.png
│ │ │ │ ├── statespace_varmax.png
│ │ │ │ ├── tsa_arma0.png
│ │ │ │ ├── tsa_arma1.png
│ │ │ │ ├── tsa_dates.png
│ │ │ │ ├── tsa_filters.png
│ │ │ │ └── wls.png
│ │ │ ├── ipython.min.css
│ │ │ ├── loading.gif
│ │ │ ├── minus.gif
│ │ │ ├── mktree.css
│ │ │ ├── mktree.js
│ │ │ ├── nbviewer.pygments.css
│ │ │ ├── plus.gif
│ │ │ └── scripts.js
│ │ ├── _templates
│ │ │ └── autosummary
│ │ │ │ ├── class.rst
│ │ │ │ └── glmfamilies.rst
│ │ ├── about.rst
│ │ ├── anova.rst
│ │ ├── conf.py
│ │ ├── contingency_tables.rst
│ │ ├── contrasts.rst
│ │ ├── datasets
│ │ │ ├── dataset_proposal.rst
│ │ │ └── index.rst
│ │ ├── dev
│ │ │ ├── dataset_notes.rst
│ │ │ ├── examples.rst
│ │ │ ├── get_involved.rst
│ │ │ ├── git_notes.rst
│ │ │ ├── images
│ │ │ │ └── git_merge.png
│ │ │ ├── index.rst
│ │ │ ├── internal.rst
│ │ │ ├── maintainer_notes.rst
│ │ │ ├── naming_conventions.rst
│ │ │ ├── test_notes.rst
│ │ │ ├── testing.rst
│ │ │ └── vbench.rst
│ │ ├── diagnostic.rst
│ │ ├── discretemod.rst
│ │ ├── distributions.rst
│ │ ├── duration.rst
│ │ ├── emplike.rst
│ │ ├── endog_exog.rst
│ │ ├── example_formulas.rst
│ │ ├── examples
│ │ │ ├── README
│ │ │ ├── index.rst
│ │ │ └── landing.json
│ │ ├── extending.rst.TXT
│ │ ├── faq.rst
│ │ ├── gee.rst
│ │ ├── genericmle.rst.TXT
│ │ ├── gettingstarted.rst
│ │ ├── glm.rst
│ │ ├── glm_techn1.rst.TXT
│ │ ├── glm_techn2.rst.TXT
│ │ ├── gmm.rst
│ │ ├── gmm_techn1.rst.TXT
│ │ ├── graphics.rst
│ │ ├── images
│ │ │ ├── aw.png
│ │ │ ├── hl.png
│ │ │ ├── ht.png
│ │ │ ├── ls.png
│ │ │ ├── re.png
│ │ │ ├── statsmodels_hybi_banner.png
│ │ │ ├── statsmodels_hybi_banner.svg
│ │ │ ├── statsmodels_hybi_favico.ico
│ │ │ ├── tk.png
│ │ │ └── tm.png
│ │ ├── importpaths.rst
│ │ ├── imputation.rst
│ │ ├── index.rst
│ │ ├── install.rst
│ │ ├── iolib.rst
│ │ ├── miscmodels.rst
│ │ ├── missing.rst
│ │ ├── mixed_glm.rst
│ │ ├── mixed_linear.rst
│ │ ├── multivariate.rst
│ │ ├── nonparametric.rst
│ │ ├── pitfalls.rst
│ │ ├── plots
│ │ │ ├── arma_predict_plot.py
│ │ │ ├── bkf_plot.py
│ │ │ ├── cff_plot.py
│ │ │ ├── graphics-mean_diff_plot.py
│ │ │ ├── graphics_boxplot_beanplot.py
│ │ │ ├── graphics_boxplot_violinplot.py
│ │ │ ├── graphics_functional_fboxplot.py
│ │ │ ├── graphics_functional_hdrboxplot.py
│ │ │ ├── graphics_functional_rainbowplot.py
│ │ │ ├── graphics_gofplots_qqplot.py
│ │ │ ├── graphics_month_plot.py
│ │ │ ├── graphics_plot_fit_ex.py
│ │ │ ├── hpf_plot.py
│ │ │ ├── load_macrodata.py
│ │ │ ├── var_plot_acorr.py
│ │ │ ├── var_plot_fevd.py
│ │ │ ├── var_plot_forecast.py
│ │ │ ├── var_plot_input.py
│ │ │ ├── var_plot_irf.py
│ │ │ ├── var_plot_irf_cum.py
│ │ │ └── var_plots.py
│ │ ├── regression.rst
│ │ ├── regression_techn1.rst.TXT
│ │ ├── release
│ │ │ ├── github-stats-0.5.rst
│ │ │ ├── github-stats-0.6.rst
│ │ │ ├── index.rst
│ │ │ ├── old_changes.rst
│ │ │ ├── version0.5.rst
│ │ │ ├── version0.6.rst
│ │ │ ├── version0.7.rst
│ │ │ ├── version0.8.rst
│ │ │ └── version0.9.rst
│ │ ├── rlm.rst
│ │ ├── rlm_techn1.rst
│ │ ├── sandbox.rst
│ │ ├── statespace.rst
│ │ ├── stats.rst
│ │ ├── tools.rst
│ │ ├── tsa.rst
│ │ ├── tsastats.rst.TXT
│ │ └── vector_ar.rst
│ ├── sphinxext
│ │ ├── LICENSE.txt
│ │ ├── MANIFEST.in
│ │ ├── README.txt
│ │ ├── github.py
│ │ ├── ipython_console_highlighting.py
│ │ ├── ipython_directive.py
│ │ └── numpy_ext
│ │ │ ├── __init__.py
│ │ │ ├── docscrape.py
│ │ │ ├── docscrape_sphinx.py
│ │ │ └── plot_directive.py
│ └── themes
│ │ └── statsmodels
│ │ ├── indexsidebar.html
│ │ ├── layout.html
│ │ ├── page.html
│ │ ├── relations.html
│ │ ├── sidelinks.html
│ │ ├── static
│ │ ├── nature.css_t
│ │ └── statsmodels_hybi_banner.png
│ │ └── theme.conf
└── zh
│ ├── GLMNotes.lyx
│ ├── GLMNotes.pdf
│ ├── Makefile
│ ├── README.md
│ ├── fix_longtable.py
│ ├── make.bat
│ ├── source
│ ├── _static
│ │ ├── blogger.png
│ │ ├── blogger_sm.png
│ │ ├── bullet.gif
│ │ ├── closelabel.png
│ │ ├── examples.css
│ │ ├── facebox.css
│ │ ├── facebox.js
│ │ ├── gettingstarted_0.png
│ │ ├── images
│ │ │ ├── anova.png
│ │ │ ├── categorical_interaction_plot.png
│ │ │ ├── chi2_fitting.png
│ │ │ ├── contrasts.png
│ │ │ ├── discrete_overview.png
│ │ │ ├── distributed_estimation.png
│ │ │ ├── exponential_smoothing.png
│ │ │ ├── fairs_data.png
│ │ │ ├── formulas_intro.png
│ │ │ ├── generic_mle.png
│ │ │ ├── glm_formulas.png
│ │ │ ├── glm_overview.png
│ │ │ ├── glm_weights.png
│ │ │ ├── gls.png
│ │ │ ├── influence_glm_logit.png
│ │ │ ├── kde_overview.png
│ │ │ ├── markov_autoregression.png
│ │ │ ├── markov_regression.png
│ │ │ ├── mixed_lm.png
│ │ │ ├── ols.png
│ │ │ ├── pca_fertility_factors.png
│ │ │ ├── plots_boxplots.png
│ │ │ ├── prediction.png
│ │ │ ├── quantile_regression.png
│ │ │ ├── recursive_ls.png
│ │ │ ├── regression_diagnostics.png
│ │ │ ├── regression_plots.png
│ │ │ ├── rlm.png
│ │ │ ├── rlm_overview.png
│ │ │ ├── statespace_arma0.png
│ │ │ ├── statespace_concentrated_scale.png
│ │ │ ├── statespace_cycles.png
│ │ │ ├── statespace_dfm_coincident.png
│ │ │ ├── statespace_local_linear_trend.png
│ │ │ ├── statespace_sarimax_internet.png
│ │ │ ├── statespace_sarimax_stata.png
│ │ │ ├── statespace_seasonal.png
│ │ │ ├── statespace_structural_harvey_jaeger.png
│ │ │ ├── statespace_varmax.png
│ │ │ ├── tsa_arma0.png
│ │ │ ├── tsa_arma1.png
│ │ │ ├── tsa_dates.png
│ │ │ ├── tsa_filters.png
│ │ │ └── wls.png
│ │ ├── ipython.min.css
│ │ ├── loading.gif
│ │ ├── minus.gif
│ │ ├── mktree.css
│ │ ├── mktree.js
│ │ ├── nbviewer.pygments.css
│ │ ├── plus.gif
│ │ └── scripts.js
│ ├── _templates
│ │ └── autosummary
│ │ │ ├── class.rst
│ │ │ └── glmfamilies.rst
│ ├── about.rst
│ ├── anova.rst
│ ├── conf.py
│ ├── contingency_tables.rst
│ ├── contrasts.rst
│ ├── datasets
│ │ ├── dataset_proposal.rst
│ │ └── index.rst
│ ├── dev
│ │ ├── dataset_notes.rst
│ │ ├── examples.rst
│ │ ├── get_involved.rst
│ │ ├── git_notes.rst
│ │ ├── images
│ │ │ └── git_merge.png
│ │ ├── index.rst
│ │ ├── internal.rst
│ │ ├── maintainer_notes.rst
│ │ ├── naming_conventions.rst
│ │ ├── test_notes.rst
│ │ ├── testing.rst
│ │ └── vbench.rst
│ ├── diagnostic.rst
│ ├── discretemod.rst
│ ├── distributions.rst
│ ├── duration.rst
│ ├── emplike.rst
│ ├── endog_exog.rst
│ ├── example_formulas.rst
│ ├── examples
│ │ ├── README
│ │ ├── index.rst
│ │ └── landing.json
│ ├── extending.rst.TXT
│ ├── faq.rst
│ ├── gee.rst
│ ├── genericmle.rst.TXT
│ ├── gettingstarted.rst
│ ├── glm.rst
│ ├── glm_techn1.rst.TXT
│ ├── glm_techn2.rst.TXT
│ ├── gmm.rst
│ ├── gmm_techn1.rst.TXT
│ ├── graphics.rst
│ ├── images
│ │ ├── aw.png
│ │ ├── hl.png
│ │ ├── ht.png
│ │ ├── ls.png
│ │ ├── re.png
│ │ ├── statsmodels_hybi_banner.png
│ │ ├── statsmodels_hybi_banner.svg
│ │ ├── statsmodels_hybi_favico.ico
│ │ ├── tk.png
│ │ └── tm.png
│ ├── importpaths.rst
│ ├── imputation.rst
│ ├── index.rst
│ ├── install.rst
│ ├── iolib.rst
│ ├── miscmodels.rst
│ ├── missing.rst
│ ├── mixed_glm.rst
│ ├── mixed_linear.rst
│ ├── multivariate.rst
│ ├── nonparametric.rst
│ ├── pitfalls.rst
│ ├── plots
│ │ ├── arma_predict_plot.py
│ │ ├── bkf_plot.py
│ │ ├── cff_plot.py
│ │ ├── graphics-mean_diff_plot.py
│ │ ├── graphics_boxplot_beanplot.py
│ │ ├── graphics_boxplot_violinplot.py
│ │ ├── graphics_functional_fboxplot.py
│ │ ├── graphics_functional_hdrboxplot.py
│ │ ├── graphics_functional_rainbowplot.py
│ │ ├── graphics_gofplots_qqplot.py
│ │ ├── graphics_month_plot.py
│ │ ├── graphics_plot_fit_ex.py
│ │ ├── hpf_plot.py
│ │ ├── load_macrodata.py
│ │ ├── var_plot_acorr.py
│ │ ├── var_plot_fevd.py
│ │ ├── var_plot_forecast.py
│ │ ├── var_plot_input.py
│ │ ├── var_plot_irf.py
│ │ ├── var_plot_irf_cum.py
│ │ └── var_plots.py
│ ├── regression.rst
│ ├── regression_techn1.rst.TXT
│ ├── release
│ │ ├── github-stats-0.5.rst
│ │ ├── github-stats-0.6.rst
│ │ ├── index.rst
│ │ ├── old_changes.rst
│ │ ├── version0.5.rst
│ │ ├── version0.6.rst
│ │ ├── version0.7.rst
│ │ ├── version0.8.rst
│ │ └── version0.9.rst
│ ├── rlm.rst
│ ├── rlm_techn1.rst
│ ├── sandbox.rst
│ ├── statespace.rst
│ ├── stats.rst
│ ├── tools.rst
│ ├── tsa.rst
│ ├── tsastats.rst.TXT
│ └── vector_ar.rst
│ ├── sphinxext
│ ├── LICENSE.txt
│ ├── MANIFEST.in
│ ├── README.txt
│ ├── github.py
│ ├── ipython_console_highlighting.py
│ ├── ipython_directive.py
│ └── numpy_ext
│ │ ├── __init__.py
│ │ ├── docscrape.py
│ │ ├── docscrape_sphinx.py
│ │ └── plot_directive.py
│ └── themes
│ └── statsmodels
│ ├── indexsidebar.html
│ ├── layout.html
│ ├── page.html
│ ├── relations.html
│ ├── sidelinks.html
│ ├── static
│ ├── nature.css_t
│ └── statsmodels_hybi_banner.png
│ └── theme.conf
└── examples
├── incomplete
├── arima.py
├── arma2.py
├── dates.py
├── glsar.py
├── ols_table.py
├── ols_tftest.py
└── wls_extended.py
├── notebooks
├── categorical_interaction_plot.ipynb
├── chi2_fitting.ipynb
├── contrasts.ipynb
├── discrete_choice_example.ipynb
├── discrete_choice_overview.ipynb
├── distributed_estimation.ipynb
├── exponential_smoothing.ipynb
├── formulas.ipynb
├── generic_mle.ipynb
├── glm.ipynb
├── glm_formula.ipynb
├── glm_weights.ipynb
├── gls.ipynb
├── influence_glm_logit.ipynb
├── interactions_anova.ipynb
├── kernel_density.ipynb
├── markov_autoregression.ipynb
├── markov_regression.ipynb
├── mixed_lm_example.ipynb
├── ols.ipynb
├── pca_fertility_factors.ipynb
├── plots_boxplots.ipynb
├── predict.ipynb
├── quantile_regression.ipynb
├── recursive_ls.ipynb
├── regression_diagnostics.ipynb
├── regression_plots.ipynb
├── robust_models_0.ipynb
├── robust_models_1.ipynb
├── star_diagram.png
├── statespace_arma_0.ipynb
├── statespace_concentrated_scale.ipynb
├── statespace_cycles.ipynb
├── statespace_dfm_coincident.ipynb
├── statespace_local_linear_trend.ipynb
├── statespace_sarimax_internet.ipynb
├── statespace_sarimax_stata.ipynb
├── statespace_seasonal.ipynb
├── statespace_structural_harvey_jaeger.ipynb
├── statespace_varmax.ipynb
├── tsa_arma_0.ipynb
├── tsa_arma_1.ipynb
├── tsa_dates.ipynb
├── tsa_filters.ipynb
└── wls.ipynb
├── python
├── categorical_interaction_plot.py
├── contrasts.py
├── discrete_choice_example.py
├── discrete_choice_overview.py
├── formulas.py
├── generic_mle.py
├── glm.py
├── glm_formula.py
├── gls.py
├── interactions_anova.py
├── kernel_density.py
├── ols.py
├── predict.py
├── quantile_regression.py
├── regression_diagnostics.py
├── regression_plots.py
├── robust_models_0.py
├── robust_models_1.py
├── tsa_arma_0.py
├── tsa_arma_1.py
├── tsa_dates.py
├── tsa_filters.py
└── wls.py
└── run_all.py
/CHANGES.md:
--------------------------------------------------------------------------------
1 | Release Notes
2 | =============
3 |
4 | The list of changes for each statsmodels release can be found [here](https://www.statsmodels.org/devel/release/index.html). Full details are available in the [commit logs](https://github.com/statsmodels/statsmodels).
5 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (C) 2006, Jonathan E. Taylor
2 | All rights reserved.
3 |
4 | Copyright (c) 2006-2008 Scipy Developers.
5 | All rights reserved.
6 |
7 | Copyright (c) 2009-2018 Statsmodels Developers.
8 | All rights reserved.
9 |
10 |
11 | Redistribution and use in source and binary forms, with or without
12 | modification, are permitted provided that the following conditions are met:
13 |
14 | a. Redistributions of source code must retain the above copyright notice,
15 | this list of conditions and the following disclaimer.
16 | b. Redistributions in binary form must reproduce the above copyright
17 | notice, this list of conditions and the following disclaimer in the
18 | documentation and/or other materials provided with the distribution.
19 | c. Neither the name of Statsmodels nor the names of its contributors
20 | may be used to endorse or promote products derived from this software
21 | without specific prior written permission.
22 |
23 |
24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 | ARE DISCLAIMED. IN NO EVENT SHALL STATSMODELS OR CONTRIBUTORS BE LIABLE FOR
28 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
34 | DAMAGE.
35 |
--------------------------------------------------------------------------------
/README_l1.txt:
--------------------------------------------------------------------------------
1 | What the l1 addition is
2 | =======================
3 | A slight modification that allows l1 regularized LikelihoodModel.
4 |
5 | Regularization is handled by a fit_regularized method.
6 |
7 | Main Files
8 | ==========
9 |
10 | l1_demo/demo.py
11 | $ python demo.py --get_l1_slsqp_results logit
12 | does a quick demo of the regularization using logistic regression.
13 |
14 | l1_demo/sklearn_compare.py
15 | $ python sklearn_compare.py
16 | Plots a comparison of regularization paths. Modify the source to use
17 | different datasets.
18 |
19 | statsmodels/base/l1_cvxopt.py
20 | fit_l1_cvxopt_cp()
21 | Fit likelihood model using l1 regularization. Use the CVXOPT package.
22 | Lots of small functions supporting fit_l1_cvxopt_cp
23 |
24 | statsmodels/base/l1_slsqp.py
25 | fit_l1_slsqp()
26 | Fit likelihood model using l1 regularization. Use scipy.optimize
27 | Lots of small functions supporting fit_l1_slsqp
28 |
29 | statsmodels/base/l1_solvers_common.py
30 | Common methods used by l1 solvers
31 |
32 | statsmodels/base/model.py
33 | Likelihoodmodel.fit()
34 | 3 lines modified to allow for importing and calling of l1 fitting functions
35 |
36 | statsmodels/discrete/discrete_model.py
37 | L1MultinomialResults class
38 | Child of MultinomialResults
39 | MultinomialModel.fit()
40 | 3 lines re-directing l1 fit results to the L1MultinomialResults class
41 |
--------------------------------------------------------------------------------
/docs/en/GLMNotes.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/GLMNotes.pdf
--------------------------------------------------------------------------------
/docs/en/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SPHINXPROJ = statsmodels
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | PAPER =
12 | TOOLSPATH = ../tools/
13 | DATASETBUILD = dataset_rst.py
14 | EXAMPLEBUILD = examples_rst.py
15 | NOTEBOOKBUILD = nbgenerate.py
16 | FOLDTOC = fold_toc.py
17 |
18 | # Internal variables.
19 | PAPEROPT_a4 = -D latex_paper_size=a4
20 | PAPEROPT_letter = -D latex_paper_size=letter
21 | ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
22 |
23 |
24 | # Put it first so that "make" without argument is like "make help".
25 | help:
26 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
27 |
28 | .PHONY: help Makefile
29 |
30 | cleanall:
31 | @$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
32 | -rm source/examples/generated/*
33 | -rm -rf source/examples/notebooks/generated/*
34 | -rm -rf ../tools/hash_dict.pickle
35 | -rm -rf source/datasets/generated/*
36 |
37 | notebooks:
38 | @echo "Generating notebooks from examples/notebooks folder"
39 | $(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
40 |
41 | html:
42 | # make directories for images
43 | @echo "Make static directory for images"
44 | mkdir -p $(BUILDDIR)/html/_static
45 | # generate the examples rst files
46 | @echo "Generating reST from examples folder"
47 | #$(TOOLSPATH)$(EXAMPLEBUILD)
48 | @echo "Generating datasets from installed statsmodels.datasets"
49 | $(TOOLSPATH)$(DATASETBUILD)
50 | @echo "Generating notebooks from examples/notebooks folder"
51 | $(TOOLSPATH)$(NOTEBOOKBUILD) --parallel --report-errors --skip-existing
52 | @echo "Running sphinx-build"
53 | @echo @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
54 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
55 | @echo "Copying rendered example notebooks"
56 | mkdir -p $(BUILDDIR)/html/examples/notebooks/generated
57 | cp source/examples/notebooks/generated/*html $(BUILDDIR)/html/examples/notebooks/generated
58 | @echo $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/index.html
59 | $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/index.html
60 | @echo $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/dev/index.html ../_static
61 | $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/dev/index.html ../_static
62 |
63 | # Catch-all target: route all unknown targets to Sphinx using the new
64 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
65 | %: Makefile
66 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
67 |
--------------------------------------------------------------------------------
/docs/en/README.md:
--------------------------------------------------------------------------------
1 | # Documentation Documentation
2 |
3 | We use a combination of sphinx and Jupyter notebooks for the documentation.
4 | Jupyter notebooks should be used for longer, self-contained examples demonstrating
5 | a topic.
6 | Sphinx is nice because we get the tables of contents and API documentation.
7 |
8 | ## Build Process
9 |
10 | Building the docs requires a few additional dependencies. You can get most
11 | of these with
12 |
13 | ```bash
14 |
15 | pip install -e .[docs]
16 |
17 | ```
18 |
19 | From the root of the project.
20 | Some of the examples rely on `rpy2` to execute R code from the notebooks.
21 | It's not included in the setup requires since it's known to be difficult to
22 | install.
23 |
24 | To generate the HTML docs, run ``make html`` from the ``docs`` directory.
25 | This executes a few distinct builds
26 |
27 | 1. datasets
28 | 2. notebooks
29 | 3. sphinx
30 |
31 | # Notebook Builds
32 |
33 | We're using `nbconvert` to execute the notebooks, and then convert them
34 | to HTML. The conversion is handled by `statsmodels/tools/nbgenerate.py`.
35 | The default python kernel (embedded in the notebook) is `python3`.
36 | You need at least `nbconvert==4.2.0` to specify a non-default kernel,
37 | which can be passed in the Makefile.
38 |
--------------------------------------------------------------------------------
/docs/en/fix_longtable.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import sys
3 | import os
4 |
5 |
6 | BUILDDIR = sys.argv[-1]
7 | read_file_path = os.path.join(BUILDDIR,'latex','statsmodels.tex')
8 | write_file_path = os.path.join(BUILDDIR, 'latex','statsmodels_tmp.tex')
9 |
10 | read_file = open(read_file_path,'r')
11 | write_file = open(write_file_path, 'w')
12 |
13 | for line in read_file:
14 | if 'longtable}{LL' in line:
15 | line = line.replace('longtable}{LL', 'longtable}{|l|l|')
16 | write_file.write(line)
17 |
18 | read_file.close()
19 | write_file.close()
20 |
21 | os.remove(read_file_path)
22 | os.rename(write_file_path, read_file_path)
23 |
--------------------------------------------------------------------------------
/docs/en/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 |
11 | set SOURCEDIR=source
12 | set BUILDDIR=build
13 | set SPHINXPROJ=statsmodels
14 | set SPHINXOPTS=-j auto
15 |
16 | set TOOLSPATH=../tools
17 | set DATASETBUILD=dataset_rst.py
18 | set NOTEBOOKBUILD=nbgenerate.py
19 | set FOLDTOC=fold_toc.py
20 |
21 | if "%1" == "" goto help
22 |
23 | %SPHINXBUILD% >NUL 2>NUL
24 | if errorlevel 9009 (
25 | echo.
26 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
27 | echo.installed, then set the SPHINXBUILD environment variable to point
28 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
29 | echo.may add the Sphinx directory to PATH.
30 | echo.
31 | echo.If you don't have Sphinx installed, grab it from
32 | echo.http://sphinx-doc.org/
33 | exit /b 1
34 | )
35 |
36 | if "%1" == "html" (
37 | echo mkdir %BUILDDIR%\html\_static
38 | mkdir %BUILDDIR%\html\_static
39 | echo python %TOOLSPATH%/%NOTEBOOKBUILD% --parallel --report-errors --skip-existing
40 | python %TOOLSPATH%/%NOTEBOOKBUILD% --parallel --report-errors --skip-existing
41 | echo python %TOOLSPATH%/%DATASETBUILD%
42 | python %TOOLSPATH%/%DATASETBUILD%
43 | )
44 |
45 | echo %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
46 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
47 | if errorlevel 1 exit /b 1
48 |
49 | if "%1" == "html" (
50 | echo xcopy /s source/examples/notebooks/generated/*.html %BUILDDIR%/html/examples/notebooks/generated
51 | xcopy /s source/examples/notebooks/generated/*.html %BUILDDIR%/html/examples/notebooks/generated
52 | echo python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/index.html
53 | python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/index.html
54 | echo python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/examples/index.html ../_static
55 | python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/examples/index.html ../_static
56 | echo python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/dev/index.html ../_static
57 | python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/dev/index.html ../_static
58 | if NOT EXIST %BUILDDIR%/html/examples/notebooks/generated mkdir %BUILDDIR%\html\examples\notebooks\generated
59 | )
60 |
61 | goto end
62 |
63 | :help
64 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
65 |
66 | :end
67 | popd
68 |
--------------------------------------------------------------------------------
/docs/en/source/_static/blogger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/blogger.png
--------------------------------------------------------------------------------
/docs/en/source/_static/blogger_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/blogger_sm.png
--------------------------------------------------------------------------------
/docs/en/source/_static/bullet.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/bullet.gif
--------------------------------------------------------------------------------
/docs/en/source/_static/closelabel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/closelabel.png
--------------------------------------------------------------------------------
/docs/en/source/_static/examples.css:
--------------------------------------------------------------------------------
1 | .examples-page {
2 | /*override div.body padding of 30px */
3 | margin-left: -30px;
4 | margin-right: -30px;
5 | }
6 |
7 | .examples-page .padleft {
8 | padding-left: 30px;
9 | }
10 |
11 | .examples-page h1, .examples-page h2, .examples-page h3 {
12 | padding-left: 30px; /* to make up for margin above */
13 | }
14 |
15 | .examples-page .toclist {
16 | list-style:none;
17 | margin-bottom:0px;
18 | margin-top:0px;
19 | }
20 |
21 | /* Marketing section of Overview
22 | -------------------------------------------------- */
23 | .marketing p {
24 | margin-right: 10px;
25 | }
26 |
27 | /* Eaxmples page
28 | ------------------------- */
29 | .thumbnail {
30 | margin-bottom: 9px;
31 | background-color: #fff;
32 | }
33 |
34 | /* Example sites showcase */
35 | .example-sites img {
36 | max-width: 100%;
37 | margin: 0 auto;
38 | }
39 |
40 | .marketing-byline {
41 | font-size: 18px;
42 | font-weight: 300;
43 | line-height: 24px;
44 | color: #999;
45 | text-align: center;
46 | }
47 |
48 | /* From bootstrap.css */
49 | .thumbnails {
50 | margin-left: -20px;
51 | list-style: none;
52 | *zoom: 1;
53 | }
54 |
55 | .thumbnails:before,
56 | .thumbnails:after {
57 | display: table;
58 | line-height: 0;
59 | content: "";
60 | }
61 |
62 | .thumbnails:after {
63 | clear: both;
64 | }
65 |
66 | .row-fluid .thumbnails {
67 | margin-left: 0;
68 | }
69 |
70 | .thumbnails > li {
71 | float: left;
72 | margin-bottom: 20px;
73 | margin-left: 20px;
74 | }
75 |
76 | .thumbnail {
77 | display: block;
78 | padding: 4px;
79 | line-height: 20px;
80 | border: 1px solid #ddd;
81 | -webkit-border-radius: 4px;
82 | -moz-border-radius: 4px;
83 | border-radius: 4px;
84 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
85 | -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
86 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
87 | -webkit-transition: all 0.2s ease-in-out;
88 | -moz-transition: all 0.2s ease-in-out;
89 | -o-transition: all 0.2s ease-in-out;
90 | transition: all 0.2s ease-in-out;
91 | }
92 |
93 | a.thumbnail:hover,
94 | a.thumbnail:focus {
95 | border-color: #0088cc;
96 | -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
97 | -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
98 | box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
99 | }
100 |
101 | .thumbnail > img {
102 | display: block;
103 | width: 360px;
104 | max-width: 100%;
105 | height: auto;
106 | margin-right: auto;
107 | margin-left: auto;
108 | }
109 |
110 | .thumbnail .caption {
111 | padding: 9px;
112 | color: #555555;
113 | }
114 |
--------------------------------------------------------------------------------
/docs/en/source/_static/facebox.css:
--------------------------------------------------------------------------------
1 | #facebox {
2 | position: absolute;
3 | top: 0;
4 | left: 0;
5 | z-index: 100;
6 | text-align: left;
7 | }
8 |
9 |
10 | #facebox .popup{
11 | position:relative;
12 | border:3px solid rgba(0,0,0,0);
13 | -webkit-border-radius:5px;
14 | -moz-border-radius:5px;
15 | border-radius:5px;
16 | -webkit-box-shadow:0 0 18px rgba(0,0,0,0.4);
17 | -moz-box-shadow:0 0 18px rgba(0,0,0,0.4);
18 | box-shadow:0 0 18px rgba(0,0,0,0.4);
19 | }
20 |
21 | #facebox .content {
22 | display:table;
23 | width: 370px;
24 | padding: 10px;
25 | background: #fff;
26 | -webkit-border-radius:4px;
27 | -moz-border-radius:4px;
28 | border-radius:4px;
29 | }
30 |
31 | #facebox .content > p:first-child{
32 | margin-top:0;
33 | }
34 | #facebox .content > p:last-child{
35 | margin-bottom:0;
36 | }
37 |
38 | #facebox .close{
39 | position:absolute;
40 | top:5px;
41 | right:5px;
42 | padding:2px;
43 | background:#fff;
44 | }
45 | #facebox .close img{
46 | opacity:0.3;
47 | }
48 | #facebox .close:hover img{
49 | opacity:1.0;
50 | }
51 |
52 | #facebox .loading {
53 | text-align: center;
54 | }
55 |
56 | #facebox .image {
57 | text-align: center;
58 | }
59 |
60 | #facebox img {
61 | border: 0;
62 | margin: 0;
63 | }
64 |
65 | #facebox_overlay {
66 | position: fixed;
67 | top: 0px;
68 | left: 0px;
69 | height:100%;
70 | width:100%;
71 | }
72 |
73 | .facebox_hide {
74 | z-index:-100;
75 | }
76 |
77 | .facebox_overlayBG {
78 | background-color: #000;
79 | z-index: 99;
80 | }
--------------------------------------------------------------------------------
/docs/en/source/_static/gettingstarted_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/gettingstarted_0.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/anova.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/anova.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/categorical_interaction_plot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/categorical_interaction_plot.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/chi2_fitting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/chi2_fitting.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/contrasts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/contrasts.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/discrete_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/discrete_overview.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/distributed_estimation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/distributed_estimation.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/exponential_smoothing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/exponential_smoothing.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/fairs_data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/fairs_data.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/formulas_intro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/formulas_intro.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/generic_mle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/generic_mle.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/glm_formulas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/glm_formulas.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/glm_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/glm_overview.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/glm_weights.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/glm_weights.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/gls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/gls.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/influence_glm_logit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/influence_glm_logit.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/kde_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/kde_overview.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/markov_autoregression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/markov_autoregression.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/markov_regression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/markov_regression.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/mixed_lm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/mixed_lm.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/ols.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/ols.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/pca_fertility_factors.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/pca_fertility_factors.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/plots_boxplots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/plots_boxplots.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/prediction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/prediction.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/quantile_regression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/quantile_regression.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/recursive_ls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/recursive_ls.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/regression_diagnostics.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/regression_diagnostics.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/regression_plots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/regression_plots.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/rlm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/rlm.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/rlm_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/rlm_overview.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_arma0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_arma0.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_concentrated_scale.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_concentrated_scale.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_cycles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_cycles.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_dfm_coincident.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_dfm_coincident.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_local_linear_trend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_local_linear_trend.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_sarimax_internet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_sarimax_internet.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_sarimax_stata.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_sarimax_stata.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_seasonal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_seasonal.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_structural_harvey_jaeger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_structural_harvey_jaeger.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/statespace_varmax.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/statespace_varmax.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/tsa_arma0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/tsa_arma0.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/tsa_arma1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/tsa_arma1.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/tsa_dates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/tsa_dates.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/tsa_filters.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/tsa_filters.png
--------------------------------------------------------------------------------
/docs/en/source/_static/images/wls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/images/wls.png
--------------------------------------------------------------------------------
/docs/en/source/_static/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/loading.gif
--------------------------------------------------------------------------------
/docs/en/source/_static/minus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/minus.gif
--------------------------------------------------------------------------------
/docs/en/source/_static/mktree.css:
--------------------------------------------------------------------------------
1 | /* Put this inside a @media qualifier so Netscape 4 ignores it */
2 | @media screen, print {
3 | /* Turn off list bullets */
4 | ul.mktree li { list-style: none; }
5 | /* Control how "spaced out" the tree is */
6 | ul.mktree, ul.mktree ul , ul.mktree li { margin-left:10px; padding:0px; }
7 | /* Provide space for our own "bullet" inside the LI */
8 | ul.mktree li .bullet { padding-left: 15px; }
9 | /* Show "bullets" in the links, depending on the class of the LI that the link's in */
10 | ul.mktree li.liOpen .bullet { cursor: pointer; background: url(minus.gif) center left no-repeat; }
11 | ul.mktree li.liClosed .bullet { cursor: pointer; background: url(plus.gif) center left no-repeat; }
12 | ul.mktree li.liBullet .bullet { cursor: default; background: url(bullet.gif) center left no-repeat; }
13 | /* Sublists are visible or not based on class of parent LI */
14 | ul.mktree li.liOpen ul { display: block; }
15 | ul.mktree li.liClosed ul { display: none; }
16 |
17 | /* Format menu items differently depending on what level of the tree they are in */
18 | /* Uncomment this if you want your fonts to decrease in size the deeper they are in the tree */
19 | /*
20 | ul.mktree li ul li { font-size: 90% }
21 | */
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/docs/en/source/_static/plus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/_static/plus.gif
--------------------------------------------------------------------------------
/docs/en/source/_static/scripts.js:
--------------------------------------------------------------------------------
1 | function cleanUpText(codebox){
2 | /// Not currently used
3 | /// Strips a whole IPython session of input and output prompts
4 | //escape quotation marks
5 | codebox = codebox.replace(/"/g, "\'");
6 |
7 | // newlines
8 | codebox = codebox.replace(/[\r\n|\r|\n]$/g, ""); // remove at end
9 | codebox = codebox.replace(/[\r\n|\r|\n]+/g, "\\n");
10 | // prompts
11 | codebox = codebox.replace(/In \[\d+\]: /g, "");
12 | codebox = codebox.replace(/Out \[\d+\]: /g, "");
13 |
14 | return codebox;
15 | }
16 |
17 | function htmlescape(text){
18 | return (text.replace(/&/g, "&")
19 | .replace(//g, ">")
21 | .replace(/"/g, """)
22 | .replace(/'/g, "'"))
23 | }
24 |
25 | function scrapeText(codebox){
26 | /// Returns input lines cleaned of prompt1 and prompt2
27 | var lines = codebox.split('\n');
28 | var newlines = new Array();
29 | $.each(lines, function() {
30 | if (this.match(/^In \[\d+]: /)){
31 | newlines.push(this.replace(/^(\s)*In \[\d+]: /,""));
32 | }
33 | else if (this.match(/^(\s)*\.+:/)){
34 | newlines.push(this.replace(/^(\s)*\.+: /,""));
35 | }
36 |
37 | }
38 | );
39 | return newlines.join('\\n');
40 | }
41 |
42 | $(document).ready(
43 | function() {
44 | // grab all code boxes
45 | var ipythoncode = $(".highlight-ipython");
46 | $.each(ipythoncode, function() {
47 | var codebox = scrapeText($(this).text());
48 | // give them a facebox pop-up with plain text code
49 | $(this).append('View Code');
50 | $(this,"textarea").select();
51 | });
52 | });
53 |
--------------------------------------------------------------------------------
/docs/en/source/_templates/autosummary/class.rst:
--------------------------------------------------------------------------------
1 | {{ fullname }}
2 | {{ underline }}
3 |
4 | .. currentmodule:: {{ module }}
5 |
6 | .. autoclass:: {{ objname }}
7 |
8 | {% block methods %}
9 |
10 | {% if methods %}
11 | .. rubric:: Methods
12 |
13 | .. autosummary::
14 | :toctree:
15 | {% for item in methods %}
16 | {% if item != '__init__' %}
17 | ~{{ name }}.{{ item }}
18 | {% endif %}
19 | {%- endfor %}
20 | {% endif %}
21 | {% endblock %}
22 |
23 | {% block attributes %}
24 | {% if attributes %}
25 | .. rubric:: Attributes
26 |
27 | .. autosummary::
28 | {% for item in attributes %}
29 | ~{{ name }}.{{ item }}
30 | {%- endfor %}
31 | {% endif %}
32 | {% endblock %}
33 |
--------------------------------------------------------------------------------
/docs/en/source/_templates/autosummary/glmfamilies.rst:
--------------------------------------------------------------------------------
1 | {{ fullname }}
2 | {{ underline }}
3 |
4 | .. currentmodule:: {{ module }}
5 |
6 | .. autoclass:: {{ objname }}
7 |
8 | {% block methods %}
9 |
10 | {% if methods %}
11 | .. rubric:: Methods
12 |
13 | .. autosummary::
14 | :toctree:
15 | {% for item in methods %}
16 | {% if item != '__init__' %}
17 | ~{{ name }}.{{ item }}
18 | {% endif %}
19 | {%- endfor %}
20 | {% endif %}
21 | {% endblock %}
22 |
--------------------------------------------------------------------------------
/docs/en/source/anova.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.stats.anova
2 |
3 | .. _anova:
4 |
5 | ANOVA
6 | =====
7 |
8 | Analysis of Variance models containing anova_lm for ANOVA analysis with a
9 | linear OLSModel, and AnovaRM for repeated measures ANOVA, within ANOVA for
10 | balanced data.
11 |
12 | Examples
13 | --------
14 |
15 | .. ipython:: python
16 |
17 | import statsmodels.api as sm
18 | from statsmodels.formula.api import ols
19 |
20 | moore = sm.datasets.get_rdataset("Moore", "carData",
21 | cache=True) # load data
22 | data = moore.data
23 | data = data.rename(columns={"partner.status":
24 | "partner_status"}) # make name pythonic
25 | moore_lm = ols('conformity ~ C(fcategory, Sum)*C(partner_status, Sum)',
26 | data=data).fit()
27 |
28 | table = sm.stats.anova_lm(moore_lm, typ=2) # Type 2 ANOVA DataFrame
29 | print(table)
30 |
31 | A more detailed example for `anova_lm` can be found here:
32 |
33 | * `ANOVA `__
34 |
35 | Module Reference
36 | ----------------
37 |
38 | .. module:: statsmodels.stats.anova
39 | :synopsis: Analysis of Variance
40 |
41 | .. autosummary::
42 | :toctree: generated/
43 |
44 | anova_lm
45 | AnovaRM
46 |
--------------------------------------------------------------------------------
/docs/en/source/dev/examples.rst:
--------------------------------------------------------------------------------
1 | .. _examples:
2 |
3 | Examples
4 | ========
5 |
6 | Examples are invaluable for new users who hope to get up and running quickly
7 | with `statsmodels`, and they are extremely useful to those who wish to explore
8 | new features of `statsmodels`. We hope to provide documentation and tutorials
9 | for as many models and use-cases as possible! Please consider submitting an example with any PR that introduces new functionality.
10 |
11 | User-contributed examples/tutorials/recipes can be placed on the
12 | `statsmodels examples wiki page `_
13 | That wiki page is freely editable. Please post your cool tricks,
14 | examples, and recipes on there!
15 |
16 | If you would rather have your example file officially accepted to the
17 | `statsmodels` distribution and posted on this website, you will need to go
18 | through the normal `patch submission process `_ and follow the instructions that follow.
19 |
20 | File Format
21 | ~~~~~~~~~~~
22 |
23 | Examples are best contributed as IPython notebooks. Save your notebook with all output cells cleared in ``examples/notebooks``. From the notebook save the pure Python output to ``examples/python``. The first line of the Notebook *must* be a header cell that contains a title for the notebook, if you want the notebook to be included in the documentation.
24 |
25 |
26 | The Example Gallery
27 | ~~~~~~~~~~~~~~~~~~~
28 |
29 | We have a gallery of example notebooks available `here `_. If you would like your example to show up in this gallery, add a link to the notebook in ``docs/source/examples/landing.json``. For the thumbnail, take a screenshot of what you think is the best "hook" for the notebook. The image will be displayed at 360 x 225 (W x H). It's best to save the image as a PNG with a resolution that is some multiple of 360 x 225 (720 x 450 is preferred).
30 |
31 |
32 | Before submitting a PR
33 | ~~~~~~~~~~~~~~~~~~~~~~
34 |
35 | To save you some time and to make the new examples nicely fit into the existing
36 | ones consider the following points.
37 |
38 | **Look at examples source code** to get a feel for how statsmodels examples should look like.
39 |
40 | **Build the docs** by running `make html` from the docs directory to see how your example looks in the fully rendered html pages.
41 |
--------------------------------------------------------------------------------
/docs/en/source/dev/get_involved.rst:
--------------------------------------------------------------------------------
1 | Get Involved
2 | ============
3 |
4 | Where to Start?
5 | ---------------
6 |
7 | Use grep or download a tool like `grin `__ to search the code for TODO notes::
8 |
9 | grin -i -I "*.py*" todo
10 |
11 | This shows almost 700 TODOs in the code base right now. Feel free to inquire on the mailing list about any of these.
12 |
13 | Sandbox
14 | -------
15 |
16 | We currently have a large amount code in the :ref:`sandbox`. The medium term goal is to move much of this to feature branches as it gets worked on and remove the sandbox folder. Many of these models and functions are close to done, however, and we welcome any and all contributions to complete them, including refactoring, documentation, and tests. These models include generalized additive models (GAM), information theoretic models such as maximum entropy, survival models, systems of equation models, restricted least squares, panel data models, and time series models such as (G)ARCH.
17 |
18 | .. .. toctree::
19 | .. :maxdepth: 4
20 | ..
21 | .. ../sandbox
22 |
23 | Contribute an Example
24 | ---------------------
25 |
26 | Contribute an :ref:`example `, add some technical documentation, or contribute a statistics tutorial.
27 |
--------------------------------------------------------------------------------
/docs/en/source/dev/images/git_merge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/dev/images/git_merge.png
--------------------------------------------------------------------------------
/docs/en/source/dev/internal.rst:
--------------------------------------------------------------------------------
1 | .. _model:
2 |
3 |
4 |
5 | Internal Classes
6 | ================
7 |
8 | The following summarizes classes and functions that are not intended to be
9 | directly used, but of interest only for internal use or for a developer who
10 | wants to extend on existing model classes.
11 |
12 |
13 | Module Reference
14 | ----------------
15 |
16 | Model and Results Classes
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^
18 |
19 | These are the base classes for both the estimation models and the results.
20 | They are not directly useful, but layout the structure of the subclasses and
21 | define some common methods.
22 |
23 | .. module:: statsmodels.base.model
24 | :synopsis: Base classes that are inherited by models
25 |
26 | .. currentmodule:: statsmodels.base.model
27 |
28 | .. autosummary::
29 | :toctree: generated/
30 |
31 | Model
32 | LikelihoodModel
33 | GenericLikelihoodModel
34 | Results
35 | LikelihoodModelResults
36 | ResultMixin
37 | GenericLikelihoodModelResults
38 |
39 | .. module:: statsmodels.stats.contrast
40 | :synopsis: Classes for statistical test
41 |
42 | .. currentmodule:: statsmodels.stats.contrast
43 |
44 | .. autosummary::
45 | :toctree: generated/
46 |
47 | ContrastResults
48 |
49 | .. inheritance-diagram:: statsmodels.base.model statsmodels.discrete.discrete_model statsmodels.regression.linear_model statsmodels.miscmodels.count
50 | :parts: 3
51 |
52 |
53 | .. inheritance-diagram:: statsmodels.regression.linear_model.GLS statsmodels.regression.linear_model.WLS statsmodels.regression.linear_model.OLS statsmodels.regression.linear_model.GLSAR
54 | :parts: 1
55 |
56 | Linear Model
57 | ^^^^^^^^^^^^
58 |
59 | .. inheritance-diagram:: statsmodels.regression.linear_model
60 | :parts: 1
61 |
62 | Generalized Linear Model
63 | ^^^^^^^^^^^^^^^^^^^^^^^^
64 |
65 | .. inheritance-diagram:: statsmodels.genmod.generalized_linear_model
66 | statsmodels.genmod.families.family statsmodels.genmod.families.links
67 | :parts: 1
68 |
69 | Discrete Model
70 | ^^^^^^^^^^^^^^
71 |
72 | .. inheritance-diagram:: statsmodels.discrete.discrete_model
73 | :parts: 1
74 |
75 | Robust Model
76 | ^^^^^^^^^^^^
77 |
78 | .. inheritance-diagram:: statsmodels.robust.robust_linear_model
79 | :parts: 1
80 |
81 | Vector Autoregressive Model
82 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
83 |
84 | .. inheritance-diagram:: statsmodels.tsa.vector_ar.var_model
85 | :parts: 3
86 |
--------------------------------------------------------------------------------
/docs/en/source/dev/testing.rst:
--------------------------------------------------------------------------------
1 | Testing on Build Machines
2 | -------------------------
3 |
4 | There are currently several places that statsmodels is automatically built and tested against different dependency and Python versions and architectures. Check these logs periodically, make sure everything looks okay, and fix any failures.:
5 |
6 | * `Travis CI `_
7 | * `Daily testing on Ubuntu via Python(x,y) `_
8 | * `NiPy testing on SPARC Boxes `_
9 |
10 | The test coverage pages are here.
11 |
12 | * `Coveralls `_
13 |
--------------------------------------------------------------------------------
/docs/en/source/distributions.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.sandbox.distributions
2 | :synopsis: Probability distributions
3 |
4 | .. currentmodule:: statsmodels.sandbox.distributions
5 |
6 | .. _distributions:
7 |
8 |
9 | Distributions
10 | =============
11 |
12 | This section collects various additional functions and methods for statistical
13 | distributions.
14 |
15 | Empirical Distributions
16 | -----------------------
17 |
18 | .. module:: statsmodels.distributions.empirical_distribution
19 | :synopsis: Tools for working with empirical distributions
20 |
21 | .. currentmodule:: statsmodels.distributions.empirical_distribution
22 |
23 | .. autosummary::
24 | :toctree: generated/
25 |
26 | ECDF
27 | StepFunction
28 | monotone_fn_inverter
29 |
30 | Distribution Extras
31 | -------------------
32 |
33 |
34 | .. module:: statsmodels.sandbox.distributions.extras
35 | :synopsis: Probability distributions and random number generators
36 |
37 | .. currentmodule:: statsmodels.sandbox.distributions.extras
38 |
39 | *Skew Distributions*
40 |
41 | .. autosummary::
42 | :toctree: generated/
43 |
44 | SkewNorm_gen
45 | SkewNorm2_gen
46 | ACSkewT_gen
47 | skewnorm2
48 |
49 | *Distributions based on Gram-Charlier expansion*
50 |
51 | .. autosummary::
52 | :toctree: generated/
53 |
54 | pdf_moments_st
55 | pdf_mvsk
56 | pdf_moments
57 | NormExpan_gen
58 |
59 | *cdf of multivariate normal* wrapper for scipy.stats
60 |
61 |
62 | .. autosummary::
63 | :toctree: generated/
64 |
65 | mvstdnormcdf
66 | mvnormcdf
67 |
68 | Univariate Distributions by non-linear Transformations
69 | ------------------------------------------------------
70 |
71 | Univariate distributions can be generated from a non-linear transformation of an
72 | existing univariate distribution. `Transf_gen` is a class that can generate a new
73 | distribution from a monotonic transformation, `TransfTwo_gen` can use hump-shaped
74 | or u-shaped transformation, such as abs or square. The remaining objects are
75 | special cases.
76 |
77 | .. module:: statsmodels.sandbox.distributions.transformed
78 | :synopsis: Experimental probability distributions and random number generators
79 |
80 | .. currentmodule:: statsmodels.sandbox.distributions.transformed
81 |
82 | .. autosummary::
83 | :toctree: generated/
84 |
85 | TransfTwo_gen
86 | Transf_gen
87 |
88 | ExpTransf_gen
89 | LogTransf_gen
90 | SquareFunc
91 |
92 | absnormalg
93 | invdnormalg
94 |
95 | loggammaexpg
96 | lognormalg
97 | negsquarenormalg
98 |
99 | squarenormalg
100 | squaretg
101 |
--------------------------------------------------------------------------------
/docs/en/source/emplike.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.emplike
2 |
3 |
4 | .. _emplike:
5 |
6 |
7 | Empirical Likelihood :mod:`emplike`
8 | ====================================
9 |
10 |
11 | Introduction
12 | ------------
13 |
14 | Empirical likelihood is a method of nonparametric inference and estimation that lifts the
15 | obligation of having to specify a family of underlying distributions. Moreover, empirical
16 | likelihood methods do not require re-sampling but still
17 | uniquely determine confidence regions whose shape mirrors the shape of the data.
18 | In essence, empirical likelihood attempts to combine the benefits of parametric
19 | and nonparametric methods while limiting their shortcomings. The main difficulties of
20 | empirical likelihood is the computationally intensive methods required to conduct inference.
21 | :mod:`statsmodels.emplike` attempts to provide a user-friendly interface that allows the
22 | end user to effectively conduct empirical likelihood analysis without having to concern
23 | themselves with the computational burdens.
24 |
25 | Currently, :mod:`emplike` provides methods to conduct hypothesis tests and form confidence
26 | intervals for descriptive statistics. Empirical likelihood estimation and inference
27 | in a regression, accelerated failure time and instrumental variable model are
28 | currently under development.
29 |
30 | References
31 | ^^^^^^^^^^
32 |
33 | The main reference for empirical likelihood is::
34 |
35 | Owen, A.B. "Empirical Likelihood." Chapman and Hall, 2001.
36 |
37 |
38 |
39 | Examples
40 | --------
41 |
42 | .. ipython:: python
43 |
44 | import numpy as np
45 | import statsmodels.api as sm
46 |
47 | # Generate Data
48 | x = np.random.standard_normal(50)
49 |
50 | # initiate EL
51 | el = sm.emplike.DescStat(x)
52 |
53 | # confidence interval for the mean
54 | el.ci_mean()
55 |
56 | # test variance is 1
57 | el.test_var(1)
58 |
59 |
60 | Module Reference
61 | ----------------
62 |
63 | .. module:: statsmodels.emplike
64 | :synopsis: Empirical likelihood tools
65 |
66 | .. autosummary::
67 | :toctree: generated/
68 |
69 | descriptive.DescStat
70 | descriptive.DescStatUV
71 | descriptive.DescStatMV
72 |
--------------------------------------------------------------------------------
/docs/en/source/examples/README:
--------------------------------------------------------------------------------
1 | The format for landing.json should be self-explanatory. The images should be placed in docs/source/_static/images/. They will be displayed at 360 x 225 (W x H). It's best to save them as a png with a resolution of a multiple of at least 720 x 450. If you want, you can use png crush to make the images smaller.
2 |
--------------------------------------------------------------------------------
/docs/en/source/examples/index.rst:
--------------------------------------------------------------------------------
1 | :orphan:
2 |
3 | .. _statsmodels-examples:
4 |
5 | Statsmodels Examples
6 | ====================
7 |
8 | This page provides a series of examples, tutorials and recipes to help you get
9 | started with ``statsmodels``. Each of the examples shown here is made available
10 | as an IPython Notebook and as a plain python script on the `statsmodels github
11 | repository `_.
12 |
13 | We also encourage users to submit their own examples, tutorials or cool
14 | `statsmodels` trick to the `Examples wiki page
15 | `_
16 |
17 | The Examples
18 | ------------
19 |
20 | .. toctree::
21 | :maxdepth: 3
22 | :glob:
23 |
24 | notebooks/generated/*
25 |
--------------------------------------------------------------------------------
/docs/en/source/extending.rst.TXT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/extending.rst.TXT
--------------------------------------------------------------------------------
/docs/en/source/faq.rst:
--------------------------------------------------------------------------------
1 | :orphan:
2 |
3 | .. currentmodule:: statsmodels
4 |
5 | .. _faq:
6 |
7 | Frequently Asked Question
8 | -------------------------
9 |
10 | .. _endog-exog-faq:
11 |
12 | What do endog and exog mean?
13 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 |
15 | These are shorthand for endogenous and exogenous variables. You might be more comfortable with the common ``y`` and ``X`` notation in linear models. Sometimes the endogenous variable ``y`` is called a dependent variable. Likewise, sometimes the exogenous variables ``X`` are called the independent variables. You can read about this in greater detail at :ref:`endog_exog`
16 |
17 |
18 | .. _missing-faq:
19 |
20 | How does statsmodels handle missing data?
21 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 |
23 | Missing data can be handled via the ``missing`` keyword argument. Every model takes this keyword. You can find more information in the docstring of :class:`statsmodels.base.Model `.
24 |
25 | .. `Model class `_.
26 |
27 | .. _build-faq:
28 |
29 | Why won't statsmodels build?
30 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 |
32 | If you're on Python 3.4, you *must* use Cython 0.20.1. If you're still having problems, try running
33 |
34 | .. code-block:: bash
35 |
36 | python setup.py clean
37 |
38 | What if my question isn't answered here?
39 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40 |
41 | You may find answers for questions that have not yet been added here on GitHub under the `FAQ issues tag `_. If not, please ask your question on stackoverflow using the `statsmodels tag `_ or on the `mailing list `_.
42 |
--------------------------------------------------------------------------------
/docs/en/source/genericmle.rst.TXT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/genericmle.rst.TXT
--------------------------------------------------------------------------------
/docs/en/source/glm_techn1.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.glm
2 |
3 |
4 | .. _glm_techn1:
5 |
6 | Technical Documentation
7 | =======================
8 |
9 | Introduction
10 | ------------
11 |
12 | Just a placeholder
13 |
--------------------------------------------------------------------------------
/docs/en/source/glm_techn2.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.glm
2 |
3 |
4 | .. _glm_techn2:
5 |
6 | Technical Documentation - part 2
7 | ================================
8 |
9 | Implementation Notes
10 | --------------------
11 |
12 | Just a placeholder
13 |
--------------------------------------------------------------------------------
/docs/en/source/gmm.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.sandbox.regression.gmm
2 |
3 |
4 | .. _gmm:
5 |
6 |
7 | Generalized Method of Moments :mod:`gmm`
8 | ========================================
9 |
10 | :mod:`statsmodels.gmm` contains model classes and functions that are based on
11 | estimation with Generalized Method of Moments.
12 | Currently the general non-linear case is implemented. An example class for the standard
13 | linear instrumental variable model is included. This has been introduced as a test case, it
14 | works correctly but it does not take the linear structure into account. For the linear
15 | case we intend to introduce a specific implementation which will be faster and numerically
16 | more accurate.
17 |
18 | Currently, GMM takes arbitrary non-linear moment conditions and calculates the estimates
19 | either for a given weighting matrix or iteratively by alternating between estimating
20 | the optimal weighting matrix and estimating the parameters. Implementing models with
21 | different moment conditions is done by subclassing GMM. In the minimal implementation
22 | only the moment conditions, `momcond` have to be defined.
23 |
24 | .. currentmodule:: statsmodels.sandbox.regression.gmm
25 |
26 |
27 | Module Reference
28 | """"""""""""""""
29 |
30 | .. module:: statsmodels.sandbox.regression.gmm
31 | :synopsis: A framework for implementing Generalized Method of Moments (GMM)
32 |
33 | .. autosummary::
34 | :toctree: generated/
35 |
36 | GMM
37 | GMMResults
38 | IV2SLS
39 | IVGMM
40 | IVGMMResults
41 | IVRegressionResults
42 | LinearIVGMM
43 | NonlinearIVGMM
44 |
--------------------------------------------------------------------------------
/docs/en/source/gmm_techn1.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.sandbox.regression.gmm
2 |
3 |
4 | .. _gmm_techn1:
5 |
6 | Technical Documentation
7 | =======================
8 |
9 | Introduction
10 | ------------
11 |
12 | Generalized Method of Moments is an extension of the Method of Moments
13 | if there are more moment conditions than parameters that are estimated.
14 |
15 | simple example
16 |
17 |
18 | General Structure and Implementation
19 | ------------------------------------
20 |
21 | The main class for GMM estimation, makes little assumptions about the
22 | moment conditions. It is designed for the general case when moment
23 | conditions are given as function by the user.
24 |
25 | ::
26 |
27 | def momcond(params)
28 |
29 | which should return a two dimensional array with observation in rows
30 | and moment conditions in columns. Denote this function by `$g(\theta)$`. Then
31 | the GMM estimator is given as the solution to the maximization problem:
32 |
33 | ..math: max_{\theta) g(theta)' W g(theta) (1)
34 |
35 | The weighting matrix can be estimated in several different ways. The
36 | basic method `fitgmm` takes the weighting matrix as argument or if it is
37 | not given takes the identity matrix and maximizes (1)
38 | taking W as given. Since the optimizing functions solve minimization problems,
39 | we usually minimizes the negative of the objective function.
40 | `fit_iterative` calculates the optimal weighting matrix and maximizes the
41 | criterion function in alternating steps. The number of iterations can
42 | be given as an argument to this fit method. The optimal weighting matrix,
43 | which is the covariance matrix of the moment conditions, can be estimated
44 | in different ways. Kernel and shrinkage estimators are planned but not yet
45 | implemented. TODO
46 |
47 | The GMM class itself does not define any moment conditions. To get an
48 | estimator for given moment conditions, GMM needs to be subclassed.
49 | The basic structure of writing new models based on
50 | the generic MLE or GMM framework and subclassing is described in
51 | `extending.rst` (TODO: link)
52 |
53 | As an example
54 |
--------------------------------------------------------------------------------
/docs/en/source/graphics.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.graphics
2 |
3 | .. _graphics:
4 |
5 | Graphics
6 | ========
7 |
8 | .. automodule:: statsmodels.graphics
9 |
10 | Goodness of Fit Plots
11 | ---------------------
12 |
13 | .. autosummary::
14 | :toctree: generated/
15 |
16 | gofplots.qqplot
17 | gofplots.qqline
18 | gofplots.qqplot_2samples
19 | gofplots.ProbPlot
20 |
21 | Boxplots
22 | --------
23 |
24 | .. autosummary::
25 | :toctree: generated/
26 |
27 | boxplots.violinplot
28 | boxplots.beanplot
29 |
30 | Correlation Plots
31 | ------------------
32 |
33 | .. autosummary::
34 | :toctree: generated/
35 |
36 | correlation.plot_corr
37 | correlation.plot_corr_grid
38 | plot_grids.scatter_ellipse
39 |
40 | Functional Plots
41 | ----------------
42 |
43 | .. autosummary::
44 | :toctree: generated/
45 |
46 | functional.hdrboxplot
47 | functional.fboxplot
48 | functional.rainbowplot
49 | functional.banddepth
50 |
51 | Regression Plots
52 | ----------------
53 |
54 | .. autosummary::
55 | :toctree: generated/
56 |
57 | regressionplots.plot_fit
58 | regressionplots.plot_regress_exog
59 | regressionplots.plot_partregress
60 | regressionplots.plot_ccpr
61 | regressionplots.abline_plot
62 | regressionplots.influence_plot
63 | regressionplots.plot_leverage_resid2
64 |
65 | Time Series Plots
66 | -----------------
67 |
68 | .. autosummary::
69 | :toctree: generated/
70 |
71 | tsaplots.plot_acf
72 | tsaplots.plot_pacf
73 | tsaplots.month_plot
74 | tsaplots.quarter_plot
75 |
76 | Other Plots
77 | -----------
78 |
79 | .. autosummary::
80 | :toctree: generated/
81 |
82 | factorplots.interaction_plot
83 | mosaicplot.mosaic
84 | agreement.mean_diff_plot
85 |
--------------------------------------------------------------------------------
/docs/en/source/images/aw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/aw.png
--------------------------------------------------------------------------------
/docs/en/source/images/hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/hl.png
--------------------------------------------------------------------------------
/docs/en/source/images/ht.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/ht.png
--------------------------------------------------------------------------------
/docs/en/source/images/ls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/ls.png
--------------------------------------------------------------------------------
/docs/en/source/images/re.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/re.png
--------------------------------------------------------------------------------
/docs/en/source/images/statsmodels_hybi_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/statsmodels_hybi_banner.png
--------------------------------------------------------------------------------
/docs/en/source/images/statsmodels_hybi_favico.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/statsmodels_hybi_favico.ico
--------------------------------------------------------------------------------
/docs/en/source/images/tk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/tk.png
--------------------------------------------------------------------------------
/docs/en/source/images/tm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/source/images/tm.png
--------------------------------------------------------------------------------
/docs/en/source/imputation.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.imputation.mice
2 | :synopsis: Multiple imputation for missing data
3 |
4 | .. currentmodule:: statsmodels.imputation.mice
5 |
6 | .. _imputation:
7 |
8 |
9 | Multiple Imputation with Chained Equations
10 | ==========================================
11 |
12 | The MICE module allows most Statsmodels models to be fit to a dataset
13 | with missing values on the independent and/or dependent variables, and
14 | provides rigorous standard errors for the fitted parameters. The
15 | basic idea is to treat each variable with missing values as the
16 | dependent variable in a regression, with some or all of the remaining
17 | variables as its predictors. The MICE procedure cycles through these
18 | models, fitting each in turn, then uses a procedure called "predictive
19 | mean matching" (PMM) to generate random draws from the predictive
20 | distributions determined by the fitted models. These random draws
21 | become the imputed values for one imputed data set.
22 |
23 | By default, each variable with missing variables is modeled using a
24 | linear regression with main effects for all other variables in the
25 | data set. Note that even when the imputation model is linear, the PMM
26 | procedure preserves the domain of each variable. Thus, for example,
27 | if all observed values for a given variable are positive, all imputed
28 | values for the variable will always be positive. The user also has
29 | the option to specify which model is used to produce imputed values
30 | for each variable.
31 |
32 | .. code
33 |
34 |
35 | Classes
36 | -------
37 |
38 | .. currentmodule:: statsmodels.imputation.mice
39 |
40 | .. autosummary::
41 | :toctree: generated/
42 |
43 | MICE
44 | MICEData
45 |
46 |
47 | Implementation Details
48 | ----------------------
49 |
50 | Internally, this function uses
51 | `pandas.isnull `_.
52 | Anything that returns True from this function will be treated as missing data.
53 |
--------------------------------------------------------------------------------
/docs/en/source/iolib.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.iolib
2 |
3 | .. _iolib:
4 |
5 | Input-Output :mod:`iolib`
6 | =========================
7 |
8 | ``statsmodels`` offers some functions for input and output. These include a
9 | reader for STATA files, a class for generating tables for printing in several
10 | formats and two helper functions for pickling.
11 |
12 | Users can also leverage the powerful input/output functions provided by :ref:`pandas.io `. Among other things, ``pandas`` (a ``statsmodels`` dependency) allows reading and writing to Excel, CSV, and HDF5 (PyTables).
13 |
14 | Examples
15 | --------
16 |
17 | `SimpleTable: Basic example `__
18 |
19 | Module Reference
20 | ----------------
21 |
22 | .. module:: statsmodels.iolib
23 | :synopsis: Tools for reading datasets and producing summary output
24 |
25 | .. autosummary::
26 | :toctree: generated/
27 |
28 | foreign.StataReader
29 | foreign.StataWriter
30 | foreign.genfromdta
31 | foreign.savetxt
32 | table.SimpleTable
33 | table.csv2st
34 | smpickle.save_pickle
35 | smpickle.load_pickle
36 |
37 |
38 | The following are classes and functions used to return the summary of
39 | estimation results, and mostly intended for internal use. There are currently
40 | two versions for creating summaries.
41 |
42 | .. autosummary::
43 | :toctree: generated/
44 |
45 | summary.Summary
46 | summary2.Summary
47 |
--------------------------------------------------------------------------------
/docs/en/source/miscmodels.rst:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | .. module:: statsmodels.miscmodels
5 | .. currentmodule:: statsmodels.miscmodels
6 |
7 |
8 | .. _miscmodels:
9 |
10 |
11 | Other Models :mod:`miscmodels`
12 | ==============================
13 |
14 | :mod:`statsmodels.miscmodels` contains model classes and that do not yet fit into
15 | any other category, or are basic implementations that are not yet polished and will most
16 | likely still change. Some of these models were written as examples for the generic
17 | maximum likelihood framework, and there will be others that might be based on general
18 | method of moments.
19 |
20 | The models in this category have been checked for basic cases, but might be more exposed
21 | to numerical problems than the complete implementation. For example, count.Poisson has
22 | been added using only the generic maximum likelihood framework, the standard errors
23 | are based on the numerical evaluation of the Hessian, while discretemod.Poisson uses
24 | analytical Gradients and Hessian and will be more precise, especially in cases when there
25 | is strong multicollinearity.
26 | On the other hand, by subclassing GenericLikelihoodModel, it is easy to add new models,
27 | another example can be seen in the zero inflated Poisson model, miscmodels.count.
28 |
29 |
30 | Count Models :mod:`count`
31 | --------------------------
32 |
33 | .. module:: statsmodels.miscmodels.count
34 | .. currentmodule:: statsmodels.miscmodels.count
35 |
36 | .. autosummary::
37 | :toctree: generated/
38 |
39 | PoissonGMLE
40 | PoissonOffsetGMLE
41 | PoissonZiGMLE
42 |
43 | Linear Model with t-distributed errors
44 | --------------------------------------
45 |
46 | This is a class that shows that a new model can be defined by only specifying the
47 | method for the loglikelihood. All result statistics are inherited from the generic
48 | likelihood model and result classes. The results have been checked against R for a
49 | simple case.
50 |
51 | .. module:: statsmodels.miscmodels.tmodel
52 | .. currentmodule:: statsmodels.miscmodels.tmodel
53 |
54 | .. autosummary::
55 | :toctree: generated/
56 |
57 | TLinearModel
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/en/source/missing.rst:
--------------------------------------------------------------------------------
1 | :orphan:
2 |
3 | .. _missing_data:
4 |
5 | Missing Data
6 | ------------
7 | All of the models can handle missing data. For performance reasons, the default is not to do any checking for missing data. If, however, you would like for missing data to be handled internally, you can do so by using the missing keyword argument. The default is to do nothing
8 |
9 | .. ipython:: python
10 |
11 | import statsmodels.api as sm
12 | data = sm.datasets.longley.load(as_pandas=False)
13 | data.exog = sm.add_constant(data.exog)
14 | # add in some missing data
15 | missing_idx = np.array([False] * len(data.endog))
16 | missing_idx[[4, 10, 15]] = True
17 | data.endog[missing_idx] = np.nan
18 | ols_model = sm.OLS(data.endog, data.exog)
19 | ols_fit = ols_model.fit()
20 | print(ols_fit.params)
21 |
22 | This silently fails and all of the model parameters are NaN, which is probably not what you expected. If you are not sure whether or not you have missing data you can use `missing = 'raise'`. This will raise a `MissingDataError` during model instantiation if missing data is present so that you know something was wrong in your input data.
23 |
24 | .. ipython:: python
25 | :okexcept:
26 |
27 | ols_model = sm.OLS(data.endog, data.exog, missing='raise')
28 |
29 | If you want statsmodels to handle the missing data by dropping the observations, use `missing = 'drop'`.
30 |
31 | .. ipython:: python
32 |
33 | ols_model = sm.OLS(data.endog, data.exog, missing='drop')
34 |
35 | We are considering adding a configuration framework so that you can set the option with a global setting.
36 |
--------------------------------------------------------------------------------
/docs/en/source/mixed_glm.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.genmod.bayes_mixed_glm
2 |
3 | Generalized Linear Mixed Effects Models
4 | =======================================
5 |
6 | Generalized Linear Mixed Effects (GLIMMIX) models are generalized
7 | linear models with random effects in the linear predictors.
8 | Statsmodels currently supports estimation of binomial and Poisson
9 | GLIMMIX models using two Bayesian methods: the Laplace approximation
10 | to the posterior, and a variational Bayes approximation to the
11 | posterior. Both methods provide point estimates (posterior means) and
12 | assessments of uncertainty (posterior standard deviation).
13 |
14 | The current implementation only supports independent random effects.
15 |
16 | Technical Documentation
17 | -----------------------
18 |
19 | Unlike Statsmodels mixed linear models, the GLIMMIX implementation is
20 | not group-based. Groups are created by interacting all random effects
21 | with a categorical variable. Note that this creates large, sparse
22 | random effects design matrices `exog_vc`. Internally, `exog_vc` is
23 | converted to a scipy sparse matrix. When passing the arguments
24 | directly to the class initializer, a sparse matrix may be passed.
25 | When using formulas, a dense matrix is created then converted to
26 | sparse. For very large problems, it may not be feasible to use
27 | formulas due to the size of this dense intermediate matrix.
28 |
29 | References
30 | ^^^^^^^^^^
31 |
32 | Blei, Kucukelbir, McAuliffe (2017). Variational Inference: A review
33 | for Statisticians https://arxiv.org/pdf/1601.00670.pdf
34 |
35 | Module Reference
36 | ----------------
37 |
38 | .. module:: statsmodels.genmod.bayes_mixed_glm
39 | :synopsis: Bayes Mixed Generalized Linear Models
40 |
41 |
42 | The model classes are:
43 |
44 | .. autosummary::
45 | :toctree: generated/
46 |
47 | BinomialBayesMixedGLM
48 | PoissonBayesMixedGLM
49 |
50 | The result class is:
51 |
52 | .. autosummary::
53 | :toctree: generated/
54 |
55 | BayesMixedGLMResults
56 |
--------------------------------------------------------------------------------
/docs/en/source/multivariate.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.multivariate
2 | :synopsis: Models for multivariate data
3 |
4 | .. currentmodule:: statsmodels.multivariate
5 |
6 | .. _multivariate:
7 |
8 |
9 | Multivariate Statistics :mod:`multivariate`
10 | ===========================================
11 |
12 | This section includes methods and algorithms from multivariate statistics.
13 |
14 |
15 | Principal Component Analysis
16 | ----------------------------
17 |
18 | .. module:: statsmodels.multivariate.pca
19 | :synopsis: Principal Component Analaysis
20 |
21 | .. currentmodule:: statsmodels.multivariate.pca
22 |
23 | .. autosummary::
24 | :toctree: generated/
25 |
26 | PCA
27 | pca
28 |
29 |
30 | Factor Analysis
31 | ---------------
32 |
33 | .. currentmodule:: statsmodels.multivariate.factor
34 |
35 | .. autosummary::
36 | :toctree: generated/
37 |
38 | Factor
39 | FactorResults
40 |
41 |
42 | Factor Rotation
43 | ---------------
44 |
45 | .. currentmodule:: statsmodels.multivariate.factor_rotation
46 |
47 | .. autosummary::
48 | :toctree: generated/
49 |
50 | rotate_factors
51 | target_rotation
52 | procrustes
53 | promax
54 |
55 |
56 | Canonical Correlation
57 | ---------------------
58 |
59 | .. currentmodule:: statsmodels.multivariate.cancorr
60 |
61 | .. autosummary::
62 | :toctree: generated/
63 |
64 | CanCorr
65 |
66 |
67 | MANOVA
68 | ------
69 |
70 | .. currentmodule:: statsmodels.multivariate.manova
71 |
72 | .. autosummary::
73 | :toctree: generated/
74 |
75 | MANOVA
76 |
77 |
78 | MultivariateOLS
79 | ---------------
80 |
81 | `_MultivariateOLS` is a model class with limited features. Currently it
82 | supports multivariate hypothesis tests and is used as backend for MANOVA.
83 |
84 | .. currentmodule:: statsmodels.multivariate.multivariate_ols
85 |
86 | .. autosummary::
87 | :toctree: generated/
88 |
89 | _MultivariateOLS
90 | _MultivariateOLSResults
91 | MultivariateTestResults
92 |
--------------------------------------------------------------------------------
/docs/en/source/plots/arma_predict_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import matplotlib.pyplot as plt
3 | import pandas as pd
4 |
5 | dta = sm.datasets.sunspots.load_pandas().data[['SUNACTIVITY']]
6 | dta.index = pd.DatetimeIndex(start='1700', end='2009', freq='A')
7 | res = sm.tsa.ARMA(dta, (3, 0)).fit(disp=0)
8 | fig, ax = plt.subplots()
9 | ax = dta.loc['1950':].plot(ax=ax)
10 | res.plot_predict('1990', '2012', dynamic=True, ax=ax,
11 | plot_insample=False)
12 |
--------------------------------------------------------------------------------
/docs/en/source/plots/bkf_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 |
3 | from load_macrodata import dta
4 |
5 | cycles = sm.tsa.filters.bkfilter(dta[['realinv']], 6, 24, 12)
6 |
7 | import matplotlib.pyplot as plt
8 | fig, ax = plt.subplots()
9 | cycles.plot(ax=ax, style=['r--', 'b-'])
10 |
--------------------------------------------------------------------------------
/docs/en/source/plots/cff_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 |
3 | from load_macrodata import dta
4 |
5 | cf_cycles, cf_trend = sm.tsa.filters.cffilter(dta[["infl", "unemp"]])
6 |
7 | import matplotlib.pyplot as plt
8 | fig, ax = plt.subplots()
9 | cf_cycles.plot(ax=ax, style=['r--', 'b-'])
10 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics-mean_diff_plot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Test Bland-Altman
3 | """
4 |
5 | Author: Joses Ho
6 |
7 | """
8 |
9 | import statsmodels.api as sm
10 | import numpy as np
11 | import matplotlib.pyplot as plt
12 |
13 | # Seed the random number generator.
14 | # This ensures that the results below are reproducible.
15 | np.random.seed(9999)
16 | m1 = np.random.random(20)
17 | m2 = np.random.random(20)
18 |
19 | f, ax = plt.subplots(1, figsize = (8,5))
20 | sm.graphics.mean_diff_plot(m1, m2, ax = ax)
21 |
22 | plt.show()
23 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_boxplot_beanplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 00:22:40 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 |
10 | import numpy as np
11 | import matplotlib.pyplot as plt
12 | import statsmodels.api as sm
13 | data = sm.datasets.anes96.load_pandas()
14 | party_ID = np.arange(7)
15 | labels = ["Strong Democrat", "Weak Democrat", "Independent-Democrat",
16 | "Independent-Indpendent", "Independent-Republican",
17 | "Weak Republican", "Strong Republican"]
18 |
19 | plt.rcParams['figure.subplot.bottom'] = 0.23 # keep labels visible
20 | age = [data.exog['age'][data.endog == id] for id in party_ID]
21 | fig = plt.figure()
22 | ax = fig.add_subplot(111)
23 | sm.graphics.beanplot(age, ax=ax, labels=labels,
24 | plot_opts={'cutoff_val':5, 'cutoff_type':'abs',
25 | 'label_fontsize':'small',
26 | 'label_rotation':30})
27 | ax.set_xlabel("Party identification of respondent.")
28 | ax.set_ylabel("Age")
29 |
30 | #plt.show()
31 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_boxplot_violinplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 00:11:32 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 | import numpy as np
10 | import matplotlib.pyplot as plt
11 | import statsmodels.api as sm
12 |
13 | data = sm.datasets.anes96.load_pandas()
14 | party_ID = np.arange(7)
15 | labels = ["Strong Democrat", "Weak Democrat", "Independent-Democrat",
16 | "Independent-Indpendent", "Independent-Republican",
17 | "Weak Republican", "Strong Republican"]
18 | plt.rcParams['figure.subplot.bottom'] = 0.23 # keep labels visible
19 | age = [data.exog['age'][data.endog == id] for id in party_ID]
20 | fig = plt.figure()
21 | ax = fig.add_subplot(111)
22 | sm.graphics.violinplot(age, ax=ax, labels=labels,
23 | plot_opts={'cutoff_val':5, 'cutoff_type':'abs',
24 | 'label_fontsize':'small',
25 | 'label_rotation':30})
26 | ax.set_xlabel("Party identification of respondent.")
27 | ax.set_ylabel("Age")
28 |
29 | #plt.show()
30 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_functional_fboxplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 11:10:51 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 |
10 | #Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
11 | #surface temperature data.
12 |
13 | import numpy as np
14 | import matplotlib.pyplot as plt
15 | import statsmodels.api as sm
16 | data = sm.datasets.elnino.load(as_pandas=False)
17 |
18 | #Create a functional boxplot. We see that the years 1982-83 and 1997-98 are
19 | #outliers; these are the years where El Nino (a climate pattern
20 | #characterized by warming up of the sea surface and higher air pressures)
21 | #occurred with unusual intensity.
22 |
23 | fig = plt.figure()
24 | ax = fig.add_subplot(111)
25 | res = sm.graphics.fboxplot(data.raw_data[:, 1:], wfactor=2.58,
26 | labels=data.raw_data[:, 0].astype(int),
27 | ax=ax)
28 |
29 | ax.set_xlabel("Month of the year")
30 | ax.set_ylabel("Sea surface temperature (C)")
31 | ax.set_xticks(np.arange(13, step=3) - 1)
32 | ax.set_xticklabels(["", "Mar", "Jun", "Sep", "Dec"])
33 | ax.set_xlim([-0.2, 11.2])
34 |
35 | #plt.show()
36 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_functional_hdrboxplot.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | #Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
4 | #surface temperature data.
5 |
6 | import numpy as np
7 | import matplotlib.pyplot as plt
8 | import statsmodels.api as sm
9 | data = sm.datasets.elnino.load(as_pandas=False)
10 |
11 | #Create a HDR functional boxplot. We see that the years 1982-83 and 1997-98 are
12 | #outliers; these are the years where El Nino (a climate pattern
13 | #characterized by warming up of the sea surface and higher air pressures)
14 | #occurred with unusual intensity.
15 |
16 | fig = plt.figure()
17 | ax = fig.add_subplot(111)
18 | fig, res = sm.graphics.hdrboxplot(data.raw_data[:, 1:],
19 | labels=data.raw_data[:, 0].astype(int),
20 | ax=ax)
21 |
22 | ax.plot([0, 10], [25, 25])
23 | ax.set_xlabel("Month of the year")
24 | ax.set_ylabel("Sea surface temperature (C)")
25 | ax.set_xticks(np.arange(13, step=3) - 1)
26 | ax.set_xticklabels(["", "Mar", "Jun", "Sep", "Dec"])
27 | ax.set_xlim([-0.2, 11.2])
28 |
29 | plt.show()
30 |
31 | print(res)
32 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_functional_rainbowplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 11:08:56 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 |
10 | #Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
11 | #surface temperature data.
12 |
13 | import numpy as np
14 | import matplotlib.pyplot as plt
15 | import statsmodels.api as sm
16 | data = sm.datasets.elnino.load(as_pandas=False)
17 |
18 | #Create a rainbow plot:
19 |
20 | fig = plt.figure()
21 | ax = fig.add_subplot(111)
22 | res = sm.graphics.rainbowplot(data.raw_data[:, 1:], ax=ax)
23 |
24 | ax.set_xlabel("Month of the year")
25 | ax.set_ylabel("Sea surface temperature (C)")
26 | ax.set_xticks(np.arange(13, step=3) - 1)
27 | ax.set_xticklabels(["", "Mar", "Jun", "Sep", "Dec"])
28 | ax.set_xlim([-0.2, 11.2])
29 |
30 | #plt.show()
31 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_gofplots_qqplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Sun May 06 05:32:15 2012
4 |
5 | Author: Josef Perktold
6 | editted by: Paul Hobson (2012-08-19)
7 | """
8 | from scipy import stats
9 | from matplotlib import pyplot as plt
10 | import statsmodels.api as sm
11 |
12 | #example from docstring
13 | data = sm.datasets.longley.load(as_pandas=False)
14 | data.exog = sm.add_constant(data.exog, prepend=True)
15 | mod_fit = sm.OLS(data.endog, data.exog).fit()
16 | res = mod_fit.resid
17 |
18 | left = -1.8 #x coordinate for text insert
19 |
20 | fig = plt.figure()
21 |
22 | ax = fig.add_subplot(2, 2, 1)
23 | sm.graphics.qqplot(res, ax=ax)
24 | top = ax.get_ylim()[1] * 0.75
25 | txt = ax.text(left, top, 'no keywords', verticalalignment='top')
26 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
27 |
28 | ax = fig.add_subplot(2, 2, 2)
29 | sm.graphics.qqplot(res, line='s', ax=ax)
30 | top = ax.get_ylim()[1] * 0.75
31 | txt = ax.text(left, top, "line='s'", verticalalignment='top')
32 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
33 |
34 | ax = fig.add_subplot(2, 2, 3)
35 | sm.graphics.qqplot(res, line='45', fit=True, ax=ax)
36 | ax.set_xlim(-2, 2)
37 | top = ax.get_ylim()[1] * 0.75
38 | txt = ax.text(left, top, "line='45', \nfit=True", verticalalignment='top')
39 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
40 |
41 | ax = fig.add_subplot(2, 2, 4)
42 | sm.graphics.qqplot(res, dist=stats.t, line='45', fit=True, ax=ax)
43 | ax.set_xlim(-2, 2)
44 | top = ax.get_ylim()[1] * 0.75
45 | txt = ax.text(left, top, "dist=stats.t, \nline='45', \nfit=True",
46 | verticalalignment='top')
47 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
48 |
49 | fig.tight_layout()
50 |
51 | plt.gcf()
52 |
53 |
54 | # example with the new ProbPlot class
55 | import numpy as np
56 | x = np.random.normal(loc=8.25, scale=3.5, size=37)
57 | y = np.random.normal(loc=8.00, scale=3.25, size=37)
58 | pp_x = sm.ProbPlot(x, fit=True)
59 | pp_y = sm.ProbPlot(y, fit=True)
60 |
61 | # probability of exceedance
62 | fig2 = pp_x.probplot(exceed=True)
63 |
64 | # compare x quantiles to y quantiles
65 | fig3 = pp_x.qqplot(other=pp_y, line='45')
66 |
67 | # same as above with probabilities/percentiles
68 | fig4 = pp_x.ppplot(other=pp_y, line='45')
69 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_month_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import pandas as pd
3 |
4 | dta = sm.datasets.elnino.load_pandas().data
5 | dta['YEAR'] = dta.YEAR.astype(int).astype(str)
6 | dta = dta.set_index('YEAR').T.unstack()
7 | dates = pd.to_datetime(list(map(lambda x : '-'.join(x) + '-1', dta.index.values)))
8 |
9 | dta.index = pd.DatetimeIndex(list(dates), freq='MS')
10 | dta.name = 'temp'
11 | fig = sm.graphics.tsa.month_plot(dta)
12 |
--------------------------------------------------------------------------------
/docs/en/source/plots/graphics_plot_fit_ex.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Monday April 1st 2013
5 |
6 | Author: Padarn Wilson
7 |
8 | """
9 |
10 | # Load the Statewide Crime data set and perform linear regression with
11 | # 'poverty' and 'hs_grad' as variables and 'muder' as the response
12 |
13 |
14 | import statsmodels.api as sm
15 | import matplotlib.pyplot as plt
16 | import numpy as np
17 |
18 | data = sm.datasets.statecrime.load_pandas().data
19 | murder = data['murder']
20 | X = data[['poverty', 'hs_grad']].copy()
21 | X['constant'] = 1
22 |
23 | y = murder
24 | model = sm.OLS(y, X)
25 | results = model.fit()
26 |
27 | # Create a plot just for the variable 'Poverty':
28 |
29 | fig, ax = plt.subplots()
30 | fig = sm.graphics.plot_fit(results, 0, ax=ax)
31 | ax.set_ylabel("Murder Rate")
32 | ax.set_xlabel("Poverty Level")
33 | ax.set_title("Linear Regression")
34 |
35 | plt.show()
36 |
--------------------------------------------------------------------------------
/docs/en/source/plots/hpf_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import pandas as pd
3 | from load_macrodata import dta
4 |
5 | cycle, trend = sm.tsa.filters.hpfilter(dta.realgdp, 1600)
6 | gdp_decomp = dta[['realgdp']].copy()
7 | gdp_decomp["cycle"] = cycle
8 | gdp_decomp["trend"] = trend
9 |
10 | import matplotlib.pyplot as plt
11 | fig, ax = plt.subplots()
12 | gdp_decomp[["realgdp", "trend"]]["2000-03-31":].plot(ax=ax,
13 | fontsize=16)
14 |
--------------------------------------------------------------------------------
/docs/en/source/plots/load_macrodata.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import pandas as pd
3 | dta = sm.datasets.macrodata.load_pandas().data
4 | dates = sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3')
5 | index = pd.DatetimeIndex(dates)
6 | dta.set_index(index, inplace=True)
7 |
--------------------------------------------------------------------------------
/docs/en/source/plots/var_plot_acorr.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_acorr
2 | plot_acorr()
3 |
--------------------------------------------------------------------------------
/docs/en/source/plots/var_plot_fevd.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_fevd
2 | plot_fevd()
3 |
--------------------------------------------------------------------------------
/docs/en/source/plots/var_plot_forecast.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_forecast
2 | plot_forecast()
3 |
--------------------------------------------------------------------------------
/docs/en/source/plots/var_plot_input.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_input
2 | plot_input()
3 |
--------------------------------------------------------------------------------
/docs/en/source/plots/var_plot_irf.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_irf
2 | plot_irf()
3 |
--------------------------------------------------------------------------------
/docs/en/source/plots/var_plot_irf_cum.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_irf_cum
2 | plot_irf_cum()
3 |
--------------------------------------------------------------------------------
/docs/en/source/plots/var_plots.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | from statsmodels.tsa.api import VAR
4 | from statsmodels.api import datasets as ds
5 | from statsmodels.tsa.base.datetools import dates_from_str
6 |
7 |
8 | import pandas
9 | mdata = ds.macrodata.load_pandas().data
10 |
11 | # prepare the dates index
12 | dates = mdata[['year', 'quarter']].astype(int)
13 | quarterly = [str(yr) + 'Q' + str(mo)
14 | for yr, mo in zip(dates["year"], dates["quarter"])]
15 | quarterly = dates_from_str(quarterly)
16 |
17 | mdata = mdata[['realgdp','realcons','realinv']]
18 | mdata.index = pandas.DatetimeIndex(quarterly)
19 | data = np.log(mdata).diff().dropna()
20 |
21 | model = VAR(data)
22 | est = model.fit(maxlags=2)
23 |
24 | def plot_input():
25 | est.plot()
26 |
27 | def plot_acorr():
28 | est.plot_acorr()
29 |
30 | def plot_irf():
31 | est.irf().plot()
32 |
33 | def plot_irf_cum():
34 | irf = est.irf()
35 | irf.plot_cum_effects()
36 |
37 | def plot_forecast():
38 | est.plot_forecast(10)
39 |
40 | def plot_fevd():
41 | est.fevd(20).plot()
42 |
--------------------------------------------------------------------------------
/docs/en/source/regression_techn1.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.regression
2 |
3 |
4 | .. _regression-techn1:
5 |
6 | Technical Documentation
7 | =======================
8 |
9 | Introduction
10 | ------------
11 |
12 | Just a placeholder
13 |
--------------------------------------------------------------------------------
/docs/en/source/release/index.rst:
--------------------------------------------------------------------------------
1 | .. During each release add in this folder information about important changes.
2 | .. Each versionx.x.rst file should have four main sections.
3 | .. (1) Major features (2) Important bug fixes (3) API breakage (4) Credits
4 |
5 | .. The github-stats-x.x.rst files are generated by tools/github_stats.py with
6 | .. some cleanup afterwards. I do python github_stats.py > github-stats-x.x.rst.
7 | .. As of the 0.5 release, this script asks for your github name and password
8 | .. to download the statistics.
9 |
10 | .. _whatsnew_index:
11 |
12 | =========================
13 | What's new in Statsmodels
14 | =========================
15 |
16 | .. toctree::
17 | :maxdepth: 1
18 |
19 | version0.9
20 | version0.8
21 | version0.7
22 | version0.6
23 | github-stats-0.6
24 | version0.5
25 | github-stats-0.5
26 |
27 | For an overview of changes that occured previous to the 0.5.0 release see :ref:`old_changes`.
28 |
--------------------------------------------------------------------------------
/docs/en/source/rlm.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.robust
2 |
3 |
4 | .. _rlm:
5 |
6 | Robust Linear Models
7 | ====================
8 |
9 | Robust linear models with support for the M-estimators listed under `Norms`_.
10 |
11 | See `Module Reference`_ for commands and arguments.
12 |
13 | Examples
14 | --------
15 |
16 | .. ipython:: python
17 |
18 | # Load modules and data
19 | import statsmodels.api as sm
20 | data = sm.datasets.stackloss.load(as_pandas=False)
21 | data.exog = sm.add_constant(data.exog)
22 |
23 | # Fit model and print summary
24 | rlm_model = sm.RLM(data.endog, data.exog, M=sm.robust.norms.HuberT())
25 | rlm_results = rlm_model.fit()
26 | print(rlm_results.params)
27 |
28 | Detailed examples can be found here:
29 |
30 | * `Robust Models 1 `__
31 | * `Robust Models 2 `__
32 |
33 | Technical Documentation
34 | -----------------------
35 |
36 | .. toctree::
37 | :maxdepth: 1
38 |
39 | rlm_techn1
40 |
41 | References
42 | ^^^^^^^^^^
43 |
44 | * PJ Huber. ‘Robust Statistics’ John Wiley and Sons, Inc., New York. 1981.
45 | * PJ Huber. 1973, ‘The 1972 Wald Memorial Lectures: Robust Regression: Asymptotics, Conjectures, and Monte Carlo.’ The Annals of Statistics, 1.5, 799-821.
46 | * R Venables, B Ripley. ‘Modern Applied Statistics in S’ Springer, New York,
47 |
48 | Module Reference
49 | ----------------
50 |
51 | .. module:: statsmodels.robust
52 |
53 | Model Classes
54 | ^^^^^^^^^^^^^
55 |
56 | .. module:: statsmodels.robust.robust_linear_model
57 | .. currentmodule:: statsmodels.robust.robust_linear_model
58 |
59 | .. autosummary::
60 | :toctree: generated/
61 |
62 | RLM
63 |
64 | Model Results
65 | ^^^^^^^^^^^^^
66 |
67 | .. autosummary::
68 | :toctree: generated/
69 |
70 | RLMResults
71 |
72 | .. _norms:
73 |
74 | Norms
75 | ^^^^^
76 |
77 | .. module:: statsmodels.robust.norms
78 | .. currentmodule:: statsmodels.robust.norms
79 |
80 | .. autosummary::
81 | :toctree: generated/
82 |
83 | AndrewWave
84 | Hampel
85 | HuberT
86 | LeastSquares
87 | RamsayE
88 | RobustNorm
89 | TrimmedMean
90 | TukeyBiweight
91 | estimate_location
92 |
93 |
94 | Scale
95 | ^^^^^
96 |
97 | .. module:: statsmodels.robust.scale
98 | .. currentmodule:: statsmodels.robust.scale
99 |
100 | .. autosummary::
101 | :toctree: generated/
102 |
103 | Huber
104 | HuberScale
105 | mad
106 | hubers_scale
107 |
--------------------------------------------------------------------------------
/docs/en/source/rlm_techn1.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.rlm
2 | :synopsis: Outlier robust linear models
3 |
4 | .. currentmodule:: statsmodels.rlm
5 |
6 |
7 | .. _rlm_techn1:
8 |
9 | Weight Functions
10 | ----------------
11 |
12 | Andrew's Wave
13 |
14 | .. image:: images/aw.png
15 |
16 | Hampel 17A
17 |
18 | .. image:: images/hl.png
19 |
20 | Huber's t
21 |
22 | .. image:: images/ht.png
23 |
24 | Least Squares
25 |
26 | .. image:: images/ls.png
27 |
28 | Ramsay's Ea
29 |
30 | .. image:: images/re.png
31 |
32 | Trimmed Mean
33 |
34 | .. image:: images/tm.png
35 |
36 | Tukey's Biweight
37 |
38 | .. image:: images/tk.png
39 |
40 |
41 |
--------------------------------------------------------------------------------
/docs/en/source/tsastats.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.tsa.tsatools
2 |
3 | Time Series Analysis
4 | ====================
5 |
6 | These are some of the helper functions for doing time series analysis. First
7 | we can load some a some data from the US Macro Economy 1959:Q1 - 2009:Q3. ::
8 |
9 | >>> data = sm.datasets.macrodata.load(as_pandas=False)
10 |
11 | The macro dataset is a structured array. ::
12 |
13 | >>> data = data.data[['year','quarter','realgdp','tbilrate','cpi','unemp']]
14 |
15 | We can add a lag like so ::
16 |
17 | >>> data = sm.tsa.add_lag(data, 'realgdp', lags=2)
18 |
19 | TODO:
20 | -scikits.timeseries
21 | -link in to var docs
22 |
--------------------------------------------------------------------------------
/docs/en/sphinxext/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include tests *.py
2 | include *.txt
3 |
--------------------------------------------------------------------------------
/docs/en/sphinxext/README.txt:
--------------------------------------------------------------------------------
1 | =====================================
2 | numpydoc -- Numpy's Sphinx extensions
3 | =====================================
4 |
5 | Numpy's documentation uses several custom extensions to Sphinx. These
6 | are shipped in this ``numpydoc`` package, in case you want to make use
7 | of them in third-party projects.
8 |
9 | The following extensions are available:
10 |
11 | - ``numpydoc``: support for the Numpy docstring format in Sphinx, and add
12 | the code description directives ``np-function``, ``np-cfunction``, etc.
13 | that support the Numpy docstring syntax.
14 |
15 | - ``numpydoc.traitsdoc``: For gathering documentation about Traits attributes.
16 |
17 | - ``numpydoc.plot_directives``: Adaptation of Matplotlib's ``plot::``
18 | directive. Note that this implementation may still undergo severe
19 | changes or eventually be deprecated.
20 |
21 | - ``numpydoc.only_directives``: (DEPRECATED)
22 |
23 | - ``numpydoc.autosummary``: (DEPRECATED) An ``autosummary::`` directive.
24 | Available in Sphinx 0.6.2 and (to-be) 1.0 as ``sphinx.ext.autosummary``,
25 | and it the Sphinx 1.0 version is recommended over that included in
26 | Numpydoc.
27 |
--------------------------------------------------------------------------------
/docs/en/sphinxext/numpy_ext/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/sphinxext/numpy_ext/__init__.py
--------------------------------------------------------------------------------
/docs/en/themes/statsmodels/indexsidebar.html:
--------------------------------------------------------------------------------
1 | Download
2 |
3 | {% if 'dev' in version %}
4 |
5 | This documentation is for version {{ version }}, which is not
6 | released yet. Grab the source code from Github to install this version. You can go to the documentation for the last release here.
7 |
8 | {% else %}
9 |
10 | This documentation is for the {{ release }} release. You can install it with pip:
11 |
12 |
pip install --upgrade --no-deps statsmodels
13 |
14 | or conda:
15 |
16 | conda install statsmodels
17 | Documentation for the current development version is here.
18 |
19 | {% endif %}
20 |
21 | Participate
22 |
23 |
27 |
28 | Grab the source from Github.
29 | Report bugs to the Issue Tracker.
30 | Have a look at our Developer Pages.
31 |
32 |
--------------------------------------------------------------------------------
/docs/en/themes/statsmodels/page.html:
--------------------------------------------------------------------------------
1 | {#
2 | Overwrites what is displayed on the examples landing page.
3 | #}
4 | {%- extends "layout.html" %}
5 | {% block body %}
6 |
7 |
8 | {% if pagename == 'examples/index' %}
9 |
10 |
Statsmodels Examples
11 |
12 | This page provides a series of examples, tutorials and recipes to help you get started with statsmodels. Each of the examples shown here is made available as an IPython Notebook and as a plain python script on the
statsmodels github repository.
13 |
14 | If you are not comfortable with git, we also encourage users to submit their own examples, tutorials or cool statsmodels tricks to the
Examples wiki page.
15 |
16 |
17 |
18 |
Topics
19 |
20 | {% for section in examples %}
21 |
24 | {% endfor %}
25 |
26 |
27 |
28 | {% for section in examples %}
29 |
{{ section.header }}
30 |
31 |
32 |
33 | {% for link in section.links %}
34 | -
35 |
{{link.text}}
36 |
37 |
38 |
39 |
40 | {% endfor %}
41 |
42 |
43 | {% endfor %}
44 |
45 | {% else %}
46 |
47 | {{ body }}
48 |
49 | {% endif %}
50 |
51 | {% endblock %}
52 |
--------------------------------------------------------------------------------
/docs/en/themes/statsmodels/relations.html:
--------------------------------------------------------------------------------
1 | {#
2 | basic/relations.html
3 | ~~~~~~~~~~~~~~~~~~~~
4 |
5 | Sphinx sidebar template: relation links.
6 |
7 | :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
8 | :license: BSD, see LICENSE for details.
9 | #}
10 | {%- if prev %}
11 | {{ _('Previous topic') }}
12 | {%- if prev.title[:19] == "statsmodels" %}
13 | {{ "sm." ~ prev.title[20:] }}
15 | {%- else %}
16 | {{ prev.title }}
18 |
19 | {%- endif %}
20 | {%- endif %}
21 |
22 | {%- if next %}
23 | {{ _('Next topic') }}
24 | {%- if next.title[:19] == "statsmodels" %}
25 | {{ "sm." ~ next.title[20:] }}
27 | {%- else %}
28 | {{ next.title }}
30 | {%- endif %}
31 |
32 | {%- endif %}
33 |
--------------------------------------------------------------------------------
/docs/en/themes/statsmodels/sidelinks.html:
--------------------------------------------------------------------------------
1 |
2 |  }})
3 |
--------------------------------------------------------------------------------
/docs/en/themes/statsmodels/static/statsmodels_hybi_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/en/themes/statsmodels/static/statsmodels_hybi_banner.png
--------------------------------------------------------------------------------
/docs/en/themes/statsmodels/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 | stylesheet = nature.css
4 | pygments_style = tango
5 |
--------------------------------------------------------------------------------
/docs/zh/GLMNotes.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/GLMNotes.pdf
--------------------------------------------------------------------------------
/docs/zh/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SPHINXPROJ = statsmodels
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | PAPER =
12 | TOOLSPATH = ../tools/
13 | DATASETBUILD = dataset_rst.py
14 | EXAMPLEBUILD = examples_rst.py
15 | NOTEBOOKBUILD = nbgenerate.py
16 | FOLDTOC = fold_toc.py
17 |
18 | # Internal variables.
19 | PAPEROPT_a4 = -D latex_paper_size=a4
20 | PAPEROPT_letter = -D latex_paper_size=letter
21 | ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
22 |
23 |
24 | # Put it first so that "make" without argument is like "make help".
25 | help:
26 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
27 |
28 | .PHONY: help Makefile
29 |
30 | cleanall:
31 | @$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
32 | -rm source/examples/generated/*
33 | -rm -rf source/examples/notebooks/generated/*
34 | -rm -rf ../tools/hash_dict.pickle
35 | -rm -rf source/datasets/generated/*
36 |
37 | notebooks:
38 | @echo "Generating notebooks from examples/notebooks folder"
39 | $(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
40 |
41 | html:
42 | # make directories for images
43 | @echo "Make static directory for images"
44 | mkdir -p $(BUILDDIR)/html/_static
45 | # generate the examples rst files
46 | @echo "Generating reST from examples folder"
47 | #$(TOOLSPATH)$(EXAMPLEBUILD)
48 | @echo "Generating datasets from installed statsmodels.datasets"
49 | $(TOOLSPATH)$(DATASETBUILD)
50 | @echo "Generating notebooks from examples/notebooks folder"
51 | $(TOOLSPATH)$(NOTEBOOKBUILD) --parallel --report-errors --skip-existing
52 | @echo "Running sphinx-build"
53 | @echo @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
54 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
55 | @echo "Copying rendered example notebooks"
56 | mkdir -p $(BUILDDIR)/html/examples/notebooks/generated
57 | cp source/examples/notebooks/generated/*html $(BUILDDIR)/html/examples/notebooks/generated
58 | @echo $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/index.html
59 | $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/index.html
60 | @echo $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/dev/index.html ../_static
61 | $(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/dev/index.html ../_static
62 |
63 | # Catch-all target: route all unknown targets to Sphinx using the new
64 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
65 | %: Makefile
66 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)
67 |
--------------------------------------------------------------------------------
/docs/zh/README.md:
--------------------------------------------------------------------------------
1 | # Documentation Documentation
2 |
3 | We use a combination of sphinx and Jupyter notebooks for the documentation.
4 | Jupyter notebooks should be used for longer, self-contained examples demonstrating
5 | a topic.
6 | Sphinx is nice because we get the tables of contents and API documentation.
7 |
8 | ## Build Process
9 |
10 | Building the docs requires a few additional dependencies. You can get most
11 | of these with
12 |
13 | ```bash
14 |
15 | pip install -e .[docs]
16 |
17 | ```
18 |
19 | From the root of the project.
20 | Some of the examples rely on `rpy2` to execute R code from the notebooks.
21 | It's not included in the setup requires since it's known to be difficult to
22 | install.
23 |
24 | To generate the HTML docs, run ``make html`` from the ``docs`` directory.
25 | This executes a few distinct builds
26 |
27 | 1. datasets
28 | 2. notebooks
29 | 3. sphinx
30 |
31 | # Notebook Builds
32 |
33 | We're using `nbconvert` to execute the notebooks, and then convert them
34 | to HTML. The conversion is handled by `statsmodels/tools/nbgenerate.py`.
35 | The default python kernel (embedded in the notebook) is `python3`.
36 | You need at least `nbconvert==4.2.0` to specify a non-default kernel,
37 | which can be passed in the Makefile.
38 |
--------------------------------------------------------------------------------
/docs/zh/fix_longtable.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import sys
3 | import os
4 |
5 |
6 | BUILDDIR = sys.argv[-1]
7 | read_file_path = os.path.join(BUILDDIR,'latex','statsmodels.tex')
8 | write_file_path = os.path.join(BUILDDIR, 'latex','statsmodels_tmp.tex')
9 |
10 | read_file = open(read_file_path,'r')
11 | write_file = open(write_file_path, 'w')
12 |
13 | for line in read_file:
14 | if 'longtable}{LL' in line:
15 | line = line.replace('longtable}{LL', 'longtable}{|l|l|')
16 | write_file.write(line)
17 |
18 | read_file.close()
19 | write_file.close()
20 |
21 | os.remove(read_file_path)
22 | os.rename(write_file_path, read_file_path)
23 |
--------------------------------------------------------------------------------
/docs/zh/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 |
11 | set SOURCEDIR=source
12 | set BUILDDIR=build
13 | set SPHINXPROJ=statsmodels
14 | set SPHINXOPTS=-j auto
15 |
16 | set TOOLSPATH=../tools
17 | set DATASETBUILD=dataset_rst.py
18 | set NOTEBOOKBUILD=nbgenerate.py
19 | set FOLDTOC=fold_toc.py
20 |
21 | if "%1" == "" goto help
22 |
23 | %SPHINXBUILD% >NUL 2>NUL
24 | if errorlevel 9009 (
25 | echo.
26 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
27 | echo.installed, then set the SPHINXBUILD environment variable to point
28 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
29 | echo.may add the Sphinx directory to PATH.
30 | echo.
31 | echo.If you don't have Sphinx installed, grab it from
32 | echo.http://sphinx-doc.org/
33 | exit /b 1
34 | )
35 |
36 | if "%1" == "html" (
37 | echo mkdir %BUILDDIR%\html\_static
38 | mkdir %BUILDDIR%\html\_static
39 | echo python %TOOLSPATH%/%NOTEBOOKBUILD% --parallel --report-errors --skip-existing
40 | python %TOOLSPATH%/%NOTEBOOKBUILD% --parallel --report-errors --skip-existing
41 | echo python %TOOLSPATH%/%DATASETBUILD%
42 | python %TOOLSPATH%/%DATASETBUILD%
43 | )
44 |
45 | echo %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
46 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
47 | if errorlevel 1 exit /b 1
48 |
49 | if "%1" == "html" (
50 | echo xcopy /s source/examples/notebooks/generated/*.html %BUILDDIR%/html/examples/notebooks/generated
51 | xcopy /s source/examples/notebooks/generated/*.html %BUILDDIR%/html/examples/notebooks/generated
52 | echo python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/index.html
53 | python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/index.html
54 | echo python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/examples/index.html ../_static
55 | python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/examples/index.html ../_static
56 | echo python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/dev/index.html ../_static
57 | python %TOOLSPATH%/%FOLDTOC% %BUILDDIR%/html/dev/index.html ../_static
58 | if NOT EXIST %BUILDDIR%/html/examples/notebooks/generated mkdir %BUILDDIR%\html\examples\notebooks\generated
59 | )
60 |
61 | goto end
62 |
63 | :help
64 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
65 |
66 | :end
67 | popd
68 |
--------------------------------------------------------------------------------
/docs/zh/source/_static/blogger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/blogger.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/blogger_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/blogger_sm.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/bullet.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/bullet.gif
--------------------------------------------------------------------------------
/docs/zh/source/_static/closelabel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/closelabel.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/facebox.css:
--------------------------------------------------------------------------------
1 | #facebox {
2 | position: absolute;
3 | top: 0;
4 | left: 0;
5 | z-index: 100;
6 | text-align: left;
7 | }
8 |
9 |
10 | #facebox .popup{
11 | position:relative;
12 | border:3px solid rgba(0,0,0,0);
13 | -webkit-border-radius:5px;
14 | -moz-border-radius:5px;
15 | border-radius:5px;
16 | -webkit-box-shadow:0 0 18px rgba(0,0,0,0.4);
17 | -moz-box-shadow:0 0 18px rgba(0,0,0,0.4);
18 | box-shadow:0 0 18px rgba(0,0,0,0.4);
19 | }
20 |
21 | #facebox .content {
22 | display:table;
23 | width: 370px;
24 | padding: 10px;
25 | background: #fff;
26 | -webkit-border-radius:4px;
27 | -moz-border-radius:4px;
28 | border-radius:4px;
29 | }
30 |
31 | #facebox .content > p:first-child{
32 | margin-top:0;
33 | }
34 | #facebox .content > p:last-child{
35 | margin-bottom:0;
36 | }
37 |
38 | #facebox .close{
39 | position:absolute;
40 | top:5px;
41 | right:5px;
42 | padding:2px;
43 | background:#fff;
44 | }
45 | #facebox .close img{
46 | opacity:0.3;
47 | }
48 | #facebox .close:hover img{
49 | opacity:1.0;
50 | }
51 |
52 | #facebox .loading {
53 | text-align: center;
54 | }
55 |
56 | #facebox .image {
57 | text-align: center;
58 | }
59 |
60 | #facebox img {
61 | border: 0;
62 | margin: 0;
63 | }
64 |
65 | #facebox_overlay {
66 | position: fixed;
67 | top: 0px;
68 | left: 0px;
69 | height:100%;
70 | width:100%;
71 | }
72 |
73 | .facebox_hide {
74 | z-index:-100;
75 | }
76 |
77 | .facebox_overlayBG {
78 | background-color: #000;
79 | z-index: 99;
80 | }
--------------------------------------------------------------------------------
/docs/zh/source/_static/gettingstarted_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/gettingstarted_0.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/anova.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/anova.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/categorical_interaction_plot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/categorical_interaction_plot.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/chi2_fitting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/chi2_fitting.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/contrasts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/contrasts.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/discrete_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/discrete_overview.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/distributed_estimation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/distributed_estimation.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/exponential_smoothing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/exponential_smoothing.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/fairs_data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/fairs_data.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/formulas_intro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/formulas_intro.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/generic_mle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/generic_mle.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/glm_formulas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/glm_formulas.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/glm_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/glm_overview.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/glm_weights.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/glm_weights.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/gls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/gls.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/influence_glm_logit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/influence_glm_logit.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/kde_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/kde_overview.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/markov_autoregression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/markov_autoregression.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/markov_regression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/markov_regression.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/mixed_lm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/mixed_lm.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/ols.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/ols.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/pca_fertility_factors.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/pca_fertility_factors.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/plots_boxplots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/plots_boxplots.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/prediction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/prediction.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/quantile_regression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/quantile_regression.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/recursive_ls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/recursive_ls.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/regression_diagnostics.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/regression_diagnostics.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/regression_plots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/regression_plots.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/rlm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/rlm.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/rlm_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/rlm_overview.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_arma0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_arma0.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_concentrated_scale.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_concentrated_scale.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_cycles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_cycles.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_dfm_coincident.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_dfm_coincident.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_local_linear_trend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_local_linear_trend.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_sarimax_internet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_sarimax_internet.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_sarimax_stata.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_sarimax_stata.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_seasonal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_seasonal.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_structural_harvey_jaeger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_structural_harvey_jaeger.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/statespace_varmax.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/statespace_varmax.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/tsa_arma0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/tsa_arma0.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/tsa_arma1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/tsa_arma1.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/tsa_dates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/tsa_dates.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/tsa_filters.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/tsa_filters.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/images/wls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/images/wls.png
--------------------------------------------------------------------------------
/docs/zh/source/_static/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/loading.gif
--------------------------------------------------------------------------------
/docs/zh/source/_static/minus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/minus.gif
--------------------------------------------------------------------------------
/docs/zh/source/_static/mktree.css:
--------------------------------------------------------------------------------
1 | /* Put this inside a @media qualifier so Netscape 4 ignores it */
2 | @media screen, print {
3 | /* Turn off list bullets */
4 | ul.mktree li { list-style: none; }
5 | /* Control how "spaced out" the tree is */
6 | ul.mktree, ul.mktree ul , ul.mktree li { margin-left:10px; padding:0px; }
7 | /* Provide space for our own "bullet" inside the LI */
8 | ul.mktree li .bullet { padding-left: 15px; }
9 | /* Show "bullets" in the links, depending on the class of the LI that the link's in */
10 | ul.mktree li.liOpen .bullet { cursor: pointer; background: url(minus.gif) center left no-repeat; }
11 | ul.mktree li.liClosed .bullet { cursor: pointer; background: url(plus.gif) center left no-repeat; }
12 | ul.mktree li.liBullet .bullet { cursor: default; background: url(bullet.gif) center left no-repeat; }
13 | /* Sublists are visible or not based on class of parent LI */
14 | ul.mktree li.liOpen ul { display: block; }
15 | ul.mktree li.liClosed ul { display: none; }
16 |
17 | /* Format menu items differently depending on what level of the tree they are in */
18 | /* Uncomment this if you want your fonts to decrease in size the deeper they are in the tree */
19 | /*
20 | ul.mktree li ul li { font-size: 90% }
21 | */
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/docs/zh/source/_static/plus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/_static/plus.gif
--------------------------------------------------------------------------------
/docs/zh/source/_static/scripts.js:
--------------------------------------------------------------------------------
1 | function cleanUpText(codebox){
2 | /// Not currently used
3 | /// Strips a whole IPython session of input and output prompts
4 | //escape quotation marks
5 | codebox = codebox.replace(/"/g, "\'");
6 |
7 | // newlines
8 | codebox = codebox.replace(/[\r\n|\r|\n]$/g, ""); // remove at end
9 | codebox = codebox.replace(/[\r\n|\r|\n]+/g, "\\n");
10 | // prompts
11 | codebox = codebox.replace(/In \[\d+\]: /g, "");
12 | codebox = codebox.replace(/Out \[\d+\]: /g, "");
13 |
14 | return codebox;
15 | }
16 |
17 | function htmlescape(text){
18 | return (text.replace(/&/g, "&")
19 | .replace(//g, ">")
21 | .replace(/"/g, """)
22 | .replace(/'/g, "'"))
23 | }
24 |
25 | function scrapeText(codebox){
26 | /// Returns input lines cleaned of prompt1 and prompt2
27 | var lines = codebox.split('\n');
28 | var newlines = new Array();
29 | $.each(lines, function() {
30 | if (this.match(/^In \[\d+]: /)){
31 | newlines.push(this.replace(/^(\s)*In \[\d+]: /,""));
32 | }
33 | else if (this.match(/^(\s)*\.+:/)){
34 | newlines.push(this.replace(/^(\s)*\.+: /,""));
35 | }
36 |
37 | }
38 | );
39 | return newlines.join('\\n');
40 | }
41 |
42 | $(document).ready(
43 | function() {
44 | // grab all code boxes
45 | var ipythoncode = $(".highlight-ipython");
46 | $.each(ipythoncode, function() {
47 | var codebox = scrapeText($(this).text());
48 | // give them a facebox pop-up with plain text code
49 | $(this).append('View Code');
50 | $(this,"textarea").select();
51 | });
52 | });
53 |
--------------------------------------------------------------------------------
/docs/zh/source/_templates/autosummary/class.rst:
--------------------------------------------------------------------------------
1 | {{ fullname }}
2 | {{ underline }}
3 |
4 | .. currentmodule:: {{ module }}
5 |
6 | .. autoclass:: {{ objname }}
7 |
8 | {% block methods %}
9 |
10 | {% if methods %}
11 | .. rubric:: Methods
12 |
13 | .. autosummary::
14 | :toctree:
15 | {% for item in methods %}
16 | {% if item != '__init__' %}
17 | ~{{ name }}.{{ item }}
18 | {% endif %}
19 | {%- endfor %}
20 | {% endif %}
21 | {% endblock %}
22 |
23 | {% block attributes %}
24 | {% if attributes %}
25 | .. rubric:: Attributes
26 |
27 | .. autosummary::
28 | {% for item in attributes %}
29 | ~{{ name }}.{{ item }}
30 | {%- endfor %}
31 | {% endif %}
32 | {% endblock %}
33 |
--------------------------------------------------------------------------------
/docs/zh/source/_templates/autosummary/glmfamilies.rst:
--------------------------------------------------------------------------------
1 | {{ fullname }}
2 | {{ underline }}
3 |
4 | .. currentmodule:: {{ module }}
5 |
6 | .. autoclass:: {{ objname }}
7 |
8 | {% block methods %}
9 |
10 | {% if methods %}
11 | .. rubric:: Methods
12 |
13 | .. autosummary::
14 | :toctree:
15 | {% for item in methods %}
16 | {% if item != '__init__' %}
17 | ~{{ name }}.{{ item }}
18 | {% endif %}
19 | {%- endfor %}
20 | {% endif %}
21 | {% endblock %}
22 |
--------------------------------------------------------------------------------
/docs/zh/source/anova.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.stats.anova
2 |
3 | .. _anova:
4 |
5 | ANOVA
6 | =====
7 |
8 | Analysis of Variance models containing anova_lm for ANOVA analysis with a
9 | linear OLSModel, and AnovaRM for repeated measures ANOVA, within ANOVA for
10 | balanced data.
11 |
12 | Examples
13 | --------
14 |
15 | .. ipython:: python
16 |
17 | import statsmodels.api as sm
18 | from statsmodels.formula.api import ols
19 |
20 | moore = sm.datasets.get_rdataset("Moore", "carData",
21 | cache=True) # load data
22 | data = moore.data
23 | data = data.rename(columns={"partner.status":
24 | "partner_status"}) # make name pythonic
25 | moore_lm = ols('conformity ~ C(fcategory, Sum)*C(partner_status, Sum)',
26 | data=data).fit()
27 |
28 | table = sm.stats.anova_lm(moore_lm, typ=2) # Type 2 ANOVA DataFrame
29 | print(table)
30 |
31 | A more detailed example for `anova_lm` can be found here:
32 |
33 | * `ANOVA `__
34 |
35 | Module Reference
36 | ----------------
37 |
38 | .. module:: statsmodels.stats.anova
39 | :synopsis: Analysis of Variance
40 |
41 | .. autosummary::
42 | :toctree: generated/
43 |
44 | anova_lm
45 | AnovaRM
46 |
--------------------------------------------------------------------------------
/docs/zh/source/dev/examples.rst:
--------------------------------------------------------------------------------
1 | .. _examples:
2 |
3 | Examples
4 | ========
5 |
6 | Examples are invaluable for new users who hope to get up and running quickly
7 | with `statsmodels`, and they are extremely useful to those who wish to explore
8 | new features of `statsmodels`. We hope to provide documentation and tutorials
9 | for as many models and use-cases as possible! Please consider submitting an example with any PR that introduces new functionality.
10 |
11 | User-contributed examples/tutorials/recipes can be placed on the
12 | `statsmodels examples wiki page `_
13 | That wiki page is freely editable. Please post your cool tricks,
14 | examples, and recipes on there!
15 |
16 | If you would rather have your example file officially accepted to the
17 | `statsmodels` distribution and posted on this website, you will need to go
18 | through the normal `patch submission process `_ and follow the instructions that follow.
19 |
20 | File Format
21 | ~~~~~~~~~~~
22 |
23 | Examples are best contributed as IPython notebooks. Save your notebook with all output cells cleared in ``examples/notebooks``. From the notebook save the pure Python output to ``examples/python``. The first line of the Notebook *must* be a header cell that contains a title for the notebook, if you want the notebook to be included in the documentation.
24 |
25 |
26 | The Example Gallery
27 | ~~~~~~~~~~~~~~~~~~~
28 |
29 | We have a gallery of example notebooks available `here `_. If you would like your example to show up in this gallery, add a link to the notebook in ``docs/source/examples/landing.json``. For the thumbnail, take a screenshot of what you think is the best "hook" for the notebook. The image will be displayed at 360 x 225 (W x H). It's best to save the image as a PNG with a resolution that is some multiple of 360 x 225 (720 x 450 is preferred).
30 |
31 |
32 | Before submitting a PR
33 | ~~~~~~~~~~~~~~~~~~~~~~
34 |
35 | To save you some time and to make the new examples nicely fit into the existing
36 | ones consider the following points.
37 |
38 | **Look at examples source code** to get a feel for how statsmodels examples should look like.
39 |
40 | **Build the docs** by running `make html` from the docs directory to see how your example looks in the fully rendered html pages.
41 |
--------------------------------------------------------------------------------
/docs/zh/source/dev/get_involved.rst:
--------------------------------------------------------------------------------
1 | Get Involved
2 | ============
3 |
4 | Where to Start?
5 | ---------------
6 |
7 | Use grep or download a tool like `grin `__ to search the code for TODO notes::
8 |
9 | grin -i -I "*.py*" todo
10 |
11 | This shows almost 700 TODOs in the code base right now. Feel free to inquire on the mailing list about any of these.
12 |
13 | Sandbox
14 | -------
15 |
16 | We currently have a large amount code in the :ref:`sandbox`. The medium term goal is to move much of this to feature branches as it gets worked on and remove the sandbox folder. Many of these models and functions are close to done, however, and we welcome any and all contributions to complete them, including refactoring, documentation, and tests. These models include generalized additive models (GAM), information theoretic models such as maximum entropy, survival models, systems of equation models, restricted least squares, panel data models, and time series models such as (G)ARCH.
17 |
18 | .. .. toctree::
19 | .. :maxdepth: 4
20 | ..
21 | .. ../sandbox
22 |
23 | Contribute an Example
24 | ---------------------
25 |
26 | Contribute an :ref:`example `, add some technical documentation, or contribute a statistics tutorial.
27 |
--------------------------------------------------------------------------------
/docs/zh/source/dev/images/git_merge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/dev/images/git_merge.png
--------------------------------------------------------------------------------
/docs/zh/source/dev/internal.rst:
--------------------------------------------------------------------------------
1 | .. _model:
2 |
3 |
4 |
5 | Internal Classes
6 | ================
7 |
8 | The following summarizes classes and functions that are not intended to be
9 | directly used, but of interest only for internal use or for a developer who
10 | wants to extend on existing model classes.
11 |
12 |
13 | Module Reference
14 | ----------------
15 |
16 | Model and Results Classes
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^
18 |
19 | These are the base classes for both the estimation models and the results.
20 | They are not directly useful, but layout the structure of the subclasses and
21 | define some common methods.
22 |
23 | .. module:: statsmodels.base.model
24 | :synopsis: Base classes that are inherited by models
25 |
26 | .. currentmodule:: statsmodels.base.model
27 |
28 | .. autosummary::
29 | :toctree: generated/
30 |
31 | Model
32 | LikelihoodModel
33 | GenericLikelihoodModel
34 | Results
35 | LikelihoodModelResults
36 | ResultMixin
37 | GenericLikelihoodModelResults
38 |
39 | .. module:: statsmodels.stats.contrast
40 | :synopsis: Classes for statistical test
41 |
42 | .. currentmodule:: statsmodels.stats.contrast
43 |
44 | .. autosummary::
45 | :toctree: generated/
46 |
47 | ContrastResults
48 |
49 | .. inheritance-diagram:: statsmodels.base.model statsmodels.discrete.discrete_model statsmodels.regression.linear_model statsmodels.miscmodels.count
50 | :parts: 3
51 |
52 |
53 | .. inheritance-diagram:: statsmodels.regression.linear_model.GLS statsmodels.regression.linear_model.WLS statsmodels.regression.linear_model.OLS statsmodels.regression.linear_model.GLSAR
54 | :parts: 1
55 |
56 | Linear Model
57 | ^^^^^^^^^^^^
58 |
59 | .. inheritance-diagram:: statsmodels.regression.linear_model
60 | :parts: 1
61 |
62 | Generalized Linear Model
63 | ^^^^^^^^^^^^^^^^^^^^^^^^
64 |
65 | .. inheritance-diagram:: statsmodels.genmod.generalized_linear_model
66 | statsmodels.genmod.families.family statsmodels.genmod.families.links
67 | :parts: 1
68 |
69 | Discrete Model
70 | ^^^^^^^^^^^^^^
71 |
72 | .. inheritance-diagram:: statsmodels.discrete.discrete_model
73 | :parts: 1
74 |
75 | Robust Model
76 | ^^^^^^^^^^^^
77 |
78 | .. inheritance-diagram:: statsmodels.robust.robust_linear_model
79 | :parts: 1
80 |
81 | Vector Autoregressive Model
82 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
83 |
84 | .. inheritance-diagram:: statsmodels.tsa.vector_ar.var_model
85 | :parts: 3
86 |
--------------------------------------------------------------------------------
/docs/zh/source/dev/testing.rst:
--------------------------------------------------------------------------------
1 | Testing on Build Machines
2 | -------------------------
3 |
4 | There are currently several places that statsmodels is automatically built and tested against different dependency and Python versions and architectures. Check these logs periodically, make sure everything looks okay, and fix any failures.:
5 |
6 | * `Travis CI `_
7 | * `Daily testing on Ubuntu via Python(x,y) `_
8 | * `NiPy testing on SPARC Boxes `_
9 |
10 | The test coverage pages are here.
11 |
12 | * `Coveralls `_
13 |
--------------------------------------------------------------------------------
/docs/zh/source/distributions.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.sandbox.distributions
2 | :synopsis: Probability distributions
3 |
4 | .. currentmodule:: statsmodels.sandbox.distributions
5 |
6 | .. _distributions:
7 |
8 |
9 | Distributions
10 | =============
11 |
12 | This section collects various additional functions and methods for statistical
13 | distributions.
14 |
15 | Empirical Distributions
16 | -----------------------
17 |
18 | .. module:: statsmodels.distributions.empirical_distribution
19 | :synopsis: Tools for working with empirical distributions
20 |
21 | .. currentmodule:: statsmodels.distributions.empirical_distribution
22 |
23 | .. autosummary::
24 | :toctree: generated/
25 |
26 | ECDF
27 | StepFunction
28 | monotone_fn_inverter
29 |
30 | Distribution Extras
31 | -------------------
32 |
33 |
34 | .. module:: statsmodels.sandbox.distributions.extras
35 | :synopsis: Probability distributions and random number generators
36 |
37 | .. currentmodule:: statsmodels.sandbox.distributions.extras
38 |
39 | *Skew Distributions*
40 |
41 | .. autosummary::
42 | :toctree: generated/
43 |
44 | SkewNorm_gen
45 | SkewNorm2_gen
46 | ACSkewT_gen
47 | skewnorm2
48 |
49 | *Distributions based on Gram-Charlier expansion*
50 |
51 | .. autosummary::
52 | :toctree: generated/
53 |
54 | pdf_moments_st
55 | pdf_mvsk
56 | pdf_moments
57 | NormExpan_gen
58 |
59 | *cdf of multivariate normal* wrapper for scipy.stats
60 |
61 |
62 | .. autosummary::
63 | :toctree: generated/
64 |
65 | mvstdnormcdf
66 | mvnormcdf
67 |
68 | Univariate Distributions by non-linear Transformations
69 | ------------------------------------------------------
70 |
71 | Univariate distributions can be generated from a non-linear transformation of an
72 | existing univariate distribution. `Transf_gen` is a class that can generate a new
73 | distribution from a monotonic transformation, `TransfTwo_gen` can use hump-shaped
74 | or u-shaped transformation, such as abs or square. The remaining objects are
75 | special cases.
76 |
77 | .. module:: statsmodels.sandbox.distributions.transformed
78 | :synopsis: Experimental probability distributions and random number generators
79 |
80 | .. currentmodule:: statsmodels.sandbox.distributions.transformed
81 |
82 | .. autosummary::
83 | :toctree: generated/
84 |
85 | TransfTwo_gen
86 | Transf_gen
87 |
88 | ExpTransf_gen
89 | LogTransf_gen
90 | SquareFunc
91 |
92 | absnormalg
93 | invdnormalg
94 |
95 | loggammaexpg
96 | lognormalg
97 | negsquarenormalg
98 |
99 | squarenormalg
100 | squaretg
101 |
--------------------------------------------------------------------------------
/docs/zh/source/emplike.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.emplike
2 |
3 |
4 | .. _emplike:
5 |
6 |
7 | Empirical Likelihood :mod:`emplike`
8 | ====================================
9 |
10 |
11 | Introduction
12 | ------------
13 |
14 | Empirical likelihood is a method of nonparametric inference and estimation that lifts the
15 | obligation of having to specify a family of underlying distributions. Moreover, empirical
16 | likelihood methods do not require re-sampling but still
17 | uniquely determine confidence regions whose shape mirrors the shape of the data.
18 | In essence, empirical likelihood attempts to combine the benefits of parametric
19 | and nonparametric methods while limiting their shortcomings. The main difficulties of
20 | empirical likelihood is the computationally intensive methods required to conduct inference.
21 | :mod:`statsmodels.emplike` attempts to provide a user-friendly interface that allows the
22 | end user to effectively conduct empirical likelihood analysis without having to concern
23 | themselves with the computational burdens.
24 |
25 | Currently, :mod:`emplike` provides methods to conduct hypothesis tests and form confidence
26 | intervals for descriptive statistics. Empirical likelihood estimation and inference
27 | in a regression, accelerated failure time and instrumental variable model are
28 | currently under development.
29 |
30 | References
31 | ^^^^^^^^^^
32 |
33 | The main reference for empirical likelihood is::
34 |
35 | Owen, A.B. "Empirical Likelihood." Chapman and Hall, 2001.
36 |
37 |
38 |
39 | Examples
40 | --------
41 |
42 | .. ipython:: python
43 |
44 | import numpy as np
45 | import statsmodels.api as sm
46 |
47 | # Generate Data
48 | x = np.random.standard_normal(50)
49 |
50 | # initiate EL
51 | el = sm.emplike.DescStat(x)
52 |
53 | # confidence interval for the mean
54 | el.ci_mean()
55 |
56 | # test variance is 1
57 | el.test_var(1)
58 |
59 |
60 | Module Reference
61 | ----------------
62 |
63 | .. module:: statsmodels.emplike
64 | :synopsis: Empirical likelihood tools
65 |
66 | .. autosummary::
67 | :toctree: generated/
68 |
69 | descriptive.DescStat
70 | descriptive.DescStatUV
71 | descriptive.DescStatMV
72 |
--------------------------------------------------------------------------------
/docs/zh/source/examples/README:
--------------------------------------------------------------------------------
1 | The format for landing.json should be self-explanatory. The images should be placed in docs/source/_static/images/. They will be displayed at 360 x 225 (W x H). It's best to save them as a png with a resolution of a multiple of at least 720 x 450. If you want, you can use png crush to make the images smaller.
2 |
--------------------------------------------------------------------------------
/docs/zh/source/examples/index.rst:
--------------------------------------------------------------------------------
1 | :orphan:
2 |
3 | .. _statsmodels-examples:
4 |
5 | Statsmodels Examples
6 | ====================
7 |
8 | This page provides a series of examples, tutorials and recipes to help you get
9 | started with ``statsmodels``. Each of the examples shown here is made available
10 | as an IPython Notebook and as a plain python script on the `statsmodels github
11 | repository `_.
12 |
13 | We also encourage users to submit their own examples, tutorials or cool
14 | `statsmodels` trick to the `Examples wiki page
15 | `_
16 |
17 | The Examples
18 | ------------
19 |
20 | .. toctree::
21 | :maxdepth: 3
22 | :glob:
23 |
24 | notebooks/generated/*
25 |
--------------------------------------------------------------------------------
/docs/zh/source/extending.rst.TXT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/extending.rst.TXT
--------------------------------------------------------------------------------
/docs/zh/source/faq.rst:
--------------------------------------------------------------------------------
1 | :orphan:
2 |
3 | .. currentmodule:: statsmodels
4 |
5 | .. _faq:
6 |
7 | Frequently Asked Question
8 | -------------------------
9 |
10 | .. _endog-exog-faq:
11 |
12 | What do endog and exog mean?
13 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 |
15 | These are shorthand for endogenous and exogenous variables. You might be more comfortable with the common ``y`` and ``X`` notation in linear models. Sometimes the endogenous variable ``y`` is called a dependent variable. Likewise, sometimes the exogenous variables ``X`` are called the independent variables. You can read about this in greater detail at :ref:`endog_exog`
16 |
17 |
18 | .. _missing-faq:
19 |
20 | How does statsmodels handle missing data?
21 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 |
23 | Missing data can be handled via the ``missing`` keyword argument. Every model takes this keyword. You can find more information in the docstring of :class:`statsmodels.base.Model `.
24 |
25 | .. `Model class `_.
26 |
27 | .. _build-faq:
28 |
29 | Why won't statsmodels build?
30 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 |
32 | If you're on Python 3.4, you *must* use Cython 0.20.1. If you're still having problems, try running
33 |
34 | .. code-block:: bash
35 |
36 | python setup.py clean
37 |
38 | What if my question isn't answered here?
39 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40 |
41 | You may find answers for questions that have not yet been added here on GitHub under the `FAQ issues tag `_. If not, please ask your question on stackoverflow using the `statsmodels tag `_ or on the `mailing list `_.
42 |
--------------------------------------------------------------------------------
/docs/zh/source/genericmle.rst.TXT:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/genericmle.rst.TXT
--------------------------------------------------------------------------------
/docs/zh/source/glm_techn1.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.glm
2 |
3 |
4 | .. _glm_techn1:
5 |
6 | Technical Documentation
7 | =======================
8 |
9 | Introduction
10 | ------------
11 |
12 | Just a placeholder
13 |
--------------------------------------------------------------------------------
/docs/zh/source/glm_techn2.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.glm
2 |
3 |
4 | .. _glm_techn2:
5 |
6 | Technical Documentation - part 2
7 | ================================
8 |
9 | Implementation Notes
10 | --------------------
11 |
12 | Just a placeholder
13 |
--------------------------------------------------------------------------------
/docs/zh/source/gmm.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.sandbox.regression.gmm
2 |
3 |
4 | .. _gmm:
5 |
6 |
7 | Generalized Method of Moments :mod:`gmm`
8 | ========================================
9 |
10 | :mod:`statsmodels.gmm` contains model classes and functions that are based on
11 | estimation with Generalized Method of Moments.
12 | Currently the general non-linear case is implemented. An example class for the standard
13 | linear instrumental variable model is included. This has been introduced as a test case, it
14 | works correctly but it does not take the linear structure into account. For the linear
15 | case we intend to introduce a specific implementation which will be faster and numerically
16 | more accurate.
17 |
18 | Currently, GMM takes arbitrary non-linear moment conditions and calculates the estimates
19 | either for a given weighting matrix or iteratively by alternating between estimating
20 | the optimal weighting matrix and estimating the parameters. Implementing models with
21 | different moment conditions is done by subclassing GMM. In the minimal implementation
22 | only the moment conditions, `momcond` have to be defined.
23 |
24 | .. currentmodule:: statsmodels.sandbox.regression.gmm
25 |
26 |
27 | Module Reference
28 | """"""""""""""""
29 |
30 | .. module:: statsmodels.sandbox.regression.gmm
31 | :synopsis: A framework for implementing Generalized Method of Moments (GMM)
32 |
33 | .. autosummary::
34 | :toctree: generated/
35 |
36 | GMM
37 | GMMResults
38 | IV2SLS
39 | IVGMM
40 | IVGMMResults
41 | IVRegressionResults
42 | LinearIVGMM
43 | NonlinearIVGMM
44 |
--------------------------------------------------------------------------------
/docs/zh/source/gmm_techn1.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.sandbox.regression.gmm
2 |
3 |
4 | .. _gmm_techn1:
5 |
6 | Technical Documentation
7 | =======================
8 |
9 | Introduction
10 | ------------
11 |
12 | Generalized Method of Moments is an extension of the Method of Moments
13 | if there are more moment conditions than parameters that are estimated.
14 |
15 | simple example
16 |
17 |
18 | General Structure and Implementation
19 | ------------------------------------
20 |
21 | The main class for GMM estimation, makes little assumptions about the
22 | moment conditions. It is designed for the general case when moment
23 | conditions are given as function by the user.
24 |
25 | ::
26 |
27 | def momcond(params)
28 |
29 | which should return a two dimensional array with observation in rows
30 | and moment conditions in columns. Denote this function by `$g(\theta)$`. Then
31 | the GMM estimator is given as the solution to the maximization problem:
32 |
33 | ..math: max_{\theta) g(theta)' W g(theta) (1)
34 |
35 | The weighting matrix can be estimated in several different ways. The
36 | basic method `fitgmm` takes the weighting matrix as argument or if it is
37 | not given takes the identity matrix and maximizes (1)
38 | taking W as given. Since the optimizing functions solve minimization problems,
39 | we usually minimizes the negative of the objective function.
40 | `fit_iterative` calculates the optimal weighting matrix and maximizes the
41 | criterion function in alternating steps. The number of iterations can
42 | be given as an argument to this fit method. The optimal weighting matrix,
43 | which is the covariance matrix of the moment conditions, can be estimated
44 | in different ways. Kernel and shrinkage estimators are planned but not yet
45 | implemented. TODO
46 |
47 | The GMM class itself does not define any moment conditions. To get an
48 | estimator for given moment conditions, GMM needs to be subclassed.
49 | The basic structure of writing new models based on
50 | the generic MLE or GMM framework and subclassing is described in
51 | `extending.rst` (TODO: link)
52 |
53 | As an example
54 |
--------------------------------------------------------------------------------
/docs/zh/source/graphics.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.graphics
2 |
3 | .. _graphics:
4 |
5 | Graphics
6 | ========
7 |
8 | .. automodule:: statsmodels.graphics
9 |
10 | Goodness of Fit Plots
11 | ---------------------
12 |
13 | .. autosummary::
14 | :toctree: generated/
15 |
16 | gofplots.qqplot
17 | gofplots.qqline
18 | gofplots.qqplot_2samples
19 | gofplots.ProbPlot
20 |
21 | Boxplots
22 | --------
23 |
24 | .. autosummary::
25 | :toctree: generated/
26 |
27 | boxplots.violinplot
28 | boxplots.beanplot
29 |
30 | Correlation Plots
31 | ------------------
32 |
33 | .. autosummary::
34 | :toctree: generated/
35 |
36 | correlation.plot_corr
37 | correlation.plot_corr_grid
38 | plot_grids.scatter_ellipse
39 |
40 | Functional Plots
41 | ----------------
42 |
43 | .. autosummary::
44 | :toctree: generated/
45 |
46 | functional.hdrboxplot
47 | functional.fboxplot
48 | functional.rainbowplot
49 | functional.banddepth
50 |
51 | Regression Plots
52 | ----------------
53 |
54 | .. autosummary::
55 | :toctree: generated/
56 |
57 | regressionplots.plot_fit
58 | regressionplots.plot_regress_exog
59 | regressionplots.plot_partregress
60 | regressionplots.plot_ccpr
61 | regressionplots.abline_plot
62 | regressionplots.influence_plot
63 | regressionplots.plot_leverage_resid2
64 |
65 | Time Series Plots
66 | -----------------
67 |
68 | .. autosummary::
69 | :toctree: generated/
70 |
71 | tsaplots.plot_acf
72 | tsaplots.plot_pacf
73 | tsaplots.month_plot
74 | tsaplots.quarter_plot
75 |
76 | Other Plots
77 | -----------
78 |
79 | .. autosummary::
80 | :toctree: generated/
81 |
82 | factorplots.interaction_plot
83 | mosaicplot.mosaic
84 | agreement.mean_diff_plot
85 |
--------------------------------------------------------------------------------
/docs/zh/source/images/aw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/aw.png
--------------------------------------------------------------------------------
/docs/zh/source/images/hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/hl.png
--------------------------------------------------------------------------------
/docs/zh/source/images/ht.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/ht.png
--------------------------------------------------------------------------------
/docs/zh/source/images/ls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/ls.png
--------------------------------------------------------------------------------
/docs/zh/source/images/re.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/re.png
--------------------------------------------------------------------------------
/docs/zh/source/images/statsmodels_hybi_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/statsmodels_hybi_banner.png
--------------------------------------------------------------------------------
/docs/zh/source/images/statsmodels_hybi_favico.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/statsmodels_hybi_favico.ico
--------------------------------------------------------------------------------
/docs/zh/source/images/tk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/tk.png
--------------------------------------------------------------------------------
/docs/zh/source/images/tm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/source/images/tm.png
--------------------------------------------------------------------------------
/docs/zh/source/imputation.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.imputation.mice
2 | :synopsis: Multiple imputation for missing data
3 |
4 | .. currentmodule:: statsmodels.imputation.mice
5 |
6 | .. _imputation:
7 |
8 |
9 | Multiple Imputation with Chained Equations
10 | ==========================================
11 |
12 | The MICE module allows most Statsmodels models to be fit to a dataset
13 | with missing values on the independent and/or dependent variables, and
14 | provides rigorous standard errors for the fitted parameters. The
15 | basic idea is to treat each variable with missing values as the
16 | dependent variable in a regression, with some or all of the remaining
17 | variables as its predictors. The MICE procedure cycles through these
18 | models, fitting each in turn, then uses a procedure called "predictive
19 | mean matching" (PMM) to generate random draws from the predictive
20 | distributions determined by the fitted models. These random draws
21 | become the imputed values for one imputed data set.
22 |
23 | By default, each variable with missing variables is modeled using a
24 | linear regression with main effects for all other variables in the
25 | data set. Note that even when the imputation model is linear, the PMM
26 | procedure preserves the domain of each variable. Thus, for example,
27 | if all observed values for a given variable are positive, all imputed
28 | values for the variable will always be positive. The user also has
29 | the option to specify which model is used to produce imputed values
30 | for each variable.
31 |
32 | .. code
33 |
34 |
35 | Classes
36 | -------
37 |
38 | .. currentmodule:: statsmodels.imputation.mice
39 |
40 | .. autosummary::
41 | :toctree: generated/
42 |
43 | MICE
44 | MICEData
45 |
46 |
47 | Implementation Details
48 | ----------------------
49 |
50 | Internally, this function uses
51 | `pandas.isnull `_.
52 | Anything that returns True from this function will be treated as missing data.
53 |
--------------------------------------------------------------------------------
/docs/zh/source/iolib.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.iolib
2 |
3 | .. _iolib:
4 |
5 | Input-Output :mod:`iolib`
6 | =========================
7 |
8 | ``statsmodels`` offers some functions for input and output. These include a
9 | reader for STATA files, a class for generating tables for printing in several
10 | formats and two helper functions for pickling.
11 |
12 | Users can also leverage the powerful input/output functions provided by :ref:`pandas.io `. Among other things, ``pandas`` (a ``statsmodels`` dependency) allows reading and writing to Excel, CSV, and HDF5 (PyTables).
13 |
14 | Examples
15 | --------
16 |
17 | `SimpleTable: Basic example `__
18 |
19 | Module Reference
20 | ----------------
21 |
22 | .. module:: statsmodels.iolib
23 | :synopsis: Tools for reading datasets and producing summary output
24 |
25 | .. autosummary::
26 | :toctree: generated/
27 |
28 | foreign.StataReader
29 | foreign.StataWriter
30 | foreign.genfromdta
31 | foreign.savetxt
32 | table.SimpleTable
33 | table.csv2st
34 | smpickle.save_pickle
35 | smpickle.load_pickle
36 |
37 |
38 | The following are classes and functions used to return the summary of
39 | estimation results, and mostly intended for internal use. There are currently
40 | two versions for creating summaries.
41 |
42 | .. autosummary::
43 | :toctree: generated/
44 |
45 | summary.Summary
46 | summary2.Summary
47 |
--------------------------------------------------------------------------------
/docs/zh/source/miscmodels.rst:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | .. module:: statsmodels.miscmodels
5 | .. currentmodule:: statsmodels.miscmodels
6 |
7 |
8 | .. _miscmodels:
9 |
10 |
11 | Other Models :mod:`miscmodels`
12 | ==============================
13 |
14 | :mod:`statsmodels.miscmodels` contains model classes and that do not yet fit into
15 | any other category, or are basic implementations that are not yet polished and will most
16 | likely still change. Some of these models were written as examples for the generic
17 | maximum likelihood framework, and there will be others that might be based on general
18 | method of moments.
19 |
20 | The models in this category have been checked for basic cases, but might be more exposed
21 | to numerical problems than the complete implementation. For example, count.Poisson has
22 | been added using only the generic maximum likelihood framework, the standard errors
23 | are based on the numerical evaluation of the Hessian, while discretemod.Poisson uses
24 | analytical Gradients and Hessian and will be more precise, especially in cases when there
25 | is strong multicollinearity.
26 | On the other hand, by subclassing GenericLikelihoodModel, it is easy to add new models,
27 | another example can be seen in the zero inflated Poisson model, miscmodels.count.
28 |
29 |
30 | Count Models :mod:`count`
31 | --------------------------
32 |
33 | .. module:: statsmodels.miscmodels.count
34 | .. currentmodule:: statsmodels.miscmodels.count
35 |
36 | .. autosummary::
37 | :toctree: generated/
38 |
39 | PoissonGMLE
40 | PoissonOffsetGMLE
41 | PoissonZiGMLE
42 |
43 | Linear Model with t-distributed errors
44 | --------------------------------------
45 |
46 | This is a class that shows that a new model can be defined by only specifying the
47 | method for the loglikelihood. All result statistics are inherited from the generic
48 | likelihood model and result classes. The results have been checked against R for a
49 | simple case.
50 |
51 | .. module:: statsmodels.miscmodels.tmodel
52 | .. currentmodule:: statsmodels.miscmodels.tmodel
53 |
54 | .. autosummary::
55 | :toctree: generated/
56 |
57 | TLinearModel
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/zh/source/missing.rst:
--------------------------------------------------------------------------------
1 | :orphan:
2 |
3 | .. _missing_data:
4 |
5 | Missing Data
6 | ------------
7 | All of the models can handle missing data. For performance reasons, the default is not to do any checking for missing data. If, however, you would like for missing data to be handled internally, you can do so by using the missing keyword argument. The default is to do nothing
8 |
9 | .. ipython:: python
10 |
11 | import statsmodels.api as sm
12 | data = sm.datasets.longley.load(as_pandas=False)
13 | data.exog = sm.add_constant(data.exog)
14 | # add in some missing data
15 | missing_idx = np.array([False] * len(data.endog))
16 | missing_idx[[4, 10, 15]] = True
17 | data.endog[missing_idx] = np.nan
18 | ols_model = sm.OLS(data.endog, data.exog)
19 | ols_fit = ols_model.fit()
20 | print(ols_fit.params)
21 |
22 | This silently fails and all of the model parameters are NaN, which is probably not what you expected. If you are not sure whether or not you have missing data you can use `missing = 'raise'`. This will raise a `MissingDataError` during model instantiation if missing data is present so that you know something was wrong in your input data.
23 |
24 | .. ipython:: python
25 | :okexcept:
26 |
27 | ols_model = sm.OLS(data.endog, data.exog, missing='raise')
28 |
29 | If you want statsmodels to handle the missing data by dropping the observations, use `missing = 'drop'`.
30 |
31 | .. ipython:: python
32 |
33 | ols_model = sm.OLS(data.endog, data.exog, missing='drop')
34 |
35 | We are considering adding a configuration framework so that you can set the option with a global setting.
36 |
--------------------------------------------------------------------------------
/docs/zh/source/mixed_glm.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.genmod.bayes_mixed_glm
2 |
3 | Generalized Linear Mixed Effects Models
4 | =======================================
5 |
6 | Generalized Linear Mixed Effects (GLIMMIX) models are generalized
7 | linear models with random effects in the linear predictors.
8 | Statsmodels currently supports estimation of binomial and Poisson
9 | GLIMMIX models using two Bayesian methods: the Laplace approximation
10 | to the posterior, and a variational Bayes approximation to the
11 | posterior. Both methods provide point estimates (posterior means) and
12 | assessments of uncertainty (posterior standard deviation).
13 |
14 | The current implementation only supports independent random effects.
15 |
16 | Technical Documentation
17 | -----------------------
18 |
19 | Unlike Statsmodels mixed linear models, the GLIMMIX implementation is
20 | not group-based. Groups are created by interacting all random effects
21 | with a categorical variable. Note that this creates large, sparse
22 | random effects design matrices `exog_vc`. Internally, `exog_vc` is
23 | converted to a scipy sparse matrix. When passing the arguments
24 | directly to the class initializer, a sparse matrix may be passed.
25 | When using formulas, a dense matrix is created then converted to
26 | sparse. For very large problems, it may not be feasible to use
27 | formulas due to the size of this dense intermediate matrix.
28 |
29 | References
30 | ^^^^^^^^^^
31 |
32 | Blei, Kucukelbir, McAuliffe (2017). Variational Inference: A review
33 | for Statisticians https://arxiv.org/pdf/1601.00670.pdf
34 |
35 | Module Reference
36 | ----------------
37 |
38 | .. module:: statsmodels.genmod.bayes_mixed_glm
39 | :synopsis: Bayes Mixed Generalized Linear Models
40 |
41 |
42 | The model classes are:
43 |
44 | .. autosummary::
45 | :toctree: generated/
46 |
47 | BinomialBayesMixedGLM
48 | PoissonBayesMixedGLM
49 |
50 | The result class is:
51 |
52 | .. autosummary::
53 | :toctree: generated/
54 |
55 | BayesMixedGLMResults
56 |
--------------------------------------------------------------------------------
/docs/zh/source/multivariate.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.multivariate
2 | :synopsis: Models for multivariate data
3 |
4 | .. currentmodule:: statsmodels.multivariate
5 |
6 | .. _multivariate:
7 |
8 |
9 | Multivariate Statistics :mod:`multivariate`
10 | ===========================================
11 |
12 | This section includes methods and algorithms from multivariate statistics.
13 |
14 |
15 | Principal Component Analysis
16 | ----------------------------
17 |
18 | .. module:: statsmodels.multivariate.pca
19 | :synopsis: Principal Component Analaysis
20 |
21 | .. currentmodule:: statsmodels.multivariate.pca
22 |
23 | .. autosummary::
24 | :toctree: generated/
25 |
26 | PCA
27 | pca
28 |
29 |
30 | Factor Analysis
31 | ---------------
32 |
33 | .. currentmodule:: statsmodels.multivariate.factor
34 |
35 | .. autosummary::
36 | :toctree: generated/
37 |
38 | Factor
39 | FactorResults
40 |
41 |
42 | Factor Rotation
43 | ---------------
44 |
45 | .. currentmodule:: statsmodels.multivariate.factor_rotation
46 |
47 | .. autosummary::
48 | :toctree: generated/
49 |
50 | rotate_factors
51 | target_rotation
52 | procrustes
53 | promax
54 |
55 |
56 | Canonical Correlation
57 | ---------------------
58 |
59 | .. currentmodule:: statsmodels.multivariate.cancorr
60 |
61 | .. autosummary::
62 | :toctree: generated/
63 |
64 | CanCorr
65 |
66 |
67 | MANOVA
68 | ------
69 |
70 | .. currentmodule:: statsmodels.multivariate.manova
71 |
72 | .. autosummary::
73 | :toctree: generated/
74 |
75 | MANOVA
76 |
77 |
78 | MultivariateOLS
79 | ---------------
80 |
81 | `_MultivariateOLS` is a model class with limited features. Currently it
82 | supports multivariate hypothesis tests and is used as backend for MANOVA.
83 |
84 | .. currentmodule:: statsmodels.multivariate.multivariate_ols
85 |
86 | .. autosummary::
87 | :toctree: generated/
88 |
89 | _MultivariateOLS
90 | _MultivariateOLSResults
91 | MultivariateTestResults
92 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/arma_predict_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import matplotlib.pyplot as plt
3 | import pandas as pd
4 |
5 | dta = sm.datasets.sunspots.load_pandas().data[['SUNACTIVITY']]
6 | dta.index = pd.DatetimeIndex(start='1700', end='2009', freq='A')
7 | res = sm.tsa.ARMA(dta, (3, 0)).fit(disp=0)
8 | fig, ax = plt.subplots()
9 | ax = dta.loc['1950':].plot(ax=ax)
10 | res.plot_predict('1990', '2012', dynamic=True, ax=ax,
11 | plot_insample=False)
12 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/bkf_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 |
3 | from load_macrodata import dta
4 |
5 | cycles = sm.tsa.filters.bkfilter(dta[['realinv']], 6, 24, 12)
6 |
7 | import matplotlib.pyplot as plt
8 | fig, ax = plt.subplots()
9 | cycles.plot(ax=ax, style=['r--', 'b-'])
10 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/cff_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 |
3 | from load_macrodata import dta
4 |
5 | cf_cycles, cf_trend = sm.tsa.filters.cffilter(dta[["infl", "unemp"]])
6 |
7 | import matplotlib.pyplot as plt
8 | fig, ax = plt.subplots()
9 | cf_cycles.plot(ax=ax, style=['r--', 'b-'])
10 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics-mean_diff_plot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Test Bland-Altman
3 | """
4 |
5 | Author: Joses Ho
6 |
7 | """
8 |
9 | import statsmodels.api as sm
10 | import numpy as np
11 | import matplotlib.pyplot as plt
12 |
13 | # Seed the random number generator.
14 | # This ensures that the results below are reproducible.
15 | np.random.seed(9999)
16 | m1 = np.random.random(20)
17 | m2 = np.random.random(20)
18 |
19 | f, ax = plt.subplots(1, figsize = (8,5))
20 | sm.graphics.mean_diff_plot(m1, m2, ax = ax)
21 |
22 | plt.show()
23 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_boxplot_beanplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 00:22:40 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 |
10 | import numpy as np
11 | import matplotlib.pyplot as plt
12 | import statsmodels.api as sm
13 | data = sm.datasets.anes96.load_pandas()
14 | party_ID = np.arange(7)
15 | labels = ["Strong Democrat", "Weak Democrat", "Independent-Democrat",
16 | "Independent-Indpendent", "Independent-Republican",
17 | "Weak Republican", "Strong Republican"]
18 |
19 | plt.rcParams['figure.subplot.bottom'] = 0.23 # keep labels visible
20 | age = [data.exog['age'][data.endog == id] for id in party_ID]
21 | fig = plt.figure()
22 | ax = fig.add_subplot(111)
23 | sm.graphics.beanplot(age, ax=ax, labels=labels,
24 | plot_opts={'cutoff_val':5, 'cutoff_type':'abs',
25 | 'label_fontsize':'small',
26 | 'label_rotation':30})
27 | ax.set_xlabel("Party identification of respondent.")
28 | ax.set_ylabel("Age")
29 |
30 | #plt.show()
31 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_boxplot_violinplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 00:11:32 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 | import numpy as np
10 | import matplotlib.pyplot as plt
11 | import statsmodels.api as sm
12 |
13 | data = sm.datasets.anes96.load_pandas()
14 | party_ID = np.arange(7)
15 | labels = ["Strong Democrat", "Weak Democrat", "Independent-Democrat",
16 | "Independent-Indpendent", "Independent-Republican",
17 | "Weak Republican", "Strong Republican"]
18 | plt.rcParams['figure.subplot.bottom'] = 0.23 # keep labels visible
19 | age = [data.exog['age'][data.endog == id] for id in party_ID]
20 | fig = plt.figure()
21 | ax = fig.add_subplot(111)
22 | sm.graphics.violinplot(age, ax=ax, labels=labels,
23 | plot_opts={'cutoff_val':5, 'cutoff_type':'abs',
24 | 'label_fontsize':'small',
25 | 'label_rotation':30})
26 | ax.set_xlabel("Party identification of respondent.")
27 | ax.set_ylabel("Age")
28 |
29 | #plt.show()
30 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_functional_fboxplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 11:10:51 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 |
10 | #Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
11 | #surface temperature data.
12 |
13 | import numpy as np
14 | import matplotlib.pyplot as plt
15 | import statsmodels.api as sm
16 | data = sm.datasets.elnino.load(as_pandas=False)
17 |
18 | #Create a functional boxplot. We see that the years 1982-83 and 1997-98 are
19 | #outliers; these are the years where El Nino (a climate pattern
20 | #characterized by warming up of the sea surface and higher air pressures)
21 | #occurred with unusual intensity.
22 |
23 | fig = plt.figure()
24 | ax = fig.add_subplot(111)
25 | res = sm.graphics.fboxplot(data.raw_data[:, 1:], wfactor=2.58,
26 | labels=data.raw_data[:, 0].astype(int),
27 | ax=ax)
28 |
29 | ax.set_xlabel("Month of the year")
30 | ax.set_ylabel("Sea surface temperature (C)")
31 | ax.set_xticks(np.arange(13, step=3) - 1)
32 | ax.set_xticklabels(["", "Mar", "Jun", "Sep", "Dec"])
33 | ax.set_xlim([-0.2, 11.2])
34 |
35 | #plt.show()
36 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_functional_hdrboxplot.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | #Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
4 | #surface temperature data.
5 |
6 | import numpy as np
7 | import matplotlib.pyplot as plt
8 | import statsmodels.api as sm
9 | data = sm.datasets.elnino.load(as_pandas=False)
10 |
11 | #Create a HDR functional boxplot. We see that the years 1982-83 and 1997-98 are
12 | #outliers; these are the years where El Nino (a climate pattern
13 | #characterized by warming up of the sea surface and higher air pressures)
14 | #occurred with unusual intensity.
15 |
16 | fig = plt.figure()
17 | ax = fig.add_subplot(111)
18 | fig, res = sm.graphics.hdrboxplot(data.raw_data[:, 1:],
19 | labels=data.raw_data[:, 0].astype(int),
20 | ax=ax)
21 |
22 | ax.plot([0, 10], [25, 25])
23 | ax.set_xlabel("Month of the year")
24 | ax.set_ylabel("Sea surface temperature (C)")
25 | ax.set_xticks(np.arange(13, step=3) - 1)
26 | ax.set_xticklabels(["", "Mar", "Jun", "Sep", "Dec"])
27 | ax.set_xlim([-0.2, 11.2])
28 |
29 | plt.show()
30 |
31 | print(res)
32 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_functional_rainbowplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Fri May 04 11:08:56 2012
5 |
6 | Author: Ralf Gommers
7 |
8 | """
9 |
10 | #Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
11 | #surface temperature data.
12 |
13 | import numpy as np
14 | import matplotlib.pyplot as plt
15 | import statsmodels.api as sm
16 | data = sm.datasets.elnino.load(as_pandas=False)
17 |
18 | #Create a rainbow plot:
19 |
20 | fig = plt.figure()
21 | ax = fig.add_subplot(111)
22 | res = sm.graphics.rainbowplot(data.raw_data[:, 1:], ax=ax)
23 |
24 | ax.set_xlabel("Month of the year")
25 | ax.set_ylabel("Sea surface temperature (C)")
26 | ax.set_xticks(np.arange(13, step=3) - 1)
27 | ax.set_xticklabels(["", "Mar", "Jun", "Sep", "Dec"])
28 | ax.set_xlim([-0.2, 11.2])
29 |
30 | #plt.show()
31 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_gofplots_qqplot.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Sun May 06 05:32:15 2012
4 |
5 | Author: Josef Perktold
6 | editted by: Paul Hobson (2012-08-19)
7 | """
8 | from scipy import stats
9 | from matplotlib import pyplot as plt
10 | import statsmodels.api as sm
11 |
12 | #example from docstring
13 | data = sm.datasets.longley.load(as_pandas=False)
14 | data.exog = sm.add_constant(data.exog, prepend=True)
15 | mod_fit = sm.OLS(data.endog, data.exog).fit()
16 | res = mod_fit.resid
17 |
18 | left = -1.8 #x coordinate for text insert
19 |
20 | fig = plt.figure()
21 |
22 | ax = fig.add_subplot(2, 2, 1)
23 | sm.graphics.qqplot(res, ax=ax)
24 | top = ax.get_ylim()[1] * 0.75
25 | txt = ax.text(left, top, 'no keywords', verticalalignment='top')
26 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
27 |
28 | ax = fig.add_subplot(2, 2, 2)
29 | sm.graphics.qqplot(res, line='s', ax=ax)
30 | top = ax.get_ylim()[1] * 0.75
31 | txt = ax.text(left, top, "line='s'", verticalalignment='top')
32 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
33 |
34 | ax = fig.add_subplot(2, 2, 3)
35 | sm.graphics.qqplot(res, line='45', fit=True, ax=ax)
36 | ax.set_xlim(-2, 2)
37 | top = ax.get_ylim()[1] * 0.75
38 | txt = ax.text(left, top, "line='45', \nfit=True", verticalalignment='top')
39 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
40 |
41 | ax = fig.add_subplot(2, 2, 4)
42 | sm.graphics.qqplot(res, dist=stats.t, line='45', fit=True, ax=ax)
43 | ax.set_xlim(-2, 2)
44 | top = ax.get_ylim()[1] * 0.75
45 | txt = ax.text(left, top, "dist=stats.t, \nline='45', \nfit=True",
46 | verticalalignment='top')
47 | txt.set_bbox(dict(facecolor='k', alpha=0.1))
48 |
49 | fig.tight_layout()
50 |
51 | plt.gcf()
52 |
53 |
54 | # example with the new ProbPlot class
55 | import numpy as np
56 | x = np.random.normal(loc=8.25, scale=3.5, size=37)
57 | y = np.random.normal(loc=8.00, scale=3.25, size=37)
58 | pp_x = sm.ProbPlot(x, fit=True)
59 | pp_y = sm.ProbPlot(y, fit=True)
60 |
61 | # probability of exceedance
62 | fig2 = pp_x.probplot(exceed=True)
63 |
64 | # compare x quantiles to y quantiles
65 | fig3 = pp_x.qqplot(other=pp_y, line='45')
66 |
67 | # same as above with probabilities/percentiles
68 | fig4 = pp_x.ppplot(other=pp_y, line='45')
69 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_month_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import pandas as pd
3 |
4 | dta = sm.datasets.elnino.load_pandas().data
5 | dta['YEAR'] = dta.YEAR.astype(int).astype(str)
6 | dta = dta.set_index('YEAR').T.unstack()
7 | dates = pd.to_datetime(list(map(lambda x : '-'.join(x) + '-1', dta.index.values)))
8 |
9 | dta.index = pd.DatetimeIndex(list(dates), freq='MS')
10 | dta.name = 'temp'
11 | fig = sm.graphics.tsa.month_plot(dta)
12 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/graphics_plot_fit_ex.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 |
4 | Created on Monday April 1st 2013
5 |
6 | Author: Padarn Wilson
7 |
8 | """
9 |
10 | # Load the Statewide Crime data set and perform linear regression with
11 | # 'poverty' and 'hs_grad' as variables and 'muder' as the response
12 |
13 |
14 | import statsmodels.api as sm
15 | import matplotlib.pyplot as plt
16 | import numpy as np
17 |
18 | data = sm.datasets.statecrime.load_pandas().data
19 | murder = data['murder']
20 | X = data[['poverty', 'hs_grad']].copy()
21 | X['constant'] = 1
22 |
23 | y = murder
24 | model = sm.OLS(y, X)
25 | results = model.fit()
26 |
27 | # Create a plot just for the variable 'Poverty':
28 |
29 | fig, ax = plt.subplots()
30 | fig = sm.graphics.plot_fit(results, 0, ax=ax)
31 | ax.set_ylabel("Murder Rate")
32 | ax.set_xlabel("Poverty Level")
33 | ax.set_title("Linear Regression")
34 |
35 | plt.show()
36 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/hpf_plot.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import pandas as pd
3 | from load_macrodata import dta
4 |
5 | cycle, trend = sm.tsa.filters.hpfilter(dta.realgdp, 1600)
6 | gdp_decomp = dta[['realgdp']].copy()
7 | gdp_decomp["cycle"] = cycle
8 | gdp_decomp["trend"] = trend
9 |
10 | import matplotlib.pyplot as plt
11 | fig, ax = plt.subplots()
12 | gdp_decomp[["realgdp", "trend"]]["2000-03-31":].plot(ax=ax,
13 | fontsize=16)
14 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/load_macrodata.py:
--------------------------------------------------------------------------------
1 | import statsmodels.api as sm
2 | import pandas as pd
3 | dta = sm.datasets.macrodata.load_pandas().data
4 | dates = sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3')
5 | index = pd.DatetimeIndex(dates)
6 | dta.set_index(index, inplace=True)
7 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/var_plot_acorr.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_acorr
2 | plot_acorr()
3 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/var_plot_fevd.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_fevd
2 | plot_fevd()
3 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/var_plot_forecast.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_forecast
2 | plot_forecast()
3 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/var_plot_input.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_input
2 | plot_input()
3 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/var_plot_irf.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_irf
2 | plot_irf()
3 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/var_plot_irf_cum.py:
--------------------------------------------------------------------------------
1 | from var_plots import plot_irf_cum
2 | plot_irf_cum()
3 |
--------------------------------------------------------------------------------
/docs/zh/source/plots/var_plots.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | from statsmodels.tsa.api import VAR
4 | from statsmodels.api import datasets as ds
5 | from statsmodels.tsa.base.datetools import dates_from_str
6 |
7 |
8 | import pandas
9 | mdata = ds.macrodata.load_pandas().data
10 |
11 | # prepare the dates index
12 | dates = mdata[['year', 'quarter']].astype(int)
13 | quarterly = [str(yr) + 'Q' + str(mo)
14 | for yr, mo in zip(dates["year"], dates["quarter"])]
15 | quarterly = dates_from_str(quarterly)
16 |
17 | mdata = mdata[['realgdp','realcons','realinv']]
18 | mdata.index = pandas.DatetimeIndex(quarterly)
19 | data = np.log(mdata).diff().dropna()
20 |
21 | model = VAR(data)
22 | est = model.fit(maxlags=2)
23 |
24 | def plot_input():
25 | est.plot()
26 |
27 | def plot_acorr():
28 | est.plot_acorr()
29 |
30 | def plot_irf():
31 | est.irf().plot()
32 |
33 | def plot_irf_cum():
34 | irf = est.irf()
35 | irf.plot_cum_effects()
36 |
37 | def plot_forecast():
38 | est.plot_forecast(10)
39 |
40 | def plot_fevd():
41 | est.fevd(20).plot()
42 |
--------------------------------------------------------------------------------
/docs/zh/source/regression_techn1.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.regression
2 |
3 |
4 | .. _regression-techn1:
5 |
6 | Technical Documentation
7 | =======================
8 |
9 | Introduction
10 | ------------
11 |
12 | Just a placeholder
13 |
--------------------------------------------------------------------------------
/docs/zh/source/release/index.rst:
--------------------------------------------------------------------------------
1 | .. During each release add in this folder information about important changes.
2 | .. Each versionx.x.rst file should have four main sections.
3 | .. (1) Major features (2) Important bug fixes (3) API breakage (4) Credits
4 |
5 | .. The github-stats-x.x.rst files are generated by tools/github_stats.py with
6 | .. some cleanup afterwards. I do python github_stats.py > github-stats-x.x.rst.
7 | .. As of the 0.5 release, this script asks for your github name and password
8 | .. to download the statistics.
9 |
10 | .. _whatsnew_index:
11 |
12 | =========================
13 | What's new in Statsmodels
14 | =========================
15 |
16 | .. toctree::
17 | :maxdepth: 1
18 |
19 | version0.9
20 | version0.8
21 | version0.7
22 | version0.6
23 | github-stats-0.6
24 | version0.5
25 | github-stats-0.5
26 |
27 | For an overview of changes that occured previous to the 0.5.0 release see :ref:`old_changes`.
28 |
--------------------------------------------------------------------------------
/docs/zh/source/rlm.rst:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.robust
2 |
3 |
4 | .. _rlm:
5 |
6 | Robust Linear Models
7 | ====================
8 |
9 | Robust linear models with support for the M-estimators listed under `Norms`_.
10 |
11 | See `Module Reference`_ for commands and arguments.
12 |
13 | Examples
14 | --------
15 |
16 | .. ipython:: python
17 |
18 | # Load modules and data
19 | import statsmodels.api as sm
20 | data = sm.datasets.stackloss.load(as_pandas=False)
21 | data.exog = sm.add_constant(data.exog)
22 |
23 | # Fit model and print summary
24 | rlm_model = sm.RLM(data.endog, data.exog, M=sm.robust.norms.HuberT())
25 | rlm_results = rlm_model.fit()
26 | print(rlm_results.params)
27 |
28 | Detailed examples can be found here:
29 |
30 | * `Robust Models 1 `__
31 | * `Robust Models 2 `__
32 |
33 | Technical Documentation
34 | -----------------------
35 |
36 | .. toctree::
37 | :maxdepth: 1
38 |
39 | rlm_techn1
40 |
41 | References
42 | ^^^^^^^^^^
43 |
44 | * PJ Huber. ‘Robust Statistics’ John Wiley and Sons, Inc., New York. 1981.
45 | * PJ Huber. 1973, ‘The 1972 Wald Memorial Lectures: Robust Regression: Asymptotics, Conjectures, and Monte Carlo.’ The Annals of Statistics, 1.5, 799-821.
46 | * R Venables, B Ripley. ‘Modern Applied Statistics in S’ Springer, New York,
47 |
48 | Module Reference
49 | ----------------
50 |
51 | .. module:: statsmodels.robust
52 |
53 | Model Classes
54 | ^^^^^^^^^^^^^
55 |
56 | .. module:: statsmodels.robust.robust_linear_model
57 | .. currentmodule:: statsmodels.robust.robust_linear_model
58 |
59 | .. autosummary::
60 | :toctree: generated/
61 |
62 | RLM
63 |
64 | Model Results
65 | ^^^^^^^^^^^^^
66 |
67 | .. autosummary::
68 | :toctree: generated/
69 |
70 | RLMResults
71 |
72 | .. _norms:
73 |
74 | Norms
75 | ^^^^^
76 |
77 | .. module:: statsmodels.robust.norms
78 | .. currentmodule:: statsmodels.robust.norms
79 |
80 | .. autosummary::
81 | :toctree: generated/
82 |
83 | AndrewWave
84 | Hampel
85 | HuberT
86 | LeastSquares
87 | RamsayE
88 | RobustNorm
89 | TrimmedMean
90 | TukeyBiweight
91 | estimate_location
92 |
93 |
94 | Scale
95 | ^^^^^
96 |
97 | .. module:: statsmodels.robust.scale
98 | .. currentmodule:: statsmodels.robust.scale
99 |
100 | .. autosummary::
101 | :toctree: generated/
102 |
103 | Huber
104 | HuberScale
105 | mad
106 | hubers_scale
107 |
--------------------------------------------------------------------------------
/docs/zh/source/rlm_techn1.rst:
--------------------------------------------------------------------------------
1 | .. module:: statsmodels.rlm
2 | :synopsis: Outlier robust linear models
3 |
4 | .. currentmodule:: statsmodels.rlm
5 |
6 |
7 | .. _rlm_techn1:
8 |
9 | Weight Functions
10 | ----------------
11 |
12 | Andrew's Wave
13 |
14 | .. image:: images/aw.png
15 |
16 | Hampel 17A
17 |
18 | .. image:: images/hl.png
19 |
20 | Huber's t
21 |
22 | .. image:: images/ht.png
23 |
24 | Least Squares
25 |
26 | .. image:: images/ls.png
27 |
28 | Ramsay's Ea
29 |
30 | .. image:: images/re.png
31 |
32 | Trimmed Mean
33 |
34 | .. image:: images/tm.png
35 |
36 | Tukey's Biweight
37 |
38 | .. image:: images/tk.png
39 |
40 |
41 |
--------------------------------------------------------------------------------
/docs/zh/source/tsastats.rst.TXT:
--------------------------------------------------------------------------------
1 | .. currentmodule:: statsmodels.tsa.tsatools
2 |
3 | Time Series Analysis
4 | ====================
5 |
6 | These are some of the helper functions for doing time series analysis. First
7 | we can load some a some data from the US Macro Economy 1959:Q1 - 2009:Q3. ::
8 |
9 | >>> data = sm.datasets.macrodata.load(as_pandas=False)
10 |
11 | The macro dataset is a structured array. ::
12 |
13 | >>> data = data.data[['year','quarter','realgdp','tbilrate','cpi','unemp']]
14 |
15 | We can add a lag like so ::
16 |
17 | >>> data = sm.tsa.add_lag(data, 'realgdp', lags=2)
18 |
19 | TODO:
20 | -scikits.timeseries
21 | -link in to var docs
22 |
--------------------------------------------------------------------------------
/docs/zh/sphinxext/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include tests *.py
2 | include *.txt
3 |
--------------------------------------------------------------------------------
/docs/zh/sphinxext/README.txt:
--------------------------------------------------------------------------------
1 | =====================================
2 | numpydoc -- Numpy's Sphinx extensions
3 | =====================================
4 |
5 | Numpy's documentation uses several custom extensions to Sphinx. These
6 | are shipped in this ``numpydoc`` package, in case you want to make use
7 | of them in third-party projects.
8 |
9 | The following extensions are available:
10 |
11 | - ``numpydoc``: support for the Numpy docstring format in Sphinx, and add
12 | the code description directives ``np-function``, ``np-cfunction``, etc.
13 | that support the Numpy docstring syntax.
14 |
15 | - ``numpydoc.traitsdoc``: For gathering documentation about Traits attributes.
16 |
17 | - ``numpydoc.plot_directives``: Adaptation of Matplotlib's ``plot::``
18 | directive. Note that this implementation may still undergo severe
19 | changes or eventually be deprecated.
20 |
21 | - ``numpydoc.only_directives``: (DEPRECATED)
22 |
23 | - ``numpydoc.autosummary``: (DEPRECATED) An ``autosummary::`` directive.
24 | Available in Sphinx 0.6.2 and (to-be) 1.0 as ``sphinx.ext.autosummary``,
25 | and it the Sphinx 1.0 version is recommended over that included in
26 | Numpydoc.
27 |
--------------------------------------------------------------------------------
/docs/zh/sphinxext/numpy_ext/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/sphinxext/numpy_ext/__init__.py
--------------------------------------------------------------------------------
/docs/zh/themes/statsmodels/indexsidebar.html:
--------------------------------------------------------------------------------
1 | Download
2 |
3 | {% if 'dev' in version %}
4 |
5 | This documentation is for version {{ version }}, which is not
6 | released yet. Grab the source code from Github to install this version. You can go to the documentation for the last release here.
7 |
8 | {% else %}
9 |
10 | This documentation is for the {{ release }} release. You can install it with pip:
11 |
12 |
pip install --upgrade --no-deps statsmodels
13 |
14 | or conda:
15 |
16 | conda install statsmodels
17 | Documentation for the current development version is here.
18 |
19 | {% endif %}
20 |
21 | Participate
22 |
23 |
27 |
28 | Grab the source from Github.
29 | Report bugs to the Issue Tracker.
30 | Have a look at our Developer Pages.
31 |
32 |
--------------------------------------------------------------------------------
/docs/zh/themes/statsmodels/page.html:
--------------------------------------------------------------------------------
1 | {#
2 | Overwrites what is displayed on the examples landing page.
3 | #}
4 | {%- extends "layout.html" %}
5 | {% block body %}
6 |
7 |
8 | {% if pagename == 'examples/index' %}
9 |
10 |
Statsmodels Examples
11 |
12 | This page provides a series of examples, tutorials and recipes to help you get started with statsmodels. Each of the examples shown here is made available as an IPython Notebook and as a plain python script on the
statsmodels github repository.
13 |
14 | If you are not comfortable with git, we also encourage users to submit their own examples, tutorials or cool statsmodels tricks to the
Examples wiki page.
15 |
16 |
17 |
18 |
Topics
19 |
20 | {% for section in examples %}
21 |
24 | {% endfor %}
25 |
26 |
27 |
28 | {% for section in examples %}
29 |
{{ section.header }}
30 |
31 |
32 |
33 | {% for link in section.links %}
34 | -
35 |
{{link.text}}
36 |
37 |
38 |
39 |
40 | {% endfor %}
41 |
42 |
43 | {% endfor %}
44 |
45 | {% else %}
46 |
47 | {{ body }}
48 |
49 | {% endif %}
50 |
51 | {% endblock %}
52 |
--------------------------------------------------------------------------------
/docs/zh/themes/statsmodels/relations.html:
--------------------------------------------------------------------------------
1 | {#
2 | basic/relations.html
3 | ~~~~~~~~~~~~~~~~~~~~
4 |
5 | Sphinx sidebar template: relation links.
6 |
7 | :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
8 | :license: BSD, see LICENSE for details.
9 | #}
10 | {%- if prev %}
11 | {{ _('Previous topic') }}
12 | {%- if prev.title[:19] == "statsmodels" %}
13 | {{ "sm." ~ prev.title[20:] }}
15 | {%- else %}
16 | {{ prev.title }}
18 |
19 | {%- endif %}
20 | {%- endif %}
21 |
22 | {%- if next %}
23 | {{ _('Next topic') }}
24 | {%- if next.title[:19] == "statsmodels" %}
25 | {{ "sm." ~ next.title[20:] }}
27 | {%- else %}
28 | {{ next.title }}
30 | {%- endif %}
31 |
32 | {%- endif %}
33 |
--------------------------------------------------------------------------------
/docs/zh/themes/statsmodels/sidelinks.html:
--------------------------------------------------------------------------------
1 |
2 |  }})
3 |
--------------------------------------------------------------------------------
/docs/zh/themes/statsmodels/static/statsmodels_hybi_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/docs/zh/themes/statsmodels/static/statsmodels_hybi_banner.png
--------------------------------------------------------------------------------
/docs/zh/themes/statsmodels/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 | stylesheet = nature.css
4 | pygments_style = tango
5 |
--------------------------------------------------------------------------------
/examples/incomplete/arima.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 | from statsmodels.datasets.macrodata import load_pandas
3 | from statsmodels.tsa.base.datetools import dates_from_range
4 | from statsmodels.tsa.arima_model import ARIMA
5 | import matplotlib.pyplot as plt
6 | import numpy as np
7 | import statsmodels.api as sm
8 | plt.interactive(False)
9 |
10 | # let's examine an ARIMA model of CPI
11 |
12 | cpi = load_pandas().data['cpi']
13 | dates = dates_from_range('1959q1', '2009q3')
14 | cpi.index = dates
15 |
16 | res = ARIMA(cpi, (1, 1, 1), freq='Q').fit()
17 | print(res.summary())
18 |
19 | # we can look at the series
20 | cpi.diff().plot()
21 |
22 | # maybe logs are better
23 | log_cpi = np.log(cpi)
24 |
25 | # check the ACF and PCF plots
26 | acf, confint_acf = sm.tsa.acf(log_cpi.diff().values[1:], confint=95)
27 | # center the confidence intervals about zero
28 | #confint_acf -= confint_acf.mean(1)[:, None]
29 | pacf = sm.tsa.pacf(log_cpi.diff().values[1:], method='ols')
30 | # confidence interval is now an option to pacf
31 | from scipy import stats
32 | confint_pacf = stats.norm.ppf(1 - .025) * np.sqrt(1 / 202.)
33 |
34 | fig = plt.figure()
35 | ax = fig.add_subplot(121)
36 | ax.set_title('Autocorrelation')
37 | ax.plot(range(41), acf, 'bo', markersize=5)
38 | ax.vlines(range(41), 0, acf)
39 | ax.fill_between(range(41), confint_acf[:, 0], confint_acf[:, 1], alpha=.25)
40 | fig.tight_layout()
41 | ax = fig.add_subplot(122, sharey=ax)
42 | ax.vlines(range(41), 0, pacf)
43 | ax.plot(range(41), pacf, 'bo', markersize=5)
44 | ax.fill_between(range(41), -confint_pacf, confint_pacf, alpha=.25)
45 |
46 |
47 | #NOTE: you'll be able to just to this when tsa-plots is in master
48 | #sm.graphics.acf_plot(x, nlags=40)
49 | #sm.graphics.pacf_plot(x, nlags=40)
50 |
51 |
52 | # still some seasonality
53 | # try an arma(1, 1) with ma(4) term
54 |
--------------------------------------------------------------------------------
/examples/incomplete/arma2.py:
--------------------------------------------------------------------------------
1 | """
2 | Autoregressive Moving Average (ARMA) Model
3 | """
4 | import numpy as np
5 | import statsmodels.api as sm
6 |
7 | # Generate some data from an ARMA process
8 | from statsmodels.tsa.arima_process import arma_generate_sample
9 |
10 | np.random.seed(12345)
11 | arparams = np.array([.75, -.25])
12 | maparams = np.array([.65, .35])
13 |
14 | # The conventions of the arma_generate function require that we specify a
15 | # 1 for the zero-lag of the AR and MA parameters and that the AR parameters
16 | # be negated.
17 | ar = np.r_[1, -arparams]
18 | ma = np.r_[1, maparams]
19 | nobs = 250
20 | y = arma_generate_sample(ar, ma, nobs)
21 |
22 | # Now, optionally, we can add some dates information. For this example,
23 | # we'll use a pandas time series.
24 | import pandas as pd
25 | dates = sm.tsa.datetools.dates_from_range('1980m1', length=nobs)
26 | y = pd.Series(y, index=dates)
27 | arma_mod = sm.tsa.ARMA(y, order=(2, 2))
28 | arma_res = arma_mod.fit(trend='nc', disp=-1)
29 |
--------------------------------------------------------------------------------
/examples/incomplete/dates.py:
--------------------------------------------------------------------------------
1 | """
2 | Using dates with timeseries models
3 | """
4 | import statsmodels.api as sm
5 | import pandas as pd
6 |
7 | # Getting started
8 | # ---------------
9 |
10 | data = sm.datasets.sunspots.load()
11 |
12 | # Right now an annual date series must be datetimes at the end of the year.
13 |
14 | dates = sm.tsa.datetools.dates_from_range('1700', length=len(data.endog))
15 |
16 | # Using Pandas
17 | # ------------
18 |
19 | # Make a pandas Series or DataFrame with DatetimeIndex
20 | endog = pd.Series(data.endog, index=dates)
21 |
22 | # and instantiate the model
23 | ar_model = sm.tsa.AR(endog, freq='A')
24 | pandas_ar_res = ar_model.fit(maxlag=9, method='mle', disp=-1)
25 |
26 | # Let's do some out-of-sample prediction
27 | pred = pandas_ar_res.predict(start='2005', end='2015')
28 | print(pred)
29 |
30 | # Using explicit dates
31 | # --------------------
32 |
33 | ar_model = sm.tsa.AR(data.endog, dates=dates, freq='A')
34 | ar_res = ar_model.fit(maxlag=9, method='mle', disp=-1)
35 | pred = ar_res.predict(start='2005', end='2015')
36 | print(pred)
37 |
38 | # This just returns a regular array, but since the model has date information
39 | # attached, you can get the prediction dates in a roundabout way.
40 |
41 | print(ar_res.data.predict_dates)
42 |
43 | # This attribute only exists if predict has been called. It holds the dates
44 | # associated with the last call to predict.
45 | #..TODO: should this be attached to the results instance?
46 |
--------------------------------------------------------------------------------
/examples/incomplete/ols_table.py:
--------------------------------------------------------------------------------
1 | """Example: statsmodels.OLS
2 | """
3 |
4 | from statsmodels.datasets.longley import load
5 | import statsmodels.api as sm
6 | from statsmodels.iolib.table import SimpleTable, default_txt_fmt
7 | import numpy as np
8 |
9 | data = load()
10 |
11 | data_orig = (data.endog.copy(), data.exog.copy())
12 |
13 | #.. Note: In this example using zscored/standardized variables has no effect on
14 | #.. regression estimates. Are there no numerical problems?
15 |
16 | rescale = 0
17 | #0: no rescaling, 1:demean, 2:standardize, 3:standardize and transform back
18 | rescale_ratio = data.endog.std() / data.exog.std(0)
19 | if rescale > 0:
20 | # rescaling
21 | data.endog -= data.endog.mean()
22 | data.exog -= data.exog.mean(0)
23 | if rescale > 1:
24 | data.endog /= data.endog.std()
25 | data.exog /= data.exog.std(0)
26 |
27 | #skip because mean has been removed, but dimension is hardcoded in table
28 | data.exog = sm.tools.add_constant(data.exog, prepend=False)
29 |
30 |
31 | ols_model = sm.OLS(data.endog, data.exog)
32 | ols_results = ols_model.fit()
33 |
34 | # the Longley dataset is well known to have high multicollinearity
35 | # one way to find the condition number is as follows
36 |
37 |
38 | #Find OLS parameters for model with one explanatory variable dropped
39 |
40 | resparams = np.nan * np.ones((7, 7))
41 | res = sm.OLS(data.endog, data.exog).fit()
42 | resparams[:, 0] = res.params
43 |
44 | indall = range(7)
45 | for i in range(6):
46 | ind = indall[:]
47 | del ind[i]
48 | res = sm.OLS(data.endog, data.exog[:, ind]).fit()
49 | resparams[ind, i + 1] = res.params
50 |
51 | if rescale == 1:
52 | pass
53 | if rescale == 3:
54 | resparams[:-1, :] *= rescale_ratio[:, None]
55 |
56 | txt_fmt1 = default_txt_fmt
57 | numformat = '%10.4f'
58 | txt_fmt1 = dict(data_fmts=[numformat])
59 | rowstubs = data.names[1:] + ['const']
60 | headers = ['all'] + ['drop %s' % name for name in data.names[1:]]
61 | tabl = SimpleTable(resparams, headers, rowstubs, txt_fmt=txt_fmt1)
62 |
63 | nanstring = numformat % np.nan
64 | nn = len(nanstring)
65 | nanrep = ' ' * (nn - 1)
66 | nanrep = nanrep[:nn // 2] + '-' + nanrep[nn // 2:]
67 |
68 | print('Longley data - sensitivity to dropping an explanatory variable')
69 | print(str(tabl).replace(nanstring, nanrep))
70 |
--------------------------------------------------------------------------------
/examples/notebooks/categorical_interaction_plot.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Plot Interaction of Categorical Factors"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "In this example, we will vizualize the interaction between categorical factors. First, we will create some categorical data are initialized. Then plotted using the interaction_plot function which internally recodes the x-factor categories to ingegers."
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": null,
20 | "metadata": {
21 | "collapsed": false
22 | },
23 | "outputs": [],
24 | "source": [
25 | "%matplotlib inline\n",
26 | "\n",
27 | "import numpy as np\n",
28 | "import matplotlib.pyplot as plt\n",
29 | "import pandas as pd\n",
30 | "from statsmodels.graphics.factorplots import interaction_plot"
31 | ]
32 | },
33 | {
34 | "cell_type": "code",
35 | "execution_count": null,
36 | "metadata": {
37 | "collapsed": false
38 | },
39 | "outputs": [],
40 | "source": [
41 | "np.random.seed(12345)\n",
42 | "weight = pd.Series(np.repeat(['low', 'hi', 'low', 'hi'], 15), name='weight')\n",
43 | "nutrition = pd.Series(np.repeat(['lo_carb', 'hi_carb'], 30), name='nutrition')\n",
44 | "days = np.log(np.random.randint(1, 30, size=60))"
45 | ]
46 | },
47 | {
48 | "cell_type": "code",
49 | "execution_count": null,
50 | "metadata": {
51 | "collapsed": false
52 | },
53 | "outputs": [],
54 | "source": [
55 | "fig, ax = plt.subplots(figsize=(6, 6))\n",
56 | "fig = interaction_plot(x=weight, trace=nutrition, response=days, \n",
57 | " colors=['red', 'blue'], markers=['D', '^'], ms=10, ax=ax)"
58 | ]
59 | }
60 | ],
61 | "metadata": {
62 | "kernelspec": {
63 | "display_name": "Python 3",
64 | "language": "python",
65 | "name": "python3"
66 | },
67 | "language_info": {
68 | "codemirror_mode": {
69 | "name": "ipython",
70 | "version": 3
71 | },
72 | "file_extension": ".py",
73 | "mimetype": "text/x-python",
74 | "name": "python",
75 | "nbconvert_exporter": "python",
76 | "pygments_lexer": "ipython3",
77 | "version": "3.4.3"
78 | }
79 | },
80 | "nbformat": 4,
81 | "nbformat_minor": 0
82 | }
83 |
--------------------------------------------------------------------------------
/examples/notebooks/star_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apachecn/statsmodels-doc-zh/d3bfee2849fb022eab0464341ab430e212f87515/examples/notebooks/star_diagram.png
--------------------------------------------------------------------------------
/examples/python/categorical_interaction_plot.py:
--------------------------------------------------------------------------------
1 |
2 | ## Plot Interaction of Categorical Factors
3 |
4 | # In this example, we will vizualize the interaction between categorical factors. First, we will create some categorical data are initialized. Then plotted using the interaction_plot function which internally recodes the x-factor categories to ingegers.
5 |
6 | import numpy as np
7 | import matplotlib.pyplot as plt
8 | from statsmodels.graphics.factorplots import interaction_plot
9 | from pandas import Series
10 | np.random.seed(12345)
11 | weight = Series(np.repeat(['low', 'hi', 'low', 'hi'], 15), name='weight')
12 | nutrition = Series(np.repeat(['lo_carb', 'hi_carb'], 30), name='nutrition')
13 | days = np.log(np.random.randint(1, 30, size=60))
14 | plt.figure(figsize=(6, 6));
15 | interaction_plot(x=weight, trace=nutrition, response=days,
16 | colors=['red', 'blue'], markers=['D', '^'], ms=10)
17 |
18 |
19 | #
20 |
21 | # image file:
22 |
23 | # image file:
24 |
--------------------------------------------------------------------------------
/examples/python/glm_formula.py:
--------------------------------------------------------------------------------
1 |
2 | ## Generalized Linear Models (Formula)
3 |
4 | # This notebook illustrates how you can use R-style formulas to fit Generalized Linear Models.
5 | #
6 | # To begin, we load the ``Star98`` dataset and we construct a formula and pre-process the data:
7 |
8 | from __future__ import print_function
9 | import statsmodels.api as sm
10 | import statsmodels.formula.api as smf
11 | star98 = sm.datasets.star98.load_pandas().data
12 | formula = 'SUCCESS ~ LOWINC + PERASIAN + PERBLACK + PERHISP + PCTCHRT + PCTYRRND + PERMINTE*AVYRSEXP*AVSALK + PERSPENK*PTRATIO*PCTAF'
13 | dta = star98[['NABOVE', 'NBELOW', 'LOWINC', 'PERASIAN', 'PERBLACK', 'PERHISP',
14 | 'PCTCHRT', 'PCTYRRND', 'PERMINTE', 'AVYRSEXP', 'AVSALK',
15 | 'PERSPENK', 'PTRATIO', 'PCTAF']]
16 | endog = dta['NABOVE'] / (dta['NABOVE'] + dta.pop('NBELOW'))
17 | del dta['NABOVE']
18 | dta['SUCCESS'] = endog
19 |
20 |
21 | # Then, we fit the GLM model:
22 |
23 | mod1 = smf.glm(formula=formula, data=dta, family=sm.families.Binomial()).fit()
24 | mod1.summary()
25 |
26 |
27 | # Finally, we define a function to operate customized data transformation using the formula framework:
28 |
29 | def double_it(x):
30 | return 2 * x
31 |
32 |
33 | formula = 'SUCCESS ~ double_it(LOWINC) + PERASIAN + PERBLACK + PERHISP + PCTCHRT + PCTYRRND + PERMINTE*AVYRSEXP*AVSALK + PERSPENK*PTRATIO*PCTAF'
34 | mod2 = smf.glm(formula=formula, data=dta, family=sm.families.Binomial()).fit()
35 | mod2.summary()
36 |
37 |
38 | # As expected, the coefficient for ``double_it(LOWINC)`` in the second model is half the size of the ``LOWINC`` coefficient from the first model:
39 |
40 | print(mod1.params[1])
41 | print(mod2.params[1] * 2)
42 |
--------------------------------------------------------------------------------
/examples/python/kernel_density.py:
--------------------------------------------------------------------------------
1 |
2 | ## Kernel Density Estimation
3 |
4 | import numpy as np
5 | from scipy import stats
6 | import statsmodels.api as sm
7 | import matplotlib.pyplot as plt
8 | from statsmodels.distributions.mixture_rvs import mixture_rvs
9 |
10 |
11 | ##### A univariate example.
12 |
13 | np.random.seed(12345)
14 |
15 |
16 | obs_dist1 = mixture_rvs([.25,.75], size=10000, dist=[stats.norm, stats.norm],
17 | kwargs = (dict(loc=-1,scale=.5),dict(loc=1,scale=.5)))
18 |
19 |
20 | kde = sm.nonparametric.KDEUnivariate(obs_dist1)
21 | kde.fit()
22 |
23 |
24 | fig = plt.figure(figsize=(12,8))
25 | ax = fig.add_subplot(111)
26 | ax.hist(obs_dist1, bins=50, normed=True, color='red')
27 | ax.plot(kde.support, kde.density, lw=2, color='black');
28 |
29 |
30 | obs_dist2 = mixture_rvs([.25,.75], size=10000, dist=[stats.norm, stats.beta],
31 | kwargs = (dict(loc=-1,scale=.5),dict(loc=1,scale=1,args=(1,.5))))
32 |
33 | kde2 = sm.nonparametric.KDEUnivariate(obs_dist2)
34 | kde2.fit()
35 |
36 |
37 | fig = plt.figure(figsize=(12,8))
38 | ax = fig.add_subplot(111)
39 | ax.hist(obs_dist2, bins=50, normed=True, color='red')
40 | ax.plot(kde2.support, kde2.density, lw=2, color='black');
41 |
42 |
43 | # The fitted KDE object is a full non-parametric distribution.
44 |
45 | obs_dist3 = mixture_rvs([.25,.75], size=1000, dist=[stats.norm, stats.norm],
46 | kwargs = (dict(loc=-1,scale=.5),dict(loc=1,scale=.5)))
47 | kde3 = sm.nonparametric.KDEUnivariate(obs_dist3)
48 | kde3.fit()
49 |
50 |
51 | kde3.entropy
52 |
53 |
54 | kde3.evaluate(-1)
55 |
56 |
57 | ##### CDF
58 |
59 | fig = plt.figure(figsize=(12,8))
60 | ax = fig.add_subplot(111)
61 | ax.plot(kde3.support, kde3.cdf);
62 |
63 |
64 | ##### Cumulative Hazard Function
65 |
66 | fig = plt.figure(figsize=(12,8))
67 | ax = fig.add_subplot(111)
68 | ax.plot(kde3.support, kde3.cumhazard);
69 |
70 |
71 | ##### Inverse CDF
72 |
73 | fig = plt.figure(figsize=(12,8))
74 | ax = fig.add_subplot(111)
75 | ax.plot(kde3.support, kde3.icdf);
76 |
77 |
78 | ##### Survival Function
79 |
80 | fig = plt.figure(figsize=(12,8))
81 | ax = fig.add_subplot(111)
82 | ax.plot(kde3.support, kde3.sf);
83 |
--------------------------------------------------------------------------------
/examples/python/predict.py:
--------------------------------------------------------------------------------
1 |
2 | ## Prediction (out of sample)
3 |
4 | from __future__ import print_function
5 | import numpy as np
6 | import statsmodels.api as sm
7 |
8 |
9 | # ## Artificial data
10 |
11 | nsample = 50
12 | sig = 0.25
13 | x1 = np.linspace(0, 20, nsample)
14 | X = np.column_stack((x1, np.sin(x1), (x1-5)**2))
15 | X = sm.add_constant(X)
16 | beta = [5., 0.5, 0.5, -0.02]
17 | y_true = np.dot(X, beta)
18 | y = y_true + sig * np.random.normal(size=nsample)
19 |
20 |
21 | # ## Estimation
22 |
23 | olsmod = sm.OLS(y, X)
24 | olsres = olsmod.fit()
25 | print(olsres.summary())
26 |
27 |
28 | # ## In-sample prediction
29 |
30 | ypred = olsres.predict(X)
31 | print(ypred)
32 |
33 |
34 | # ## Create a new sample of explanatory variables Xnew, predict and plot
35 |
36 | x1n = np.linspace(20.5,25, 10)
37 | Xnew = np.column_stack((x1n, np.sin(x1n), (x1n-5)**2))
38 | Xnew = sm.add_constant(Xnew)
39 | ynewpred = olsres.predict(Xnew) # predict out of sample
40 | print(ynewpred)
41 |
42 |
43 | # ## Plot comparison
44 |
45 | import matplotlib.pyplot as plt
46 |
47 | fig, ax = plt.subplots()
48 | ax.plot(x1, y, 'o', label="Data")
49 | ax.plot(x1, y_true, 'b-', label="True")
50 | ax.plot(np.hstack((x1, x1n)), np.hstack((ypred, ynewpred)), 'r', label="OLS prediction")
51 | ax.legend(loc="best");
52 |
53 |
54 | ### Predicting with Formulas
55 |
56 | # Using formulas can make both estimation and prediction a lot easier
57 |
58 | from statsmodels.formula.api import ols
59 |
60 | data = {"x1" : x1, "y" : y}
61 |
62 | res = ols("y ~ x1 + np.sin(x1) + I((x1-5)**2)", data=data).fit()
63 |
64 |
65 | # We use the `I` to indicate use of the Identity transform. Ie., we don't want any expansion magic from using `**2`
66 |
67 | res.params
68 |
69 |
70 | # Now we only have to pass the single variable and we get the transformed right-hand side variables automatically
71 |
72 | res.predict(exog=dict(x1=x1n))
73 |
--------------------------------------------------------------------------------
/examples/python/tsa_arma_1.py:
--------------------------------------------------------------------------------
1 |
2 | ## Autoregressive Moving Average (ARMA): Artificial data
3 |
4 | from __future__ import print_function
5 | import numpy as np
6 | import statsmodels.api as sm
7 | from statsmodels.tsa.arima_process import arma_generate_sample
8 | np.random.seed(12345)
9 |
10 |
11 | # Generate some data from an ARMA process:
12 |
13 | arparams = np.array([.75, -.25])
14 | maparams = np.array([.65, .35])
15 |
16 |
17 | # The conventions of the arma_generate function require that we specify a 1 for the zero-lag of the AR and MA parameters and that the AR parameters be negated.
18 |
19 | arparams = np.r_[1, -arparams]
20 | maparam = np.r_[1, maparams]
21 | nobs = 250
22 | y = arma_generate_sample(arparams, maparams, nobs)
23 |
24 |
25 | # Now, optionally, we can add some dates information. For this example, we'll use a pandas time series.
26 |
27 | import pandas as pd
28 | dates = sm.tsa.datetools.dates_from_range('1980m1', length=nobs)
29 | y = pd.Series(y, index=dates)
30 | arma_mod = sm.tsa.ARMA(y, order=(2,2))
31 | arma_res = arma_mod.fit(trend='nc', disp=-1)
32 |
--------------------------------------------------------------------------------
/examples/python/tsa_dates.py:
--------------------------------------------------------------------------------
1 |
2 | ## Dates in timeseries models
3 |
4 | from __future__ import print_function
5 | import statsmodels.api as sm
6 | import pandas as pd
7 |
8 |
9 | # ## Getting started
10 |
11 | data = sm.datasets.sunspots.load()
12 |
13 |
14 | # Right now an annual date series must be datetimes at the end of the year.
15 |
16 | dates = sm.tsa.datetools.dates_from_range('1700', length=len(data.endog))
17 |
18 |
19 | # ## Using Pandas
20 | #
21 | # Make a pandas Series or DataFrame with DatetimeIndex
22 |
23 | endog = pd.Series(data.endog, index=dates)
24 |
25 |
26 | # Instantiate the model
27 |
28 | ar_model = sm.tsa.AR(endog, freq='A')
29 | pandas_ar_res = ar_model.fit(maxlag=9, method='mle', disp=-1)
30 |
31 |
32 | # Out-of-sample prediction
33 |
34 | pred = pandas_ar_res.predict(start='2005', end='2015')
35 | print(pred)
36 |
37 |
38 | # ## Using explicit dates
39 |
40 | ar_model = sm.tsa.AR(data.endog, dates=dates, freq='A')
41 | ar_res = ar_model.fit(maxlag=9, method='mle', disp=-1)
42 | pred = ar_res.predict(start='2005', end='2015')
43 | print(pred)
44 |
45 |
46 | # This just returns a regular array, but since the model has date information attached, you can get the prediction dates in a roundabout way.
47 |
48 | print(ar_res.data.predict_dates)
49 |
50 |
51 | # Note: This attribute only exists if predict has been called. It holds the dates associated with the last call to predict.
52 |
--------------------------------------------------------------------------------
/examples/run_all.py:
--------------------------------------------------------------------------------
1 | """run all examples to make sure we don't get an exception
2 |
3 | Note:
4 | If an example contaings plt.show(), then all plot windows have to be closed
5 | manually, at least in my setup.
6 |
7 | uncomment plt.show() to show all plot windows
8 |
9 | """
10 | from __future__ import print_function
11 | from statsmodels.compat import input
12 | stop_on_error = True
13 |
14 |
15 | filelist = ['example_glsar.py', 'example_wls.py', 'example_gls.py',
16 | 'example_glm.py', 'example_ols_tftest.py', # 'example_rpy.py',
17 | 'example_ols.py', 'example_rlm.py',
18 | 'example_discrete.py', 'example_predict.py',
19 | 'example_ols_table.py',
20 | # time series
21 | 'tsa/ex_arma2.py', 'tsa/ex_dates.py']
22 |
23 | if __name__ == '__main__':
24 | #temporarily disable show
25 | import matplotlib.pyplot as plt
26 | plt_show = plt.show
27 |
28 | def noop(*args):
29 | pass
30 |
31 | plt.show = noop
32 |
33 | msg = """Are you sure you want to run all of the examples?
34 | This is done mainly to check that they are up to date.
35 | (y/n) >>> """
36 |
37 | cont = input(msg)
38 | if 'y' in cont.lower():
39 | for run_all_f in filelist:
40 | try:
41 | print('\n\nExecuting example file', run_all_f)
42 | print('-----------------------' + '-' * len(run_all_f))
43 | exec(open(run_all_f).read())
44 | except:
45 | # f might be overwritten in the executed file
46 | print('**********************' + '*' * len(run_all_f))
47 | print('ERROR in example file', run_all_f)
48 | print('**********************' + '*' * len(run_all_f))
49 | if stop_on_error:
50 | raise
51 |
52 | # reenable show after closing windows
53 | plt.close('all')
54 | plt.show = plt_show
55 | plt.show()
56 |
--------------------------------------------------------------------------------