I am running a rolling for example of 100 window OLS regression estimation of the dataset found in this link (https://drive.google.com/drive/folders/0B2Iv8dfU4f
Ok so I prepared this small example so you can visualize what a Poisson regression could do.
import statsmodels as sm
import matplotlib.pyplot as plt
poi_model = sm.discrete.discrete_model.Poisson
x = np.random.uniform(0, 20,1000)
s = np.random.poisson( x*(0.5) , 1000)
plt.bar(x,s)
plt.show()
This generates random poisson counts.
Now the way to fit a poisson regression to the data is the following:
my_model = poi_model(endog=s, exog=x)
my_model = my_model.fit()
my_model.summary()
The summary displays a number of statistics but if you want to compute the mean square error you could do that like so:
preds = my_model.predict()
mse = np.mean(np.square(preds - s))
If you want to predict new values do the following:
my_model.predict(exog=new_value)