Help to solve n equations with two unknowns
Afficher commentaires plus anciens
Hi..
I have n equations of the put-call parity: C=P+PV*F-K*PV, where I have vectors for C, P and K, meaning that I would like to find the two unknowns PV and F by least square. Since I am not very confident with Matlab, I have not been able to find out, how I can code this. Hope that someone can help me.
Thanks
Réponses (2)
Matt Fig
le 20 Mar 2011
It looks like you have two unknowns and one equation. How do you think there is a unique solution?
PV * F = C - P + K * PV
One solution could be:
PV = 1
F = C - P + K * PV
another solution could be
F = 1
PV = C - P + K * PV
Or, more generally:
PV = A % A is a constant.
F = (C - P + K * PV)/A
and
F = A % A is a constant
PV = (C - P + K * PV)/A
If there is to be a unique solution, it would seem that there must be another constraining equation.
2 commentaires
John D'Errico
le 20 Mar 2011
Matt - I think you missed that C, P, K are all vectors.
Matt Fig
le 20 Mar 2011
No, I got that part. What I missed is where Kristine said that PV and F were _both_ scalar.
John D'Errico
le 20 Mar 2011
The general equation is
C = P + PV*F - K*PV
given vectors C, P, K, and scalar unknowns PV and F. However, F appears in only one place. Suppose you rewrote this in the similar form
(C - P) = T - K*PV
Could you estimate the coefficients T and K? Yes, obviously,
params = polyfit(K,C-P,1);
PV = params(1);
T = params(2);
This is simply a traditional form linear regression problem. Then once you have the constant coefficient T and the parameter PV, recover F as
K = T/PV;
Catégories
En savoir plus sur Noncentral t Distribution dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!