Code covered by the BSD License
-
[For_x,For_y]=snn_core(x,y,m,...
DESCRIPTION:
-
[For_x]=nn_core(x,m,k,method)...
-
[OutSample_For,InSample_For,I...
-
[OutSample_For_x,InSample_For...
SNN - Creates forecasts of a time series on t+1 using multivariate nearest neighbor algorithm.
-
Example_Script_NN.m
-
View all files
Nearest Neighbour Algorithm for Stock Prices Forecasts.
by Marcelo Perlin
18 Dec 2005
(Updated 21 Sep 2007)
Creates a vector with forecasted values of a time series based on the nearest neighbour algorithm.
|
Watch this File
|
| File Information |
| Description |
This is the algorithm involved on the use of the non-linear forecast of asset's prices based on the nearest neighbour method.
The basic idea of the NN algorithm is that the time series copies it's own past behavior, and such fact can be used for forecasting purposes. On the zip file there are two functions: one is the univariate version of NN (nn.m) and the other is the multivariate approach, also called simultaneous NN (snn.m).
The routines of the file were build according to the work of Rodriguez, Rivero and Artilles (2001).
For a more complete description of the method, please check the pdf document on the zip file. |
| Required Products |
Statistics Toolbox
|
| MATLAB release |
MATLAB 7 (R14)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (3) |
| 24 May 2006 |
Qing Yuan
|
|
|
| 03 May 2008 |
yamtazi lee
|
|
|
| 07 May 2008 |
Bug Catcher
|
|
|
| Updates |
| 09 Jan 2006 |
* PLEASE DISCARD THE LAST VERSION.
* Corrected a matrix with the explanatory variables on the regression
* Corrected a bug on the main loop.
* Added a word document with the details about NN algorithm. |
| 19 Jan 2006 |
* Fixed .doc file. The MatLab function stills the same. |
| 09 Mar 2006 |
Adding semi colon to the code is a good thing :) |
| 24 Mar 2006 |
* Added a function with the multivariate version of NN (Simultaneous NN) and added a vector on the output with the residues from the out-of-sample forecasts. |
| 28 Mar 2006 |
Update on help file of nn.m |
| 21 Jun 2006 |
A lot of people asked me how to use d=lenght(x), which generated a error in the previous file. This problem is fixed for both files (nn.m and snn.m). |
| 17 Aug 2006 |
Added Example.mat |
| 13 Nov 2006 |
* The function is 40% faster with full credits to Mr. Andrew Griesinger. * Added the possibility for out-of- sample forecasts. * The functions structure is now more simple, with the use of subfunctions nn_core.m and snn_core.m.* Included mregress.m. |
| 13 Nov 2006 |
Fixed a bug for the out of sample forecasts. |
| 28 Nov 2006 |
Fixed it so you don't need the functions mregress.m and sort2.m anymore. The only requirement is the regress.m function available with the statistics toolbox. |
| 06 Dec 2006 |
Zip file updated. |
| 15 Jan 2007 |
Added the possibility of changing the method. The original file only had the 'correlation' method, but this new update inserts the simpler 'absolute_distance' method (the one showed at the figure file). More details at pdf file. |
| 21 Sep 2007 |
* Added example script and changed a few more things (nothing special) |
|
Contact us at files@mathworks.com