Using pp_check for Dirichlet model


#1

Please also provide the following information in addition to your question:

  • Operating System: Windows 10
  • brms Version: 2.7.3

Hello, I am relatively new to Stan and brms. I fiited a Dirichlet model and I tried to use the pp_check function on my model fit but I get the error:

Error in validate_y(y) : ‘y’ must be a vector or 1D array.

I assume this is because I have multiple response variables. However I do not know how to indicate to the function to check a specific response variable.

Here is a reproducible example:

########

A<-rnorm(40,2,0.5)
B<-rnorm(40,2,0.5)
C<-rnorm(40,2,0.5)
V1 <- as.factor(rep(1:4, 10))
V2 <- as.factor(rep(1:4, 10))
df <- data.frame(A, B, C, V1, V2)

df_prop<-DR_data(df[,1:3])
df_prop<-as.matrix(df_prop)
df$prop<-df_prop

fit <- brm(
prop ~ V1 + (1|ID|V2), data = df, chains = 2, cores = 2, dirichlet(link = “logit”))

pp_check(fit)

##########

Any help would be much appreciated.

Cian


#2

That’s because pp_check does not support dirichlet models. I just added an informative error message for that.


#3

Thank you for the quick response.

Could you, or anyone else, propose an alternative way to compare simulated data from the model fit with the observed data?


#4

If anybody has any suggestions I am all ears.