Error function hnp for residuals stan_glm

I am trying to diagnose the model for a dose-response assay under a Bayesian approach, however, I am not able to graph it to evaluate the residual components of the deviation using the stan_glm function. The error is below.

data: https://drive.google.com/file/d/1wtbpb9XJy1diewof9K2Us6XE_topN8EQ/view?usp=sharing

library(dplyr)
library(hnp)
library(rstan)
library(rstanarm)
library(ggplot2)
library(drc)
library(rstanarm)
dados = read.table("dados.csv", header = T, sep=";", dec = ",")
dados$periodo = as.factor(dados$periodo)
dados <- dados %>% mutate(proporcao =  (dados$resposta)/60)
dados <- dados %>% mutate(logdose = log(dados$concentracao))
dados<- mutate(dados, 
               C_resposta=60-resposta)

dados2 = dados[c(1:5),]
attach(dados2)
fitstanglm24 <- stan_glm(cbind(resposta, C_resposta) ~ logdose, 
                         family = binomial(link = "logit"), data = dados2)
summary(fitstanglm24)

m24hnp <- hnp(fitstanglm24)

Error in model.frame.default(formula = cbind(y.[[i]], m. - y.[[i]]) ~  : 
  comprimentos das variáveis diferem (encontradas em '(weights)')

Hi @brenogab420, I’m not familiar with the hnp package or the hnp() function you are using, but after downloading it and looking at its documentation it doesn’t look like it’s set up to support models fit with stan_glm() (or really bayesian models in general). It may be possible to extend it to work with rstanarm, but I don’t think it will work automatically unfortunately.

thanks for contributing! @jonah!!!

Also, if you need help making particular plots after fitting a model feel free to open new topics here on the forum. If you can describe what you want to visualize then maybe we can help you make it.