Questions tagged [pystan]

The Python Interface to Stan

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

Resources:

86 questions
0
votes
1 answer

What do brackets mean after a type is specified when declaring variables in Stan?

I saw a Stan program where the data block contained int person[N_obs]. Is this creating an array of integers of size N_obs that is called with person?
socialscientist
  • 3,759
  • 5
  • 23
  • 58
0
votes
1 answer

How to use functions of objects declared as data when declaring other objects in Stan/RStan?

Suppose I want to declare a matrix mat with ncol columns, where ncol is a function of some data foo. I could accomplish this with the below data block, which requires I pass Stan a data file with values for ncol. How can I accomplish this within my…
socialscientist
  • 3,759
  • 5
  • 23
  • 58
0
votes
0 answers

Stan_glm equivalent in Python

I am trying build Market Mix Modeling (MMM) using a bayesian regression. My dependent variable is "Sales_Units", and My predictors are x1, x2, x3, x4 I also have prior information for the 4 predictors. The bayesian regression model built in R as…
Frank B
  • 1
  • 1
0
votes
1 answer

stan to manipulate and fix syntax for data

max_lag is a fixed integer number for all media. I need to have a specific lag for each media. So, how can I have a different lag for every media, and how data and parameters have to change into the syntax? For Example: max_lag_channel_media1 = 10;…
0
votes
1 answer

ImportError: No module named 'pystan'on MacOS

I installed pystan on a python virtual environment using pip install pystan. I checked the module is listed with pip freeze. but when i run a code with import pystan. It gives the error that the module is not found. below is the output from pip…
Jio
  • 578
  • 3
  • 8
  • 27
0
votes
1 answer

Error on EC2 while using fbprophet : Unrecognized token 'Initial': was expecting 'null', 'true', 'false' or NaN

m = Prophet() m.fit(df) The error below was encountered: Unrecognized token 'Initial': was expecting 'null', 'true', 'false' or NaN at [Source: Initial log joint probability = -13.932; line: 1, column: 8] The above error keeps on coming up. Tried…
0
votes
1 answer

PyStan fails with Segfault when running basic probit model

I am getting familiar with PyStan. I have run several models including a Bayesian linear regression model without issue. However, when I try to run the following code I get a seg fault error: Segmentation fault (core dumped) Interestingly, this…
samvoit4
  • 295
  • 2
  • 8
0
votes
1 answer

Is there a way to install "pystan" & "fbprophet". I getting errors while installing

I tried installing via pip and conda, both ways failed. Anybody know how to overcome this problem.
Krishna75
  • 17
  • 5
0
votes
1 answer

Pystan, Runtime error - Initialization failed

I'm trying to develop a Bayesian model using Pystan. I'm able to compile the model successfully. But when I'm sampling data I'm getting run time error. Refer to the code below: my_code = ''' data { int N; int K1; int K2; real…
Niha K
  • 21
  • 3
0
votes
1 answer

STAN RuntimeError: Initialization failed

I'm trying to estimate the mean and covariance matrix of a multivariate normal distribution with STAN. I first import pystan and generate the data. I basically try to follow the official YouTube tutorial for Python. import pystan as ps import numpy…
Christian Singer
  • 295
  • 3
  • 5
  • 15
0
votes
0 answers

pd.read_excel crashes (hangs) on certain files

FOA I've never had pandas crash (freeze, loop infinitely) on me before. Second it's not the files, they were reading well before. Doing a bit of research I stumbled upon this issue where the cause is traced back to pd._libs.cp36. Another similar…
0
votes
1 answer

PyStan Model description

I am trying to build a simple statistical model to study both stochastic model and PyStan. Here, this is my model description in PyStan which does not work well. Please help me. Model is to predict Val by person's Age. Its formulation is that Val…
Koutarou
  • 21
  • 2
0
votes
0 answers

No module named 'fbprophet' in jupyter notebook inside visual studio code though it is listed in pip3 list

screenshot ModuleNotFoundError Traceback (most recent call last) in ----> 1 from fbprophet import Prophet ModuleNotFoundError: No module named 'fbprophet'
0
votes
1 answer

Stan (pystan) creating a vector of ints to assign to a categorical distribution

First time using Stan. I am starting with an example found on a Coursera class where they're using JAGS which I am trying to reimplement in Stan. The class is free to audit and I have linked the relevant lecture. Background on the model: (I don't…
qwertylpc
  • 2,016
  • 7
  • 24
  • 34
0
votes
1 answer

Generated quanties with a transformed parameters block

I need to extend the following model with a generated quantities block, but I can't figure out how to do it: import pystan import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd plt.style.use('ggplot') data…
Tom Kealy
  • 2,537
  • 2
  • 27
  • 45