Error in fmincon-NaN values

5 ビュー (過去 30 日間)
Alessandra Costa
Alessandra Costa 2019 年 2 月 20 日
コメント済み: Star Strider 2019 年 2 月 20 日
Hi to everyone, I work with a matrix of time series (21 financial time serie), and I'm trying to use fmincon optimization function. Given the maximum likelihood function that I defined, when I call fmincon function, using interior-point algorithm, fmincon stopped because it founds NaN in the data input vectors. There are some NaN in every vector that's included in the matrix, and I would like to know if it is possible to overcome this problem. If I preliminarly treat the missing values in the matrix, with interpolation method (i.e.linear) or if I substitute NaN with 0, fmincon works, but obviously the results are influenced by missing data treatment. Is there any method to ignore NaN data in input vector?
Thank yo so much.

採用された回答

Star Strider
Star Strider 2019 年 2 月 20 日
The usual method MATLAB toolboxes use to deal with NaN values in data is to omit the entire row that has a NaN value in any column. (This also follows the usual MATLAB convention of rows being observations and columns being individual variable values in each observation.) You need to decide if this approach works in your situation and with your data.
  2 件のコメント
Alessandra Costa
Alessandra Costa 2019 年 2 月 20 日
Given the dimension of the matrix, 4683 by 21 of 21 financial time series, If I omit the entire row with NaN value for all the value (in every column), I'll lose too many observations. Just think about the fact that for one series, I have an entire year of missing values and I work with daily data. Your answer confirms me that there's not an automatic way to tell to fmincon or to the handle function used in it to ignore NaN, by preserving the original size of vectors.
Thank you so much
Star Strider
Star Strider 2019 年 2 月 20 日
My pleasure.

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by