Summarise a model with statistics indicators
model_summarise(
data,
x = "x",
y = "y",
digits = NULL,
direction = c("wide", "long"),
extra = FALSE,
.groups = "drop",
...
)A data frame to summarise
x variable name
y variable name
integer indicating the number of decimal places (round) or significant digits (signif) to be used.
the wide (default) or long format for the output
summarise extra variables. FALSE in default.
Grouping structure passing to summarise function. "drop" in default.
other arguments passing to functions. Supporting arguments
nrmse_method: Method for nrmse
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
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
data <- data.frame(x = 1:10, y = 1:10 + runif(10))
data %>% model_summarise()
#> n r r2 bias mse rmse nrmse d
#> 1 10 0.9968714 0.9937527 -0.3974769 0.2400306 0.4899292 0.08907803 0.9922655
data %>% model_summarise(digits = 2)
#> n r r2 bias mse rmse nrmse d
#> 1 10 1 0.99 -0.4 0.24 0.49 0.09 0.99
# Export as long format
data %>% model_summarise(digits = 2, direction = "long")
#> # A tibble: 8 × 2
#> indicator value
#> <chr> <dbl>
#> 1 n 10
#> 2 r 1
#> 3 r2 0.99
#> 4 bias -0.4
#> 5 mse 0.24
#> 6 rmse 0.49
#> 7 nrmse 0.09
#> 8 d 0.99