Beta distributional regression : problem with operator


#1
  • Operating System: Ubuntu 16.04.4
  • brms Version: 2.2.0

Hello!

I have trouble coding beta distributional modelling with brms.

my_formula <- bf(y ~ x1 + x2, phi ~ x1 + x2, family = Beta)

The operators for the reparametrization step are only adapted for vector * real, so the compilator return this error :

SYNTAX ERROR, MESSAGE(S) FROM PARSER:

No matches for: 

  vector * vector

Available argument signatures for operator*:

  real * real
  vector * real
  row vector * real
  matrix * real
  row vector * vector
  vector * row vector
  matrix * vector
  row vector * matrix
  matrix * matrix
  real * vector
  real * row vector
  real * matrix

expression is ill formed
  error in 'model62bd888b6e_file62b1ff3659' at line 51, column 37
  -------------------------------------------------
    49:   // likelihood including all constants 
    50:   if (!prior_only) { 
    51:     target += beta_lpdf(Y | mu * phi, (1 - mu) * phi); 
                                            ^
    52:   } 
  -------------------------------------------------

Error in stanc(model_code = paste(program, collapse = "\n"), model_name = model_cppname,  : 
  failed to parse Stan model 'file62b1ff3659' due to the above error.

The operator should be .*, or a loop is needed. I will be able to solve this by formulating my own beta distribution, but the issue deserves to be reported!

Thank you!
Lucas


#2

This is a bug that I have fixed already in the latest dev version of brms to be installed via

if (!require("devtools")) {
  install.packages("devtools")
}
devtools::install_github("paul-buerkner/brms", dependencies = TRUE)

#3

Great, thank you Paul!