knitr::opts_chunk$set(echo = FALSE) knitr::opts_chunk$set(options(knitr.kable.NA = '')) flextable::set_flextable_defaults(fonts_ignore = TRUE)
title: "r report.title
"
date: "r format(Sys.Date(), '%B %d, %Y')
"
if(dataset.name != "dataset"){ cat("**Dataset:**", dataset.name) cat("\n\n") }
Measure: r if(measure.name == "measure") outputs$item.name.range else paste0(measure.name, " (", outputs$item.name.range, ")")
Comparison groups: r if(length(outputs$dif.groups) == 2) paste(outputs$dif.groups, collapse = " and ") else paste(outputs$dif.groups, collapse = ", ")
Items with no variance: r outputs$no.var.items
Items with no variance within comparison groups: r outputs$no.var.by.group.items
DIF detection method: r if(biased.items == "IRT") biased.items else paste(biased.items, "using", match.type, "Scores")
Total number of biased items: r paste(n.biased, "out of", outputs$n.items)
Type of DIF: r dif.type
if(dif.type == "uniform"){ if(n.biased > 0){ cat("*Number of items uniformly biased toward each group*") cat("\n\n") toward.flex <- format_flex(toward) cat(knitr::knit_print(toward.flex)) cat("\n\n") } }
if(outputs$no.var.items != "none"){ cat("\n\n") cat("^a^ Items were not included in any DIF analysis and were not used to compute treatment effects.") cat("\n\n") } if(outputs$no.var.by.group.items != "none"){ cat("\n\n") cat("^b^ Items were not included in the IRT-based DIF analysis and were not used to compute IRT-based treatment effects.") cat("\n\n") }
if(nrow(biased.items.table) != 0){ bi.flex <- format_flex(biased.items.table) cat(knitr::knit_print(bi.flex)) cat("\n\n") cat(" ") cat("*Note:* X = method determined item to be biased") cat("\n\n") } else { cat("Item bias was not detected by any of the selected methods") cat("\n\n") }
Note. Logical values in bias columns are based on p-values adjusted with the Benjamini & Hochberg (1995) method rather than directly on the p-value columns.
if(!is.null(dif.analysis$MH)){ cat("## Mantel-Haenszel") cat("\n\n") if(class(dif.analysis$MH$item.level) == "character"){ cat(dif.analysis$MH$item.level) cat("\n\n") } else { MHtab <- format_flex(dif.analysis$MH$item.level, bold.bias = "item") cat(knitr::knit_print(MHtab)) cat("\n\n") } }
if(!is.null(dif.analysis$logistic)){ cat("## Logistic Regression") cat("\n\n") cat("#### Model Comparisons") cat("\n\n") logglobtab <- format_flex(dif.analysis$logistic$global.level, bold.bias = "global") cat(knitr::knit_print(logglobtab)) cat("\n\n") cat(" ") cat("\n\n") cat("#### Item-level Tests") cat("\n\n") if(class(dif.analysis$logistic$item.level) == "character"){ cat(dif.analysis$logistic$item.level) cat("\n\n") } else { logitemtab <- format_flex(dif.analysis$logistic$item.level, bold.bias = "item") cat(knitr::knit_print(logitemtab)) cat("\n\n") } }
if(!is.null(dif.analysis$IRT)){ cat("## Item Response Theory") cat("\n\n") cat("#### Model Comparisons") cat("\n\n") irtglobtab <- format_flex(dif.analysis$IRT$global.level, bold.bias = "global") cat(knitr::knit_print(irtglobtab)) cat("\n\n") cat(" ") cat("\n\n") cat("#### Item-level Tests") cat("\n\n") if(class(dif.analysis$IRT$item.level) == "character"){ cat(dif.analysis$IRT$item.level) cat("\n\n") } else { irtitemtab <- format_flex(dif.analysis$IRT$item.level, bold.bias = "item") cat(knitr::knit_print(irtitemtab)) cat("\n\n") } }
if(!is.null(dif.analysis$loess)){ cat("## Graphical Analysis via loess") cat("\n\n") print(dif.analysis$loess$plot) cat("\n\n") cat("*Note.* Polytomous items are unit scaled when calculating the total or rest score. Thus, the maximum score is equal to the number of items.") cat("\n\n") }
gridExtra::grid.arrange(bias.plots[[1]], bias.plots[[2]])
for(i in 1:length(effects.tables)){ cat("\n\n") cat("##", names(effects.tables)[[i]]) cat("\n\n") cat("'Bias Omitted' treatment effect estimates adjusted for bias in", paste(names(inputs$item.data)[dif.models$biased.items], collapse = ", "), ".") cat("\n\n") et.flex <- format_flex(effects.tables[[i]]) cat("\n\n") cat(knitr::knit_print(et.flex)) cat("\n\n") cat(" ") print(effects.plots[[i]]) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.