Function to create a regressionplot()

조회 수: 4 (최근 30일)
Marco Sartori
Marco Sartori 2020년 9월 8일
댓글: Marco Sartori 2020년 9월 8일
Good morning everybody,
I'm struggling at realizing a portion of code which allows me to automatically extrapolate the set of data to compose the object for the regressionplot() function, which requires a Tx2 matrix.
So let's make an example of my matrix with elements which indicate only the date of the "regression" event (montlhy data):
[31/05/2000
02/06/2001
03/06/2001
05/06/2002
06/06/2002
07/06/2002 ]
and the result which I want to obtain to use in the recessionplot() should be:
[31/05/2000 01/06/2000
02/06/2001 04/06/2001
05/06/2001 08/06/2001]
In order ot allow the presence of recession shadow also for just one month data, I need to set the closing month as i+1 (thus it is 01/06 instead of only 31/05)
How could I obtain such a Tx2 matrix?
Thank you in advance!
  댓글 수: 2
KSSV
KSSV 2020년 9월 8일
I hope for the dates you have respective values. Convert the dates into datenum. USe interp1 with the available data and with new date.
Marco Sartori
Marco Sartori 2020년 9월 8일
Yes, each time my X value is lower than the median computed, I have a recession event. The problem is that I have to select just the starting date and ending date (ending+1) for the regression plot

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by