search for: sigmah2

Displaying 1 result from an estimated 1 matches for "sigmah2".

Did you mean: sigma2
2012 Jul 20
1
fitting Ornstein-Uhlenbeck process by MAXIMUM LIKELYHOOD
...(spread) { n=length(spread) delta=n/n Sx=sum(spread[1:n-1]) Sy=sum(spread[2:n]) Sxx=(Sx)^2 Syy=(Sy)^2 Sxy=Sx*Sy mu = (Sy*Sxx - Sx*Sxy) / ( n*(Sxx - Sxy) - (Sx^2 - Sx*Sy) ) lambda = -log( (Sxy - mu*Sx - mu*Sy + n*mu^2) / (Sxx -2*mu*Sx + n*mu^2) )/delta a = exp(-lambda*delta) sigmah2 = (Syy - 2*a*Sxy + a^2*Sxx - 2*mu*(1-a)*(Sy - a*Sx) + n*mu^2*(1-a)^2)/n; sigma = sqrt((sigmah2)*2*lambda/(1-a^2)) theta=list(lambda=lambda, mu=mu,sigma=sigma,sigmah2=sigmah2) return(theta) } where is my error? is there some other script to obtain a good result by the same method? thank y...