Coder Social home page Coder Social logo

Comments (6)

paul-buerkner avatar paul-buerkner commented on August 17, 2024

Thanks for reporting! It is hard to tell why this happens without more information.

How large is your new data? Does this happen for every (subset of) new data. You may try only one or two rows of new data and see if the error still occurs.

Can you also show me the traceback of the error (write traceback() after the error ocurred)?

EDIT: Can you also show me the model as passed to brm that produces the error? In addition, does this happen for all of your models or only for some?

from brms.

alireza202 avatar alireza202 commented on August 17, 2024

The new data is pretty small, ~ 100. For now I have reverted to the old version, but I'll check again, and let you know.

This is the model:

data {
int<lower=1> N; # number of observations
real Y[N]; # response variable
int<lower=1> K; # number of fixed effects
matrix[N,K] X; # FE design matrix

data for random effects of subcat

int<lower=1> J_1[N]; # RE levels
int<lower=1> N_1; # number of levels
int<lower=1> K_1; # number of REs
real Z_1[N]; # RE design matrix
}
transformed data {
}
parameters {
vector[K] b; # fixed effects
vector[N_1] pre_1; # unscaled REs
real<lower=0> sd_1; # RE standard deviation
real<lower=0> sigma; # residual SD
}
transformed parameters {
vector[N] eta; # linear predictor
vector[N_1] r_1; # REs

compute linear predictor

eta <- X_b;
r_1 <- sd_1 * (pre_1); # scale REs

if available add REs to linear predictor

for (n in 1:N) {
eta[n] <- eta[n] + Z_1[n]_r_1[J_1[n]];
}
}
model {

prior specifications

sigma ~ cauchy(0,5);
sd_1 ~ cauchy(0,5);
pre_1 ~ normal(0,1);

likelihood contribution

Y ~ normal(eta,sigma);
}

from brms.

paul-buerkner avatar paul-buerkner commented on August 17, 2024

Thanks for the model code, but I rather ment the function call brm(formula, data, etc.) so that I can replicate your model with dummy data and see if the same error occurs (sorry that my formulation was misleading).

from brms.

alireza202 avatar alireza202 commented on August 17, 2024

Sure, here it is:

brm(formula = y ~ x1 + x2 + x3 + (1 | subcat),
data = df,
family = "gaussian",
n.chains = 4,
n.cluster = 4)

from brms.

alireza202 avatar alireza202 commented on August 17, 2024

I solved it, but I'm not sure how. It had something to do with my factor levels. When I refactored them again, it worked. Factors in R are much like wildcards... you never know what's gonna happen with them...

from brms.

paul-buerkner avatar paul-buerkner commented on August 17, 2024

I am glad to hear that, although it would have been interesting to understand what was really causing this issue. ;-)

from brms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.