'priorsense' package plotting issue

Hi,
I came across the ‘priorsense’ package and wanted to try it out. Unfortunately, I can’t make any of the plotting functions work. My stan object is called ‘fit’ and contains ‘lprior’ and ‘log_lik’ values calculated in the generated quantities block. Using:

powerscale_sensitivity(fit) 

works just fine (even though many potential problems are detected ;)).
But trying to plot only the parameter ‘pdd1’ with:

powerscale_plot_dens(
  fit, 
  variables = c("pdd1")
)

gives:
Error in powerscale_plot_dens.powerscaled_sequence(ps, variable = variable, :
Assertion on ‘variables_per_page’ failed: Must be of type ‘number’ (or ‘NULL’), not ‘character’.

So I tried:

powerscale_plot_dens(
  fit, 
  variables = c("pdd1"),
  variables_per_page = NULL
)

Now I don’t get an error, but R is working forever, and I guess it is stuck.
I could share the stan obect if that helps.
Thanks for any advice!

Cheers,
Friedrich

I’ve used priorsense (very cool package) but I’m not very familiar with the internals of the package or how all the arguments work. I’m tagging the maintainer @n-kall who will hopefully be able to help you out.

2 Likes

Thanks for reporting this @buf. I’ll take a look and see what is going on

@buf One issue is that the keyword argument is variable not variables. So it is not actually correctly selecting pdd1 and is trying to plot all the variables in your last code block (which is why it is taking too long). Can you try with variable = "pdd1" and let me know if it works?

I think variables = "pdd1" is being partially matched and converted to variables_per_page = "pdd1", hence it is passing a character.

2 Likes

That works! Sorry for this oversight, I must have been too tired. And thank you for building this package; it’s really cool!

1 Like

No problem @buf. It’s actually a bit of an oversight on my part as variables_per_page was only added recently and I didn’t think about it being partially matched by variables. I’ll try to make a fix so it would at least alert the user more informatively

2 Likes