<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-3965329713014965566.post5663943458097608787..comments</id><updated>2010-01-28T12:15:14.660-08:00</updated><title type='text'>Comments on Max Dama on Automated Trading: Decision Tree Bagging System (R code)</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.maxdama.com/feeds/5663943458097608787/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default?start-index=26&amp;max-results=25'/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-875900551247178874</id><published>2010-01-28T12:15:14.660-08:00</published><updated>2010-01-28T12:15:14.660-08:00</updated><title type='text'>Andrew, 

Please see the update I just posted at t...</title><content type='html'>Andrew, &lt;br /&gt;&lt;br /&gt;Please see the update I just posted at the top of the page.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/875900551247178874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/875900551247178874'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1264709714660#c875900551247178874' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-4095758006920325253</id><published>2010-01-28T10:09:50.420-08:00</published><updated>2010-01-28T10:09:50.420-08:00</updated><title type='text'>Max,

Thanks for posting this interesting example....</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;Thanks for posting this interesting example.  I would like to play with it using R (which I&amp;#39;m still learning) but I noticed the links to the R code, data and harness file are broken. Would you have the sample files available via other links?&lt;br /&gt;&lt;br /&gt;warm regards,&lt;br /&gt;&lt;br /&gt;Andrew</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4095758006920325253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4095758006920325253'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1264702190420#c4095758006920325253' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-1443571584853884382</id><published>2009-12-06T18:45:21.979-08:00</published><updated>2009-12-06T18:45:21.979-08:00</updated><title type='text'>Thanks Chris.</title><content type='html'>Thanks Chris.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1443571584853884382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1443571584853884382'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1260153921979#c1443571584853884382' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-488604525082100414</id><published>2009-12-03T05:03:27.289-08:00</published><updated>2009-12-03T05:03:27.289-08:00</updated><title type='text'>Hi Max,

thanks for sharing your insights on your ...</title><content type='html'>Hi Max,&lt;br /&gt;&lt;br /&gt;thanks for sharing your insights on your blog. I&amp;#39;ve been working with randomForest and other classification algos since many years (having a background in biostatistics, where these methods have been used for quite some time before they became famous in finance).&lt;br /&gt;&lt;br /&gt;I compared my code with yours (my financial time-series are ordered past-to-present), using your gold data, and I think your R code doesn&amp;#39;t do what you want it to do (I use R 2.9.1):&lt;br /&gt;&lt;br /&gt;in the following lines in your code:&lt;br /&gt;&lt;br /&gt;  idx = rev(data.frame(targets = seq(1, btsamples*skip, skip)))&lt;br /&gt;  idx = data.frame(idx, data = idx$targets+horizon)&lt;br /&gt;&lt;br /&gt;because the rev() command doesn&amp;#39;t work as you want it (it does not reverse the rows in the data.frame), later on in your code the time-axis of &amp;#39;preds&amp;#39; is wrong (still ordered from present to past, instead from past to present), yielding problems during the creation of the equities time-series (using cumprod()), where you do reverse the order of &amp;#39;returns&amp;#39;. &lt;br /&gt;&lt;br /&gt;so I suggest to replace those two lines above with something like (the idx$data you never use in your code, so I drop it&lt;br /&gt;):&lt;br /&gt;  &lt;br /&gt;  idx = data.frame(targets = rev(seq(1, btsamples*skip, skip)))&lt;br /&gt;&lt;br /&gt;Tell me, if I&amp;#39;m wrong, but I think, this is the way, it&amp;#39;s supposed to be.&lt;br /&gt;&lt;br /&gt;Cheers, Chris</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/488604525082100414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/488604525082100414'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1259845407289#c488604525082100414' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-5499156293268299028</id><published>2009-11-16T13:52:02.692-08:00</published><updated>2009-11-16T13:52:02.692-08:00</updated><title type='text'>Henning,

Definitely. Hopefully we've done enough ...</title><content type='html'>Henning,&lt;br /&gt;&lt;br /&gt;Definitely. Hopefully we&amp;#39;ve done enough regularization that we haven&amp;#39;t allowed ourselves to overfit too much, but only out of sample testing can really show how it works. &lt;br /&gt;&lt;br /&gt;Thanks for the compliment, I&amp;#39;m glad it&amp;#39;s useful. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/5499156293268299028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/5499156293268299028'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1258408322692#c5499156293268299028' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-8655177718937939603</id><published>2009-11-16T13:48:23.181-08:00</published><updated>2009-11-16T13:48:23.181-08:00</updated><title type='text'>Hi Max,
love your blog. Really great content...

J...</title><content type='html'>Hi Max,&lt;br /&gt;love your blog. Really great content...&lt;br /&gt;&lt;br /&gt;Just a tiny question.&lt;br /&gt;Isn&amp;#39;t this decision tree bagging system data snooping par excellence? It fit&amp;#39;s parameters in the best possible way to explain the sample but what about out-of-sample performance?  May be I&amp;#39;ll just have to paper trade it :)&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Henning</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/8655177718937939603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/8655177718937939603'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1258408103181#c8655177718937939603' title=''/><author><name>henner's Blog</name><uri>http://www.blogger.com/profile/15381506750678483901</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-1015917733386021608</id><published>2009-11-16T04:01:01.591-08:00</published><updated>2009-11-16T04:01:01.591-08:00</updated><title type='text'>Noob,

There are heuristics like that but you figu...</title><content type='html'>Noob,&lt;br /&gt;&lt;br /&gt;There are heuristics like that but you figure them out by playing around with it, there haven&amp;#39;t been results proved about it, and I think it&amp;#39;s impossible due to the random nature of the forest. &lt;br /&gt;&lt;br /&gt;Feel free to modify the code, it&amp;#39;s only a few lines actually. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1015917733386021608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1015917733386021608'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1258372861591#c1015917733386021608' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-4534674963787394732</id><published>2009-11-15T07:35:41.777-08:00</published><updated>2009-11-15T07:35:41.777-08:00</updated><title type='text'>Hi again Max,

If I want to papertrade gold with t...</title><content type='html'>Hi again Max,&lt;br /&gt;&lt;br /&gt;If I want to papertrade gold with the DTB as a predictor how can I see what the prediction is for the next week/day?&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Noob</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4534674963787394732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4534674963787394732'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1258299341777#c4534674963787394732' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-4584344902421281856</id><published>2009-11-15T06:12:30.861-08:00</published><updated>2009-11-15T06:12:30.861-08:00</updated><title type='text'>Hi Max,

Is it possible somehow to add some tradin...</title><content type='html'>Hi Max,&lt;br /&gt;&lt;br /&gt;Is it possible somehow to add some trading rules into the evaluation? For example a stop-loss where the long position is kept until it turns down.&lt;br /&gt;&lt;br /&gt;Noob</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4584344902421281856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4584344902421281856'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1258294350861#c4584344902421281856' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-1990043341766659141</id><published>2009-11-14T08:38:33.872-08:00</published><updated>2009-11-14T08:38:33.872-08:00</updated><title type='text'>Hi Max,
Thanks for sharing!!!
Are there certain re...</title><content type='html'>Hi Max,&lt;br /&gt;Thanks for sharing!!!&lt;br /&gt;Are there certain relations (or ranges) between:  data (number of posts), btsamples, trainperiods and treesInBag (and other inputs)that is preferable?&lt;br /&gt;For example: 2 * trainperiods = treesInBag.&lt;br /&gt;&lt;br /&gt;Thank you &lt;br /&gt;Noob</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1990043341766659141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1990043341766659141'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1258216713872#c1990043341766659141' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-1108089289747853981</id><published>2009-11-12T11:00:11.831-08:00</published><updated>2009-11-12T11:00:11.831-08:00</updated><title type='text'>Anon,

You need a csv file with 1 minute data to d...</title><content type='html'>Anon,&lt;br /&gt;&lt;br /&gt;You need a csv file with 1 minute data to do that. Then just replace the filename in the code with your new filename.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1108089289747853981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1108089289747853981'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1258052411831#c1108089289747853981' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-440092218025539939</id><published>2009-11-11T16:42:34.032-08:00</published><updated>2009-11-11T16:42:34.032-08:00</updated><title type='text'>Hi Max
Very interesting!! Thank you for sharing!!!...</title><content type='html'>Hi Max&lt;br /&gt;Very interesting!! Thank you for sharing!!!&lt;br /&gt;How do I configure it to run on 1 minute data?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/440092218025539939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/440092218025539939'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1257986554032#c440092218025539939' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-883090150099977363</id><published>2009-07-30T17:50:40.254-07:00</published><updated>2009-07-30T17:50:40.254-07:00</updated><title type='text'>Max,

I agree.   It looks like it needs a lot of p...</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;I agree.   It looks like it needs a lot of points.&lt;br /&gt;&lt;br /&gt;The Logistic Regression surprised me.  I was fooling around with a couple of logistic models before I saw this.  That&amp;#39;s now on the back burner.&lt;br /&gt;&lt;br /&gt;The Nearest-Neighbor scheme seems to pick up a lot, even with just a few points.   I&amp;#39;ve only read about these models, I haven&amp;#39;t had time to test them out.  I&amp;#39;ll probably look a little closer now.&lt;br /&gt;&lt;br /&gt;The sad part about most financial problems is they don&amp;#39;t have nice little &amp;quot;islands&amp;quot; to discover.  It&amp;#39;s just loud or louder noise.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Bill S</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/883090150099977363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/883090150099977363'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1249001440254#c883090150099977363' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-1870346556937722357</id><published>2009-07-30T08:09:26.437-07:00</published><updated>2009-07-30T08:09:26.437-07:00</updated><title type='text'>Thanks Bill. Surprising that Bayes Nets did so bad...</title><content type='html'>Thanks Bill. Surprising that Bayes Nets did so badly.&lt;br /&gt;&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1870346556937722357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1870346556937722357'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248966566437#c1870346556937722357' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-2718620605022780607</id><published>2009-07-30T07:39:21.292-07:00</published><updated>2009-07-30T07:39:21.292-07:00</updated><title type='text'>Max,

I was testing the randomforest and svm metho...</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;I was testing the randomforest and svm methods to see what the trade-off/advantages are.   While I was pushing &amp;quot;gamma&amp;quot;, waaaaay overfitting the svm test, I went looking for results from the tests of others.   I bumped into the following and thought you might be interested.&lt;br /&gt;&lt;br /&gt;http://home.comcast.net/~tom.fawcett/public_html/ML-gallery/pages/index.html&lt;br /&gt;&lt;br /&gt;Notice the similarities of svm and randomforest.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Bill S</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/2718620605022780607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/2718620605022780607'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248964761292#c2718620605022780607' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-8481489946781606152</id><published>2009-07-29T06:50:43.338-07:00</published><updated>2009-07-29T06:50:43.338-07:00</updated><title type='text'>You're welcome Bill</title><content type='html'>You&amp;#39;re welcome Bill</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/8481489946781606152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/8481489946781606152'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248875443338#c8481489946781606152' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-6064444323254384971</id><published>2009-07-28T13:43:06.514-07:00</published><updated>2009-07-28T13:43:06.514-07:00</updated><title type='text'>Max,

Thanks for the answers and the links.   That...</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;Thanks for the answers and the links.   That course information will keep me busy for a while.  I also subscribed to the Finance mailing list.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks again,&lt;br /&gt;Bill S</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/6064444323254384971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/6064444323254384971'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248813786514#c6064444323254384971' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-4703743999194401620</id><published>2009-07-28T12:03:30.290-07:00</published><updated>2009-07-28T12:03:30.290-07:00</updated><title type='text'>Bill,

Yes, that's where the offsetting occurs- an...</title><content type='html'>Bill,&lt;br /&gt;&lt;br /&gt;Yes, that&amp;#39;s where the offsetting occurs- anywhere you see the variable &amp;quot;horizon&amp;quot;.&lt;br /&gt;&lt;br /&gt;RandomForest selects random bootstrap samples to train each tree. That&amp;#39;s why each run gives different results. &lt;br /&gt;&lt;br /&gt;I haven&amp;#39;t read a book on R. I took this class at UC Berkeley: http://www.stat.berkeley.edu/classes/s133/  The professor has all the notes online. The &amp;quot;schedule&amp;quot; link at the top left has the notes and the &amp;quot;resources&amp;quot; link has some interesting sites. It was a good class and the notes are clear. &lt;br /&gt;&lt;br /&gt;R has a great community, just subscribe to the email lists: http://www.r-project.org/mail.html   I&amp;#39;m on the SIG-Finance mailer. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4703743999194401620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/4703743999194401620'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248807810290#c4703743999194401620' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-3331387695177571765</id><published>2009-07-28T11:16:57.787-07:00</published><updated>2009-07-28T11:16:57.787-07:00</updated><title type='text'>Max,

You answered a couple of questions.

First, ...</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;You answered a couple of questions.&lt;br /&gt;&lt;br /&gt;First, it appears that I am interpreting rungoldtreesys.R and the data file correctly.&lt;br /&gt;&lt;br /&gt;Second, yes, I was looking for a lag between &amp;quot;targets&amp;quot; and &amp;quot;returns&amp;quot;.&lt;br /&gt;&lt;br /&gt;This brings up some new questions:&lt;br /&gt;&lt;br /&gt;1. In file rtreesystem.R, is the following line where the &amp;quot;targets&amp;quot; &amp;quot;data&amp;quot; offset occurs?&lt;br /&gt;&lt;br /&gt;savedEnsemble = trainEnsemble(data[(t + horizon+1):(t + trainperiods+horizon+1), ], targets[(t + 1):(t + trainperiods+1)], verbose = TRUE, treesInBag, keepNFeatures)&lt;br /&gt;&lt;br /&gt;If not, where does it occur?&lt;br /&gt;&lt;br /&gt;2. Running the same data 10 times, I get 10 different answers (typically with a different order of variable importance).    Does this mean that no single variable dominates the data, or something else?&lt;br /&gt;&lt;br /&gt;3. Can you recommend a good book on R, hopefully with a lot of examples?  I&amp;#39;m an engineer (a mediocre programmer in various languages).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Bill S</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/3331387695177571765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/3331387695177571765'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248805017787#c3331387695177571765' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-2102790458684153642</id><published>2009-07-27T21:17:55.290-07:00</published><updated>2009-07-27T21:17:55.290-07:00</updated><title type='text'>Bill,

The dumber the questions you have to ask, t...</title><content type='html'>Bill,&lt;br /&gt;&lt;br /&gt;The dumber the questions you have to ask, the dumber the teacher. &lt;br /&gt;&lt;br /&gt;The 9th variable/returns are not ignored, they&amp;#39;re included in the inputs. &lt;br /&gt;&lt;br /&gt;Are you thinking that this is essentially giving the model exactly the same data it&amp;#39;s trying to predict and therefore cheating? Actually it&amp;#39;s not because the input data is lagged by one period compared to the targets. So the returns from yesterday are used to predict the returns today.&lt;br /&gt;&lt;br /&gt;If you&amp;#39;re asking something else, please clarify. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/2102790458684153642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/2102790458684153642'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248754675290#c2102790458684153642' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-3803695514097160682</id><published>2009-07-27T14:58:44.845-07:00</published><updated>2009-07-27T14:58:44.845-07:00</updated><title type='text'>Max,

Please forgive me for the dumb questions, bu...</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;Please forgive me for the dumb questions, but I&amp;#39;m new to R and randomForest.&lt;br /&gt;&lt;br /&gt;From files gold01-09.csv and rungoldtreesys.R:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#setwd(&amp;quot;C:\\Documents and Settings\\Max\\My Documents\\Quant\\R&amp;quot;)&lt;br /&gt;data = read.csv(&amp;#39;gold00-09.csv&amp;#39;, header=TRUE, stringsAsFactors=FALSE)&lt;br /&gt;returns = data[[9]]&lt;br /&gt;dates = data[[1]]&lt;br /&gt;data = data[-c(1)]&lt;br /&gt;targets = returns&lt;br /&gt;targets[targets&amp;gt;=0]=1&lt;br /&gt;targets[targets&amp;lt;0]=-1&lt;br /&gt;&lt;br /&gt;source(&amp;#39;rtreesystem.r&amp;#39;)&lt;br /&gt;# factormodel.tree(data, targets, returns, btsamples=250, horizon=1, trainperiods=150, leverage = &amp;#39;kelly&amp;#39;, keepNFeatures = 10, treesInBag = 200)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the above code, the +1 -1 &amp;quot;targets&amp;quot; values are the ones you&amp;#39;re trying to classify/predict.  They are &amp;quot;digitized&amp;quot; from the 9th variable in &amp;quot;data&amp;quot; (which is GLDr1 in the data file, and &amp;quot;returns&amp;quot; in the above code).    When you pass &amp;quot;data&amp;quot; and &amp;quot;returns&amp;quot; into &amp;quot;factormodel.tree&amp;quot; how do you tell it to ignore &amp;quot;returns&amp;quot; and/or the 9th variable for modeling/prediction?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Bill S</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/3803695514097160682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/3803695514097160682'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248731924845#c3803695514097160682' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-7600555498167110894</id><published>2009-07-27T11:55:47.171-07:00</published><updated>2009-07-27T11:55:47.171-07:00</updated><title type='text'>Bill,

You can find the code here: http://cran.r-p...</title><content type='html'>Bill,&lt;br /&gt;&lt;br /&gt;You can find the code here: http://cran.r-project.org/web/packages/randomForest/index.html&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Max</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/7600555498167110894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/7600555498167110894'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248720947171#c7600555498167110894' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-5427115370249937056</id><published>2009-07-27T11:33:48.802-07:00</published><updated>2009-07-27T11:33:48.802-07:00</updated><title type='text'>Max,

Interesting article.

I'm trying to reproduc...</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;Interesting article.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m trying to reproduce your results on my machine.   I&amp;#39;ve loaded R, rtreesystem.r, rungoldtreesys.r, and gold01-09.csv.&lt;br /&gt;&lt;br /&gt;When I run it, R comes back with:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Loading required package: randomForest&lt;br /&gt;&lt;br /&gt;Error in trainEnsemble(data[(t + horizon + 1):(t + trainperiods + horizon +  : &lt;br /&gt;  could not find function &amp;quot;randomForest&amp;quot;&lt;br /&gt;&lt;br /&gt;In addition: Warning message:&lt;br /&gt;In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :&lt;br /&gt;  there is no package called &amp;#39;randomForest&amp;#39;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Apparently, it can&amp;#39;t find &amp;quot;randomforest&amp;quot;.   Can you post the code for &amp;quot;randomforest&amp;quot;?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Bill S</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/5427115370249937056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/5427115370249937056'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248719628802#c5427115370249937056' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-1940547520827812446</id><published>2009-07-27T11:30:00.896-07:00</published><updated>2009-07-27T11:30:00.896-07:00</updated><title type='text'>Max,

Interesting article.

I'm trying to reproduc...</title><content type='html'>Max,&lt;br /&gt;&lt;br /&gt;Interesting article.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m trying to reproduce your results on my machine.   I&amp;#39;ve loaded R, rtreesystem.r, rungoldtreesys.r, and gold01-09.csv.&lt;br /&gt;&lt;br /&gt;When I run it, R comes back with:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Loading required package: randomForest&lt;br /&gt;&lt;br /&gt;Error in trainEnsemble(data[(t + horizon + 1):(t + trainperiods + horizon +  : &lt;br /&gt;  could not find function &amp;quot;randomForest&amp;quot;&lt;br /&gt;&lt;br /&gt;In addition: Warning message:&lt;br /&gt;In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :&lt;br /&gt;  there is no package called &amp;#39;randomForest&amp;#39;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Apparently, it can&amp;#39;t find &amp;quot;randomforest&amp;quot;.   Can you post the code for &amp;quot;randomforest&amp;quot;?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Bill S</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1940547520827812446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1940547520827812446'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1248719400896#c1940547520827812446' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3965329713014965566.post-1793419015415184397</id><published>2009-06-27T09:46:42.077-07:00</published><updated>2009-06-27T09:46:42.077-07:00</updated><title type='text'>That'll do it.</title><content type='html'>That&amp;#39;ll do it.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1793419015415184397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3965329713014965566/5663943458097608787/comments/default/1793419015415184397'/><link rel='alternate' type='text/html' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html?showComment=1246121202077#c1793419015415184397' title=''/><author><name>Max Dama</name><uri>http://www.blogger.com/profile/12948829617916062149</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='17229209747989421341'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.maxdama.com/2009/05/decision-tree-bagging-system-r-code.html' ref='tag:blogger.com,1999:blog-3965329713014965566.post-5663943458097608787' source='http://www.blogger.com/feeds/3965329713014965566/posts/default/5663943458097608787' type='text/html'/></entry></feed>