Trying non-linear model in brms when rstan loo pareto-k values are all 1-inf

Hi!

Hope this email finds you all well, safe and sane

I have question about applying hierarchical non-linear models in brms.

In particular, I have two questions:

  1. How do you make parameter estimates be a function of other parameters? I get the following message when I try it:

The parameter ‘reserveK’ is not a valid distributional or non-linear parameter. Did you forget to set ‘nl = TRUE’?

  1. How can I input information from two datasets or make it a conditional (if-else) if I use one dataset? For example, if two sets of data inform some specific parameters.

I have run the model in rstan, but when I do loo() I get pareto-k values that are 100% within 1-Inf (very bad), and thus have to go with k-fold. So I thought I would give the model a try with brms to see if I get the same loo results (and make sure I have no model misspecification).

Attached the stan model (txt) and some failed attempts to implement the same model with brms (.R)brms_failedattempts.R (3.6 KB) codeforbrms.txt (3.8 KB)

Thank you!
Best regards
J

1 Like

Hi,
it seems your question fell through, sorry.

Some quick thoughts:

We would be able to help you more effectively if you also shared the remote_complete data or its subset (so that I could actually run the code and fiddle with it).

I don’t have much experience with non-linear models in brms, I would guess the syntax you used should work (or at least produce a different error), maybe it is actually a bug? (tagging @paul.buerkner). You might also try to fomulate the model in the form

 brm(bf( x ~ y, nl = TRUE) + bf(y ~ c, nl = TRUE) + ... , family = ...)

Also the model looks quite complex - do you get good convergence (n_eff, Rhat)? Are you able to recover parameters from simulated data? I am just trying to figure out if the high pareto-k isn’t actually a symptom of some deeper problems that won’t go away with moving to brms or using k-fold CV. Parts of the model look like some sigmoid function and sigmoids are quite difficult to fit well so that’s why I’m asking…

I am not sure I understand what you are trying to achieve… Maybe concatenating the datasets and using the subset helper would let you do this? From the docs (brmsformula function - RDocumentation):

For multivariate models, subset may be used in the aterms part, to use different subsets of the data in different univariate models. For instance, if sub is a logical variable and y is the response of one of the univariate models, we may write y | subset(sub) ~ predictors so that y is predicted only for those observations for which sub evaluates to TRUE .

Best of luck with your model!

2 Likes