4

I ran this model using the brms package: fit<-brm(scoreAMI2~ year2011 + year2012+ year2013+ year2014+ (1|sysid)+ (1|hrr)+ (1|sysid:hrr), data=standata, prior=priors,warmup = 1000, iter = 2000, chains = 4, control = list(adapt_delta = 0.95))

I am trying to extract tidy draws for the random intercept where I interacted my two grouping terms which are sysid and hrr. I use the get variables function which pulls up these names for that interaction term for example: r_sysid:hrr[100100_318,Intercept]

I ran this code to pull the draws for all 3000 sysid-hrr combinations:

fit %>% spread_draws(r_sysid:hrr[sys_hrr,Intercept])

but I keep getting this error message: numerical expression has 3 elements: only the first usednumerical expression has 3 elements: only the first usedError in r_sysid:hrr[sys_hrr, Intercept] : NA/NaN argument

A. S. K.
  • 2,504
  • 13
  • 22
micaaron
  • 41
  • 1
  • 1
    Could you please provide a working example? That may include stripping the code down to the bare minimum that will produce the error. Please also provide what you objects look like by e.g. `head(dataset)` – P1storius Aug 06 '19 at 15:15
  • 3
    Names with `:` in them aren't standard, you may try escaping the name with backticks, `spread_draws(\`r_sysid:hrr\`[sys_hrr,Intercept])` – Gregor Thomas Aug 06 '19 at 15:27
  • 1
    I tried the backtick method and it worked fine. – John Paul Mar 01 '21 at 21:33
  • backtick also worked for me, OP should write it as an answer – baskcat Apr 07 '21 at 09:41

0 Answers0