[R] randomForest outlier return NA

Liaw, Andy andy_liaw at merck.com
Thu Jul 15 16:52:22 CEST 2010


There's a bug in the code.  If you add row names to the X matrix befor
you call randomForest(), you'd get:

R> summary (outlier(mdl.rf) )
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-1.0580 -0.5957  0.0000  0.6406  1.2650  9.5200 

I'll fix this in the next release.  Thanks for reporting.

Best,
Andy 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Pau Carrio Gaspar
Sent: Wednesday, July 14, 2010 6:36 AM
To: r-help at r-project.org
Subject: [R] randomForest outlier return NA

Dear R-users,

I have a problem with randomForest{outlier}.
After running the following code ( that produces a silly data set and
builds
a model with randomForest ):

#######################
library(randomForest)
set.seed(0)

## build data set
X <- rbind(  matrix( runif(n=400,min=-1,max=1), ncol = 10 ) ,
rep(1,times= 10 )  )
Y <- matrix( nrow = nrow(X), ncol = 1)
for( i in (1:nrow(X))){   Y[i,1] <- sign( sum ( X[i,])) }

## build model
mdl.rf <-  randomForest( x = X, y = as.factor(Y) , proximity=TRUE ,
mtry =
10 , ntree = 500)
summary (outlier(mdl.rf) )
#######################

I get the following output:

  Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
                                                     41


Can anyone explain why the output of outlier only returns NA's ?

Thanks
Pau

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Notice:  This e-mail message, together with any attachme...{{dropped:11}}



More information about the R-help mailing list