3.0

3.0 | 2 ratings Rate this file 20 Downloads (last 30 days) File Size: 114.98 KB File ID: #9396
image thumbnail

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

Greate function and work well, also the author is fine person

03 May 2008 yamtazi lee

can not be used, more bugs

07 May 2008 Bug Catcher

Bugs where? Squash them! Fast, before they multiply!

Please login to add a comment or rating.
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)

Tag Activity for this File
Tag Applied By Date/Time
finance Marcelo Perlin 22 Oct 2008 08:10:13
modeling Marcelo Perlin 22 Oct 2008 08:10:13
analysis Marcelo Perlin 22 Oct 2008 08:10:13
nearest neighbour Marcelo Perlin 22 Oct 2008 08:10:13
non linear forecasts Marcelo Perlin 22 Oct 2008 08:10:13
analysis sam desai 09 Oct 2009 05:12:04

Contact us at files@mathworks.com