Plotting daily time series data

Hi,

How can I plot a daily time series?

I tried the code below, but freq input support (monthly, quarterly and yearly).

Thanks in advance!

dstart = 201501;
freq = 12 ;
struct plotControl myPlot;
myPlot = plotGetDefaults("xy");
plotSetXTicInterval(&myPlot, 365, 201501);
plotSetXTicLabel(&myPlot, "YYYY-QQ");
plotTS(myPlot, dstart, freq, y);

and these

struct plotControl myPlot;

myplot = plotGetDefaults("XY");

// Turn off grid
plotSetGrid(&myPlot, "off");

// Set the title text, font and font-size
plotSetTitle(&myPlot, "U.S. Wholesale Price Index ", "Helvetica Neue", 18);

// Set the Y-axis text, font and font-size
plotSetYLabel(&myPlot, "ln(wpi)", "Helvetica Neue", 14);

// Set the X-tick label format to 4 digit year
plotSetXTicLabel(&myPlot, "YYYY");

// Place an X-tick every 5 years (20 quarters),
// starting with January of 1960
plotSetXTicInterval(&myPlot,4, 2015);

// Draw the plot, using the settings
// in 'myPlot'
plotTS(myPlot, 2015, 4, y);

plotTS(201501, 1/365, y);

2 Answers



0



You have two options for plotting daily data in GAUSS.

  1. Starting in GAUSS version 19, plotTS can now plot daily data, as well as monthly, quarterly and yearly data.
  2. GAUSS 19 also introduced a new function plotTSHF which can plot data which is daily, hourly, or by minute, second or hundredths of a second.

The main difference is that plotTS takes time in DT Scalar format, whereas plotTSHF requires the date arguments to be POSIX times.

Plot of daily data with plotTS

/*
** January 5th, 8th, 9th, 10th
** of the year 1986. At hour 00,
** minute 00, second 00
**
** In DT Scalar format
*/
dt = { 19860105000000,
       19860108000000,
       19860109000000,
       19860110000000 };

y = { 0.05,
      0.84,
      0.40,
      0.75 };

plotTS(dt, "days", y);

Plot of daily data with plotTSHF

/*
** January 5th, 8th, 9th, 10th
** of the year 1986. At hour 00,
** minute 00, second 00
**
** As POSIX time
*/
dt = { 505267200, 
       505526400, 
       505612800, 
       505699200 };

y = { 0.05,
      0.84,
      0.40,
      0.75 };

plotTSHF(dt, "days", y);

You may find this blog post about plotting high-frequency data with plotTSHF helpful. There is also a blog post about reading dates and times which you can find here.

aptech

1,323


0



Brilliant, Thanks very much.

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap