Skip to content

Commit

Permalink
remove new function code
Browse files Browse the repository at this point in the history
  • Loading branch information
JTPetter committed May 14, 2024
1 parent 847e302 commit 8c4de1b
Showing 1 changed file with 0 additions and 108 deletions.
108 changes: 0 additions & 108 deletions R/doeAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -833,114 +833,6 @@ get_levels <- function(var, num_levels, dataset) {
plot$plotObject <- p
}

# .doeAnalysisPlotEffectNormalDistribution <- function(jaspResults, options, blocks, covariates, ready) {
# if (!is.null(jaspResults[["normalEffectsPlot"]]) || !options[["normalEffectsPlot"]]) {
# return()
# }
# plot <- createJaspPlot(title = gettext("Normal Plot of Standardized Effects"), width = 600, height = 400)
# plot$dependOn(options = c("normalEffectsPlot", "tableAlias", .doeAnalysisBaseDependencies()))
# plot$position <- 11
# jaspResults[["normalEffectsPlot"]] <- plot
# if (!ready || is.null(jaspResults[["doeResult"]]) || jaspResults$getError()) {
# return()
# }
# result <- if (options[["codeFactors"]]) jaspResults[["doeResultCoded"]]$object[["regression"]] else jaspResults[["doeResult"]]$object[["regression"]]
# fac <- if (options[["tableAlias"]]) result[["coefficients"]][["termsAliased"]][-1] else result[["coefficients"]][["terms"]][-1]
# coefDf <- data.frame(result[["objectSummary"]]$coefficients)
# tDf <- data.frame("tValue" = coefDf[["t.value"]],
# terms = result[["coefficients"]][["terms"]])
#
# # Do not include intercept, covariates and blocks in normal effects plot
# tDf <- tDf[-1, ] # remove intercept
# if (length(blocks) > 0 && !identical(blocks, "")) {
# tDf <- tDf[!grepl(blocks, tDf$terms),]
# fac <- if (options[["tableAlias"]]) fac[!grepl("BLK", fac)] else fac[!grepl(blocks, fac)]
# }
# if (length(covariates) > 0 && !identical(covariates, "")) {
# tDf <- tDf[!tDf$terms %in% unlist(covariates), ] # remove the covariate(s)
# fac <- if (options[["tableAlias"]]) fac[!grepl("COV", fac)] else fac[!fac %in% unlist(covariates)]
# }
#
#
# #library(ggplot2)
# data <- c(1.79, -0.52, 3.08, 0.9, -0.79, -1.58)
# x <- data
#
#
# ticks <- ticks
#
# x <- x[order(x)]
# n <- length(x)
# i <- rank(x)
# p <- (i - 0.3) / (n + 0.4)
#
#
# df <- data.frame(x = x, p = p)
# # Create the ggplot with probit transformation
# ggplot(df, aes(x = x, y = p)) +
# stat_function(fun = pnorm, colour = "blue", size = 1) + # Reference line using the pnorm function
# geom_point(color = "red", size = 3) +
# scale_y_continuous(trans = 'probit', labels = scales::percent_format(accuracy = 1), breaks = ticks) +
# labs(x = "Value", y = "Probit of Percentile",
# title = "Comparison of Data to Standard Normal Distribution Percentiles") +
# theme_minimal() +
# xlim(-3, 3.5) # Optional: adjust the x-limits to show more of the tails if needed
#
#
#
#
# c(0.1, 1, 5, seq(10, 90, 10), 95, 99, 99.9)
# tDf
#
# theoretical_fit <- qnorm((1:nrow(tDf))/(nrow(tDf)+1))
# tDf <- dplyr::arrange(tDf, tValue)
#
# # Plotting using ggplot2
# ggplot2::ggplot(tDf, ggplot2::aes(sample = tValue)) +
# #ggplot2::geom_point(ggplot2::aes(y = prob), color = "blue") + # plot actual data points with their percentiles
# ggplot2::geom_line(ggplot2::aes(x = theoretical_fit, y = sort(tValue)), color = "red") + # add theoretical fit line
# ggplot2::labs(title = "Normal Probability Plot of the Effects",
# x = "Theoretical Quantiles",
# y = "Percentiles") +
# ggplot2::theme_minimal() +
# ggplot2::scale_y_continuous(labels = scales::percent) # format y-axis as percent
#
# tDf$percentile <- pnorm(tDf$tValue) * 100
# # Plotting
# ggplot(tDf, aes(x = tValue)) +
# geom_point(aes(y = percentile), color = "blue") + # Actual data points
# geom_line(data = data.frame(t = sort(tDf$tValue)), aes(x = t, y = pnorm(t) * 100), color = "red") + # Theoretical fit line
# labs(title = "Normal Probability Plot of the Effects",
# x = "T-Values",
# y = "Percentiles") +
# theme_minimal() +
# scale_y_continuous(limits = c(0, 100)) +
# scale_x_continuous(limits = c(-3, 3))# y-axis as percent
#
#
#
#
#
#
# df <- result[["objectSummary"]]$df[2]
# crit <- abs(qt(0.025, df))
# fac_t <- cbind.data.frame(fac, t)
# fac_t <- cbind(fac_t[order(fac_t$t), ], y = seq_len(length(t)))
# xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, t, crit))
# critLabelDf <- data.frame(x = 0, y = crit, label = sprintf("t = %.2f", crit))
# p <- ggplot2::ggplot(data = fac_t, mapping = ggplot2::aes(y = t, x = y)) +
# ggplot2::geom_bar(stat = "identity") +
# ggplot2::geom_hline(yintercept = crit, linetype = "dashed", color = "red") +
# ggplot2::geom_label(data = critLabelDf, mapping = ggplot2::aes(x = x, y = y, label = label), col = "red", size = 5) +
# ggplot2::scale_x_continuous(name = gettext("Term"), breaks = fac_t$y, labels = fac_t$fac) +
# ggplot2::scale_y_continuous(name =
# gettext("Standardized Effect"), breaks = xBreaks, limits = range(xBreaks)) +
# ggplot2::coord_flip() +
# jaspGraphs::geom_rangeframe() +
# jaspGraphs::themeJaspRaw()
# plot$plotObject <- p
# }

.doeAnalysisPlotQQResiduals <- function(jaspResults, options, ready) {
if (!is.null(jaspResults[["plotNorm"]]) || !options[["plotNorm"]]) {
return()
Expand Down

0 comments on commit 8c4de1b

Please sign in to comment.