Sandra,
 
This might mean you have a few very good predictors (and many not so good ones) and increasing mtry increases the likelihood that those predictors are included in mtry's draw.  Your predictive ability may be increased with small mtry values by increasing the number of trees. Try increasing to 1000 or even 10,000 trees and see what happens. I don't think you should consider this a problem of overfitting, particularly if you are running a predict on new data in the end... your output will be a probability and you'll be able to tweak the level of fit by balancing true positives and false positives from your training set.  I think you are fine going with the large mtry if that's what the error rates are telling you.
 
One other note, using the formula interface uses more memory so I'd recommend stating x and y in the randomForest call instead, see the help pages for more. 
 
Good luck. 
Tim
 
 
 
------------------------------

Message: 2
Date: Mon, 7 Feb 2011 17:13:49 +0100
From: Sandra Oliveira <sisoliveira@gmail.com>
To: <r-sig-geo@stat.math.ethz.ch>
Subject: [R-sig-Geo] mtry in Random Forest
Message-ID:
<AANLkTinV=gLqay5XE2uVMmCjNgzrS+iARjJ5NZOkX447@mail.gmail.com>
Content-Type: text/plain

Hi all,

I'm writing to ask some suggestions about the selection of mtry in
randomForest.

I'm running randomForest in a dataset with circa 10 000 observations and 33
variables.

I used the function tuneRF to find the mtry value and it gives me mtry=16 as
the optimal for the several trials I ran.
I applied also smaller mtry values for comparison, since several authors
found that the mtry parameter influences the variable importance measures.

In fact, my results tell me that a larger mtry gives higher importance to
fewer variables, changing the %IncMSE of the variables depending on mtry.
The % variance explained also increases with increasing mtry and I wonder if
it's a case of overfitting. I also read that in general a mtry=1 gives
already high predictive accuracy.

Below are the results of the randomForest regression models for the
different mtry values. Any ideas and comments are appreciated.

Thank you,

Sandra Oliveira

mtry = 2

randomForest(formula = density ~ ., data = eumed1, importance = TRUE,
     mtry
= 2, ntree = 500, keep.forest = FALSE, na.action = na.fail)

               Type of random forest: regression

                     Number of trees: 500

No. of variables tried at each split: 2

Mean of squared residuals: 0.001436110

                    % Var explained: 88.34



mtry=4

randomForest(formula = density ~ ., data = eumed1, importance = TRUE,
     mtry
= 4, ntree = 500, keep.forest = FALSE, na.action = na.fail)

               Type of random forest: regression

                     Number of trees: 500

No. of variables tried at each split: 4

           Mean of squared residuals: 0.000750564

                    % Var explained: 93.91



mtry=8:

randomForest(formula = density ~ ., data = eumed1, importance = TRUE,
     mtry
= 8, ntree = 500, keep.forest = FALSE, na.action = na.fail)

               Type of random forest: regression

                     Number of trees: 500

No. of variables tried at each split: 8

           Mean of squared residuals: 0.0004648443

                    % Var explained: 96.23


mtry=11 (the default, 33/3)

randomForest(formula = density ~ ., data = eumed1, importance = TRUE,
     mtry
= 11, ntree = 500, keep.forest = FALSE, na.action = na.fail)

               Type of random forest: regression

                     Number of trees: 500

No. of variables tried at each split: 11

           Mean of squared residuals: 0.0004213192

                    % Var explained: 96.58

mtry=16
randomForest(formula = density ~ ., data = eumed1, importance = TRUE,
mtry = 16, ntree = 500, keep.forest = FALSE, na.action = na.fail)
               Type of random forest: regression
                     Number of trees: 500
No. of variables tried at each split: 16
          Mean of squared residuals: 0.0003961789
                    % Var explained: 96.78



Timothy G. Howard, Ph.D.
Director of Science
New York Natural Heritage Program
625 Broadway, 5th floor
Albany, NY 12233-4757

(518) 402-8945
facsimile  (518) 402-8925

	[[alternative HTML version deleted]]

