Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Sarit Weisburd <sarit.weisburd@mail.huji.ac.il> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: MLE Estimation of Poisson process |

Date |
Thu, 10 Nov 2011 13:57:55 +0200 |

Dear statalist, I think I have figured out how to run the MLE via MATA - but am surprised the results are different from streg. Does anyone know of a way to get a clear explanation of how streg manages estimation with time varying covariates? Or have any suggestions about what could be going on? The MLE I estimate - which should match the streg estimation is: Q(beta)=Integral ( xbeta* (dN(t)- exp(xbeta)) ) where dN(t) is a dummy variable equal to 0/1 (as in Cook & Lawless - chapter 3.2). The reason for the integral is that I am examining a duration with time varying covariates. In the data every row in my dataset is an interval over which all covariates remain constant so their integral is simply computes as the sum of length* xbeta* (dN(t)- exp(xbeta)) at each point. This is the Mata code I use: do { i=0 grad=J(cols(X),1,0) hes=J(cols(X),cols(X),0) do { i=i+1 mu=exp(X[i,.]*b) grad=grad+xlength[i,.]'(0.25*event[i]-mu) hes=hes+xlength[i,.]'X[i,.]*mu } while (i<rows(X)) bold=b b=bold+cholinv(hes)*grad cha=(bold-b)'(bold-b)/(bold'bold) iter=iter+1 } while (cha>1e-16) This is the streg command: stset t1, failure(des) id(id) exit (time .) streg police_exp precipitation night weekend, dist(exp) nohr Any ideas??? Thanks, Sarit On Tue, Nov 8, 2011 at 9:21 PM, Sarit Weisburd <sarit.weisburd@mail.huji.ac.il> wrote: > Dear statalist, > > I have been estimating a poisson process with time-varying covariates using > the streg command but want to make sure streg is doing what I understand it > should be. > I therefore am trying to manually reach the same results via maximum > likelihood estimation but cannot figure out how to tell stata to calculate > the log likelihood function which includes an integral: > > This is the log likelihood function, Q(beta)=I ( xbeta* (dN(t) > - exp(xbeta)) ) where dN(t) is a dummy variable equal to 0/1 (as in Cook & > Lawless - chapter 3.2). > I=integral > > The reason for the integral is that I am examining a duration with time > varying covariates. For example - looking at the duration between car > accidents in a given location - and want to control for traffic flow that > changed multiple times in that duration. > > What I would like stata to do is calculate the integral as a sum of > xbeta*(dN(t)-exp(xbeta)) > > over all splits in a given duration and then I could continue with MLE > estimation. > > Does anyone have any suggestions about how this could be done? > > Thanks, > Sarit > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > -- Sarit Weisburd Doctoral Candidate Department of Economics Hebrew University Mount Scopus Campus Jerusalem 91905, Israel sarit.weisburd@mail.huji.ac.il * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: MLE Estimation of Poisson process***From:*Sarit Weisburd <sarit.weisburd@mail.huji.ac.il>

- Prev by Date:
**Re: st: * mark indicating between group significans in box plots** - Next by Date:
**Re: st: -nlsur- AIDS** - Previous by thread:
**st: MLE Estimation of Poisson process** - Next by thread:
**st: MLE Estimation of Poisson process** - Index(es):