Skip to contents

Create reports for model comparison as obtained by the performance::compare_performance() function in the performance package.

Usage

# S3 method for class 'test_performance'
report(x, ...)

# S3 method for class 'test_performance'
report_table(x, ...)

# S3 method for class 'test_performance'
report_statistics(x, table = NULL, ...)

# S3 method for class 'test_performance'
report_parameters(x, table = NULL, ...)

# S3 method for class 'test_performance'
report_text(x, table = NULL, ...)

Arguments

x

Object of class NEW OBJECT.

...

Arguments passed to or from other methods.

table

Provide the output of report_table() to avoid its re-computation.

Value

An object of class report().

Examples

# \donttest{
library(report)
library(performance)

m1 <- lm(Sepal.Length ~ Petal.Length * Species, data = iris)
m2 <- lm(Sepal.Length ~ Petal.Length + Species, data = iris)
m3 <- lm(Sepal.Length ~ Petal.Length, data = iris)

x <- performance::test_performance(m1, m2, m3)
r <- report(x)
r
#> We compared three models; lm (BF = 26.52), lm (BF = 4.20e-11) and lm (BF =
#> 26.52).
summary(r)
#> We compared three models; lm (), lm () and lm ().
as.data.frame(r)
#> Name | Model |      BF | df | df_diff |  Chi2 |      p
#> ------------------------------------------------------
#> m1   |    lm |         |  7 |         |       |       
#> m2   |    lm |   26.52 |  5 |   -2.00 |  3.47 | 0.177 
#> m3   |    lm | < 0.001 |  3 |   -2.00 | 57.81 | < .001
#> Models were detected as nested (in terms of fixed parameters) and are compared in sequential order.
summary(as.data.frame(r))
#> Name | Model |      BF | df | df_diff |  Chi2 |      p
#> ------------------------------------------------------
#> m1   |    lm |         |  7 |         |       |       
#> m2   |    lm |   26.52 |  5 |   -2.00 |  3.47 | 0.177 
#> m3   |    lm | < 0.001 |  3 |   -2.00 | 57.81 | < .001
#> Models were detected as nested (in terms of fixed parameters) and are compared in sequential order.

# Specific reports
report_table(x)
#> Name | Model |      BF | df | df_diff |  Chi2 |      p
#> ------------------------------------------------------
#> m1   |    lm |         |  7 |         |       |       
#> m2   |    lm |   26.52 |  5 |   -2.00 |  3.47 | 0.177 
#> m3   |    lm | < 0.001 |  3 |   -2.00 | 57.81 | < .001
#> Models were detected as nested (in terms of fixed parameters) and are compared in sequential order.
report_statistics(x)
#> BF = 26.52
#> BF = 4.20e-11
report_parameters(x)
#>   - lm (BF = 26.52)
#>   - lm (BF = 4.20e-11)
#>   - lm (BF = 26.52)
# }