minimize Kolmogorov-Smirnov distance

3 views (last 30 days)
gaia buratti
gaia buratti on 24 Jul 2011
Hi, I have 5 parameters to estimate (m,V,M,r,F). M=mu0*(1-m) and V=sigma0*(1-m). and sigma e mu are other two parameters My goal is to find the parameters that minimize the KS distance of dW so computed:
for t=1:T
W(t,1)=(P(t,1).*exp(-r*t)-F).^-(m-1);
end
dW=W(2:end,1)-W(1:end-1,1);
respect to a normal distribution with mean M and standard deviation V. where P is a vector of prices. At first I made a function with the parameters as impu, that computed the vector and the KS distance using kstest. The funcion work good, but when I used fminsearch with that function it returned mthe following errors Error in ==> erfc at 23 y = erfcore(x,1);
Error in ==> normcdf at 68 p = 0.5 * erfc(-z ./ sqrt(2));
Error in ==> cdf at 105 p = normcdf(x,a1,a2);
Error in ==> K_S at 24 cdfvals=cdf('norm',x,M,sqrt(V));
Error in ==> @(par)K_S(par,P)
Error in ==> fminsearch at 265 x(:) = y; f = funfcn(x,varargin{:});
I guessed that there were some problems because it hadn't enough informaation. So I decided to divide in 2 steps, at first compute dW with arbitrary parameters and use it as imput of a function that finds the best fit M V using the KS distance. Then I would like to find the other 3 parameters left using anominimizing another function thata compute dW and minimize th e KS distance to a normcdf with mean and std equal to the M V previously estimated. But returns the error:
??? Error using ==> erfcore Input must be real.
Error in ==> erfc at 23 y = erfcore(x,1);
Error in ==> normcdf at 68 p = 0.5 * erfc(-z ./ sqrt(2));
Error in ==> K_S2 at 24 [ignore1,ignore2,d] = kstest(dW,[dW normcdf(dW,M,V)]);
Error in ==> fminsearch at 266 f = funfcn(x,varargin{:}) May someone help me solving this problem or finding a better way? Gaia

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!