Henrik-

A coding solutions may be

... + (1/(2*stdev*stdev))*sum(  ( y-(rev/12)- c(0,y[-n]) *exp(-lap/12) )^2
 )

where n is the number of observations in y.

Personally, I would use lm.  Your model can be written as a linear function.


Let x=c(0,y[-n]).  Then run  lm(y~x).  The parameter estimates in y~x
correspond to the parameters in your model (with some very minor
arithmetic).

The lm() approach is quick and easy.  If, however, your goal is to gain
experience with MLEs by hand, I fully support the manual option.  You could
do both and compare the answers.

-tgs

On Wed, Apr 21, 2010 at 5:12 PM, Henkep <flyerhenke@hotmail.com> wrote:

>
> Thank you Thomas.
>
> (a) an embarrassing mistake by me. Of course it should be squared. Thank
> you
> for pointing that out.
> (b) Do you possibly have any suggestions on how to solve this issue?  I
> presume that there is no reason in trying to create a lagged "vector"
> manually?
>
> Best Regards
>
> Henrik
> --
> View this message in context:
> http://n4.nabble.com/Maximum-Likelihood-Estimation-in-R-tp2018822p2019701.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

