Problem with missing data in a time series

조회 수: 4 (최근 30일)
Fabrizio Marinelli
Fabrizio Marinelli 2013년 1월 29일
Hello, I need a hand on this problem: In an Excel workbook I reported 10 time series (with monthly frequency) of 10 titles that should cover the past 15 years. Unfortunately, not all titles can cover the 15-year time series. For example, a title only goes up to 2003; So in the column of that title, I have the first 5 years with a "Not Available" instead of a value. Once I’have imported the data into Matlab, obviously, in the column of the title with the shorter series appears NaN where there are no values.
Prices xlsread = ('PrezziTitoli.xls')
whos
% Name Size Bytes Class Attributes
%
Prices 182x10% 6360 double
My goal is to estimate the variance-covariance matrix, however, because of the lack of data, the calculation is not possible for me. I thought to an interpolation, before the calculation of the variance-covariance matrix, to cover the values that in Matlab return NaN, for example with a "fillts", but have difficulties in its use.
Can you help?
Thanks

채택된 답변

Shashank Prasanna
Shashank Prasanna 2013년 1월 29일
You can use NONCOV to compute the covariance matrix for data with NaN:
  댓글 수: 3
Shashank Prasanna
Shashank Prasanna 2013년 1월 29일
Then interpolation is way to go. What is the problem with using fillts? It does require you to create a financial time series object first. If you prefer to just use interp1, check the doc of interp1:
http://www.mathworks.com/help/matlab/ref/interp1.html Unless you provide some code you tried, it will be hard to help.
Fabrizio Marinelli
Fabrizio Marinelli 2013년 1월 30일
Thank you, thank you! I solved.. Following your first advice I calculated the log-returns in normal way and than i used nonmean, nonvar, etc. for the statistics, excluding NaN's rows.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Titus Edelhofer
Titus Edelhofer 2013년 1월 29일
Hi,
this answer is more of a general advice rather than answering the question, sorry for that ;-).
I'm not sure that it will make sense to try to go from 2003 back 5 years "guessing" the data. I would assume it makes more sense to restrict yourself to the last 10 years, i.e., where you have all the data and compute the variance-covariance matrix for this time period only ...
Titus
  댓글 수: 1
Fabrizio Marinelli
Fabrizio Marinelli 2013년 1월 29일
Hi, I know that it would be better to reduce the period of observation. Unfortunately, because of a project for the university, I must act over 15 years. Anyway thanks for the suggestion.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by