- Joined
- 11/3/08
- Messages
- 18
- Points
- 11
i have the following function:
R(T) = beta - ((lamda * sigma)/ alpha) + (r0 - (beta - ((lamda * sigma)/ alpha)) *( 1- exp (- beta*T))/ (beta *T) + ( (sigma^2)*(1- exp (- beta*T))^2)/ (4*(beta^3)*T)
where lamda is the only unknown because alpha, beta et sigma are already estimated using GMM. the result are (Alpha = 5.1356%, beta = 0.1374, sigma = 0.0118)
the only parameter lamda will be estimated using the fitting of the function to the data.
where the real data of R (T) is the vector y = [0.079 0.0782 0.0791 0.0793 0.0791 0.0802 0.0798]
and T is the maturity present in the vector x = [0.5 1 2 3 5 7 10]
i have make a curvefitting with the curve fitting toolbox but the result was so bad: as follow: where a is lamda
General model:
f(x) = (0.1374-(a*0.0118/0.051356)-((0.0118^2)/(2*(0.051356^2))))+(0.05-
(0.1374-(a*0.0118/0.051356)-((0.0118^2)/(2*(0.051356^2)
))))*((1-exp(-0.1374*x))/(0.1374*x))+(((0.0118^2)/(4*(0.1374^3)
*x))*(1-exp(-0.1375*x))^2)
Coefficients (with 95% confidence bounds):
a = -0.1382 (-0.4263, 0.1499)
Goodness of fit:
SSE: 0.002049
R-square: -846.7
Adjusted R-square: -846.7
RMSE: 0.01848
Warning: A negative R-square is possible if the model
does not contain a constant term and the fit
is poor (worse than just fitting the mean).
Try changing the model or using a different StartPoint.
I have read in the help of matlab that i can use the function lsqcurvefit to compute exactly what i need. but the help wasn't so clear about how to use it.
please can you help me . i rely so much on your help. My knowledge about programming is so poor.
R(T) = beta - ((lamda * sigma)/ alpha) + (r0 - (beta - ((lamda * sigma)/ alpha)) *( 1- exp (- beta*T))/ (beta *T) + ( (sigma^2)*(1- exp (- beta*T))^2)/ (4*(beta^3)*T)
where lamda is the only unknown because alpha, beta et sigma are already estimated using GMM. the result are (Alpha = 5.1356%, beta = 0.1374, sigma = 0.0118)
the only parameter lamda will be estimated using the fitting of the function to the data.
where the real data of R (T) is the vector y = [0.079 0.0782 0.0791 0.0793 0.0791 0.0802 0.0798]
and T is the maturity present in the vector x = [0.5 1 2 3 5 7 10]
i have make a curvefitting with the curve fitting toolbox but the result was so bad: as follow: where a is lamda
General model:
f(x) = (0.1374-(a*0.0118/0.051356)-((0.0118^2)/(2*(0.051356^2))))+(0.05-
(0.1374-(a*0.0118/0.051356)-((0.0118^2)/(2*(0.051356^2)
))))*((1-exp(-0.1374*x))/(0.1374*x))+(((0.0118^2)/(4*(0.1374^3)
*x))*(1-exp(-0.1375*x))^2)
Coefficients (with 95% confidence bounds):
a = -0.1382 (-0.4263, 0.1499)
Goodness of fit:
SSE: 0.002049
R-square: -846.7
Adjusted R-square: -846.7
RMSE: 0.01848
Warning: A negative R-square is possible if the model
does not contain a constant term and the fit
is poor (worse than just fitting the mean).
Try changing the model or using a different StartPoint.
I have read in the help of matlab that i can use the function lsqcurvefit to compute exactly what i need. but the help wasn't so clear about how to use it.
please can you help me . i rely so much on your help. My knowledge about programming is so poor.