Description Usage Arguments Details Value See Also Examples

Vectorized summary statistics, including geometric mean, harmonic mean, sample standard error (SE), coefficient of variation (CV), root mean square error (RMSE), mean absolute error (MAE), and sensitivity.

1 2 3 4 5 6 7 8 9 10 11 |

`x` |
vector of values to evaluate |

`na.rm` |
logical indicating whether NA values in |

`zero.rm` |
logical indicating whether zeros in |

`...` |
further arguments passed to other methods |

`y` |
vector of 'predicted' values to compare against |

`stdz` |
logical, standardize output by range of |

For vectors including at least one zero, results of
`geom_mean`

and `harm_mean`

are always 0 by
definition, unless `zero.rm=TRUE`

.

Like `sd`

, `sem`

uses *n-1* in
denominator to correct for small-sample bias.

`rmse`

is one way to assess prediction accuracy.

`mae`

gives a measure of sensitivity when `stdz=TRUE`

.

These functions return NA when NAs present and `na.rm=TRUE`

.

Numeric value.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ```
# test data
xx <- c(-1, 0, 1, 4, 77, NA)
# harmonic mean
harm_mean(xx, na.rm=TRUE, zero.rm=FALSE) # 0 by definition
harm_mean(xx, na.rm=TRUE, zero.rm=TRUE) # 15.20988
# geometric mean
### NOT RUN:
# geom_mean(xx, na.rm=TRUE, zero.rm=FALSE)) # fails for neg vals
### END NOT RUN
xx <- xx[-1] # remove negative values
geom_mean(xx, na.rm=TRUE, zero.rm=FALSE) # 0 by definition
geom_mean(xx, na.rm=TRUE, zero.rm=TRUE) # 6.753313
# standard error of the mean
sem(xx) # 21.76899
# coefficient of variation
cv(xx) # 183.9268
# root mean squared error
set.seed(23)
xx <- c(-1, 0, 1, 4, 77, NA)
yy <- xx+rnorm(length(xx), 10)
rmse(xx, yy) # 10.71919
rmse(yy, xx) # same, order invariant
# mean absolute error
mae(xx, yy, stdz=FALSE) # 10.69236
# range-standardized mean absolute error (aka sensitivity)
mae(xx, yy, stdz=TRUE) # 0.1370815
mae(yy, xx, stdz=TRUE) # 0.135684 -- order matters!
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.