# postResample

From caret v3.32
by Max Kuhn

##### Calculates performance across resamples

Given two numeric vectors of data, the mean squared error and R-squared are calculated. For two factors, the overall agreement rate and Kappa are determined.

- Keywords
- utilities

##### Usage

`postResample(pred, obs)`

##### Arguments

- pred
- A vector of numeric data (could be a factor)
- obs
- A vector of numeric data (could be a factor)

##### Details

This function is meant to be used with `apply`

across a matrix. For numeric data
the code checks to see if the standard deviation of either vector is zero. If so, the correlation
between those samples is assigned a value of zero. `NA`

values are ignored everywhere.

Note that many models have more predictors (or parameters) than data points, so the typical mean squared
error denominator (n - p) does not apply. Root mean squared error is calculated using `sqrt(mean((pred - obs)^2`

.
Also, R-squared is calculated as the square of the correlation between the observed and predicted outcomes.

##### Value

- A vector of performance estimates.

##### See Also

##### Examples

```
predicted <- matrix(rnorm(50), ncol = 5)
observed <- rnorm(10)
apply(predicted, 2, postResample, obs = observed)
```

*Documentation reproduced from package caret, version 3.32, License: GPL-2*

### Community examples

Looks like there are no examples yet.