       Maximum Likelihood Problem

• To: mathgroup at smc.vnet.net
• Subject: [mg46428] Maximum Likelihood Problem
• From: sabrinacasagrande at hotmail.com (sabbri)
• Date: Tue, 17 Feb 2004 07:46:46 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```I need to generate an algorithm in order to estimate the parameters of
an equation . It's probably a mistake in my codes that prevents me to
get the right results.
DATA (Sample Path generating): I generated the data using an
approximation of the differential equation dXt = - B Xt dt + s dWt:

u[x_]:= x + m[x]*t + s[x]*
((t)^(1/2))*(Quantile[NormalDistribution[0,1],Random[]])

where I state m[x_]= -10 x, and s[x_]= 1, t=1/12 Then I generate the
data with Table[NestList[u,0.2,100],{1}]]. So I have my data with the
true parameters value, B=10 and s=1.
ALGORITHM: I use an approximation (of the transition density
probability function). I constructed the approximation based on the
saddle points method (or Laplace Method).

sigx[x_] := s

mx[x_] := -B x

g[x_] = Integrate[(1/sigx[u]), {u, 0, x}]

sigy[x_] = 1

my[x_] = (mx[x]/sigx[x]) - (D[sigx[x], x]/2)

fi[z_] = (1/Sqrt[2 Pi]) (Exp[-(z^2)/2])

lamy[x_] = (-1/2) (((my[x])^2) + D[my[x], x])

c[y_, x_, j_] := c[y, x, j]
= ((j)*(y - x)^(-j)) (Integrate[((w - x)^(j - 1))((lamy[w]c[w, x, j -
1]) + ((D[c[w, x, j - 1], {w, 2}])(1/2))), {w, x,y}])

c[y_, x_, 0] = 1

py[t_, y_, x_] = (1/Sqrt[t]) (fi[(y - x)/(Sqrt[t])])
(Exp[Integrate[my[w], {w, x,y}]]) (Sum[c[y, x, k] ((t)^k)/(k!), {k, 0,
1}])

px[t_, y_, x_] = (py[t, g[y], g[x]]/sigx[g[x]])

And finally I get a function (the likelihood function)

L[N_] = Sum[Log[px[t, x[n + 1], x[n]]], {n, 1, N}]/N

where x[n_] are the values I generated above. So x[n_]:=
Extract[data,{1,n}]
Now I try to maximize it.
I tried using two methods: 1)the function Maximize
Maximize[{L,s>0},{B,s}]

2) Solve[] on the derivatives == 0 of my target function.
Solve[{D[L,B]==0,D[L,s]==0},{B,s}]

In none of this case I can get the results. (Mind that I generated the
data attributing the values to parameters, so data were generated with
the right values: I should obtain those values while maximizing!!!)
Can you help me? Where am I wrong?

```

• Prev by Date: RE: Printing Variables and Their Values
• Next by Date: RE: Shared Functions