<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Random Forests class-level sensitivity analysis</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>

<table width="100%" summary="page for rf.class.sensitivity"><tr><td>rf.class.sensitivity</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>Random Forests class-level sensitivity analysis</h2>

<h3>Description</h3>

<p>Performs a sensitivity analysis on a specified class in a random forests model
</p>


<h3>Usage</h3>

<pre>
rf.class.sensitivity(x, xdata, d = "1", p = 0.05, nperm = 999,
  plot = TRUE, seed = NULL, ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p>randomForest class object</p>
</td></tr>
<tr valign="top"><td><code>xdata</code></td>
<td>
<p>Independent variables used in model</p>
</td></tr>
<tr valign="top"><td><code>d</code></td>
<td>
<p>Which class to perturb</p>
</td></tr>
<tr valign="top"><td><code>p</code></td>
<td>
<p>Proportion of class to be randomized</p>
</td></tr>
<tr valign="top"><td><code>nperm</code></td>
<td>
<p>Number of permutations</p>
</td></tr>
<tr valign="top"><td><code>plot</code></td>
<td>
<p>Plot results (TRUE/FALSE)</p>
</td></tr>
<tr valign="top"><td><code>seed</code></td>
<td>
<p>Random seed value</p>
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
<p>Additional arguments passed to randomForest</p>
</td></tr>
</table>


<h3>Value</h3>

<p>List object with following components:
@return mean.error Mean of RMSE
@return sd.error  Standard deviation of RMSE
@return rmse  Root mean squared error (RMSE) for each perturbed probability
@return probs  data.frame with &quot;true&quot; estimate in first column and perturbed probabilities in subsequent columns.
</p>


<h3>Note</h3>

<p>Wildlife survey data likely decreases the proportion of imperfect detection (false absences or presences) but can still be a source of error. Because of this it is often necessary to test the model sensitivity of a given class (eg., used verses available habitat).
</p>
<p>Model sensitivity of false absences is evaluated by randomly assigning a proportion of the specified positive class to the other, refitting the model and estimating the probabilities. Each perturbed estimate is compared against the &quot;true&quot; estimate. Currently only supports binomial models.
</p>


<h3>Author(s)</h3>

<p>Jeffrey S. Evans  &lt;jeffrey_evans@tnc.org&gt;
</p>


<h3>References</h3>

<p>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
</p>
<p>Gardner, R.H., R.V. O'Neill, M.G. Turner, and V.H. Dale (1989). Quantifying scale-dependent effects of animal movements with simple percolation models. Landscape Ecology 3:217-227.
</p>


<h3>Examples</h3>

<pre>
library(randomForest)	
data(iris)
  y &lt;- as.factor(ifelse(iris$Species == "setosa" | 
                 iris$Species == "virginica", 1, 0) )
    xdata &lt;- iris[,1:4] 

rf.mdl &lt;- randomForest(xdata, y, ntree=501) 
  ua &lt;- rf.class.sensitivity(rf.mdl, xdata=xdata, nperm=20, ntree=501, plot=TRUE)
      
</pre>


</body></html>
