Function to create a regressionplot()

4 Ansichten (letzte 30 Tage)
Marco Sartori
Marco Sartori am 8 Sep. 2020
Kommentiert: Marco Sartori am 8 Sep. 2020
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 Kommentare
KSSV
KSSV am 8 Sep. 2020
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 am 8 Sep. 2020
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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Time Series Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by