paul-buerkner/brms

Only check required variables in post-processing methods

Open

#782 aperta il 31 ott 2019

Vedi su GitHub
 (2 commenti) (3 reazioni) (0 assegnatari)R (220 fork)batch import
featuregood first issuepost-processing

Metriche repository

Star
 (1402 star)
Metriche merge PR
 (Merge medio 7g 21h) (1 PR mergiata in 30 g)

Descrizione

Say we are modeling a distributional parameter, like the example in the vignette:

zinb <- read.csv("https://paul-buerkner.github.io/data/fish.csv")

fit_zinb2 <- brm(bf(count ~ persons + child + camper,
                       zi ~ child), 
                 data = zinb,
                 family = zero_inflated_poisson())

and we want to get a fitted value for the distributional parameter for a particular predictor value:

fitted(fit_zinb2,
       newdata = data.frame(child = 2),
       dpar = "zi")

we get the following error:

Error: The following variables are missing in 'data': 'persons', 'camper'

even though the model for zi does not include those variables, which are only in the model for the count response.

This is a very minor issue, but it would be ideal if the code checked the variables in the newdata dataframe against the model for the dpar.

Guida contributor