Skip to content

Commit

Permalink
initialize report.compare_performance
Browse files Browse the repository at this point in the history
  • Loading branch information
DominiqueMakowski committed Dec 22, 2020
1 parent b64193c commit 648ee68
Show file tree
Hide file tree
Showing 22 changed files with 159 additions and 36 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Collate:
'report.aov.R'
'report.bayesfactor_models.R'
'report.character.R'
'report.compare_performance.R'
'report.data.frame.R'
'report.default.R'
'report.factor.R'
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ S3method(report,aovlist)
S3method(report,bayesfactor_inclusion)
S3method(report,bayesfactor_models)
S3method(report,character)
S3method(report,compare_performance)
S3method(report,data.frame)
S3method(report,default)
S3method(report,factor)
Expand Down Expand Up @@ -162,6 +163,7 @@ S3method(report_table,aovlist)
S3method(report_table,bayesfactor_inclusion)
S3method(report_table,bayesfactor_models)
S3method(report_table,character)
S3method(report_table,compare_performance)
S3method(report_table,data.frame)
S3method(report_table,default)
S3method(report_table,factor)
Expand Down
9 changes: 6 additions & 3 deletions R/report.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Automatic report of R objects
#' Automatic reporting of R objects
#'
#' Create reports of different objects. See the documentation for your object's class:
#' \itemize{
Expand All @@ -7,10 +7,11 @@
#' \item{\link[=report.htest]{Correlations and t-tests} (\code{htest})}
#' \item{\link[=report.aov]{ANOVAs} (\code{aov, anova, aovlist, ...})}
#' \item{\link[=report.lm]{Regression models} (\code{glm, lm, ...})}
#' % \item{\link[=report.lmerMod]{Mixed models} (\code{glmer, lmer, glmmTMB, ...})}
#' \item{\link[=report.lm]{Mixed models} (\code{glmer, lmer, glmmTMB, ...})}
#' \item{\link[=report.stanreg]{Bayesian models} (\code{stanreg, brms...})}
#' \item{\link[=report.bayesfactor_models]{Bayes factors} (from \code{bayestestR})}
#' % \item{\link[=report.lavaan]{Structural Equation Models (SEM)} (from \code{lavaan})}
#' \item{\link[=report.lavaan]{Structural Equation Models (SEM)} (from \code{lavaan})}
#' \item{\link[=report.compare_performance]{Model comparison} (from \code{\link[performance:compare_performance]{performance}})}
#' }
#'
#' @param x The R object that you want to report (see list of of supported objects above).
Expand Down Expand Up @@ -52,6 +53,7 @@
#' \item \code{\link{report_statistics}}
#' \item \code{\link{report_effectsize}}
#' \item \code{\link{report_model}}
#' \item \code{\link{report_priors}}
#' \item \code{\link{report_random}}
#' \item \code{\link{report_performance}}
#' \item \code{\link{report_info}}
Expand All @@ -63,6 +65,7 @@
#' \item \code{\link{report_packages}}
#' \item \code{\link{report_participants}}
#' \item \code{\link{report_sample}}
#' \item \code{\link{report_date}}
#' }
#' Methods:
#' \itemize{
Expand Down
4 changes: 2 additions & 2 deletions R/report.aov.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' ANOVAs Report
#' Reporting ANOVAs
#'
#' Create a report of an ANOVA.
#' Create reports for ANOVA models.
#'
#' @param x Object of class \code{aov}, \code{anova} or \code{aovlist}.
#' @inheritParams report
Expand Down
4 changes: 2 additions & 2 deletions R/report.bayesfactor_models.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Report Models' Bayes Factor
#' Reporting Models' Bayes Factor
#'
#' Create a report of Bayes factors for model comparison.
#' Create reports of Bayes factors for model comparison.
#'
#' @param x Object of class \code{bayesfactor_inclusion}.
#' @param interpretation Effect size interpretation set of rules (see \link[effectsize]{interpret_bf}).
Expand Down
38 changes: 38 additions & 0 deletions R/report.compare_performance.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#' Reporting models comparison
#'
#' Create reports for model comparison as obtained by the \code{\link[performance:compare_performance]{performance::compare_performance()}} function in the \code{performance} package.
#'
#' @param x Object of class \code{NEW OBJECT}.
#' @inheritParams report
#'
#' @inherit report return seealso
#'
#' @examples
#' library(report)
#'
#' 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)
#'
#' if(require("performance")){
#' x <- performance::compare_performance(m1, m2, m3)
#' r <- report(x)
#' r
#' # summary(r)
#' # as.data.frame(r)
#' # summary(as.data.frame(r))
#' }
#'
#' @export
report.compare_performance <- function(x, ...) {
print("Support for compare_performance not fully implemented yet :(")
}


#' @rdname report.compare_performance
#' @export
report_table.compare_performance <- function(x, ...) {
table <- x
table_short <- x
as.report_table(table, summary = table_short)
}
4 changes: 2 additions & 2 deletions R/report.data.frame.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Reports of Data
#' Reporting Datasets and Dataframes
#'
#' Create a report of a data frame.
#' Create reports for data frames.
#'
#' @inheritParams report
#' @param n Include number of observations for each individual variable.
Expand Down
4 changes: 2 additions & 2 deletions R/report.htest.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Reports of h-tests (Correlation, t-test...)
#' Reporting h-tests (Correlation, t-test...)
#'
#' Create a report of an h-test object (\code{t.test()}, \code{cor.test()}).
#' Create reports for h-test objects (\code{t.test()}, \code{cor.test()}).
#'
#' @param x Object of class htest.
#' @param table Provide the output of \code{report_table()} to avoid its re-computation.
Expand Down
8 changes: 6 additions & 2 deletions R/report.lavaan.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
#' dem60 =~ y1 + y2 + y3
#' dem60 ~ ind60 "
#' model <- lavaan::sem(structure, data = PoliticalDemocracy)
#' report(model)
#' r <- report(model)
#' r
#'
#' report_table(model)
#' report_performance(model)
#' }
#' @export
report.lavaan <- function(x, ...) {
print("Support for lavaan not implemented yet :(")
print("Support for lavaan not fully implemented yet :(")
}


Expand Down
4 changes: 2 additions & 2 deletions R/report.lm.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Reports of (General) Linear Models
#' Reporting (General) Linear Models
#'
#' Create a report for (general) linear models.
#' Create reports for (general) linear models.
#'
#' @param x Object of class \code{lm} or \code{glm}.
#' @param include_effectsize If \code{FALSE}, won't include effect-size related indices (standardized coefficients, etc.).
Expand Down
6 changes: 3 additions & 3 deletions R/report.stanreg.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Reports of Bayesian Models
#' Reporting Bayesian Models
#'
#' Create a report Bayesian models. The description of the parameters follows the
#' Create reports for Bayesian models. The description of the parameters follows the
#' Sequential Effect eXistence and sIgnificance Testing framework (see \link[bayestestR:sexit]{SEXIT documentation}).
#'
#' @inheritParams report.lm
Expand All @@ -11,7 +11,7 @@
#'
#' # Bayesian models
#' if(require("rstanarm")){
#' model <- stan_glm(mpg ~ qsec + wt, data = mtcars, refresh=0, iter=600)
#' model <- stan_glm(mpg ~ qsec + wt, data = mtcars, refresh=0, iter=300)
#' r <- report(model)
#' r
#' summary(r)
Expand Down
2 changes: 1 addition & 1 deletion R/report_misc.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Miscellaneous reports
#'
#' Why? Because we can.
#' Other convenient or totally useless reports.
#'
#' @inheritParams report
#'
Expand Down
7 changes: 4 additions & 3 deletions man/report.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/report.aov.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/report.bayesfactor_models.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions man/report.compare_performance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/report.data.frame.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/report.htest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/report.lavaan.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/report.lm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 648ee68

Please sign in to comment.