Hi,
I'm unfamiliar with Stan, but running your code (without Shiny) gives me the following errors/problems:
- You want your graph to be dependent on an input slider I presume, but nowhere in your Stan code do you use the variable x or bins, so the model is not using any user-data at this point.
- Creating the
stan_model
with your provided (easy) function takes a long time, is this normal? You can add the argumentverbose = T
tostan_model
to see its intermediate steps - Finally, when I try and run the sampling method, I get an error:
> fit <- rstan::sampling(model)
Error in cpp_object_initializer(.self, .refClassDef, ...) :
could not find function "cpp_object_initializer"
failed to create the sampler; sampling not done
Try and create a piece of normal R code that works first, then we'll worry about the Shiny
You can find help for creating an example here:
Good luck,
PJ