Function to create a regressionplot()

3 次查看(过去 30 天)
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