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.0

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.0
File Size Uploaded
pystan-2.15.0.0.tar.gz 25.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for pystan 2.15.0.0
File
pystan-2.15.0.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
pystan-2.15.0.0-cp36-cp36m-win32.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-32 Details
pystan-2.15.0.0-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.0-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.0-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.10+ Intel (x86-64, i386), macOS 10.9+ Intel (x86-64, i386), macOS 10.6+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.9+ x86-64 Details
pystan-2.15.0.0-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
pystan-2.15.0.0-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details
pystan-2.15.0.0-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.0-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.0-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.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
pystan-2.15.0.0-cp34-cp34m-manylinux1_x86_64.whl CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.0-cp34-cp34m-manylinux1_i686.whl CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.0-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.10+ x86-64, macOS 10.9+ Intel (x86-64, i386), macOS 10.9+ x86-64, macOS 10.10+ Intel (x86-64, i386), macOS 10.6+ Intel (x86-64, i386) Details
pystan-2.15.0.0-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.0-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.0-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details
pystan-2.15.0.0-cp27-cp27m-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32 Details
pystan-2.15.0.0-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.9+ x86-64, macOS 10.10+ Intel (x86-64, i386), macOS 10.6+ Intel (x86-64, i386), macOS 10.9+ Intel (x86-64, i386), macOS 10.10+ x86-64 Details

Total release size: 989.9 MB

Release files / pystan-2.15.0.0.tar.gz

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

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

Download URL pystan-2.15.0.0-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
a979c0a04e3685ae720b949ffd930e69d6321757be8676bc96d78fc8d8feef20
BLAKE2b-256 checksum
How to use checksums
5bf927365812c93d81e54997d7f6340e5bccb92f75a5af71240a8ec584b87189
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
f1c4999131d9b0393b11095abff738bc3b66fed6b8a903394b0ddf5543df3372
BLAKE2b-256 checksum
How to use checksums
c29a21d96691b59940d0bdc97c5d61e5e42da52eef2bb555cdd1b145a2cd9575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
1220505a4791801be2936aaa898739ef8f7f1cf681e589387b68ef19396607e0
BLAKE2b-256 checksum
How to use checksums
6b43b7474e664f3c391c7be635c68c0b7e730289558a5a93b1338c8187f80239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
dfbbc4f41c1d9bba106e1b78a65f64d34e8c8854ab2d5e77e181040db03d42de
BLAKE2b-256 checksum
How to use checksums
8a2e324ff4fbfdda03dcda4f461dfd03b6df6d0f01a612323815bbb24608cdb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.0-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.0-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
4e6d3a443521660a07c354a3de83870b1699b2f95b0796705588997deb3e069a
BLAKE2b-256 checksum
How to use checksums
0caf7bdc8fd11c0acf5ed84ad6129fa035d7b6bb158d31eb301ee3d585170ae2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
0a1b25d972699180a1a54b333862bfb9da4506518177d85f276d0e9751cd4074
BLAKE2b-256 checksum
How to use checksums
00c1cd8a9fe6faf518c64daab11b684731e81aa99fe151af4b965e448eb63b09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
3029de1be3880d3b10d7982c63cc4b67708a889e8a3c0203912e68155186606b
BLAKE2b-256 checksum
How to use checksums
c7560ee6e7ce79818552961148d863ba50ffcd228fd5eb08b9983706b8ae6a29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
ea0f6ae41cc148ce17b98cf43e5a375ecf1ddae99d221322ec8bbff8e500e0d4
BLAKE2b-256 checksum
How to use checksums
05c88a20608e15441d2b634d603d0c3dd59f7102994ea0b43dd94b3946ef5823
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
6134db9d3bd8fd5150632e0f51e005bd5aacdb9c88842a7c0f0d62c5ea6d8a2d
BLAKE2b-256 checksum
How to use checksums
1c119f2d507b185eca0025d8cdadcaca1c2c71964c6168e3318f4cb0f1e7b7b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.0-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.0-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
dfae3aa8da8207ba3fc467da244428eafe658ba40c19eacc7333e6ec4b23cdd7
BLAKE2b-256 checksum
How to use checksums
7d5ef5acd7a6acffc75f7c654cb92802988bc5eb49ac1249e52a0d995483060e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
7134b05adf6cd20bfc1de38ce204fde607b3ecb519bf2260668e5e86d15285d5
BLAKE2b-256 checksum
How to use checksums
bd87c99677762c01d3efabab752eebc88e91956bb818fb14df7948cc09c6677b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
ae45267147ff127e1649beb715a24a0a9655686389e8e77cf70f8c2d9f485bd4
BLAKE2b-256 checksum
How to use checksums
168194e623876d1194ad07873238861259174e38a756ba37a4f7bad08ef722bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.0-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.0-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
768f860d3e396ab6ccb907363cb7ac8728c9e89e18451923755702a1f4cf31ee
BLAKE2b-256 checksum
How to use checksums
660d16a4662e547033a4b75d5dc0771a2472b69a30fc7aae3bf7763585c4d22b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
a3c1ac6d1611979fca01759c672a95e084f7bc6457ac680db159c6849e3d5f96
BLAKE2b-256 checksum
How to use checksums
aec0dd63fd597276649e2d2a43bc8ed2cba3350ac39c7071d58f454148710c61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
49402f955ef7b545480aa30b162a9b780e36cb610d32bfd6cff9c54eefcdad2f
BLAKE2b-256 checksum
How to use checksums
5bc091f463fb25914ecb0b8eb0aa129bea88dfd9840717321226bbf7b2f029ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
0074d25f4524f50237d8652aba968279809fbc96725299a7da6ac3393e9dbe65
BLAKE2b-256 checksum
How to use checksums
cea393d14b35eb2f40472451c49cfdc3a729b072468308d8f663b21fcbedd577
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL pystan-2.15.0.0-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
365678c0ec92df3eb453bafa049e1ef9a79996d501f8b10a88ae4d824700fc26
BLAKE2b-256 checksum
How to use checksums
511cc45772395fcad445000f404c7d68bcde7246416bea06f7876b0ddc37b184
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pystan-2.15.0.0-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.0-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
059a700e25e66a3c5ac3a939d9f01ad4c9e2158f2baac7cfee260e9ef2b6c339
BLAKE2b-256 checksum
How to use checksums
d0577511af2fb2d7bf610910b271ff442353f7422bc98863be3287b1735a4d9f
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.0 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