# accuracy

From forecast v5.3
by Rob Hyndman

##### Accuracy measures for forecast model

Returns range of summary measures of the forecast accuracy. If `x`

is provided, the function measures out-of-sample (test set) forecast accuracy
based on x-f. If `x`

is not provided, the function only produces in-sample (training set) accuracy measures of the forecasts based on f["x"]-fitted(f).
All measures are defined and discussed in Hyndman and Koehler (2006).

- Keywords
- ts

##### Usage

`accuracy(f, x, test=NULL)`

##### Arguments

- f
- An object of class
`"forecast"`

, or a numerical vector containing forecasts. It will also work with`Arima`

,`ets`

and`lm`

objects if`x`

is omitted -- in which case in-sample accuracy measures are r - x
- An optional numerical vector containing actual values of the same length as object, or a time series overlapping with the times of
`f`

. - test
- Indicator of which elements of x and f to test. If
`test`

is`NULL`

, all elements are used. Otherwise test is a numeric vector containing the indices of the elements to use in the test.

##### Details

MASE calculation is scaled using MAE of in-sample naive forecasts for non-seasonal time series, in-sample seasonal naive forecasts for seasonal time series and in-sample mean forecasts for non-time series data.

##### Value

- Matrix giving forecast accuracy measures.

##### References

Hyndman, R.J. and Koehler, A.B. (2006) "Another look at measures of forecast accuracy". *International Journal of Forecasting*,
**22**(4).

##### Examples

```
fit1 <- rwf(EuStockMarkets[1:200,1],h=100)
fit2 <- meanf(EuStockMarkets[1:200,1],h=100)
accuracy(fit1)
accuracy(fit2)
accuracy(fit1,EuStockMarkets[201:300,1])
accuracy(fit2,EuStockMarkets[201:300,1])
plot(fit1)
lines(EuStockMarkets[1:300,1])
```

*Documentation reproduced from package forecast, version 5.3, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.