106 questions
1
vote
1
answer
33
views
Bayesian ordinal logistic model using rstan
Is my syntax below for an ordinal logistic model correct? I get an error message which I don't understand.I got the code from a published paper illustrating a graded response model (ordinal logistic, ...
0
votes
0
answers
45
views
Bayesian model in SAS Proc MCMC - how to specify parameter constraints
I am trying to estimate a Bayesian logistic model (with a latent variable and two comparison groups, apart from model parameters), while specifying that two parameters should be equal. My SAS code ...
0
votes
0
answers
34
views
Hierarchical Time Series Modeling for Data with Different Lengths in Numpyro
Before we get started, this is what I am importing:
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
idx = pd.IndexSlice
# import jax
from jax import random
import jax....
0
votes
0
answers
20
views
Hierarchical bayesian modelling - model structure in PYMC
Hi I am learning about HBM's, and want to confirm whether the following is a valid way to model gender and region influences (along with a few other factors that can be seen in the dataframe) on the ...
0
votes
0
answers
29
views
Alternative to forecast sequential regressions
Seeking advice on how I could forecast the below better. Ultimately I am looking to build a 5-year rent growth forecast, but as part of the forecasting process, I will need other variables.
Currently, ...
1
vote
1
answer
64
views
posterior draws without including hyperparameters from hierarchical model
I have a hierarchical Bayesian model that I fit with brms. Is it possible to draw samples from the posterior where I don't specify a specific grouping from the hierarchical term? Essentially, I'm ...
0
votes
1
answer
522
views
Specifying nested random effects in "brms"
I am new to using "brms" and am encountering an issue when specifying the model formula. The error occurs in the specification of the random intercept (three variables/terms denoting the ...
0
votes
1
answer
271
views
specifying group-level effects in brms
I'm trying to model the effects of one continuous variable (mass) and three categorical variables (site, sex, and method) on another continuous variable with brms. The explanatory variables are to ...
0
votes
1
answer
554
views
How to apply a Blackjax sampler on my PyMC V5 model that uses a custom loglikelihood
I'm using PyMC v5 to perform Hamiltonian Monte Carlo in a model. I can make run the code below but it is very slow, even with multiple cores. I have a function applyMCMC for this purpose:
# define a ...
0
votes
0
answers
104
views
How can I effectively propagate parameter uncertainties from one hierarchical level to the next in Bayesian hierarchical modeling?
I am using PyMC, the probabilistic programming library of Python to implement a hierarchical bayesian model.
Consider a two-level Bayesian hierarchical model. Level-1 has a parameter m1 and level-2 ...
1
vote
1
answer
56
views
How to implement Bayesian football model in RSTAN? I can do it in RJAGS but in RSTAN
The original can be found at https://discovery.ucl.ac.uk/id/eprint/16040/1/16040.pdf
We assume the number of goals follow the Poisson distribution
Where the log of goals is computed as
With the ...
0
votes
2
answers
252
views
Cannot load a previously saved trace for future inferences using Pymc 3.11.4
I am trying to implement a simple hierarchical bayesian inference. I am inferring a parameter 'm' of a simple linear model y = mx using Pymc. I want to save the trace so that I can load it later. The ...
0
votes
1
answer
77
views
Error in `choicemodelr()`: ! argument "directory" is missing, with no default
I hope your are well. I am estimating a hierarchical bayes choice model with ChoiceModelR. This is a long code that works perfectly except this chunck. Every time I run this chunck I get the error: ...
1
vote
1
answer
85
views
Hierarchical varying effects model with MVN prior
What I'm trying to do
I've already dealt with multivariate priors in pymc (I'm using 4.0.1), but I can't get their usage in a hierarchical model working. In my example I'm modeling a regression ...
2
votes
1
answer
342
views
ValueError: Incompatible Elemsise input shapes in a Hierarchical Bayesian Time Series Model
I am trying to build a Bayesian hierarchical time series model to understand sales data of four stores using PyMC 5.4 in Python. All the stores have a seasonal component, that I am trying to model ...
0
votes
1
answer
871
views
How to set up a Half-Normal Prior in NIMBLE?
Can you give me example to write half-normal prior using Nimble package in R?
For example, if I want my precision variable "tau.b" to follow a Half-Normal(0, 2.5), will it be correct if I ...
0
votes
1
answer
410
views
A setting to subjectively adjust random effect variance in R package glmmTMB?
From my layman understanding of frequentist hierarchical models, there is some penalty mechanism built into the likelihood function, that prevents the random effects from overfitting to the data and ...
0
votes
1
answer
261
views
Set up half-Cauchy prior in rjags parfit
I'd like to set up half-Cauchy prior for rjags parallel fit. The prior is set in the model as:
model <- function(){
...
# rho.b ~ dunif(-0.99, 0.99)
tau_h ~ dt(0, 1, 1)T(0,)
tau_b ~ dt(0, 1, ...
0
votes
1
answer
108
views
BTYD: Prior model tweaking
I am recently encountering a challenge with BTYD, specifically with Pareto-NBD model. See, from the papers that I read from Faders, there are few assumptions using this model, and the first and ...
0
votes
1
answer
949
views
When trying to use INLA on a LGM I get "Error: length(covariate[[r]]) == NPredictor is not TRUE"
For a project I'm doing a need to create a LGM from points on a [0, 1]^2 grid. I'd really appreciate any help you all can give me
> set.seed(2000)
> # Define number of points and locations
> ...
0
votes
0
answers
58
views
What's causing rjags "Node inconsistent with parents" error
I'm trying to run a bird occupancy model using rjags and I'm getting an error saying: Error in node ytb[1,2,9,1:5,1] Node inconsistent with parents. The vector that the error references is a vector of ...
0
votes
0
answers
252
views
What is causing a syntax error on last line of JAGS model?
I have created a model to investigate the effects of covariates on occupancy of different bird species at different points across different properties. However, when I try to run the model using rjags,...
0
votes
1
answer
131
views
Supply different families of priors as a parameter in the bugs/stan model
This is the classic eight school example in Bayesian data analysis by Andrew Gelman. Please see the stan file and R code below. I use a cauchy prior with paratmer A for the hyperparamter tau in the ...
0
votes
0
answers
237
views
JAGS Hierarchical linear model - Extracting group mean for each parameter
I am creating a Bayesian linear regression model to predict points scored by players in a game using R and JAGS. I have 5 predictors, and the basic linear regression model is of the form:
points = ...
-1
votes
1
answer
146
views
How to predict time series with limited data
I have a dataset with four columns: date, category, product, rate(%). I would like to be able to forecast the rate for every product in my data. The major issue I'm having is that because products ...
8
votes
1
answer
4k
views
What is the meaning of bf() in brms package when we do cumulative regression analysis?
I was trying to run a Bayesian multilevel cumulative model on ordinal data and was reading the documentation of brms online. My model looks something like
model <- brm(bf(y ~ Condition + (Condition|...
4
votes
1
answer
3k
views
BayesianOptimization fails due to float error
I want to optimize my HPO of my lightgbm model. I used a Bayesian Optimization process to do so. Sadly my algorithm fails to converge.
MRE
import warnings
import pandas as pd
import time
import numpy ...
0
votes
1
answer
152
views
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 ...
1
vote
1
answer
523
views
Error: All list elements must be lists themselves: Error in using spread_draws function in tidybayes
In playing around with the tidybayes package (I replicated the data from the code simulated in the vignette: http://mjskay.github.io/tidybayes/articles/tidybayes.html), I continue to stumble onto the ...
0
votes
0
answers
59
views
How does one arrive at "fair" priors for spatial and non-spatial effects
In a basic BYM model may be written as
sometimes with covariates but that doesn't matter much here. Where s are the spatially structured effects and u the unstructured effects over units.
In Congdon ...
1
vote
0
answers
671
views
RStan - Problem in stan_file model code - Variational Bayes
I am trying to do Variational inference, so that I can get the best approximating distribution with respect to the target distribution: a Normal-Inverse-Wishart.
Normal-Inverse-Wishart distribution
...
1
vote
0
answers
152
views
Number of stochastic nodes and identifiability in JAGS
How does JAGS count the number of stochastic nodes? I assume that the number of "observed stochastic nodes" are the data points and the "unobserved stochastic nodes" are the ...
0
votes
1
answer
289
views
Use two set of data for likelihood of log_prob in tensorflow probability
I am new to tensorflow and trying to translate a STAN model into TFP. Here is my TFP model using JointDistributionCoroutineAutoBatched.
def make_joint_distribution_coroutine(Depth,N_RNA):
def ...
0
votes
0
answers
197
views
Only positive coeffcients through lmer in R
I am performing mixed effect modeling using lme4. But as you would expect, I can get positive and negative fixed and random effects as coefficients. How do I put bounds on my final coefficients such ...
1
vote
1
answer
177
views
Create a 2-hierarchy estimate of (normal) mean and standard deviation
I have a normally distributed variable x (like product demand), an index id_1 (like product number) and a second index id_2 (like product group). My goal is to estimate the mean and the standard ...
2
votes
0
answers
365
views
How to insert for loop inside pm.Deterministic() to create an array in pymc3 model?
with pm.Model() as model:
w = pm.Uniform('w', 0, 1)
c = pm.Uniform('c', 0, 5)
b = 0.5
s = pm.Deterministic('s', pm.math.exp(-c * (w * d1 + (1-w) * d2)))
s_A = np.zeros((8))
s_A = pm....
0
votes
0
answers
144
views
R stan shows weird error message when running hierarchical Bayesian model
I'm trying to sample from the posterior of this model:
enter image description here
x is a 10x1 vector, mu is a 10x1 vector, sigma is a 10x10 matrix, psi_0 is a 10x10 matrix, 1 in bold is a 5x1 unity ...
0
votes
1
answer
466
views
"empty slot not allowed in variable name" (OpenBUGS, R2OpenBUGS)
I'm a beginner with OpenBUGS which I use through the R2OpenBUGS R package. I try to set state space model for identifying a lognormal signal in very noisy data. After many trials and errors, I managed ...
0
votes
1
answer
262
views
Hierarchical Dirichlet regression (jags)... overfitting
Good Morning, please I need community help in order to understand some problems that occurred writing this model.
I aim at modeling causes of death proportion using as predictors "log_GDP" (...
0
votes
1
answer
467
views
Is there a way to obtain and store positions of matrix element in JAGS?
I am developing a bayesian hierarchical model in R with BUGS code in JAGS.
In my model, I have two matrices that contain relevant information about each another in the same exact matrix position. My ...
0
votes
0
answers
215
views
How to avoid overdispersed Poisson regression overfitting?
I have a dataset including three variables including company id (there are 96 companies), expert id (there are 38 experts) and points given by experts to companies. Points are discrete values from 0 ...
1
vote
1
answer
233
views
plot multiple scatterplots from hierarchical model with 2 predictors
I am brand new to python and pymc3. So forgive me if this question is rather silly. I have a dataset called toy_data.csv:
batch_no
batch_id
points
pred1
pred2
12-150
1
1
70.26
10.766
12-150
1
2
65.72
...
1
vote
0
answers
306
views
"this initial value does not correspond to a stochastic node" in WinBugs
I gave initial values for all the stochastic nodes, but WinBUGS still gives me the message that
this initial value does not correspond to a stochastic nodes
What node I am missing here?
#Model
model ...
2
votes
0
answers
116
views
what is the reason to draw the scatterplot matrix for the mcmc sample?
I found some bayesian paper try to draw the scatter plot matrix for the parameters.
I just wondering what is the goal to draw this scatter plot matrix?
what is the meaning if I see some linear or ...
0
votes
1
answer
264
views
Random intercepts in hierarchical Dirichlet regression (jags)
I have the following data structure:
y: 3 columns that are observed proportions of deaths over the years.
x1: GDP - continuous variable related to each year
x2: Ages- related to deaths
Here the ...
1
vote
0
answers
78
views
Bayesian Network modelling using data driven approach for Information retrieval?
I am exploring the method and code to construct the Bayesian network for information retrieval using a data-driven approach. I do find very old papers where the dataset or code are not available. I am ...
1
vote
0
answers
327
views
How do I fit a pymc3 model when each person has multiple data points?
I'm trying to practice using pymc3 on the kinds of data I come across in my research, but I'm having trouble thinking through how to fit the model when each person gives me multiple data points, and ...
0
votes
1
answer
67
views
Theano tensor length unknown for division but ok for addition in pymc3 hierarchical model
I am trying to run a hierarchical model with pymc3 in a Win10 environment using Spyder.
I have some global model parameters (theta, omega, sigma) and one specific parameter (Ci).
It takes a pd ...
1
vote
1
answer
412
views
Multi-level models + pymc3.glm
I need to fit a multi-level linear model using PyMC3 and I really like the glm api, because of the conciseness it provides. I would like to ask if and how this can be done. This blog post I found ...
2
votes
0
answers
217
views
Tensorflow probability - MCMC - problems with bijectors in transition kernel?
I'm building up a mixture of models in tensorflow-probability. The joint distribution for one given model is:
one_network_prior = tfd.JointDistributionNamed(
model=dict(
mu_g=tfb.Sigmoid(
...