Hello Stan users,
I am running a poisson network model to fit a DSA system in R and Stan.
I am running this model to fit some influenza data. My samples are poor and not fitting well. the Syntax is correct but for some reason, the sampling is not the best for my data.
I have attached the R and Stan code and the data that I am fitting
Josephine
Hi Josephine there is nothing attached. Could you also explain a bit more about your model?
here are the files
Data is influenza data which has two events, time of infection and time if recovery.
the model I am solving is a Poisson distributed DSA model as
\dot\theta =  \beta(1(1\rho){{\varphi\prime(\theta)}\over{\varphi\prime(1)}}+({\gamma \over \beta}+1)(1\theta))=f(\theta)
and
\begin{align*}
\dot\theta &= f(\theta(t))\\
\dot S(t) &= \varphi(\theta(t) \\
\dot R(t) &= \gamma I(t)\\
\dot I(t) &= 1S(t)R(t)
\end{align*}
Nets02.stan (2.6 KB)
Nets02.R (6.4 KB)
arrivals_dat.csv (26.4 KB)
The model I am solving is
\begin{align*}
\dot\theta &= f(\theta(t))\\
\dot S(t) &= \varphi(\theta(t) \\
\dot R(t) &= \gamma I(t)\\
\dot I(t) &= 1S(t)R(t)
\end{align*}
where
\dot\theta =  \beta(1(1\rho){{\varphi\prime(\theta)}\over{\varphi\prime(1)}}+({\gamma \over \beta}+1)(1\theta))=f(\theta)
This loks like an intricate model, but it’s a little hard to check. There’s several things you can do to make it easier for people to help you:
 Use the most recent version of Stan. Your model file is written with the deprecated array syntax, and uses a deprecated ODE solver. I’d gladly have a look at your model, but I’m not sure whether I have the time to reconfigure my Stan installation.
 Give a little background on your model. From your description, I can extrapolate that it’s about modelling the infectiousness of the disease, but there’s little more I can tell about the mechanism. No need to name every parameter, but it helps to have a general idea of how the model works.
 Fit the model on simulated data to check whether you can recover the original parameter values. I may be wrong, but the R script seems to be only about reading in data.
Let me explain the model in a short summary.

The network configuration model estimates \beta  the probability that an initially susceptible individual remains so at the end of the epidemic,

V=S/(1rho) is scaled susceptible population at time

I and R remains the same as in SIR model, but transformed to fit a dynamical survival EBCM network model

we have \rho initial infected nodes in the network

our aim is to recover parameters from the data and try fit the model to data and hence estimate \theta(infinity)
I hope this helps, kindly let me know