 No correspoding probability function for bernoulli_logit_glm?

Operating System: Clear Linux (28100) and Antergos (Linux)
Interface Version: rstan (Version 2.18.2, GitRev: 2e1f913d3ca3)
Compiler/Toolkit: gcc 8.3.1 and gcc 8.2.1

Hi!
Here is documentation for bernoulli_logit_glm, yet when I try it in a simple logistic regression model:

data {
int<lower=0> N;
int y[N];
matrix[N,4] X;
real mu0;
real mu1;
real sigma0;
real sigma1;
}
parameters {
real beta0;
vector beta1;
}
model {
beta0 ~ normal(mu0, sigma0);
beta1 ~ normal(mu1, sigma1);
y ~ bernoulli_logit_glm(X, beta0, beta1);
// y ~ bernoulli_logit(beta0 + X * beta1);
}

I get the error:

Probability function must end in _lpdf or _lpmf. Found distribution family = bernoulli_logit_glm with no corresponding probability function bernoulli_logit_glm_lpdf, bernoulli_logit_glm_lpmf, or bernoulli_logit_glm_log

This comes up both in RStudio (preview) and when trying to compile the model.

I was intending to benchmark this model, and given Bob Carpenter’s statements in this post from October 2017:

Matthijs’s first major commit is a set of GLM functions for negative binomial with log link (2–6 times speedup), normal linear regression with identity link (4–5 times), Poisson with log link (factor of 7) and bernoulli with logit link (9 times). Wow! And he didn’t just implement the straight-line case—this is a fully vectorized implementation as a density…

I’d expect a hefty speed up.

Unlikely, but does calling rstan::stan_version() in R return anything other than "2.18.0"?

It returns “2.18.1”.

More basic assumption tests: If you switch to:

target += bernoulli_logit_glm_lpmf(y | X, beta0, beta1);

in the model block, do you still get the same error?

No matches for:

Yeah weird. There is some version mismatch somewhere. My only suspicion is that this:

is too high a compiler version and something has broken somewhere. Maybe check which versions of StanHeaders and BH you have installed?

So, can you confirm you have these functions?

I could also try clang 7.0.1.
I also have a roughly 1-week old build of gcc-trunk (ie, the development branch).

Even my Ubuntu laptop has gcc 8.2.0 as the default compiler, but I’d (not knowing the Stan code base) be surprised if it’s the compiler…
I can try on the laptop later.

> packageVersion("BH")
 ‘1.69.0.1’
 ‘2.18.1’

Probably should have started by checking this myself - I also get the same compilation error.

1 Like

Do you know if there is an easy way to build and install the develop branch?
If I were to install_github, with ref=“develop”, it would use the development branch of rstan, which still points at Stan 2.18.

You might want to check the bottom of this if you haven’t already.

remotes::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_opts = "")

(I never did this. If you still have questions you might want to ping Ben Goodrich.)

The problem is that the development version of RStan (the interface) looks like it does not use the development version of Stan. FWIW, I did just run that, restarted R, and see the same behavior. stan_version() still returns 2.18.

@bgoodri, any suggestions, or time-frame until a release where these glm functions are supported?

It depends on when Stan 2.19 gets released.

I’d just like to pop in and mention I am also having these difficulties, or a related one at least. I was going to start a new thread but found this via the search…

data {
int<lower=1> N;  // total number of observations
int Y[N];  // response variable
int<lower=1> K;  // number of population-level effects
matrix[N, K] X;  // population-level design matrix
}
parameters {
real Intercept;  // temporary intercept
vector[K] beta;  // population-level effects
}
model {
target += normal_lpdf(Intercept | 0, 1);
target += normal_lpdf(beta | 0, 1);
for (i in 1:N){
target += bernoulli_logit_glm_lpmf(Y[i] | X, Intercept, beta);
}
}

Nor does this work

data {
int<lower=1> N;  // total number of observations
int Y[N];  // response variable
int<lower=1> K;  // number of population-level effects
matrix[N, K] X;  // population-level design matrix
}
parameters {
real Intercept;  // temporary intercept
vector[K] beta;  // population-level effects
}
model {
target += normal_lpdf(Intercept | 0, 1);
target += normal_lpdf(beta | 0, 1);
target += bernoulli_logit_glm_lpmf(Y | X, Intercept, beta);
}

They won’t compile since there is no function found. The latest version of rstan, etc are installed (and just reinstalled to be sure).

You need rstan 2.19, which hasn’t been released yet.

CmdStan 2.19 was released 10 days ago, so I would guess rstan 2.19 is coming soon.