# Data and functions

In the previous example you have experimented with predicting measured data. It may be useful to combine data and functions, for example to try to eliminate trends or seasonal components.

The basic opportunity is available in the applet below. Both data and functions can be used to construct data that should be learned. Although this is very simple, it may be useful to realize what may be needed to achieve better prediction.

## How to work with the applet

• If you have not seen the first example, please explore it first - basic description is available there.
• In this version, other functions are added, that correspond to the values seen in the previous applets:
• nasdaqday(x) returns NASDAQ stock index daily (i.e., end of day close values) for the whole year 2007 (from January 3 till December 31 of 2007) - 251 values
• nasdaqweek(x) NASDAQ weekly - data from July 5 of 2002 till January 4 of 2008 - 288 values
• eurusd(x) returns EUR USD forex currency pair data - daily data for the year 2007 - 313 values
• usdjpy(x) returns USD JPY forex currency pair data - daily data for the year 2007 - 313 values
• usdchf(x) returns USD CHF forex currency pair data - daily data for the year 2007 - 313 values
• eurjpy(x) returns EUR JPY forex currency pair data - daily data for the year 2007 - 313 values
For x=0 the first value is returned, for x=1 the next value is returned and so on. The close value is always returned, if needed, x is rounded to closest integer number. Outside the scope of the data, zero is returned.
• You can expriment with adding other functions to these data. You can also try to change the input to the function (x) to achieve other ordering of data. Some examples to try:
• nasdaqday(x)     (don't forget to set interval from 0 to 251)
• nasdaqday(x)-x/20     (don't forget to set interval from 0 to 251)
• nasdaqday(-x)     (don't forget to set interval from -251 to 0)
• nasdaqday(-x)+x/20     (don't forget to set interval from -251 to 0)
• eurusd(x)     (don't forget to set interval from 0 to 313)
• eurusd(x)-x/1800     (don't forget to set interval from 0 to 313)
• Again, this applet is for illustration only - useable prediction is usually only part of solving a problem, and the prediction usually does not have to be very exact.