I'm working with SVMs and have recently migrated to using TTR and thus xts,
but I've run into the following problem:

For each vector in an SVMs training set, I need to have a given amount of
historical data available as features for the vector. A simple example would
be to have the past 20 close prices. So I'd take a matrix like this:
    O H L C
1
2
3
4
5
...
N

and output something like this to give to my SVM:

O, H, L, C, C-1, C-2, C-3, etc
1
2
3
4
5

obviously at the top of the matrix, the historical Close cells would be
empty until there was enough data. In the pre-xts days, I accomplished this
using sapply() and t(), a probably hackish solution, but all I was able to
come up with. However, I am now running into problems with indices using
this technique, and was wondering if there was a better way to perform this
transformation, which really only amounts to a simple copy of data. Possible
solutions that occur to me include some sort of "index shift" and then a
merge, but I've been unable to get anything to work.


--
Aleks Clark

	[[alternative HTML version deleted]]

