Alessandro Urselli
Alessandro Urselli

Reputation: 41

Random Forest (rfsrc package): multivariate analysis

I'm trying to evaluate interactions between promotions on child products. My dataset counts 1073 dicotomic variables (x) and 11 dependent (y). I'm using rfsrc from randomForestSRC package in R.

fit2=rfsrc(Multivar(y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11) ~.,data = data3, importance =TRUE)
err <- get.mv.error(fit2)
err
vmp.std <- get.mv.vimp(fit2, standardize = TRUE)
plot(fit2)

Why, by default, R give me back just y1 as response?

                         Sample size: 602
                     Number of trees: 1000
           Forest terminal node size: 5
       Average no. of terminal nodes: 179.484
No. of variables tried at each split: 358
              Total no. of variables: 1073
              Total no. of responses: 11
         User has requested response: y1
       Resampling used to grow trees: swr
    Resample size used to grow trees: 602
                            Analysis: mRF-R
                              Family: regr+
                      Splitting rule: mv.mse *random*
       Number of random split points: 10
                % variance explained: 53.03
                          Error rate: 0.4

There are some command to plot some informations?

Upvotes: 4

Views: 585

Answers (1)

StupidWolf
StupidWolf

Reputation: 46908

If you look at the source code of plot.variable.rfsrc.R which is called to plot your randomForestSRC object, the default for m.target is NULL And it feeds this to another function get.univariate.target which will take the first variable. If you want to plot other variables, you specify m.target=...

library(mlr)
library(randomForestSRC)

yeast = getTaskData(yeast.task)
data = yeast[,c(1:3,15:100)]
head(data)
fit = rfsrc(Multivar(label1,label2,label3) ~.,data = data, importance =TRUE)

plot(fit,m.target="label2")

enter image description here

plot(fit,m.target="label3")

enter image description here

Upvotes: 1

Related Questions