Skip to content

Commit

Permalink
initialize stanreg
Browse files Browse the repository at this point in the history
  • Loading branch information
DominiqueMakowski committed Oct 23, 2020
1 parent a776e87 commit 3c07ccb
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 33 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Collate:
'report.lme4.R'
'report.numeric.R'
'report.sessionInfo.R'
'report.stanreg.R'
'report.survreg.R'
'report.zeroinfl.R'
'report_effectsize.R'
Expand Down
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ S3method(report,logical)
S3method(report,merMod)
S3method(report,numeric)
S3method(report,sessionInfo)
S3method(report,stanreg)
S3method(report,survreg)
S3method(report,zeroinfl)
S3method(report_effectsize,MixMod)
Expand All @@ -49,6 +50,7 @@ S3method(report_effectsize,glmmTMB)
S3method(report_effectsize,htest)
S3method(report_effectsize,lm)
S3method(report_effectsize,merMod)
S3method(report_effectsize,stanreg)
S3method(report_effectsize,survreg)
S3method(report_effectsize,zeroinfl)
S3method(report_info,MixMod)
Expand All @@ -61,6 +63,7 @@ S3method(report_info,glmmTMB)
S3method(report_info,htest)
S3method(report_info,lm)
S3method(report_info,merMod)
S3method(report_info,stanreg)
S3method(report_info,survreg)
S3method(report_info,zeroinfl)
S3method(report_intercept,MixMod)
Expand All @@ -69,6 +72,7 @@ S3method(report_intercept,glm)
S3method(report_intercept,glmmTMB)
S3method(report_intercept,lm)
S3method(report_intercept,merMod)
S3method(report_intercept,stanreg)
S3method(report_intercept,survreg)
S3method(report_intercept,zeroinfl)
S3method(report_model,MixMod)
Expand All @@ -81,6 +85,7 @@ S3method(report_model,glmmTMB)
S3method(report_model,htest)
S3method(report_model,lm)
S3method(report_model,merMod)
S3method(report_model,stanreg)
S3method(report_model,survreg)
S3method(report_model,zeroinfl)
S3method(report_parameters,MixMod)
Expand All @@ -100,6 +105,7 @@ S3method(report_parameters,logical)
S3method(report_parameters,merMod)
S3method(report_parameters,numeric)
S3method(report_parameters,sessionInfo)
S3method(report_parameters,stanreg)
S3method(report_parameters,survreg)
S3method(report_parameters,zeroinfl)
S3method(report_performance,MixMod)
Expand All @@ -108,12 +114,14 @@ S3method(report_performance,glm)
S3method(report_performance,glmmTMB)
S3method(report_performance,lm)
S3method(report_performance,merMod)
S3method(report_performance,stanreg)
S3method(report_performance,survreg)
S3method(report_performance,zeroinfl)
S3method(report_random,MixMod)
S3method(report_random,default)
S3method(report_random,glmmTMB)
S3method(report_random,merMod)
S3method(report_random,stanreg)
S3method(report_statistics,MixMod)
S3method(report_statistics,anova)
S3method(report_statistics,aov)
Expand All @@ -129,6 +137,7 @@ S3method(report_statistics,htest)
S3method(report_statistics,lm)
S3method(report_statistics,merMod)
S3method(report_statistics,numeric)
S3method(report_statistics,stanreg)
S3method(report_statistics,survreg)
S3method(report_statistics,zeroinfl)
S3method(report_table,MixMod)
Expand All @@ -150,6 +159,7 @@ S3method(report_table,logical)
S3method(report_table,merMod)
S3method(report_table,numeric)
S3method(report_table,sessionInfo)
S3method(report_table,stanreg)
S3method(report_table,survreg)
S3method(report_table,zeroinfl)
S3method(report_text,MixMod)
Expand All @@ -171,6 +181,7 @@ S3method(report_text,logical)
S3method(report_text,merMod)
S3method(report_text,numeric)
S3method(report_text,sessionInfo)
S3method(report_text,stanreg)
S3method(report_text,survreg)
S3method(report_text,zeroinfl)
S3method(summary,report_effectsize)
Expand Down
11 changes: 6 additions & 5 deletions R/report.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,29 @@
#' with a short and long description of the model summary, as well as a short
#' and long table of parameters and fit indices.
#'
#' @seealso Aspects of reports:
#' @seealso Aspects of reports (especially for stats models):
#' \itemize{
#' \item \code{\link{report_table}}
#' \item \code{\link{report_parameters}}
#' \item \code{\link{report_statistics}}
#' \item \code{\link{report_effectsize}}
#' \item \code{\link{report_model}}
#' \item \code{\link{report_random}}
#' \item \code{\link{report_performance}}
#' \item \code{\link{report_info}}
#' \item \code{\link{report_text}}
#' }
#' Methods:
#' \itemize{
#' \item \code{\link{as.report}}
#' }
#' Specific reports:
#' \itemize{
#' \item \code{\link{report_system}}
#' \item \code{\link{report_packages}}
#' \item \code{\link{report_participants}}
#' \item \code{\link{report_sample}}
#' }
#' Methods:
#' \itemize{
#' \item \code{\link{as.report}}
#' }
#'
#' @examples
#' library(report)
Expand Down
33 changes: 33 additions & 0 deletions R/report.stanreg.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#' @include report.lm.R
#' @export
report.stanreg <- report.lm

#' @export
report_effectsize.stanreg <- report_effectsize.lm

#' @export
report_table.stanreg <- report_table.lm

#' @export
report_performance.stanreg <- report_performance.lm

#' @export
report_statistics.stanreg <- report_statistics.lm

#' @export
report_parameters.stanreg <- report_parameters.lm

#' @export
report_intercept.stanreg <- report_intercept.lm

#' @export
report_random.stanreg <- report_random.merMod

#' @export
report_model.stanreg <- report_model.lm

#' @export
report_info.stanreg <- report_info.lm

#' @export
report_text.stanreg <- report_text.lm
12 changes: 9 additions & 3 deletions R/report_effectsize.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#' model <- lme4::lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris)
#' report_effectsize(model)
#' }
#'
#' # Bayesian models
#' if(require("rstanarm")){
#' model <- rstanarm::stan_lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris, refresh=0, iter=600)
#' report_effectsize(model, method="basic")
#' }
#' @export
report_effectsize <- function(x, ...) {
UseMethod("report_effectsize")
Expand Down Expand Up @@ -129,15 +135,15 @@ print.report_effectsize <- function(x, ...) {
text <- "SD "
}
text <- paste0("Standardized parameters were obtained by standardizing the data by 2 times the ", text, " (see Gelman, 2008).")
} else if (method == "smart" | method == "classic") {
} else if (method == "smart" | method == "basic") {
if (robust == TRUE) {
text <- "median and the MAD (a median-based equivalent of the SD) of the response variable."
} else {
text <- "mean and the SD of the response variable."
}
text <- paste0(" Parameters were scaled by the ", text)
text <- paste0("Parameters were scaled by the ", text)
} else {
text <- paste0(" Parameters were standardized using the ", text, " method.")
text <- paste0("Parameters were standardized using the ", text, " method.")
}

text
Expand Down
11 changes: 6 additions & 5 deletions man/report.Rd

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

11 changes: 6 additions & 5 deletions man/report.aov.Rd

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

11 changes: 6 additions & 5 deletions man/report.bayesfactor_models.Rd

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

11 changes: 6 additions & 5 deletions man/report.htest.Rd

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

11 changes: 6 additions & 5 deletions man/report.lm.Rd

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

6 changes: 6 additions & 0 deletions man/report_effectsize.Rd

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

0 comments on commit 3c07ccb

Please sign in to comment.