Missing data in input matrix - Using fminsearch

Hi
I have a matrix where the rows represent "strikes" (money value) and columns represent "time-to-maturity" (time). This gives me a NxM matrix. However, some elements (pairs of money and time) in this matrix are represented as NaN since the values do not exist for these specific pairs.
The problem arises when using fminsearch in order to optimize and obtain parameter values, as fminsearch cannot deal with NaN-values. Replacing the NaN with 0-values does absolutely no good as the new 0-values are regarded as specific values rather than missing points. Deleting all rows where values do not occur across time (i.e. for all columns) leaves me with a much smaller matrix and hence less valid parameter estimation.
Does anyone have a good idea of how to overcome this issue?
Thanks!

 Accepted Answer

It is possible that you will have to remove and then reintroduce variables. For example, suppose that your control variables are a matrix x. Then set
y = x;
y = y(:);
y(isnan(y)) = [];
Then optimize over y to get a solution yy. At the end, to get your solution yy back into the x matrix, set
x(~isnan(x)) = yy;
I hope that this is clear.
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (1)

The approach you are using (eliminating the rows with NaN values) is the best way to deal with your problem.
If you have reason to believe that the missing values are related in some specific way to the other neighbouring values (for instance, linearly), consider interpolating (perhaps interp1) to estimate them.

Categories

Find more on Optimization in Help Center and File Exchange

Asked:

on 17 Mar 2015

Answered:

on 17 Mar 2015

Community Treasure Hunt

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

Start Hunting!