bivariate.partialDependence: Bivariate partial-dependency plot

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/bivariate.partialDependence.R

Description

Bivariate partial dependence provides a graphical depiction of the marginal effect of two variables on the class probability (classification) or response (regression)

Usage

1
2
3
bivariate.partialDependence(x, pred.data, v1, v2, grid.size = 20,
  which.class = 2, plot = TRUE, col.ramp = c("#ffffff", "#2a2a2a"),
  ncols = 20, ...)

Arguments

x

random forest object

pred.data

data.frame of independent variables used in model

v1

Variable 1 used in partial dependency

v2

Variable 2 used in partial dependency

grid.size

Number of grid cells (NxN) to integrate partial dependency for

which.class

Index of class probability (only if classification)

plot

(TRUE/FALSE) Plot 3D surface

col.ramp

Colors used in building color ramp

ncols

Number of colors in color ramp

...

Arguments passed to persp

Value

A list object with vectors of v1 (p1) and v2 (p2) and a matrix (estimate), estimate of the averaged estimates.

Note

In deriving the partial-dependence, at each plotted point, the background variables are held at their median values

Author(s)

Jeffrey S. Evans <jeffrey_evans<at>tnc.org>

References

Friedman, J.H. (2001) Greedy Function Approximation: A Gradient Boosting Machine. Annals of Statistics 19(1)

Evans J.S., M.A. Murphy, Z.A. Holden, S.A. Cushman (2011). Modeling species distribution and change using Random Forests CH.8 in Predictive Modeling in Landscape Ecology eds Drew, CA, Huettmann F, Wiersma Y. Springer

Baruch-Mordo, S., J.S. Evans, J. Severson, J. D. Naugle, J. Kiesecker, J. Maestas, & M.J. Falkowski (2013) Saving sage-grouse from the trees: A proactive solution to reducing a key threat to a candidate species Biological Conservation 167:233-241

See Also

persp for persp ... plotting options

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 library(randomForest)
   data(iris)
   iris$Species <- ifelse( iris$Species == "versicolor", 1, 0 ) 
    
 # Add some noise
 idx1 <- which(iris$Species %in% 1)
 idx0 <- which( iris$Species %in% 0)
   iris$Species[sample(idx1, 2)] <- 0
   iris$Species[sample(idx0, 2)] <- 1
  
 # Specify model  
 y = iris[,"Species"] 
 x = iris[,1:4]
 
 set.seed(4364)  
 ( rf.mdl1 <- randomForest(x=x, y=factor(y)) )
 
 
 ( bvpd <- bivariate.partialDependence(rf.mdl1, iris, 
                   v1 = "Petal.Length", v2 = "Petal.Width", shade = 0.6,
                   grid.size = 20, ncols=100, border=NA, col.ramp=c("green","blue") ) ) 
	

rfUtilities documentation built on Oct. 3, 2019, 9:04 a.m.