model_summarise: Summarise a model with statistics indicators

View source: R/stat.R

model_summariseR Documentation

Summarise a model with statistics indicators

Description

Summarise a model with statistics indicators

Usage

model_summarise(
  data,
  x = "x",
  y = "y",
  digits = NULL,
  direction = c("wide", "long"),
  extra = FALSE,
  .groups = "drop",
  ...
)

Arguments

data

A data frame to summarise

x

x variable name

y

y variable name

digits

integer indicating the number of decimal places (round) or significant digits (signif) to be used.

direction

the wide (default) or long format for the output

extra

summarise extra variables. FALSE in default.

.groups

Grouping structure passing to summarise function. "drop" in default.

...

other arguments passing to functions. Supporting arguments

  • nrmse_method: Method for nrmse

Value

A data frame with statistics indicators in columns including:

  • n: Number of rows

  • r: Coefficient of correlation

  • r2: Squared coefficient of correlation

  • bias: Average amount by which actual is greater than predicted

  • mse: Average squared difference

  • rmse: Root mean squared error

  • nrmse: Normalized root mean squared error

  • d: Willmott degree of agreement

  • error7day: Percentabe of errors less than 7 days if extra is TRUE

Examples

library(dplyr)
data <- data.frame(x = 1:10, y = 1:10 + runif(10))
data %>% model_summarise()
data %>% model_summarise(digits = 2)
# Export as long format
data %>% model_summarise(digits = 2, direction = "long")

byzheng/myutils documentation built on Oct. 3, 2024, 1:35 a.m.