 Hi Andy,

thanks for your reply and your further correction.

While the next release is not available I rewrite my code with your
suggestion in case it might help anyone.

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

## build data set in data frame
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 ( as.numeric(X[i,]))) }

df <- data.frame( X , Y )
##remove
rm(X,Y)
## build model
mdl.rf <-  randomForest( formula = as.factor(Y) ~ . , data = df ,
proximity=TRUE ,  mtry = 10 , ntree = 500 )
summary (outlier(mdl.rf) )
##############################

Regards
Pau



2010/7/15 Liaw, Andy <andy_liaw@merck.com>

> 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@r-project.org [mailto:r-help-bounces@r-project.org]
> On Behalf Of Pau Carrio Gaspar
> Sent: Wednesday, July 14, 2010 6:36 AM
> To: r-help@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@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 attach...{{dropped:16}}

