In [381]:
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg
%matplotlib inline
In [382]:
import sys
sys.path.append("../")
In [383]:
import PoissonProcessClasses as PP
import imp
imp.reload(PP)
Out[383]:
In [384]:
N = 100# number of observations
d = 1 # number of covariates
The intensity is $\theta * X$ where $X$ is a row vector.
In [ ]:
theta = np.array([2])
We consider different shapes for the intensity: random, constant,sinusoidal:
In [396]:
X = 0.1*np.random.normal(size = (d,N))
X = np.reshape(np.ones(N,),(1,N))
X = np.reshape(np.sin(np.arange(N)),(1,N))
In [397]:
dt = 0.1 # discretization step
In [398]:
l = np.exp(np.dot(X.T,theta))
In [399]:
u = np.random.uniform(size = len(l))
y = 1*(l*dt>u)
print(y)
In [400]:
model = PP.PPModel(X,dt = dt)
In [401]:
res = model.fit(y)
In [406]:
print('The estimated parameter is '+ str(res.x[0])+ '. The true parameter is '+str(theta[0])+'.')
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: