I’m getting the following error with my model.
ValueError: Invalid type provided to write_stan_json for key 'cl_pure_premium' as part of collection <class 'dict'>
Here is my model
STAN```
data {
int<lower=0> N; // number policy term years
int<lower=0> cl_pure_premium[N]; // collision pure premium
vector[N] old_auto_c_score;// Farmers Auto C Model
}
parameters {
real<lower=0> mu;
real beta;
}
model {
mu ~ normal(0,3);
beta ~ normal(0,1);
cl_pure_premium~ poisson_log(mu + old_auto_c_score*beta);
}
Technically, we usually fit the variable pure premium with a quasi-poisson (standard GLM) since they're not all real numbers. Could that be the reason? I tried changing pure premium to a real data type and
```cl_pure_premium~ poisson_log(mu + old_auto_c_score*beta)
to
cl_pure_premium~ poisson_log_lmpf(mu + old_auto_c_score*beta)
but got an error that stated ’ statement should refer to a distribution without its “_lpdf/_lupdf” or “_lpmf/_lupmf” suffix’.
cl_pure_premium is a float in python so maybe it has to be real but a possion_log doesn’t seem to like real data types.