r/BayesianProgramming • • Jul 10 '22

Need Recommendation

3 Upvotes

Hello all,

I've been trying to learn bayesian statistics in R for an average of 2 month. Most of my time has been spent learning distributions and I'm slowly moving to models now and unfortunately they are very hard to come by. Especially stan and brms. What would you recommend for me to learn?

PS: I do not study in a mathematics-based department, but it can be said that I have statistical knowledge according to my field (but not very advanced)

Thank you.


r/BayesianProgramming • • Jul 07 '22

SunODE/PyMC help

3 Upvotes

Hello! I am new to this community specifically because I need some help. I'm doing some undergrad research in disease modeling and need help getting SunODE to work in a Google Cloud Platform environment. Preferably with PyMC 4 but have gotten it to kinda work in PyMC 3. I can provide more details if necessary. Thanks!


r/BayesianProgramming • • Sep 02 '21

Need help with theano use in Pymc3

3 Upvotes

Hello everyone, I've been stuck on this problem with theano for a while and was wondering if I can get some help.

I would like to implement the following formula:

alpha * T.dot( [alpha**1, alpha**2, alpha**3], [B1, B2, B3] ), as an example.

But I need to loop through different alpha values, and I have a tuple of arrays of B values (given, fixed values). What I mean by tuple of arrays, the data look like this:

tuple([ [B1], [B1, B2], [B1, B2, B3], ...]), etc., so it's an increasing (in terms of size) tuple of arrays. In the function below, the value of "beads" is one of the arrays in this tuple

I am trying to loop through using scan like so:

(I also have a value N in the function that matches the size of "beads", because when I tried to get the size from beads I would get another error. This is just a workaround for me.)

import theano
import theano.tensor as T

## Creating function for Theano

def rl_model(N, beads, alpha):
    
    
    powers = T.arange(1,N+1)[::-1].eval()
    alpha_vector = T.pow(alpha, powers)
    
    q_value = alpha * T.dot(alpha_vector, beads)
    
    return q_value
    

N = T.scalar()
beads = T.vector()
alpha = T.scalar()

results, updates = theano.scan(fn = rl_model,
                               sequences = [N, beads, alpha])

fn = theano.function(inputs = [N, beads, alpha],
                     outputs = results,
                     updates = updates)

However, I always get an error when Python tries to run the scan function. Here is the error:

results, updates = theano.scan(fn = rl_model,


    actual_slice = seq['input'][k - mintap_proxy]


    raise IndexError('too many indices for array')

IndexError: too many indices for array

Of course, file info is also given but I erased that here.

My question is, I don't quite understand where this IndexError is coming from. I thought maybe it was a problem of mixing scalars and vectors, but I don't think that's the issue. Can anyone help me better understand what's going on? I've been frustrated and stuck on this for weeks now :(


r/BayesianProgramming • • Aug 23 '21

How to calculate Bayesian posterior for Gaussian distribution

3 Upvotes

Hi everyone,

I wonder if you are aware of python or R code that can help me with understanding and implementation Bayesian posterior updating of Gaussian distribution.

Thanks


r/BayesianProgramming • • Aug 03 '21

Help wit Using Pymc3?

3 Upvotes

Howdy,

I'm trying to build a custom model in pymc3, and I'm failing to understand what's going wrong.

The basic idea I'm trying is to build an np array of the objects, and convert to a theano tensor before inputting as the mean. Here's the code for reference:

with pm.Model() as van_lom:
    
    sigma = pm.Gamma('sigma', alpha = 1, beta = 1, shape = n_prts)
    ratio = pm.Gamma('ratio', alpha = 1, beta = 1, shape = (n_prts, 2))
    # Ratio: allowed to change between neutral and emotive conditions, so each participant has 2
    
    # Now to generate array of predictions
    predictions = np.array([])
    for n in range(len(prt_codes)):
        
        conf_rating = (1 + ratio[prt_codes[n],
            condition_codes[n]]**differences[n])**(-1)
        
        conf_log = tt.log(conf_rating/(1 - conf_rating))
        
        predictions = np.append(predictions, conf_log)
        
    pred_tensor = tt.stack(predictions)
    
    y = pm.Normal('y', mu = pred_tensor, sigma = sigma[prt_codes], observed = log_conf)

Here, 'condition_codes' and 'differences' are arrays of integers (fixed beforehand, not estimated).

Basically, I need that mu in pm.Normal to change on each trial, so I tried building an array that did that. But I get an error because I end up making an array of objects which can't be transformed into a theano tensor.

This tensor stuff is really confusing for me, so if someone could explain like I'm five that would be awesome. I guess generally speaking, I'm looking to make an array (or some theano equivalent) to tell pymc3 that the mean should change on every trial, and the mean is dependent on variables that need to be estimated.

Thanks in advance for any help!


r/BayesianProgramming • • Feb 19 '21

Univariate Distribution Relationships of 76 distributions [Resource]

Thumbnail
math.wm.edu
3 Upvotes

r/BayesianProgramming • • Nov 14 '20

A Bayesian take on item response theory for assessing engineering skills

Thumbnail
triplebyte.com
3 Upvotes

r/BayesianProgramming • • Sep 19 '20

Bayesian Hierarchical Model

3 Upvotes

Hello Reddit,
I am trying to develop a Bayesian Hierarchical Model using PyMC3 and RJAGS as well. I want some good explanations regarding setting up priors and pre requisites that are required for predicting results.

Please help or PM Me!


r/BayesianProgramming • • Aug 04 '20

[1904.13001] Encoding Categorical Variables with Conjugate Bayesian Models for WeWork Lead Scoring Engine

Thumbnail
arxiv.org
3 Upvotes

r/BayesianProgramming • • Jul 15 '20

Help: Bayesian Negative Binomial ARMA

3 Upvotes

Hello to everybody, I'm working on a project for my university which objective is to produce a predictive model for COVID-19 new positives in Italy. It appears that I cannot calculate any replication for the model because when I run the code a warning says that inverse scale parameter is 0 and even though i tried to reparametrize, as my profs suggested, i wasn't able to fix it. Do you have any suggestion (about the code, which priors you would use etc.)? I don't know if this is the right place to discuss about this in case tell me. Here you can find the thread in STAN forum in which you can find also the R and STAN code. Thanks in advance for the help.

LINK:https://discourse.mc-stan.org/t/arma-bayesian-nb-model/16604


r/BayesianProgramming • • Jul 03 '20

[Cross-Post] How to implement the Therapeutic Touch example from DBA2E in TFP?

Thumbnail reddit.com
3 Upvotes

r/BayesianProgramming • • May 26 '20

Question - multilevel hierarchical model results

3 Upvotes

Hi,

I was programming a model with multivariate Gaussian using pymc3. I tried to reparametrize using Choleksy non centred reparametrization in order to have a faster result and avoid divergences. I am computing the correlation between the 2 models for each posterior statistic and I get low correlation especially for the hpd 2.5%. Does that mean I am doing something wrong? what can explain the difference? can someone please help me?

Thanks


r/BayesianProgramming • • Apr 18 '20

What metrics do I compare for model selection?

3 Upvotes

Hey y'all!I am a bayesian newb. I built my own GLM in rJAGs and it runs! I want to compare different combinations of explanatory variables. Does anyone have any good tutorials out there for bayesian model selection? Do I just look at deviance, WAIC, or is there some other metric I should be looking for to tell which of my models is better? Basically, I can build a model, but I don't really know what outputs I am supposed to include for my paper to say that this model is good. What I did was make a plot comparing predicted y values to observed. What else should I include?

Finally, is there some kind of package that will compare all combinations of possible explanatory variables, similar to dredge() in MuMIN (but that I could send a custom JAGs model to?) I know this one is a hail Mary! I have just been building many versions of my model to manually due a backwards stepwise selection.


r/BayesianProgramming • • Jun 19 '19

Guesstimate

Thumbnail
getguesstimate.com
3 Upvotes

r/BayesianProgramming • • Jun 19 '19

End-User Probabilistic Programming [pdf] | Hacker News

Thumbnail news.ycombinator.com
3 Upvotes

r/BayesianProgramming • • Mar 15 '19

15 Great Articles about Bayesian Methods and Networks

Thumbnail
datasciencecentral.com
3 Upvotes

r/BayesianProgramming • • Mar 11 '19

Question about inference on log posterior

3 Upvotes

Hi,

I am a final year BSc student current working on a project using MCMC for parameter estimation of ODE systems. In particular, I am looking at some complex likelihood-surfaces like the one posed in this paper (Page 9 of the PDF document / Page 12 of the paper) :

https://ac.els-cdn.com/S030439750800501X/1-s2.0-S030439750800501X-main.pdf?_tid=cf119d67-f8bf-4c92-823e-ce99c02bd9f6&acdnat=1551388781_f847d40e13f7b2e3f6e8b1e33712e9da

I was wondering why we are considering the log-posterior rather than the typical posterior? In the graphs we can tell from the axis that the authors of the paper are considering the log posterior and performing MCMC algorithms on this surface. I know using the log space simplifies the calculations by changing the multiplication of the prior and likelihood to an addition but I don't understand what the implications of running an MCMC on the log posterior are, since we are looking for the actual posterior.

If someone could point me in the direction of any papers or books that discuss why we perform inference on the log posterior rather than the normal posterior, that would be great!

Thanks for any responses in advance


r/BayesianProgramming • • Dec 20 '18

[1812.06855] Bayesian Optimization in AlphaGo

Thumbnail
arxiv.org
3 Upvotes

r/BayesianProgramming • • Nov 04 '18

2059: Modified Bayes' Theorem - explain xkcd

Thumbnail explainxkcd.com
3 Upvotes

r/BayesianProgramming • • Jun 30 '18

Preparation materials for CEAi Precision Workshop #1 on Bayesian modelling

Thumbnail
github.com
3 Upvotes

r/BayesianProgramming • • Jan 20 '18

PyData Tel Aviv Meetup: Uncertainty in Deep Learning - Inbar Naor

Thumbnail
youtube.com
3 Upvotes

r/BayesianProgramming • • Oct 24 '17

Motif of the Mind | Junpeng Lao, PhD

Thumbnail junpenglao.xyz
3 Upvotes

r/BayesianProgramming • • Oct 10 '17

pomegranate v0.8.0 released: probabilistic modeling in python • r/Python

Thumbnail
reddit.com
3 Upvotes

r/BayesianProgramming • • Sep 29 '17

bambinos/bambi

Thumbnail
github.com
3 Upvotes