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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2019년 2월 20일

댓글:

2019년 2월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by