# compute.r2

From mobForest v1.3.1
by Kasey Jones

##### Predictive accuracy estimates across trees for linear or poisson regression

pseudo R-square (R2) computation - proportion of total variance in response variable explained by the tree model. The function takes observed and predicted responses as input arguments and computes pseudo-R2 to determine how well the tree model fits the given data.

##### Usage

`compute.r2(response, predictions)`

##### Arguments

- response
A vector of actual response of outcome variable.

- predictions
A vector of predictions for the same outcome variable

##### Value

Predictive accuracy estimates ranging between 0 and 1.

##### Examples

```
# NOT RUN {
# This example explains 90% of the variance
response <- matrix(c(rep(0, 100), rep(10, 100)))
predictions <-
matrix(nrow = 200, ncol = 3,
data = c(rep(1, 100), rep(8, 100), rep(1, 100), rep(8, 100),
rep(1, 100), rep(8, 100)))
compute.r2(response, predictions)
# }
```

*Documentation reproduced from package mobForest, version 1.3.1, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.