Skip to main content
Stan logo

pypi version travis-ci build status appveyor-ci build status

PyStan provides a Python interface to Stan, a package for Bayesian inference using the No-U-Turn sampler, a variant of Hamiltonian Monte Carlo.

For more information on Stan and its modeling language, see the Stan User’s Guide and Reference Manual at http://mc-stan.org/.

Similar projects

Detailed Installation Instructions

Detailed installation instructions can be found in the doc/installation_beginner.md file.

Quick Installation

NumPy and Cython (version 0.22 or greater) are required. matplotlib is optional.

PyStan and the required packages may be installed from the Python Package Index using pip.

pip install pystan

Alternatively, if Cython (version 0.22 or greater) and NumPy are already available, PyStan may be installed from source with the following commands

git clone --recursive https://github.com/stan-dev/pystan.git
cd pystan
python setup.py install

If you encounter an ImportError after compiling from source, try changing out of the source directory before attempting import pystan. On Linux and OS X cd /tmp will work.

Example

import pystan
import numpy as np
import matplotlib.pyplot as plt

schools_code = """
data {
    int<lower=0> J; // number of schools
    real y[J]; // estimated treatment effects
    real<lower=0> sigma[J]; // s.e. of effect estimates
}
parameters {
    real mu;
    real<lower=0> tau;
    real eta[J];
}
transformed parameters {
    real theta[J];
    for (j in 1:J)
        theta[j] = mu + tau * eta[j];
}
model {
    eta ~ normal(0, 1);
    y ~ normal(theta, sigma);
}
"""

schools_dat = {'J': 8,
               'y': [28,  8, -3,  7, -1,  1, 18, 12],
               'sigma': [15, 10, 16, 11,  9, 11, 10, 18]}

fit = pystan.stan(model_code=schools_code, data=schools_dat,
                  iter=1000, chains=4)

print(fit)

eta = fit.extract(permuted=True)['eta']
np.mean(eta, axis=0)

# if matplotlib is installed (optional, not required), a visual summary and
# traceplot are available
fit.plot()
plt.show()

Metadata

Release files for pystan 2.15.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pystan 2.15.0.1
File Size Uploaded
pystan-2.15.0.1.tar.gz 25.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for pystan 2.15.0.1
File
pystan-2.15.0.1-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
pystan-2.15.0.1-cp36-cp36m-win32.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-32 Details
pystan-2.15.0.1-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.1-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ Intel (x86-64, i386), macOS 10.6+ Intel (x86-64, i386), macOS 10.10+ Intel (x86-64, i386), macOS 10.9+ x86-64, macOS 10.10+ x86-64 Details
pystan-2.15.0.1-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
pystan-2.15.0.1-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details
pystan-2.15.0.1-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.1-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.9+ x86-64, macOS 10.10+ x86-64, macOS 10.9+ Intel (x86-64, i386), macOS 10.6+ Intel (x86-64, i386), macOS 10.10+ Intel (x86-64, i386) Details
pystan-2.15.0.1-cp34-cp34m-manylinux1_x86_64.whl CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.1-cp34-cp34m-manylinux1_i686.whl CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.1-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 3.4 CPython 3.4 pymalloc macOS 10.9+ Intel (x86-64, i386), macOS 10.6+ Intel (x86-64, i386), macOS 10.10+ Intel (x86-64, i386), macOS 10.9+ x86-64, macOS 10.10+ x86-64 Details
pystan-2.15.0.1-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.1-cp27-cp27mu-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.1-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.1-cp27-cp27m-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 2.7 CPython 2.7 pymalloc macOS 10.10+ Intel (x86-64, i386), macOS 10.6+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.9+ Intel (x86-64, i386), macOS 10.9+ x86-64 Details

Total release size: 989.9 MB

Release files / pystan-2.15.0.1.tar.gz

Download URL pystan-2.15.0.1.tar.gz
Size 25.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c15b6b90f5115fb786fa92977d50dbd1599965c2ad5982e44201cb052f2375a4
BLAKE2b-256 checksum
How to use checksums
dd2292062d1616236f66c670125aa459bb2f35d9ea63927421265b51f26b2bb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp36-cp36m-win_amd64.whl

Download URL pystan-2.15.0.1-cp36-cp36m-win_amd64.whl
Size 42.1 MB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
c782108a127b7f7b283f0707bb0b201c063c6b2758a5e32f881343239d9fc4ab
BLAKE2b-256 checksum
How to use checksums
6cf724892f4ecfca285a930bd32f530088cbd65aac66b91e283a123721b32004
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp36-cp36m-win32.whl

Download URL pystan-2.15.0.1-cp36-cp36m-win32.whl
Size 42.0 MB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
b9603e26bd6b4178c4c09dbde6edf57d582695c4e0cb9b139b44ea49db8ab063
BLAKE2b-256 checksum
How to use checksums
05666f046eb6561d96b3821c3d09eb85dc5f0eb6bb48411817caa9ec934cdda5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp36-cp36m-manylinux1_x86_64.whl

Download URL pystan-2.15.0.1-cp36-cp36m-manylinux1_x86_64.whl
Size 62.4 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
813f88d5215f2467fed0341fb553e60b6737f4db8d1bb122d342336b0f5319a9
BLAKE2b-256 checksum
How to use checksums
246a787f21b9155c6ba44d3015afdd359ade32f3be3f7c77e3686bbdd82362ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp36-cp36m-manylinux1_i686.whl

Download URL pystan-2.15.0.1-cp36-cp36m-manylinux1_i686.whl
Size 61.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
cc5c68c199cb0525e3be2df8e6885999b51cb67f4d987440be7eefece2df9f69
BLAKE2b-256 checksum
How to use checksums
6fcdf52bd5cbdb7451558b5f152d58cd00611a768d27566f6299b2d6a160334d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL pystan-2.15.0.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 44.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ Intel (x86-64, i386) macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
921c469b67a96d9160225f88dee12fab9203a6259a39740f7418342de5aa8130
BLAKE2b-256 checksum
How to use checksums
9826c587fef31d2d654e52dadb9cfd63679a58163d0ebbc99b64fb241485b89f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp35-cp35m-win_amd64.whl

Download URL pystan-2.15.0.1-cp35-cp35m-win_amd64.whl
Size 42.1 MB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
57eb433b1671c18a50ea76516002c7683ca5e018b77226a3802debad1216177d
BLAKE2b-256 checksum
How to use checksums
4b16d67bfe11fa66de8b5b746eb63c3efbae22e3fcb6f0b5fdfa2608ab7e9da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp35-cp35m-win32.whl

Download URL pystan-2.15.0.1-cp35-cp35m-win32.whl
Size 42.0 MB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
f45bf44fa3dc64230be033cd45e48088c383ae53203f82ca4d7e2124221f684b
BLAKE2b-256 checksum
How to use checksums
75a1726f13486091d56cab06d58c8bc6dbeb754c409a81fed5bf5cb11a55c71c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp35-cp35m-manylinux1_x86_64.whl

Download URL pystan-2.15.0.1-cp35-cp35m-manylinux1_x86_64.whl
Size 62.4 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
fc2add62db8c6aea5389367398d1691d0801d687ea04dd3a18f4e9c86716c94a
BLAKE2b-256 checksum
How to use checksums
00b1a913c479854da4ab516f944a4cbd3e19790808bc88f9551bcb60ed28cb31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp35-cp35m-manylinux1_i686.whl

Download URL pystan-2.15.0.1-cp35-cp35m-manylinux1_i686.whl
Size 61.6 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
6806e964cd4215f79a47479aa8aba28ed20324613357469e6989ae68047b1fd8
BLAKE2b-256 checksum
How to use checksums
ea87c02b910ee7bd6a1b4479885bce578ceb2715573e49a6dccf9b3a6eeccda4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL pystan-2.15.0.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 44.2 MB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ Intel (x86-64, i386) macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
6880fecf43e7d9781130f96192a2042becf675c518277714e5a2d7a083b8e339
BLAKE2b-256 checksum
How to use checksums
33372685a14ad960dbf8cdeba32b390ca9818619cd7719e0ce1f47a1b29df537
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp34-cp34m-manylinux1_x86_64.whl

Download URL pystan-2.15.0.1-cp34-cp34m-manylinux1_x86_64.whl
Size 62.4 MB
Tags CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
51895dae6a0c3bd676caacac5d232dc13edb9ffee6b8a98cf1b2c4ccedd3326e
BLAKE2b-256 checksum
How to use checksums
74651465f73428e144ed6de2252a1b1dbab07ccfccff1391867ebf00716bbd2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp34-cp34m-manylinux1_i686.whl

Download URL pystan-2.15.0.1-cp34-cp34m-manylinux1_i686.whl
Size 61.6 MB
Tags CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
957c6d2b9093a507ea849972b5d23a3eec17c1cbbeb51e15441ffac8f6f73a30
BLAKE2b-256 checksum
How to use checksums
dda1876effa126fc14a3802dc7e92de49b002a285c42146508d3abb36e23bf38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL pystan-2.15.0.1-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 44.2 MB
Tags CPython 3.4 CPython 3.4 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ Intel (x86-64, i386) macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
0e405e439d8959776a575ecc69d6b07bcfd161a7e19d4a6fb5f9bdeb60190928
BLAKE2b-256 checksum
How to use checksums
dece398f4586fbd4f6c4a4d66e5338dede76d503ce29c02a90737c00fa56057f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp27-cp27mu-manylinux1_x86_64.whl

Download URL pystan-2.15.0.1-cp27-cp27mu-manylinux1_x86_64.whl
Size 62.4 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
d08c4c9f1ccc8afd07980febe111bf4994f2fe8630d0ddaeba3c726bb5dd513c
BLAKE2b-256 checksum
How to use checksums
39248b172417043f2bed1bfa9d1ababcdd5021b510fb8747666651c1eed1f832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp27-cp27mu-manylinux1_i686.whl

Download URL pystan-2.15.0.1-cp27-cp27mu-manylinux1_i686.whl
Size 61.6 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
d4b2705c2d3e9a20e205f4a254c680f676943aeec316c01ec36f031720d111e4
BLAKE2b-256 checksum
How to use checksums
9676a981c24500c8988506398abbd08a3f9e38dc99e51b3d0efcd4fbe9d27665
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp27-cp27m-manylinux1_x86_64.whl

Download URL pystan-2.15.0.1-cp27-cp27m-manylinux1_x86_64.whl
Size 62.4 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
4350c6fc662372e7ddf60117b1fd84ebe748403aad9b9e822fa95192a5d2e44e
BLAKE2b-256 checksum
How to use checksums
8521ad820f4e28357bd458418d1bc9c95a9bf00e2a21869a7933e34ef14197e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp27-cp27m-manylinux1_i686.whl

Download URL pystan-2.15.0.1-cp27-cp27m-manylinux1_i686.whl
Size 61.6 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
faec0b10f9fc57dfa4b31c3a7526c1d19499da199793a21a9c9c0140236e4324
BLAKE2b-256 checksum
How to use checksums
10e9fd3817140980d0033e896e22f4e8907c5224a3dee2508a44b10b3bfa484c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL pystan-2.15.0.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 44.2 MB
Tags CPython 2.7 CPython 2.7 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ Intel (x86-64, i386) macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
296f10824adbc09714ac63362170174f5e868dd7f240abf4a8025d59455afc9e
BLAKE2b-256 checksum
How to use checksums
ed998bc64f78b8156476e66d142ef914be993caaa782b7c735ed13639966f9ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.14.0

2 release files

3.10.1

2 release files

3.9.1

2 release files

3.9.0

2 release files

3.8.0

2 release files

3.7.0

2 release files

3.6.0

2 release files

3.5.0

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

This release

2.15.0.1 This release

19 release files

2.7.0.0

1 release file

2.4.0.0

1 release file

2.3.0.0

1 release file

2.2.0.1

1 release file

2.2.0.0

1 release file

2.1.0.1

1 release file

2.1.0.0

1 release file

2.0.1.3

1 release file

2.0.1.1

1 release file

2.0.1.0

1 release file

2.0.0.1

1 release file

2.0.0.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page