From noreply at r-forge.r-project.org Sun Aug 17 03:30:38 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 17 Aug 2014 03:30:38 +0200 (CEST) Subject: [IPSUR-commits] r216 - in pkg/RcmdrPlugin.IPSUR: . R Message-ID: <20140817013038.351CB1876B2@r-forge.r-project.org> Author: gkerns Date: 2014-08-17 03:30:36 +0200 (Sun, 17 Aug 2014) New Revision: 216 Modified: pkg/RcmdrPlugin.IPSUR/ pkg/RcmdrPlugin.IPSUR/DESCRIPTION pkg/RcmdrPlugin.IPSUR/NAMESPACE pkg/RcmdrPlugin.IPSUR/R/First.r pkg/RcmdrPlugin.IPSUR/R/enterTableProportionsTest.r pkg/RcmdrPlugin.IPSUR/R/graphs-menu.R pkg/RcmdrPlugin.IPSUR/R/misc.r pkg/RcmdrPlugin.IPSUR/R/multiSamplePropTest.r pkg/RcmdrPlugin.IPSUR/R/prob-cont-menu.R pkg/RcmdrPlugin.IPSUR/R/prob-disc-menu.R pkg/RcmdrPlugin.IPSUR/R/prob-sample-menu.R pkg/RcmdrPlugin.IPSUR/R/prob-sim-menu.R pkg/RcmdrPlugin.IPSUR/R/statistics-summaries-menu.R pkg/RcmdrPlugin.IPSUR/R/statistics-tables-menu.R Log: updating for Rcmdr 2.1-0 Property changes on: pkg/RcmdrPlugin.IPSUR ___________________________________________________________________ Added: svn:ignore + .Rproj.user .Rhistory .RData Modified: pkg/RcmdrPlugin.IPSUR/DESCRIPTION =================================================================== --- pkg/RcmdrPlugin.IPSUR/DESCRIPTION 2013-01-25 11:59:19 UTC (rev 215) +++ pkg/RcmdrPlugin.IPSUR/DESCRIPTION 2014-08-17 01:30:36 UTC (rev 216) @@ -4,7 +4,7 @@ Title: An IPSUR Plugin for the R Commander Author: G. Jay Kerns with contributions by Theophilius Boye and Tyler Drombosky, adapted from the work of John Fox et al. Maintainer: G. Jay Kerns -Imports: Rcmdr (>= 1.4-0), abind, e1071 +Imports: Rcmdr (>= 2.1-0) Suggests: abind, car, distr, distrEx, e1071, effects (>= 1.0-7), foreign, grid, lattice, lmtest, MASS, mgcv, multcomp (>= 0.991-2), nlme, nnet, qcc, relimp, RODBC LazyLoad: yes LazyData: yes Modified: pkg/RcmdrPlugin.IPSUR/NAMESPACE =================================================================== --- pkg/RcmdrPlugin.IPSUR/NAMESPACE 2013-01-25 11:59:19 UTC (rev 215) +++ pkg/RcmdrPlugin.IPSUR/NAMESPACE 2014-08-17 01:30:36 UTC (rev 216) @@ -1,5 +1,5 @@ import(stats, Rcmdr) -importFrom(e1071, skewness, kurtosis) -importFrom(abind, abind) +#importFrom(e1071, skewness, kurtosis) +#importFrom(abind, abind) exportPattern("^[^\\.]") Modified: pkg/RcmdrPlugin.IPSUR/R/First.r =================================================================== --- pkg/RcmdrPlugin.IPSUR/R/First.r 2013-01-25 11:59:19 UTC (rev 215) +++ pkg/RcmdrPlugin.IPSUR/R/First.r 2014-08-17 01:30:36 UTC (rev 216) @@ -21,4 +21,4 @@ Commander() } } -} \ No newline at end of file +} Modified: pkg/RcmdrPlugin.IPSUR/R/enterTableProportionsTest.r =================================================================== --- pkg/RcmdrPlugin.IPSUR/R/enterTableProportionsTest.r 2013-01-25 11:59:19 UTC (rev 215) +++ pkg/RcmdrPlugin.IPSUR/R/enterTableProportionsTest.r 2014-08-17 01:30:36 UTC (rev 216) @@ -1,310 +1,310 @@ -# Last modified Feb 16, 2008 - - -`enterTableMultiPropTest` <- -function () -{ - require("abind") - env <- environment() - initializeDialog(title = gettextRcmdr("Enter table for multi-proportions test")) - outerTableFrame <- tkframe(top) - assign(".tableFrame", tkframe(outerTableFrame), envir = env) - setUpTable <- function(...) { - tkdestroy(get(".tableFrame", envir = env)) - assign(".tableFrame", tkframe(outerTableFrame), envir = env) - nrows <- as.numeric(tclvalue(rowsValue)) - ncols <- as.numeric(tclvalue(colsValue)) - make.col.names <- "tklabel(.tableFrame, text='')" - col.varname <- paste(".colname.", 1, sep = "") - assign(col.varname, tclVar("Success"), envir = env) - make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='10', textvariable=", - col.varname, ")", sep = "") - col.varname <- paste(".colname.", 2, sep = "") - assign(col.varname, tclVar("Failure"), envir = env) - make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='10', textvariable=", - col.varname, ")", sep = "") - eval(parse(text = paste("tkgrid(", make.col.names, ")", - sep = "")), envir = env) - for (i in 1:nrows) { - varname <- paste(".tab.", i, ".1", sep = "") - assign(varname, tclVar(""), envir = env) - row.varname <- paste(".rowname.", i, sep = "") - assign(row.varname, tclVar(paste("Sample ", i, sep = "")), - envir = env) - make.row <- paste("tkentry(.tableFrame, width='10', textvariable=", - row.varname, ")", sep = "") - make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='10', textvariable=", - varname, ")", sep = "") - for (j in 2:ncols) { - varname <- paste(".tab.", i, ".", j, sep = "") - assign(varname, tclVar(""), envir = env) - make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='10', textvariable=", - varname, ")", sep = "") - } - eval(parse(text = paste("tkgrid(", make.row, ")", - sep = "")), envir = env) - } - tkgrid(get(".tableFrame", envir = env), sticky = "w") - } - rowColFrame <- tkframe(top) - rowsValue <- tclVar("2") - rowsSlider <- tkscale(rowColFrame, from = 2, to = 10, showvalue = FALSE, - variable = rowsValue, resolution = 1, orient = "horizontal", - command = setUpTable) - rowsShow <- tklabel(rowColFrame, textvariable = rowsValue, - width = 2, justify = "right") - colsValue <- tclVar("2") - colsSlider <- tkscale(rowColFrame, from = 2, to = 10, showvalue = FALSE, - variable = colsValue, resolution = 1, orient = "horizontal", - command = setUpTable) - colsShow <- tklabel(rowColFrame, textvariable = colsValue, - width = 2, justify = "right") - onOK <- function() { - nrows <- as.numeric(tclvalue(rowsValue)) - ncols <- as.numeric(tclvalue(colsValue)) - cell <- 0 - counts <- rep(NA, nrows * ncols) - row.names <- rep("", nrows) - col.names <- rep("", ncols) - for (i in 1:nrows) row.names[i] <- eval(parse(text = paste("tclvalue(", - paste(".rowname.", i, sep = ""), ")", sep = ""))) - for (j in 1:ncols) col.names[j] <- eval(parse(text = paste("tclvalue(", - paste(".colname.", j, sep = ""), ")", sep = ""))) - for (i in 1:nrows) { - for (j in 1:ncols) { - cell <- cell + 1 - varname <- paste(".tab.", i, ".", j, sep = "") - counts[cell] <- as.numeric(eval(parse(text = paste("tclvalue(", - varname, ")", sep = "")))) - } - } - counts <- na.omit(counts) - if (length(counts) != nrows * ncols) { - errorCondition(recall = enterTableMultiPropTest, - message = sprintf(gettextRcmdr("Number of valid entries (%d)\nnot equal to number of rows (%d) * number of columns (%d)."), - length(counts), nrows, ncols)) - return() - } - if (length(unique(row.names)) != nrows) { - errorCondition(recall = enterTableMultiPropTest, - message = gettextRcmdr("Row names are not unique.")) - return() - } - if (length(unique(col.names)) != ncols) { - errorCondition(recall = enterTableMultiPropTest, - message = gettextRcmdr("Column names are not unique.")) - return() - } - closeDialog() - command <- paste("matrix(c(", paste(counts, collapse = ","), - "), ", nrows, ", ", ncols, ", byrow=TRUE)", sep = "") - assign(".Table", justDoIt(command), envir = .GlobalEnv) - logger(paste(".Table <- ", command, sep = "")) - command <- paste("c(", paste(paste("'", row.names, "'", - sep = ""), collapse = ", "), ")", sep = "") - justDoIt(paste("rownames(.Table) <- ", command, sep = "")) - logger(paste("rownames(.Table) <- ", command, sep = "")) - command <- paste("c(", paste(paste("'", col.names, "'", - sep = ""), collapse = ", "), ")", sep = "") - justDoIt(paste("colnames(.Table) <- ", command, sep = "")) - logger(paste("colnames(.Table) <- ", command, sep = "")) - alternative <- as.character(tclvalue(alternativeVariable)) - level <- tclvalue(confidenceLevel) - test <- as.character(tclvalue(testVariable)) - if (test == "normal") - doItAndPrint(paste("prop.test(.Table, alternative='", - alternative, "', conf.level=", level, ", correct=FALSE)", - sep = "")) - else doItAndPrint(paste("prop.test(.Table, alternative='", - alternative, "', conf.level=", level, ", correct=TRUE)", - sep = "")) - logger("remove(.Table)") - remove(.Table, envir = .GlobalEnv) - tkfocus(CommanderWindow()) - } - OKCancelHelp(helpSubject = "prop.test") - radioButtons(name = "alternative", buttons = c("twosided", - "less", "greater"), values = c("two.sided", "less", "greater"), - labels = gettextRcmdr(c("Two-sided", "Difference < 0 (samples=2)", - "Difference > 0 (samples=2)")), title = gettextRcmdr("Alternative Hypothesis")) - confidenceFrame <- tkframe(top) - confidenceLevel <- tclVar("0.95") - confidenceField <- tkentry(confidenceFrame, width = "6", - textvariable = confidenceLevel) - radioButtons(name = "test", buttons = c("normal", "corrected"), - labels = gettextRcmdr(c("Normal approximation", "Normal approximation with\ncontinuity correction (samples=2)")), - title = gettextRcmdr("Type of Test")) - tkgrid(tklabel(rowColFrame, text = gettextRcmdr("Number of Rows (samples):")), - rowsSlider, rowsShow, sticky = "w") - tkgrid(rowColFrame, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("Enter counts:"), - fg = "blue"), sticky = "w") - tkgrid(outerTableFrame, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("\nOptions:"), fg = "blue"), - sticky = "w") - tkgrid(tklabel(confidenceFrame, text = gettextRcmdr("Confidence Level (samples=2): ")), - confidenceField, sticky = "w") - tkgrid(confidenceFrame, sticky = "w") - tkgrid(alternativeFrame, sticky = "nw") - tkgrid(testFrame, sticky = "w") - tkgrid(buttonsFrame, columnspan = 2, sticky = "w") - dialogSuffix(rows = 5, columns = 2) -} - - - -`enterTableSinglePropTest` <- -function () -{ - require("abind") - env <- environment() - initializeDialog(title = gettextRcmdr("Enter table for single-proportion test")) - outerTableFrame <- tkframe(top) - assign(".tableFrame", tkframe(outerTableFrame), envir = env) - setUpTable <- function(...) { - tkdestroy(get(".tableFrame", envir = env)) - assign(".tableFrame", tkframe(outerTableFrame), envir = env) - nrows <- as.numeric(tclvalue(rowsValue)) - ncols <- as.numeric(tclvalue(colsValue)) - make.col.names <- "tklabel(.tableFrame, text='')" - col.varname <- paste(".colname.", 1, sep = "") - assign(col.varname, tclVar("Success"), envir = env) - make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='7', textvariable=", - col.varname, ")", sep = "") - col.varname <- paste(".colname.", 2, sep = "") - assign(col.varname, tclVar("Failure"), envir = env) - make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='7', textvariable=", - col.varname, ")", sep = "") - eval(parse(text = paste("tkgrid(", make.col.names, ")", - sep = "")), envir = env) - for (i in 1:nrows) { - varname <- paste(".tab.", i, ".1", sep = "") - assign(varname, tclVar(""), envir = env) - row.varname <- paste(".rowname.", i, sep = "") - assign(row.varname, tclVar("Counts:"), envir = env) - make.row <- paste("tkentry(.tableFrame, width='7', textvariable=", - row.varname, ")", sep = "") - make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='7', textvariable=", - varname, ")", sep = "") - for (j in 2:ncols) { - varname <- paste(".tab.", i, ".", j, sep = "") - assign(varname, tclVar(""), envir = env) - make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='7', textvariable=", - varname, ")", sep = "") - } - eval(parse(text = paste("tkgrid(", make.row, ")", - sep = "")), envir = env) - } - tkgrid(get(".tableFrame", envir = env), sticky = "w") - } - rowColFrame <- tkframe(top) - rowsValue <- tclVar("1") - rowsSlider <- tkscale(rowColFrame, from = 1, to = 1, showvalue = FALSE, - variable = rowsValue, resolution = 1, orient = "horizontal", - command = setUpTable) - rowsShow <- tklabel(rowColFrame, textvariable = rowsValue, - width = 2, justify = "right") - colsValue <- tclVar("2") - colsSlider <- tkscale(rowColFrame, from = 2, to = 10, showvalue = FALSE, - variable = colsValue, resolution = 1, orient = "horizontal", - command = setUpTable) - colsShow <- tklabel(rowColFrame, textvariable = colsValue, - width = 2, justify = "right") - onOK <- function() { - nrows <- as.numeric(tclvalue(rowsValue)) - ncols <- as.numeric(tclvalue(colsValue)) - cell <- 0 - counts <- rep(NA, nrows * ncols) - row.names <- rep("", nrows) - col.names <- rep("", ncols) - for (i in 1:nrows) row.names[i] <- eval(parse(text = paste("tclvalue(", - paste(".rowname.", i, sep = ""), ")", sep = ""))) - for (j in 1:ncols) col.names[j] <- eval(parse(text = paste("tclvalue(", - paste(".colname.", j, sep = ""), ")", sep = ""))) - for (i in 1:nrows) { - for (j in 1:ncols) { - cell <- cell + 1 - varname <- paste(".tab.", i, ".", j, sep = "") - counts[cell] <- as.numeric(eval(parse(text = paste("tclvalue(", - varname, ")", sep = "")))) - } - } - counts <- na.omit(counts) - if (length(counts) != nrows * ncols) { - errorCondition(recall = enterTableSinglePropTest, - message = sprintf(gettextRcmdr("Number of valid entries (%d)\nnot equal to number of rows (%d) * number of columns (%d)."), - length(counts), nrows, ncols)) - return() - } - if (length(unique(col.names)) != ncols) { - errorCondition(recall = enterTableSinglePropTest, - message = gettextRcmdr("Column names are not unique.")) - return() - } - closeDialog() - command <- paste("matrix(c(", paste(counts, collapse = ","), - "), ", nrows, ", ", ncols, ", byrow=TRUE)", sep = "") - assign(".Table", justDoIt(command), envir = .GlobalEnv) - logger(paste(".Table <- ", command, sep = "")) - command <- paste("c(", paste(paste("'", row.names, "'", - sep = ""), collapse = ", "), ")", sep = "") - justDoIt(paste("rownames(.Table) <- ", command, sep = "")) - logger(paste("rownames(.Table) <- ", command, sep = "")) - command <- paste("c(", paste(paste("'", col.names, "'", - sep = ""), collapse = ", "), ")", sep = "") - justDoIt(paste("colnames(.Table) <- ", command, sep = "")) - logger(paste("colnames(.Table) <- ", command, sep = "")) - alternative <- as.character(tclvalue(alternativeVariable)) - level <- tclvalue(confidenceLevel) - test <- as.character(tclvalue(testVariable)) - p <- tclvalue(pVariable) - if (test == "normal") - doItAndPrint(paste("prop.test(rbind(.Table), alternative='", - alternative, "', p=", p, ", conf.level=", level, - ", correct=FALSE)", sep = "")) - else if (test == "corrected") - doItAndPrint(paste("prop.test(rbind(.Table), alternative='", - alternative, "', p=", p, ", conf.level=", level, - ", correct=TRUE)", sep = "")) - else doItAndPrint(paste("binom.test(rbind(.Table), alternative='", - alternative, "', p=", p, ", conf.level=", level, - ")", sep = "")) - logger("remove(.Table)") - remove(.Table, envir = .GlobalEnv) - tkfocus(CommanderWindow()) - } - OKCancelHelp(helpSubject = "prop.test") - radioButtons(top, name = "alternative", buttons = c("twosided", - "less", "greater"), values = c("two.sided", "less", "greater"), - labels = gettextRcmdr(c("Population proportion = p0", - "Population proportion < p0", "Population proportion > p0")), - title = gettextRcmdr("Alternative Hypothesis")) - rightFrame <- tkframe(top) - confidenceFrame <- tkframe(top) - confidenceLevel <- tclVar("0.95") - confidenceField <- tkentry(confidenceFrame, width = "6", - textvariable = confidenceLevel) - pFrame <- tkframe(top) - pVariable <- tclVar("0.5") - pField <- tkentry(pFrame, width = "6", textvariable = pVariable) - radioButtons(name = "test", buttons = c("normal", "corrected", - "exact"), labels = gettextRcmdr(c("Normal approximation", - "Normal approximation with\ncontinuity correction", "Exact binomial")), - title = gettextRcmdr("Type of Test")) - tkgrid(tklabel(rowColFrame, text = gettextRcmdr("Number of Rows (single sample):")), - rowsSlider, rowsShow, sticky = "w") - tkgrid(rowColFrame, sticky = "w") - tkgrid(outerTableFrame, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("\nOptions:"), fg = "blue"), - sticky = "w") - tkgrid(tklabel(pFrame, text = gettextRcmdr("Null hypothesis: p0 = ")), - pField, sticky = "w") - tkgrid(pFrame, sticky = "w") - tkgrid(tklabel(confidenceFrame, text = gettextRcmdr("Confidence Level: ")), - confidenceField, sticky = "w") - tkgrid(confidenceFrame, sticky = "w") - tkgrid(alternativeFrame, sticky = "nw") - tkgrid(testFrame, sticky = "w") - tkgrid(buttonsFrame, columnspan = 2, sticky = "w") - dialogSuffix(rows = 5, columns = 2) -} +# Last modified Feb 16, 2008 + + +`enterTableMultiPropTest` <- +function () +{ + require("abind") + env <- environment() + initializeDialog(title = gettextRcmdr("Enter table for multi-proportions test")) + outerTableFrame <- tkframe(top) + assign(".tableFrame", tkframe(outerTableFrame), envir = env) + setUpTable <- function(...) { + tkdestroy(get(".tableFrame", envir = env)) + assign(".tableFrame", tkframe(outerTableFrame), envir = env) + nrows <- as.numeric(tclvalue(rowsValue)) + ncols <- as.numeric(tclvalue(colsValue)) + make.col.names <- "tklabel(.tableFrame, text='')" + col.varname <- paste(".colname.", 1, sep = "") + assign(col.varname, tclVar("Success"), envir = env) + make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='10', textvariable=", + col.varname, ")", sep = "") + col.varname <- paste(".colname.", 2, sep = "") + assign(col.varname, tclVar("Failure"), envir = env) + make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='10', textvariable=", + col.varname, ")", sep = "") + eval(parse(text = paste("tkgrid(", make.col.names, ")", + sep = "")), envir = env) + for (i in 1:nrows) { + varname <- paste(".tab.", i, ".1", sep = "") + assign(varname, tclVar(""), envir = env) + row.varname <- paste(".rowname.", i, sep = "") + assign(row.varname, tclVar(paste("Sample ", i, sep = "")), + envir = env) + make.row <- paste("tkentry(.tableFrame, width='10', textvariable=", + row.varname, ")", sep = "") + make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='10', textvariable=", + varname, ")", sep = "") + for (j in 2:ncols) { + varname <- paste(".tab.", i, ".", j, sep = "") + assign(varname, tclVar(""), envir = env) + make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='10', textvariable=", + varname, ")", sep = "") + } + eval(parse(text = paste("tkgrid(", make.row, ")", + sep = "")), envir = env) + } + tkgrid(get(".tableFrame", envir = env), sticky = "w") + } + rowColFrame <- tkframe(top) + rowsValue <- tclVar("2") + rowsSlider <- tkscale(rowColFrame, from = 2, to = 10, showvalue = FALSE, + variable = rowsValue, resolution = 1, orient = "horizontal", + command = setUpTable) + rowsShow <- tklabel(rowColFrame, textvariable = rowsValue, + width = 2, justify = "right") + colsValue <- tclVar("2") + colsSlider <- tkscale(rowColFrame, from = 2, to = 10, showvalue = FALSE, + variable = colsValue, resolution = 1, orient = "horizontal", + command = setUpTable) + colsShow <- tklabel(rowColFrame, textvariable = colsValue, + width = 2, justify = "right") + onOK <- function() { + nrows <- as.numeric(tclvalue(rowsValue)) + ncols <- as.numeric(tclvalue(colsValue)) + cell <- 0 + counts <- rep(NA, nrows * ncols) + row.names <- rep("", nrows) + col.names <- rep("", ncols) + for (i in 1:nrows) row.names[i] <- eval(parse(text = paste("tclvalue(", + paste(".rowname.", i, sep = ""), ")", sep = ""))) + for (j in 1:ncols) col.names[j] <- eval(parse(text = paste("tclvalue(", + paste(".colname.", j, sep = ""), ")", sep = ""))) + for (i in 1:nrows) { + for (j in 1:ncols) { + cell <- cell + 1 + varname <- paste(".tab.", i, ".", j, sep = "") + counts[cell] <- as.numeric(eval(parse(text = paste("tclvalue(", + varname, ")", sep = "")))) + } + } + counts <- na.omit(counts) + if (length(counts) != nrows * ncols) { + errorCondition(recall = enterTableMultiPropTest, + message = sprintf(gettextRcmdr("Number of valid entries (%d)\nnot equal to number of rows (%d) * number of columns (%d)."), + length(counts), nrows, ncols)) + return() + } + if (length(unique(row.names)) != nrows) { + errorCondition(recall = enterTableMultiPropTest, + message = gettextRcmdr("Row names are not unique.")) + return() + } + if (length(unique(col.names)) != ncols) { + errorCondition(recall = enterTableMultiPropTest, + message = gettextRcmdr("Column names are not unique.")) + return() + } + closeDialog() + command <- paste(".Table <- matrix(c(", paste(counts, collapse = ","), + "), ", nrows, ", ", ncols, ", byrow=TRUE)", sep = "") + justDoIt(command) + logger(paste(command, sep = "")) + command <- paste("c(", paste(paste("'", row.names, "'", + sep = ""), collapse = ", "), ")", sep = "") + justDoIt(paste("rownames(.Table) <- ", command, sep = "")) + logger(paste("rownames(.Table) <- ", command, sep = "")) + command <- paste("c(", paste(paste("'", col.names, "'", + sep = ""), collapse = ", "), ")", sep = "") + justDoIt(paste("colnames(.Table) <- ", command, sep = "")) + logger(paste("colnames(.Table) <- ", command, sep = "")) + alternative <- as.character(tclvalue(alternativeVariable)) + level <- tclvalue(confidenceLevel) + test <- as.character(tclvalue(testVariable)) + if (test == "normal") + doItAndPrint(paste("prop.test(.Table, alternative='", + alternative, "', conf.level=", level, ", correct=FALSE)", + sep = "")) + else doItAndPrint(paste("prop.test(.Table, alternative='", + alternative, "', conf.level=", level, ", correct=TRUE)", + sep = "")) + logger("remove(.Table)") + remove(.Table, envir = .GlobalEnv) + tkfocus(CommanderWindow()) + } + OKCancelHelp(helpSubject = "prop.test") + radioButtons(name = "alternative", buttons = c("twosided", + "less", "greater"), values = c("two.sided", "less", "greater"), + labels = gettextRcmdr(c("Two-sided", "Difference < 0 (samples=2)", + "Difference > 0 (samples=2)")), title = gettextRcmdr("Alternative Hypothesis")) + confidenceFrame <- tkframe(top) + confidenceLevel <- tclVar("0.95") + confidenceField <- tkentry(confidenceFrame, width = "6", + textvariable = confidenceLevel) + radioButtons(name = "test", buttons = c("normal", "corrected"), + labels = gettextRcmdr(c("Normal approximation", "Normal approximation with\ncontinuity correction (samples=2)")), + title = gettextRcmdr("Type of Test")) + tkgrid(tklabel(rowColFrame, text = gettextRcmdr("Number of Rows (samples):")), + rowsSlider, rowsShow, sticky = "w") + tkgrid(rowColFrame, sticky = "w") + tkgrid(tklabel(top, text = gettextRcmdr("Enter counts:"), + fg = "blue"), sticky = "w") + tkgrid(outerTableFrame, sticky = "w") + tkgrid(tklabel(top, text = gettextRcmdr("\nOptions:"), fg = "blue"), + sticky = "w") + tkgrid(tklabel(confidenceFrame, text = gettextRcmdr("Confidence Level (samples=2): ")), + confidenceField, sticky = "w") + tkgrid(confidenceFrame, sticky = "w") + tkgrid(alternativeFrame, sticky = "nw") + tkgrid(testFrame, sticky = "w") + tkgrid(buttonsFrame, columnspan = 2, sticky = "w") + dialogSuffix(rows = 5, columns = 2) +} + + + +`enterTableSinglePropTest` <- +function () +{ + require("abind") + env <- environment() + initializeDialog(title = gettextRcmdr("Enter table for single-proportion test")) + outerTableFrame <- tkframe(top) + assign(".tableFrame", tkframe(outerTableFrame), envir = env) + setUpTable <- function(...) { + tkdestroy(get(".tableFrame", envir = env)) + assign(".tableFrame", tkframe(outerTableFrame), envir = env) + nrows <- as.numeric(tclvalue(rowsValue)) + ncols <- as.numeric(tclvalue(colsValue)) + make.col.names <- "tklabel(.tableFrame, text='')" + col.varname <- paste(".colname.", 1, sep = "") + assign(col.varname, tclVar("Success"), envir = env) + make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='7', textvariable=", + col.varname, ")", sep = "") + col.varname <- paste(".colname.", 2, sep = "") + assign(col.varname, tclVar("Failure"), envir = env) + make.col.names <- paste(make.col.names, ", ", "tkentry(.tableFrame, width='7', textvariable=", + col.varname, ")", sep = "") + eval(parse(text = paste("tkgrid(", make.col.names, ")", + sep = "")), envir = env) + for (i in 1:nrows) { + varname <- paste(".tab.", i, ".1", sep = "") + assign(varname, tclVar(""), envir = env) + row.varname <- paste(".rowname.", i, sep = "") + assign(row.varname, tclVar("Counts:"), envir = env) + make.row <- paste("tkentry(.tableFrame, width='7', textvariable=", + row.varname, ")", sep = "") + make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='7', textvariable=", + varname, ")", sep = "") + for (j in 2:ncols) { + varname <- paste(".tab.", i, ".", j, sep = "") + assign(varname, tclVar(""), envir = env) + make.row <- paste(make.row, ", ", "tkentry(.tableFrame, width='7', textvariable=", + varname, ")", sep = "") + } + eval(parse(text = paste("tkgrid(", make.row, ")", + sep = "")), envir = env) + } + tkgrid(get(".tableFrame", envir = env), sticky = "w") + } + rowColFrame <- tkframe(top) + rowsValue <- tclVar("1") + rowsSlider <- tkscale(rowColFrame, from = 1, to = 1, showvalue = FALSE, + variable = rowsValue, resolution = 1, orient = "horizontal", + command = setUpTable) + rowsShow <- tklabel(rowColFrame, textvariable = rowsValue, + width = 2, justify = "right") + colsValue <- tclVar("2") + colsSlider <- tkscale(rowColFrame, from = 2, to = 10, showvalue = FALSE, + variable = colsValue, resolution = 1, orient = "horizontal", + command = setUpTable) + colsShow <- tklabel(rowColFrame, textvariable = colsValue, + width = 2, justify = "right") + onOK <- function() { + nrows <- as.numeric(tclvalue(rowsValue)) + ncols <- as.numeric(tclvalue(colsValue)) + cell <- 0 + counts <- rep(NA, nrows * ncols) + row.names <- rep("", nrows) + col.names <- rep("", ncols) + for (i in 1:nrows) row.names[i] <- eval(parse(text = paste("tclvalue(", + paste(".rowname.", i, sep = ""), ")", sep = ""))) + for (j in 1:ncols) col.names[j] <- eval(parse(text = paste("tclvalue(", + paste(".colname.", j, sep = ""), ")", sep = ""))) + for (i in 1:nrows) { + for (j in 1:ncols) { + cell <- cell + 1 + varname <- paste(".tab.", i, ".", j, sep = "") + counts[cell] <- as.numeric(eval(parse(text = paste("tclvalue(", + varname, ")", sep = "")))) + } + } + counts <- na.omit(counts) + if (length(counts) != nrows * ncols) { + errorCondition(recall = enterTableSinglePropTest, + message = sprintf(gettextRcmdr("Number of valid entries (%d)\nnot equal to number of rows (%d) * number of columns (%d)."), + length(counts), nrows, ncols)) + return() + } + if (length(unique(col.names)) != ncols) { + errorCondition(recall = enterTableSinglePropTest, + message = gettextRcmdr("Column names are not unique.")) + return() + } + closeDialog() + command <- paste(".Table <- matrix(c(", paste(counts, collapse = ","), + "), ", nrows, ", ", ncols, ", byrow=TRUE)", sep = "") + justDoIt(command) + logger(paste(command, sep = "")) + command <- paste("c(", paste(paste("'", row.names, "'", + sep = ""), collapse = ", "), ")", sep = "") + justDoIt(paste("rownames(.Table) <- ", command, sep = "")) + logger(paste("rownames(.Table) <- ", command, sep = "")) + command <- paste("c(", paste(paste("'", col.names, "'", + sep = ""), collapse = ", "), ")", sep = "") + justDoIt(paste("colnames(.Table) <- ", command, sep = "")) + logger(paste("colnames(.Table) <- ", command, sep = "")) + alternative <- as.character(tclvalue(alternativeVariable)) + level <- tclvalue(confidenceLevel) + test <- as.character(tclvalue(testVariable)) + p <- tclvalue(pVariable) + if (test == "normal") + doItAndPrint(paste("prop.test(rbind(.Table), alternative='", + alternative, "', p=", p, ", conf.level=", level, + ", correct=FALSE)", sep = "")) + else if (test == "corrected") + doItAndPrint(paste("prop.test(rbind(.Table), alternative='", + alternative, "', p=", p, ", conf.level=", level, + ", correct=TRUE)", sep = "")) + else doItAndPrint(paste("binom.test(rbind(.Table), alternative='", + alternative, "', p=", p, ", conf.level=", level, + ")", sep = "")) + logger("remove(.Table)") + remove(.Table, envir = .GlobalEnv) + tkfocus(CommanderWindow()) + } + OKCancelHelp(helpSubject = "prop.test") + radioButtons(top, name = "alternative", buttons = c("twosided", + "less", "greater"), values = c("two.sided", "less", "greater"), + labels = gettextRcmdr(c("Population proportion = p0", + "Population proportion < p0", "Population proportion > p0")), + title = gettextRcmdr("Alternative Hypothesis")) + rightFrame <- tkframe(top) + confidenceFrame <- tkframe(top) + confidenceLevel <- tclVar("0.95") + confidenceField <- tkentry(confidenceFrame, width = "6", + textvariable = confidenceLevel) + pFrame <- tkframe(top) + pVariable <- tclVar("0.5") + pField <- tkentry(pFrame, width = "6", textvariable = pVariable) + radioButtons(name = "test", buttons = c("normal", "corrected", + "exact"), labels = gettextRcmdr(c("Normal approximation", + "Normal approximation with\ncontinuity correction", "Exact binomial")), + title = gettextRcmdr("Type of Test")) + tkgrid(tklabel(rowColFrame, text = gettextRcmdr("Number of Rows (single sample):")), + rowsSlider, rowsShow, sticky = "w") + tkgrid(rowColFrame, sticky = "w") + tkgrid(outerTableFrame, sticky = "w") + tkgrid(tklabel(top, text = gettextRcmdr("\nOptions:"), fg = "blue"), + sticky = "w") + tkgrid(tklabel(pFrame, text = gettextRcmdr("Null hypothesis: p0 = ")), + pField, sticky = "w") + tkgrid(pFrame, sticky = "w") + tkgrid(tklabel(confidenceFrame, text = gettextRcmdr("Confidence Level: ")), + confidenceField, sticky = "w") + tkgrid(confidenceFrame, sticky = "w") + tkgrid(alternativeFrame, sticky = "nw") + tkgrid(testFrame, sticky = "w") + tkgrid(buttonsFrame, columnspan = 2, sticky = "w") + dialogSuffix(rows = 5, columns = 2) +} Modified: pkg/RcmdrPlugin.IPSUR/R/graphs-menu.R =================================================================== --- pkg/RcmdrPlugin.IPSUR/R/graphs-menu.R 2013-01-25 11:59:19 UTC (rev 215) +++ pkg/RcmdrPlugin.IPSUR/R/graphs-menu.R 2014-08-17 01:30:36 UTC (rev 216) [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/ipsur -r 216 From noreply at r-forge.r-project.org Fri Aug 29 18:02:52 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 29 Aug 2014 18:02:52 +0200 (CEST) Subject: [IPSUR-commits] r217 - pkg/RcmdrPlugin.IPSUR/R Message-ID: <20140829160252.46917183E8D@r-forge.r-project.org> Author: gkerns Date: 2014-08-29 18:02:51 +0200 (Fri, 29 Aug 2014) New Revision: 217 Modified: pkg/RcmdrPlugin.IPSUR/R/misc.r pkg/RcmdrPlugin.IPSUR/R/prob-sim-menu.R Log: deleted Simulate menu Modified: pkg/RcmdrPlugin.IPSUR/R/misc.r =================================================================== --- pkg/RcmdrPlugin.IPSUR/R/misc.r 2014-08-17 01:30:36 UTC (rev 216) +++ pkg/RcmdrPlugin.IPSUR/R/misc.r 2014-08-29 16:02:51 UTC (rev 217) @@ -59,44 +59,44 @@ -####### -# Need this to assign numbers below -RcmdrEnv <- function() { - pos <- match("RcmdrEnv", search()) - if (is.na(pos)) { # Must create it - RcmdrEnv <- list() - attach(RcmdrEnv, pos = length(search()) - 1) - on.exit(detach(RcmdrEnv)) - rm(RcmdrEnv) - pos <- match("RcmdrEnv", search()) - } - return(pos.to.env(pos)) - } - -############################################################### -############################################################### -# Extra counters - #assign("simsetNumber", 0, envir = RcmdrEnv()) - #assign("datasetNumber", 0, envir = RcmdrEnv()) - assign("betasimNumber", 0, envir = RcmdrEnv()) - assign("chisqsimNumber", 0, envir = RcmdrEnv()) - assign("binomsimNumber", 0, envir = RcmdrEnv()) - assign("hypersimNumber", 0, envir = RcmdrEnv()) - assign("gammasimNumber", 0, envir = RcmdrEnv()) - assign("expsimNumber", 0, envir = RcmdrEnv()) - assign("normsimNumber", 0, envir = RcmdrEnv()) - assign("fsimNumber", 0, envir = RcmdrEnv()) - assign("tsimNumber", 0, envir = RcmdrEnv()) - assign("cauchysimNumber", 0, envir = RcmdrEnv()) - assign("geomsimNumber", 0, envir = RcmdrEnv()) - assign("lnormsimNumber", 0, envir = RcmdrEnv()) - assign("logissimNumber", 0, envir = RcmdrEnv()) - assign("nbinomsimNumber", 0, envir = RcmdrEnv()) - assign("poissimNumber", 0, envir = RcmdrEnv()) - assign("weibullsimNumber", 0, envir = RcmdrEnv()) - assign("unifsimNumber", 0, envir = RcmdrEnv()) - assign("disunifsimNumber", 0, envir = RcmdrEnv()) - -############################################################### -############################################################### -# End Extra counters +# ####### +# # Need this to assign numbers below +# RcmdrEnv <- function() { +# pos <- match("RcmdrEnv", search()) +# if (is.na(pos)) { # Must create it +# RcmdrEnv <- list() +# attach(RcmdrEnv, pos = length(search()) - 1) +# on.exit(detach(RcmdrEnv)) +# rm(RcmdrEnv) +# pos <- match("RcmdrEnv", search()) +# } +# return(pos.to.env(pos)) +# } +# +# ############################################################### +# ############################################################### +# # Extra counters +# #assign("simsetNumber", 0, envir = RcmdrEnv()) +# #assign("datasetNumber", 0, envir = RcmdrEnv()) +# assign("betasimNumber", 0, envir = RcmdrEnv()) +# assign("chisqsimNumber", 0, envir = RcmdrEnv()) +# assign("binomsimNumber", 0, envir = RcmdrEnv()) +# assign("hypersimNumber", 0, envir = RcmdrEnv()) +# assign("gammasimNumber", 0, envir = RcmdrEnv()) +# assign("expsimNumber", 0, envir = RcmdrEnv()) +# assign("normsimNumber", 0, envir = RcmdrEnv()) +# assign("fsimNumber", 0, envir = RcmdrEnv()) +# assign("tsimNumber", 0, envir = RcmdrEnv()) +# assign("cauchysimNumber", 0, envir = RcmdrEnv()) +# assign("geomsimNumber", 0, envir = RcmdrEnv()) +# assign("lnormsimNumber", 0, envir = RcmdrEnv()) +# assign("logissimNumber", 0, envir = RcmdrEnv()) +# assign("nbinomsimNumber", 0, envir = RcmdrEnv()) +# assign("poissimNumber", 0, envir = RcmdrEnv()) +# assign("weibullsimNumber", 0, envir = RcmdrEnv()) +# assign("unifsimNumber", 0, envir = RcmdrEnv()) +# assign("disunifsimNumber", 0, envir = RcmdrEnv()) +# +# ############################################################### +# ############################################################### +# # End Extra counters Modified: pkg/RcmdrPlugin.IPSUR/R/prob-sim-menu.R =================================================================== --- pkg/RcmdrPlugin.IPSUR/R/prob-sim-menu.R 2014-08-17 01:30:36 UTC (rev 216) +++ pkg/RcmdrPlugin.IPSUR/R/prob-sim-menu.R 2014-08-29 16:02:51 UTC (rev 217) @@ -1,2987 +1,2987 @@ -# Last modified Feb 14, 2008 -# simulations optimized by Tyler Drombosky 2007 - -`betaSimulate.ipsur` <- -function () -{ - initializeDialog(title = gettextRcmdr("Simulate Beta Variates")) - parameterFrame <- tkframe(top) - locationFrame <- tkframe(top) - if (!is.character(ActiveDataSet())) { - locVariable <- tclVar("new") - } - else { - locVariable <- tclVar("add") - } - addtoactiveButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "add") - newDataButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "new") - samplesVar <- tclVar("1") - samplesEntry <- tkentry(top, width = "6", textvariable = samplesVar) - shape1Var <- tclVar("1") - shape1Entry <- tkentry(top, width = "6", textvariable = shape1Var) - shape2Var <- tclVar("1") - shape2Entry <- tkentry(top, width = "6", textvariable = shape2Var) - ncpVar <- tclVar("0") - ncpEntry <- tkentry(top, width = "6", textvariable = ncpVar) - onOK <- function() { - nsamples <- round(as.numeric(tclvalue(samplesVar))) - shape1 <- tclvalue(shape1Var) - shape2 <- tclvalue(shape2Var) - ncp <- tclvalue(ncpVar) - if (is.na(nsamples)) { - errorCondition(recall = betaSimulate.ipsur, message = gettextRcmdr("Number of samples must be a positive integer.")) - return() - } - if (is.na(shape1)) { - errorCondition(recall = betaSimulate.ipsur, message = gettextRcmdr("The shape1 parameter was not specified.")) - return() - } - if (is.na(shape2)) { - errorCondition(recall = betaSimulate.ipsur, message = gettextRcmdr("The shape2 parameter was not specified.")) - return() - } - if (is.na(ncp)) { - errorCondition(recall = betaSimulate.ipsur, message = gettextRcmdr("The noncentrality parameter was not specified.")) - return() - } - closeDialog() - store <- tclvalue(locVariable) - if (store == "new") { - initializeDialog(title = gettextRcmdr("Simulation Dataset")) - dsname <- tclVar("Simset") - entryDsname <- tkentry(top, width = "20", textvariable = dsname) - newDataSS <- tclVar("100") - entryNewDataSS <- tkentry(top, width = "6", textvariable = newDataSS) - onOK <- function() { - dsnameValue <- trim.blanks(tclvalue(dsname)) - newSS <- round(as.numeric(tclvalue(newDataSS))) - closeDialog() - if (dsnameValue == "") { - errorCondition(recall = betaSimulate.ipsur, - message = gettextRcmdr("You must enter the name of a data set.")) - return() - } - if (!is.valid.name(dsnameValue)) { - errorCondition(recall = betaSimulate.ipsur, - message = paste("\"", dsnameValue, "\" ", - gettextRcmdr("is not a valid name."), sep = "")) - return() - } - if (is.element(dsnameValue, listDataSets())) { - if ("no" == tclvalue(checkReplace(dsnameValue, - gettextRcmdr("Data set")))) { - betaSimulate.ipsur() - return() - } - } - if (is.na(newSS)) { - errorCondition(recall = betaSimulate.ipsur, - message = gettextRcmdr("Sample Size must be a positive integer.")) - return() - } - UpdatebetasimNumber() - justDoIt(paste(dsnameValue, " = data.frame(beta.sim", - getRcmdr("betasimNumber"), "=1:", newSS, ")", - sep = "")) - logger(paste(dsnameValue, "has been initialized.")) - for (k in getRcmdr("betasimNumber"):(nsamples + - getRcmdr("betasimNumber") - 1)) { - justDoIt(paste(dsnameValue, "$beta.sim", k, - " <- rbeta(", newSS, ", shape1=", shape1, - ", shape2=", shape2, ", ncp=", ncp, ")", - sep = "")) - } - activeDataSet(dsnameValue) - putRcmdr("betasimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 beta variate sample stored in ", - dsnameValue, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " beta variate samples stored in ", - dsnameValue, ".", sep = "")) - } - } - OKCancelHelp(helpSubject = "rbeta") - tkgrid(tklabel(top, text = gettextRcmdr("Enter name for data set:")), - entryDsname, sticky = "e") - tkgrid(tklabel(top, text = gettextRcmdr("Sample Size (rows):")), - entryNewDataSS, sticky = "e") - tkgrid(buttonsFrame, columnspan = "2", sticky = "w") - tkgrid.configure(entryDsname, sticky = "w") - tkgrid.configure(entryNewDataSS, sticky = "w") - tkfocus(CommanderWindow()) - dialogSuffix(rows = 2, columns = 2, focus = entryDsname) - } - else { - if (!is.character(ActiveDataSet())) { - errorCondition(recall = betaSimulate.ipsur, message = gettextRcmdr("There is no active data set.")) - return() - } - .activeDataSet <- ActiveDataSet() - justDoIt(paste("samplesn <- dim(", .activeDataSet, - ")[1]", sep = "")) - UpdatebetasimNumber() - for (k in getRcmdr("betasimNumber"):(nsamples + getRcmdr("betasimNumber") - - 1)) { - justDoIt(paste(.activeDataSet, "$beta.sim", k, - " <- rbeta(", samplesn, ", shape1=", shape1, - ", shape2=", shape2, ", ncp=", ncp, ")", sep = "")) - } - activeDataSet(.activeDataSet) - putRcmdr("betasimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 beta variate sample stored in ", - .activeDataSet, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " beta variate samples stored in ", - .activeDataSet, ".", sep = "")) - } - } - tkfocus(CommanderWindow()) - } - OKCancelHelp(helpSubject = "rbeta") - tkgrid(tklabel(top, text = gettextRcmdr("Number of samples (columns):")), - samplesEntry, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("Parameters:"), fg = "blue"), - columnspan = 4, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("shape1")), shape1Entry, - sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("shape2")), shape2Entry, - sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("ncp (noncentrality parameter)")), - ncpEntry, sticky = "w") - tkgrid(tklabel(locationFrame, text = gettextRcmdr("Store values in:"), - fg = "blue"), columnspan = 4, sticky = "w") - tkgrid(tklabel(locationFrame, text = gettextRcmdr("Active Dataset")), - addtoactiveButton, sticky = "w") - tkgrid(tklabel(locationFrame, text = "New Dataset"), newDataButton, - sticky = "w") - tkgrid.configure(samplesEntry, sticky = "w") - tkgrid.configure(shape1Entry, sticky = "w") - tkgrid.configure(shape2Entry, sticky = "w") - tkgrid.configure(ncpEntry, sticky = "w") - tkgrid(locationFrame, sticky = "w") - tkgrid(buttonsFrame, sticky = "w", columnspan = 2) - dialogSuffix(rows = 6, columns = 1, focus = samplesEntry) -} - - -`binomialSimulate.ipsur` <- -function () -{ - initializeDialog(title = gettextRcmdr("Simulate Binomial Variates")) - parameterFrame <- tkframe(top) - locationFrame <- tkframe(top) - if (!is.character(ActiveDataSet())) { - locVariable <- tclVar("new") - } - else { - locVariable <- tclVar("add") - } - addtoactiveButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "add") - newDataButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "new") - samplesVar <- tclVar("1") - samplesEntry <- tkentry(top, width = "6", textvariable = samplesVar) - sizeVar <- tclVar("1") - sizeEntry <- tkentry(top, width = "6", textvariable = sizeVar) - probVar <- tclVar("0.5") - probEntry <- tkentry(top, width = "6", textvariable = probVar) - onOK <- function() { - nsamples <- round(as.numeric(tclvalue(samplesVar))) - size <- tclvalue(sizeVar) - prob <- tclvalue(probVar) - store <- tclvalue(locVariable) - if (is.na(nsamples)) { - errorCondition(recall = binomialSimulate.ipsur, message = gettextRcmdr("Number of samples must be a positive integer.")) - return() - } - if (is.na(size)) { - errorCondition(recall = binomialSimulate.ipsur, message = gettextRcmdr("Number of trials was not specified.")) - return() - } - if (is.na(prob)) { - errorCondition(recall = binomialSimulate.ipsur, message = gettextRcmdr("The success probability was not specified.")) - return() - } - closeDialog() - if (store == "new") { - initializeDialog(title = gettextRcmdr("Simulation Dataset")) - dsname <- tclVar("Simset") - entryDsname <- tkentry(top, width = "20", textvariable = dsname) - newDataSS <- tclVar("100") - entryNewDataSS <- tkentry(top, width = "6", textvariable = newDataSS) - onOK <- function() { - dsnameValue <- trim.blanks(tclvalue(dsname)) - newSS <- round(as.numeric(tclvalue(newDataSS))) - closeDialog() - if (dsnameValue == "") { - errorCondition(recall = binomialSimulate.ipsur, - message = gettextRcmdr("You must enter the name of a data set.")) - return() - } - if (!is.valid.name(dsnameValue)) { - errorCondition(recall = binomialSimulate.ipsur, - message = paste("\"", dsnameValue, "\" ", - gettextRcmdr("is not a valid name."), sep = "")) - return() - } - if (is.element(dsnameValue, listDataSets())) { - if ("no" == tclvalue(checkReplace(dsnameValue, - gettextRcmdr("Data set")))) { - binomialSimulate.ipsur() - return() - } - } - if (is.na(newSS)) { - errorCondition(recall = binomialSimulate.ipsur, - message = gettextRcmdr("Sample Size must be a positive integer.")) - return() - } - UpdatebinomsimNumber() - justDoIt(paste(dsnameValue, " = data.frame(binom.sim", - getRcmdr("binomsimNumber"), "=1:", newSS, ")", - sep = "")) - logger(paste(dsnameValue, "has been initialized.")) - for (k in getRcmdr("binomsimNumber"):(nsamples + - getRcmdr("binomsimNumber") - 1)) { - justDoIt(paste(dsnameValue, "$binom.sim", k, - " <- rbinom(", newSS, ", size=", size, ", prob=", - prob, ")", sep = "")) - } - activeDataSet(dsnameValue) - putRcmdr("binomsimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 binomial variate sample stored in ", - dsnameValue, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " binomial variate samples stored in ", - dsnameValue, ".", sep = "")) - } - } - OKCancelHelp(helpSubject = "rbinom") - tkgrid(tklabel(top, text = gettextRcmdr("Enter name for data set:")), - entryDsname, sticky = "e") - tkgrid(tklabel(top, text = gettextRcmdr("Sample Size (rows):")), - entryNewDataSS, sticky = "e") - tkgrid(buttonsFrame, columnspan = "2", sticky = "w") - tkgrid.configure(entryDsname, sticky = "w") - tkgrid.configure(entryNewDataSS, sticky = "w") - tkfocus(CommanderWindow()) - dialogSuffix(rows = 2, columns = 2, focus = entryDsname) - } - else { - if (!is.character(ActiveDataSet())) { - errorCondition(recall = binomialSimulate.ipsur, - message = gettextRcmdr("There is no active data set.")) - return() - } - .activeDataSet <- ActiveDataSet() - justDoIt(paste("samplesn <- dim(", .activeDataSet, - ")[1]", sep = "")) - UpdatebinomsimNumber() - for (k in getRcmdr("binomsimNumber"):(nsamples + - getRcmdr("binomsimNumber") - 1)) { - justDoIt(paste(.activeDataSet, "$binom.sim", - k, " <- rbinom(", samplesn, ", size=", size, - ", prob=", prob, ")", sep = "")) - } - activeDataSet(.activeDataSet) - putRcmdr("binomsimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 binomial variate sample stored in ", - .activeDataSet, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " binomial variate samples stored in ", - .activeDataSet, ".", sep = "")) - } - } - tkfocus(CommanderWindow()) - } - OKCancelHelp(helpSubject = "rbinom") - tkgrid(tklabel(top, text = gettextRcmdr("Number of samples (columns):")), - samplesEntry, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("Parameters:"), fg = "blue"), - columnspan = 4, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("size (number of trials)")), - sizeEntry, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("prob (of success)")), - probEntry, sticky = "w") - tkgrid(tklabel(locationFrame, text = gettextRcmdr("Store values in:"), - fg = "blue"), columnspan = 4, sticky = "w") - tkgrid(tklabel(locationFrame, text = gettextRcmdr("Active Dataset")), - addtoactiveButton, sticky = "w") - tkgrid(tklabel(locationFrame, text = "New Dataset"), newDataButton, - sticky = "w") - tkgrid.configure(samplesEntry, sticky = "w") - tkgrid.configure(sizeEntry, sticky = "w") - tkgrid.configure(probEntry, sticky = "w") - tkgrid(locationFrame, sticky = "w") - tkgrid(buttonsFrame, sticky = "w", columnspan = 2) - dialogSuffix(rows = 6, columns = 1, focus = samplesEntry) -} - - -`cauchySimulate.ipsur` <- -function () -{ - initializeDialog(title = gettextRcmdr("Simulate Cauchy Variates")) - parameterFrame <- tkframe(top) - locationFrame <- tkframe(top) - if (!is.character(ActiveDataSet())) { - locVariable <- tclVar("new") - } - else { - locVariable <- tclVar("add") - } - addtoactiveButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "add") - newDataButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "new") - samplesVar <- tclVar("1") - samplesEntry <- tkentry(top, width = "6", textvariable = samplesVar) - locationVar <- tclVar("0") - locationEntry <- tkentry(top, width = "6", textvariable = locationVar) - scale1Var <- tclVar("1") - scale1Entry <- tkentry(top, width = "6", textvariable = scale1Var) - onOK <- function() { - nsamples <- round(as.numeric(tclvalue(samplesVar))) - location <- tclvalue(locationVar) - scale1 <- tclvalue(scale1Var) - if (is.na(nsamples)) { - errorCondition(recall = cauchySimulate.ipsur, message = gettextRcmdr("Number of samples must be a positive integer.")) - return() - } - if (is.na(location)) { - errorCondition(recall = cauchySimulate.ipsur, message = gettextRcmdr("The location parameter was not specified.")) - return() - } - if (is.na(scale1)) { - errorCondition(recall = cauchySimulate.ipsur, message = gettextRcmdr("The scale parameter was not specified.")) - return() - } - closeDialog() - store <- tclvalue(locVariable) - if (store == "new") { - initializeDialog(title = gettextRcmdr("Simulation Dataset")) - dsname <- tclVar("Simset") - entryDsname <- tkentry(top, width = "20", textvariable = dsname) - newDataSS <- tclVar("100") - entryNewDataSS <- tkentry(top, width = "6", textvariable = newDataSS) - onOK <- function() { - dsnameValue <- trim.blanks(tclvalue(dsname)) - newSS <- round(as.numeric(tclvalue(newDataSS))) - closeDialog() - if (dsnameValue == "") { - errorCondition(recall = cauchySimulate.ipsur, - message = gettextRcmdr("You must enter the name of a data set.")) - return() - } - if (!is.valid.name(dsnameValue)) { - errorCondition(recall = cauchySimulate.ipsur, - message = paste("\"", dsnameValue, "\" ", - gettextRcmdr("is not a valid name."), sep = "")) - return() - } - if (is.element(dsnameValue, listDataSets())) { - if ("no" == tclvalue(checkReplace(dsnameValue, - gettextRcmdr("Data set")))) { - cauchySimulate.ipsur() - return() - } - } - if (is.na(newSS)) { - errorCondition(recall = cauchySimulate.ipsur, - message = gettextRcmdr("Sample Size must be a positive integer.")) - return() - } - UpdatecauchysimNumber() - justDoIt(paste(dsnameValue, " = data.frame(cauchy.sim", - getRcmdr("cauchysimNumber"), "=1:", newSS, - ")", sep = "")) - logger(paste(dsnameValue, "has been initialized.")) - for (k in getRcmdr("cauchysimNumber"):(nsamples + - getRcmdr("cauchysimNumber") - 1)) { - justDoIt(paste(dsnameValue, "$cauchy.sim", - k, " <- rcauchy(", newSS, ", location=", - location, ", scale=", scale1, ")", sep = "")) - } - activeDataSet(dsnameValue) - putRcmdr("cauchysimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 Cauchy variate sample stored in ", - dsnameValue, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " Cauchy variate samples stored in ", - dsnameValue, ".", sep = "")) - } - } - OKCancelHelp(helpSubject = "rcauchy") - tkgrid(tklabel(top, text = gettextRcmdr("Enter name for data set:")), - entryDsname, sticky = "e") - tkgrid(tklabel(top, text = gettextRcmdr("Sample Size (rows):")), - entryNewDataSS, sticky = "e") - tkgrid(buttonsFrame, columnspan = "2", sticky = "w") - tkgrid.configure(entryDsname, sticky = "w") - tkgrid.configure(entryNewDataSS, sticky = "w") - tkfocus(CommanderWindow()) - dialogSuffix(rows = 2, columns = 2, focus = entryDsname) - } - else { - if (!is.character(ActiveDataSet())) { - errorCondition(recall = cauchySimulate.ipsur, - message = gettextRcmdr("There is no active data set.")) - return() - } - .activeDataSet <- ActiveDataSet() - justDoIt(paste("samplesn <- dim(", .activeDataSet, - ")[1]", sep = "")) - UpdatecauchysimNumber() - for (k in getRcmdr("cauchysimNumber"):(nsamples + - getRcmdr("cauchysimNumber") - 1)) { - justDoIt(paste(.activeDataSet, "$cauchy.sim", - k, " <- rcauchy(", samplesn, ", location=", - location, ", scale=", scale1, ")", sep = "")) - } - activeDataSet(.activeDataSet) - putRcmdr("cauchysimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 Cauchy variate sample stored in ", - .activeDataSet, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " Cauchy variate samples stored in ", - .activeDataSet, ".", sep = "")) - } - } - tkfocus(CommanderWindow()) - } - OKCancelHelp(helpSubject = "rcauchy") - tkgrid(tklabel(top, text = gettextRcmdr("Number of samples (columns):")), - samplesEntry, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("Parameters:"), fg = "blue"), - columnspan = 4, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("location")), locationEntry, - sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("scale")), scale1Entry, - sticky = "w") - tkgrid(tklabel(locationFrame, text = gettextRcmdr("Store values in:"), - fg = "blue"), columnspan = 4, sticky = "w") - tkgrid(tklabel(locationFrame, text = gettextRcmdr("Active Dataset")), - addtoactiveButton, sticky = "w") - tkgrid(tklabel(locationFrame, text = "New Dataset"), newDataButton, - sticky = "w") - tkgrid.configure(samplesEntry, sticky = "w") - tkgrid.configure(locationEntry, sticky = "w") - tkgrid.configure(scale1Entry, sticky = "w") - tkgrid(locationFrame, sticky = "w") - tkgrid(buttonsFrame, sticky = "w", columnspan = 2) - dialogSuffix(rows = 6, columns = 1, focus = samplesEntry) -} - - -`chisqSimulate.ipsur` <- -function () -{ - initializeDialog(title = gettextRcmdr("Simulate Chi-Squared Variates")) - parameterFrame <- tkframe(top) - locationFrame <- tkframe(top) - if (!is.character(ActiveDataSet())) { - locVariable <- tclVar("new") - } - else { - locVariable <- tclVar("add") - } - addtoactiveButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "add") - newDataButton <- tkradiobutton(locationFrame, variable = locVariable, - value = "new") - samplesVar <- tclVar("1") - samplesEntry <- tkentry(top, width = "6", textvariable = samplesVar) - dfVar <- tclVar("1") - dfEntry <- tkentry(top, width = "6", textvariable = dfVar) - ncpVar <- tclVar("0") - ncpEntry <- tkentry(top, width = "6", textvariable = ncpVar) - onOK <- function() { - nsamples <- round(as.numeric(tclvalue(samplesVar))) - df <- tclvalue(dfVar) - ncp <- tclvalue(ncpVar) - if (is.na(nsamples)) { - errorCondition(recall = chisqSimulate.ipsur, message = gettextRcmdr("Number of samples must be a positive integer.")) - return() - } - if (is.na(df)) { - errorCondition(recall = chisqSimulate.ipsur, message = gettextRcmdr("The degrees of freedom were not specified.")) - return() - } - if (is.na(ncp)) { - errorCondition(recall = chisqSimulate.ipsur, message = gettextRcmdr("The noncentrality parameter was not specified.")) - return() - } - closeDialog() - store <- tclvalue(locVariable) - if (store == "new") { - initializeDialog(title = gettextRcmdr("Simulation Dataset")) - dsname <- tclVar("Simset") - entryDsname <- tkentry(top, width = "20", textvariable = dsname) - newDataSS <- tclVar("100") - entryNewDataSS <- tkentry(top, width = "6", textvariable = newDataSS) - onOK <- function() { - dsnameValue <- trim.blanks(tclvalue(dsname)) - newSS <- round(as.numeric(tclvalue(newDataSS))) - closeDialog() - if (dsnameValue == "") { - errorCondition(recall = chisqSimulate.ipsur, - message = gettextRcmdr("You must enter the name of a data set.")) - return() - } - if (!is.valid.name(dsnameValue)) { - errorCondition(recall = chisqSimulate.ipsur, - message = paste("\"", dsnameValue, "\" ", - gettextRcmdr("is not a valid name."), sep = "")) - return() - } - if (is.element(dsnameValue, listDataSets())) { - if ("no" == tclvalue(checkReplace(dsnameValue, - gettextRcmdr("Data set")))) { - chisqSimulate.ipsur() - return() - } - } - if (is.na(newSS)) { - errorCondition(recall = chisqSimulate.ipsur, - message = gettextRcmdr("Sample Size must be a positive integer.")) - return() - } - UpdatechisqsimNumber() - justDoIt(paste(dsnameValue, " = data.frame(chisq.sim", - getRcmdr("chisqsimNumber"), "=1:", newSS, ")", - sep = "")) - logger(paste(dsnameValue, "has been initialized.")) - for (k in getRcmdr("chisqsimNumber"):(nsamples + - getRcmdr("chisqsimNumber") - 1)) { - justDoIt(paste(dsnameValue, "$chisq.sim", k, - " <- rchisq(", newSS, ", df=", df, ", ncp=", - ncp, ")", sep = "")) - } - activeDataSet(dsnameValue) - putRcmdr("chisqsimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 chi-squared variate sample stored in ", - dsnameValue, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " chi-squared variate samples stored in ", - dsnameValue, ".", sep = "")) - } - } - OKCancelHelp(helpSubject = "rchisq") - tkgrid(tklabel(top, text = gettextRcmdr("Enter name for data set:")), - entryDsname, sticky = "e") - tkgrid(tklabel(top, text = gettextRcmdr("Sample Size (rows):")), - entryNewDataSS, sticky = "e") - tkgrid(buttonsFrame, columnspan = "2", sticky = "w") - tkgrid.configure(entryDsname, sticky = "w") - tkgrid.configure(entryNewDataSS, sticky = "w") - tkfocus(CommanderWindow()) - dialogSuffix(rows = 2, columns = 2, focus = entryDsname) - } - else { - if (!is.character(ActiveDataSet())) { - errorCondition(recall = chisqSimulate.ipsur, - message = gettextRcmdr("There is no active data set.")) - return() - } - .activeDataSet <- ActiveDataSet() - justDoIt(paste("samplesn <- dim(", .activeDataSet, - ")[1]", sep = "")) - UpdatechisqsimNumber() - for (k in getRcmdr("chisqsimNumber"):(nsamples + - getRcmdr("chisqsimNumber") - 1)) { - justDoIt(paste(.activeDataSet, "$chisq.sim", - k, " <- rchisq(", samplesn, ", df=", df, ", ncp=", - ncp, ")", sep = "")) - } - activeDataSet(.activeDataSet) - putRcmdr("chisqsimNumber", k) - if (nsamples == 1) { - logger(paste("There was 1 chi-squared variate sample stored in ", - .activeDataSet, ".", sep = "")) - } - else { - logger(paste("There were ", nsamples, " chi-squared variate samples stored in ", - .activeDataSet, ".", sep = "")) - } - } - tkfocus(CommanderWindow()) - } - OKCancelHelp(helpSubject = "rchisq") - tkgrid(tklabel(top, text = gettextRcmdr("Number of samples (columns):")), - samplesEntry, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("Parameters:"), fg = "blue"), - columnspan = 4, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("df (degrees of freedom)")), - dfEntry, sticky = "w") - tkgrid(tklabel(top, text = gettextRcmdr("ncp (noncentrality parameter)")), - ncpEntry, sticky = "w") - tkgrid(tklabel(locationFrame, text = gettextRcmdr("Store values in:"), [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/ipsur -r 217 From noreply at r-forge.r-project.org Fri Aug 29 19:20:14 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 29 Aug 2014 19:20:14 +0200 (CEST) Subject: [IPSUR-commits] r218 - in pkg/RcmdrPlugin.IPSUR: . inst/etc Message-ID: <20140829172014.5FC77186B67@r-forge.r-project.org> Author: gkerns Date: 2014-08-29 19:20:14 +0200 (Fri, 29 Aug 2014) New Revision: 218 Modified: pkg/RcmdrPlugin.IPSUR/DESCRIPTION pkg/RcmdrPlugin.IPSUR/inst/etc/menus.txt Log: deleted sampling distributions menu, fixed author names Modified: pkg/RcmdrPlugin.IPSUR/DESCRIPTION =================================================================== --- pkg/RcmdrPlugin.IPSUR/DESCRIPTION 2014-08-29 16:02:51 UTC (rev 217) +++ pkg/RcmdrPlugin.IPSUR/DESCRIPTION 2014-08-29 17:20:14 UTC (rev 218) @@ -2,7 +2,12 @@ Version: 0.2-0 Date: 2013-01-25 Title: An IPSUR Plugin for the R Commander -Author: G. Jay Kerns with contributions by Theophilius Boye and Tyler Drombosky, adapted from the work of John Fox et al. +Authors at R: c(person("G. Jay", "Kerns", role = c("aut", "cre"), email = "gkerns at ysu.edu"), + person("Theophilus", "Boye", role = "ctb"), person("Tyler", "Drombosky", role = "ctb") + ) +Author: G. Jay Kerns [aut, cre], + Theophilus Boye [ctb], + Tyler Drombosky [ctb] Maintainer: G. Jay Kerns Imports: Rcmdr (>= 2.1-0) Suggests: abind, car, distr, distrEx, e1071, effects (>= 1.0-7), foreign, grid, lattice, lmtest, MASS, mgcv, multcomp (>= 0.991-2), nlme, nnet, qcc, relimp, RODBC Modified: pkg/RcmdrPlugin.IPSUR/inst/etc/menus.txt =================================================================== --- pkg/RcmdrPlugin.IPSUR/inst/etc/menus.txt 2014-08-29 16:02:51 UTC (rev 217) +++ pkg/RcmdrPlugin.IPSUR/inst/etc/menus.txt 2014-08-29 17:20:14 UTC (rev 218) @@ -1,245 +1,245 @@ -# R Commander Menu Definitions - - - -# type menu/item operation/parent label command/menu activation install? - -#remove frequencyDistribution "" "" "" "" "" -#remove numericalSummaries "" "" "" "" "" -#remove twoWayTable "" "" "" "" "" -#remove enterTable "" "" "" "" "" -#remove barGraph "" "" "" "" "" -#remove boxPlot "" "" "" "" "" -#remove continuousMenu "" "" "" "" "" -#remove discreteMenu "" "" "" "" "" - - - -######################### -# Statistics menu - - item summariesMenu command "Frequency distributions... (IPSUR)" frequencyDistribution.ipsur "activeDataSetP()" "" - item summariesMenu command "Numerical summaries... (IPSUR)" numericalSummaries.ipsur "numericP()" "packageAvailable('abind') && packageAvailable('e1071')" - - item tablesMenu command "Two-way table... (IPSUR)" twoWayTable.ipsur "factorsP(2)" "packageAvailable('abind')" - item tablesMenu command "Enter and analyze two-way table... (IPSUR)" enterTable.ipsur "" "packageAvailable('abind')" - - item proportionsMenu command "Enter table for single-sample... (IPSUR)" enterTableSinglePropTest "" "packageAvailable('abind')" - item proportionsMenu command "Enter table for independent samples... (IPSUR)" enterTableMultiPropTest "" "packageAvailable('abind')" - item proportionsMenu command "Test for equality of several proportions... (IPSUR)" multiSampleProportionsTest "multiLevelFactorsP() & twoLevelFactorsP()" "packageAvailable('abind')" - - -#### - menu powerMenu statisticsMenu "" "" "" "" - item statisticsMenu cascade "Power (IPSUR)" powerMenu "" "" - item powerMenu command "Power for t-tests..." powerTtest "" "" - item powerMenu command "Power for two proportions..." powerProptest "" "" - item powerMenu command "Power for balanced ANOVA..." powerAnovatest "" "" - - - -################################### -# Graphs menu - item graphsMenu command "Boxplot... (IPSUR)" boxPlot.ipsur "numericP()" "" - item graphsMenu command "Strip chart... (IPSUR)" stripChart "numericP()" "" - item graphsMenu command "Pareto chart... (IPSUR)" paretoChart "factorsP()" "packageAvailable('qcc')" - item graphsMenu command "Bar Graph... (IPSUR)" barGraph.ipsur "factorsP()" "" - item graphsMenu command "Bar Graph enter table... (IPSUR)" barPlotSumTable "" "packageAvailable('abind')" - - -################################################################################################################################################# -################################################################################################################################################# -### ## -### DISTRIBUTIONS MENU ## -### Last modified 02/14/08 ## -### ## -############################### - -########################################################################################################## -# Sampling Distributions - - menu samplingIpsurMenu distributionsMenu "" "" "" "" - item distributionsMenu cascade "Sampling Distributions (IPSUR)" samplingIpsurMenu "" "" - - menu cntsamplingIpsurMenu samplingIpsurMenu "" "" "" "" - item samplingIpsurMenu cascade "Continuous Distributions" cntsamplingIpsurMenu "" "" - item cntsamplingIpsurMenu command "Beta population..." betaDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Cauchy population..." CauchyDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Chi-squared population..." chisquareDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Exponential population..." exponentialDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "F population..." FDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Gamma population..." gammaDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Lognormal population..." lognormalDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Logistic population..." logisticDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Normal population..." normalDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Student's t population..." tDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Uniform population..." uniformDistributionSamples.ipsur "" "" - item cntsamplingIpsurMenu command "Weibull population..." WeibullDistributionSamples.ipsur "" "" - - menu dscsamplingIpsurMenu samplingIpsurMenu "" "" "" "" - item samplingIpsurMenu cascade "Discrete Distributions" dscsamplingIpsurMenu "" "" - item dscsamplingIpsurMenu command "Binomial population..." binomialDistributionSamples.ipsur "" "" - item dscsamplingIpsurMenu command "Discrete uniform population..." disunifDistributionSamples.ipsur "" "" - item dscsamplingIpsurMenu command "Geometric population..." geomDistributionSamples.ipsur "" "" - item dscsamplingIpsurMenu command "Hypergeometric population..." hyperDistributionSamples.ipsur "" "" - item dscsamplingIpsurMenu command "Negative binomial population..." negbinomialDistributionSamples.ipsur "" "" - item dscsamplingIpsurMenu command "Poisson population..." PoissonDistributionSamples.ipsur "" "" - -########################################################################################################## -# Discrete Distributions - - menu discreteIpsurMenu distributionsMenu "" "" "" "" - item distributionsMenu cascade "Discrete Distributions (IPSUR)" discreteIpsurMenu "" "" - - menu PoissonIpsurMenu discreteIpsurMenu "" "" "" "" - item discreteIpsurMenu cascade "Poisson distribution" PoissonIpsurMenu "" "" - item PoissonIpsurMenu command "Poisson quantiles..." poissonQuantiles.ipsur "" "" - item PoissonIpsurMenu command "Poisson tail probabilities..." poissonProbabilities.ipsur "" "" - item PoissonIpsurMenu command "Poisson probabilities..." PoissonMass.ipsur "" "" - item PoissonIpsurMenu command "Plot Poisson distribution..." PoissonDistributionPlot.ipsur "" "" - item PoissonIpsurMenu command "Simulate Poisson variates..." poisSimulate.ipsur "" "" - - menu nbinomIpsurMenu discreteIpsurMenu "" "" "" "" - item discreteIpsurMenu cascade "Negative binomial distribution" nbinomIpsurMenu "" "" - item nbinomIpsurMenu command "Negative binomial quantiles..." negbinomialQuantiles.ipsur "" "" - item nbinomIpsurMenu command "Negative binomial tail probabilities..." negbinomialProbabilities.ipsur "" "" - item nbinomIpsurMenu command "Negative binomial probabilities..." negbinomialMass.ipsur "" "" - item nbinomIpsurMenu command "Plot negative binomial distribution..." negbinomialDistributionPlot.ipsur "" "" - item nbinomIpsurMenu command "Simulate negative binomial variates..." nbinomSimulate.ipsur "" "" - - menu hyperIpsurMenu discreteIpsurMenu "" "" "" "" - item discreteIpsurMenu cascade "Hypergeometric distribution" hyperIpsurMenu "" "" - item hyperIpsurMenu command "Hypergeometric quantiles..." hyperQuantiles.ipsur "" "" - item hyperIpsurMenu command "Hypergeometric tail probabilities..." hyperProbabilities.ipsur "" "" - item hyperIpsurMenu command "Hypergeometric probabilities..." hyperMass.ipsur "" "" - item hyperIpsurMenu command "Plot hypergeometric distribution..." hyperDistributionPlot.ipsur "" "" - item hyperIpsurMenu command "Simulate hypergeometric variates..." hyperSimulate.ipsur "" "" - - menu geomIpsurMenu discreteIpsurMenu "" "" "" "" - item discreteIpsurMenu cascade "Geometric distribution" geomIpsurMenu "" "" - item geomIpsurMenu command "Geometric quantiles..." geomQuantiles.ipsur "" "" - item geomIpsurMenu command "Geometric tail probabilities..." geomProbabilities.ipsur "" "" - item geomIpsurMenu command "Geometric probabilities..." geomMass.ipsur "" "" - item geomIpsurMenu command "Plot geometric distribution..." geomDistributionPlot.ipsur "" "" - item geomIpsurMenu command "Simulate geometric variates..." geomSimulate.ipsur "" "" - - menu disuniformIpsurMenu discreteIpsurMenu "" "" "" "" - item discreteIpsurMenu cascade "Discrete Uniform distribution" disuniformIpsurMenu "" "" -# item disuniformMenu command "Discrete Uniform quantiles..." disunifQuantiles "" "" -# item disuniformMenu command "Discrete Uniform probabilities..." disunifProbabilities "" "" -# item disuniformMenu command "Plot discrete uniform distribution..." disunifDistributionPlot "" "" - item disuniformIpsurMenu command "Simulate discrete uniform variates..." disunifSimulate.ipsur "" "" - - menu binomialIpsurMenu discreteIpsurMenu "" "" "" "" - item discreteIpsurMenu cascade "Binomial distribution" binomialIpsurMenu "" "" - item binomialIpsurMenu command "Binomial quantiles..." binomialQuantiles.ipsur "" "" - item binomialIpsurMenu command "Binomial tail probabilities..." binomialProbabilities.ipsur "" "" - item binomialIpsurMenu command "Binomial probabilities..." binomialMass.ipsur "" "" - item binomialIpsurMenu command "Plot binomial distribution..." binomialDistributionPlot.ipsur "" "" - item binomialIpsurMenu command "Simulate binomial variates..." binomialSimulate.ipsur "" "" - - -########################################################################################################## -# Continuous Distributions - - menu continuousIpsurMenu distributionsMenu "" "" "" "" - item distributionsMenu cascade "Continuous Distributions (IPSUR)" continuousIpsurMenu "" "" - - - menu weibullIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Weibull distribution" weibullIpsurMenu "" "" - item weibullIpsurMenu command "Weibull quantiles..." weibullQuantiles.ipsur "" "" - item weibullIpsurMenu command "Weibull probabilities..." weibullProbabilities.ipsur "" "" - item weibullIpsurMenu command "Plot weibull distribution..." weibullDistributionPlot.ipsur "" "" - item weibullIpsurMenu command "Simulate weibull variates..." weibullSimulate.ipsur "" "" - - menu uniformIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Uniform distribution" uniformIpsurMenu "" "" - item uniformIpsurMenu command "Uniform quantiles..." uniformQuantiles.ipsur "" "" - item uniformIpsurMenu command "Uniform probabilities..." uniformProbabilities.ipsur "" "" - item uniformIpsurMenu command "Plot uniform distribution..." unifDistributionPlot.ipsur "" "" - item uniformIpsurMenu command "Simulate uniform variates..." unifSimulate.ipsur "" "" - - menu tIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "t distribution" tIpsurMenu "" "" - item tIpsurMenu command "t quantiles..." tQuantiles.ipsur "" "" - item tIpsurMenu command "t probabilities..." tProbabilities.ipsur "" "" - item tIpsurMenu command "Plot t distribution..." tDistributionPlot.ipsur "" "" - item tIpsurMenu command "Simulate t variates..." tSimulate.ipsur "" "" - - menu normalIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Normal distribution" normalIpsurMenu "" "" - item normalIpsurMenu command "Normal quantiles..." normalQuantiles.ipsur "" "" - item normalIpsurMenu command "Normal probabilities..." normalProbabilities.ipsur "" "" - item normalIpsurMenu command "Plot normal distribution..." normalDistributionPlot.ipsur "" "" - item normalIpsurMenu command "Simulate normal variates..." normalSimulate.ipsur "" "" - - menu logisticIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Logistic distribution" logisticIpsurMenu "" "" - item logisticIpsurMenu command "Logistic quantiles..." logisticQuantiles.ipsur "" "" - item logisticIpsurMenu command "Logistic probabilities..." logisticProbabilities.ipsur "" "" - item logisticIpsurMenu command "Plot logistic distribution..." logisticDistributionPlot.ipsur "" "" - item logisticIpsurMenu command "Simulate logistic variates..." logisSimulate.ipsur "" "" - - menu lognormalIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Log normal distribution" lognormalIpsurMenu "" "" - item lognormalIpsurMenu command "Log normal quantiles..." lognormalQuantiles.ipsur "" "" - item lognormalIpsurMenu command "Log normal probabilities..." lognormalProbabilities.ipsur "" "" - item lognormalIpsurMenu command "Plot log normal distribution..." lognormalDistributionPlot.ipsur "" "" - item lognormalIpsurMenu command "Simulate log normal variates..." lnormalSimulate.ipsur "" "" - - menu gammaIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Gamma distribution" gammaIpsurMenu "" "" - item gammaIpsurMenu command "Gamma quantiles..." gammaQuantiles.ipsur "" "" - item gammaIpsurMenu command "Gamma probabilities..." gammaProbabilities.ipsur "" "" - item gammaIpsurMenu command "Plot gamma distribution..." gammaDistributionPlot.ipsur "" "" - item gammaIpsurMenu command "Simulate gamma variates..." gammaSimulate.ipsur "" "" - - menu FIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "F distribution" FIpsurMenu "" "" - item FIpsurMenu command "F quantiles..." FQuantiles.ipsur "" "" - item FIpsurMenu command "F probabilities..." FProbabilities.ipsur "" "" - item FIpsurMenu command "Plot F distribution..." FDistributionPlot.ipsur "" "" - item FIpsurMenu command "Simulate F variates..." fSimulate.ipsur "" "" - - menu expIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Exponential distribution" expIpsurMenu "" "" - item expIpsurMenu command "Exponential quantiles..." expQuantiles.ipsur "" "" - item expIpsurMenu command "Exponential probabilities..." expProbabilities.ipsur "" "" - item expIpsurMenu command "Plot exponential distribution..." expDistributionPlot.ipsur "" "" - item expIpsurMenu command "Simulate exponential variates..." expSimulate.ipsur "" "" - - menu chisqIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Chi-squared distribution" chisqIpsurMenu "" "" - item chisqIpsurMenu command "Chi-squared quantiles..." chisqQuantiles.ipsur "" "" - item chisqIpsurMenu command "Chi-squared probabilities..." chisqProbabilities.ipsur "" "" - item chisqIpsurMenu command "Plot chi-squared distribution..." chisquareDistributionPlot.ipsur "" "" - item chisqIpsurMenu command "Simulate chi-squared variates..." chisqSimulate.ipsur "" "" - - menu cauchyIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Cauchy distribution" cauchyIpsurMenu "" "" - item cauchyIpsurMenu command "Cauchy quantiles..." cauchyQuantiles.ipsur "" "" - item cauchyIpsurMenu command "Cauchy probabilities..." cauchyProbabilities.ipsur "" "" - item cauchyIpsurMenu command "Plot Cauchy distribution..." cauchyDistributionPlot.ipsur "" "" - item cauchyIpsurMenu command "Simulate Cauchy variates..." cauchySimulate.ipsur "" "" - - menu betaIpsurMenu continuousIpsurMenu "" "" "" "" - item continuousIpsurMenu cascade "Beta distribution" betaIpsurMenu "" "" - item betaIpsurMenu command "Beta quantiles..." betaQuantiles.ipsur "" "" - item betaIpsurMenu command "Beta probabilities..." betaProbabilities.ipsur "" "" - item betaIpsurMenu command "Plot beta distribution..." betaDistributionPlot.ipsur "" "" - item betaIpsurMenu command "Simulate beta variates..." betaSimulate.ipsur "" "" - -############################# -# Save for eventual Probability menu - item distributionsMenu command "Birthday Problem... (IPSUR)" birthdayProbabilities.ipsur "" "" - -################################################################################################################################################ -################################################################################################################################################ -# End Distributions Menu - - - - - - +# R Commander Menu Definitions + + + +# type menu/item operation/parent label command/menu activation install? + +#remove frequencyDistribution "" "" "" "" "" +#remove numericalSummaries "" "" "" "" "" +#remove twoWayTable "" "" "" "" "" +#remove enterTable "" "" "" "" "" +#remove barGraph "" "" "" "" "" +#remove boxPlot "" "" "" "" "" +#remove continuousMenu "" "" "" "" "" +#remove discreteMenu "" "" "" "" "" + + + +######################### +# Statistics menu + + item summariesMenu command "Frequency distributions... (IPSUR)" frequencyDistribution.ipsur "activeDataSetP()" "" + item summariesMenu command "Numerical summaries... (IPSUR)" numericalSummaries.ipsur "numericP()" "packageAvailable('abind') && packageAvailable('e1071')" + + item tablesMenu command "Two-way table... (IPSUR)" twoWayTable.ipsur "factorsP(2)" "packageAvailable('abind')" + item tablesMenu command "Enter and analyze two-way table... (IPSUR)" enterTable.ipsur "" "packageAvailable('abind')" + + item proportionsMenu command "Enter table for single-sample... (IPSUR)" enterTableSinglePropTest "" "packageAvailable('abind')" + item proportionsMenu command "Enter table for independent samples... (IPSUR)" enterTableMultiPropTest "" "packageAvailable('abind')" + item proportionsMenu command "Test for equality of several proportions... (IPSUR)" multiSampleProportionsTest "multiLevelFactorsP() & twoLevelFactorsP()" "packageAvailable('abind')" + + +#### + menu powerMenu statisticsMenu "" "" "" "" + item statisticsMenu cascade "Power (IPSUR)" powerMenu "" "" + item powerMenu command "Power for t-tests..." powerTtest "" "" + item powerMenu command "Power for two proportions..." powerProptest "" "" + item powerMenu command "Power for balanced ANOVA..." powerAnovatest "" "" + + + +################################### +# Graphs menu + item graphsMenu command "Boxplot... (IPSUR)" boxPlot.ipsur "numericP()" "" + item graphsMenu command "Strip chart... (IPSUR)" stripChart "numericP()" "" + item graphsMenu command "Pareto chart... (IPSUR)" paretoChart "factorsP()" "packageAvailable('qcc')" + item graphsMenu command "Bar Graph... (IPSUR)" barGraph.ipsur "factorsP()" "" + item graphsMenu command "Bar Graph enter table... (IPSUR)" barPlotSumTable "" "packageAvailable('abind')" + + +################################################################################################################################################# +################################################################################################################################################# +### ### +### DISTRIBUTIONS MENU ### +### Last modified 2014-08-29 ### +### ### +################################## + +# ########################################################################################################## +# # Sampling Distributions +# +# menu samplingIpsurMenu distributionsMenu "" "" "" "" +# item distributionsMenu cascade "Sampling Distributions (IPSUR)" samplingIpsurMenu "" "" +# +# menu cntsamplingIpsurMenu samplingIpsurMenu "" "" "" "" +# item samplingIpsurMenu cascade "Continuous Distributions" cntsamplingIpsurMenu "" "" +# item cntsamplingIpsurMenu command "Beta population..." betaDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Cauchy population..." CauchyDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Chi-squared population..." chisquareDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Exponential population..." exponentialDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "F population..." FDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Gamma population..." gammaDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Lognormal population..." lognormalDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Logistic population..." logisticDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Normal population..." normalDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Student's t population..." tDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Uniform population..." uniformDistributionSamples.ipsur "" "" +# item cntsamplingIpsurMenu command "Weibull population..." WeibullDistributionSamples.ipsur "" "" +# +# menu dscsamplingIpsurMenu samplingIpsurMenu "" "" "" "" +# item samplingIpsurMenu cascade "Discrete Distributions" dscsamplingIpsurMenu "" "" +# item dscsamplingIpsurMenu command "Binomial population..." binomialDistributionSamples.ipsur "" "" +# item dscsamplingIpsurMenu command "Discrete uniform population..." disunifDistributionSamples.ipsur "" "" +# item dscsamplingIpsurMenu command "Geometric population..." geomDistributionSamples.ipsur "" "" +# item dscsamplingIpsurMenu command "Hypergeometric population..." hyperDistributionSamples.ipsur "" "" [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/ipsur -r 218 From noreply at r-forge.r-project.org Fri Aug 29 20:53:47 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 29 Aug 2014 20:53:47 +0200 (CEST) Subject: [IPSUR-commits] r219 - pkg/RcmdrPlugin.IPSUR/R Message-ID: <20140829185347.90E55186F99@r-forge.r-project.org> Author: gkerns Date: 2014-08-29 20:53:47 +0200 (Fri, 29 Aug 2014) New Revision: 219 Modified: pkg/RcmdrPlugin.IPSUR/R/numSumIPSUR.r Log: small changes Modified: pkg/RcmdrPlugin.IPSUR/R/numSumIPSUR.r =================================================================== --- pkg/RcmdrPlugin.IPSUR/R/numSumIPSUR.r 2014-08-29 17:20:14 UTC (rev 218) +++ pkg/RcmdrPlugin.IPSUR/R/numSumIPSUR.r 2014-08-29 18:53:47 UTC (rev 219) @@ -4,10 +4,11 @@ function (data, statistics = c("mean", "sd", "skewness", "kurtosis", "quantiles"), quantiles = c(0, 0.25, 0.5, 0.75, 1), groups) { - if (!require(abind)) - stop("abind package missing") - if (!require(e1071)) + if (!requireNamespace("abind", quietly = TRUE)) { + stop("abind package missing") + } else if (!requireNamespace("e1071", quietly = TRUE)){ stop("e1071 package missing") + } else { data <- as.data.frame(data) if (!missing(groups)) groups <- as.factor(groups) @@ -70,10 +71,10 @@ table[, "sd"] <- sd(data[, variables], na.rm = TRUE) if ("skewness" %in% stats) table[, "skewness"] <- apply(as.matrix(data[, variables]), - MARGIN = 2, skewness, na.rm = TRUE) + MARGIN = 2, e1071::skewness, na.rm = TRUE) if ("kurtosis" %in% stats) table[, "kurtosis"] <- apply(as.matrix(data[, variables]), - MARGIN = 2, kurtosis, na.rm = TRUE) + MARGIN = 2, e1071::kurtosis, na.rm = TRUE) if ("quantiles" %in% statistics) { table[, quants] <- t(apply(data[, variables, drop = FALSE], 2, quantile, probs = quantiles, na.rm = TRUE)) @@ -97,10 +98,10 @@ groups, sd, na.rm = TRUE) if ("skewness" %in% stats) table[, "skewness", variable] <- tapply(data[, - variable], groups, skewness, na.rm = TRUE) + variable], groups, e1071::skewness, na.rm = TRUE) if ("kurtosis" %in% stats) table[, "kurtosis", variable] <- tapply(data[, - variable], groups, kurtosis, na.rm = TRUE) + variable], groups, e1071::kurtosis, na.rm = TRUE) if ("quantiles" %in% statistics) { res <- matrix(unlist(tapply(data[, variable], groups, quantile, probs = quantiles, na.rm = TRUE)), @@ -126,12 +127,16 @@ result$NAs <- NAs class(result) <- "numSummaryIPSUR" result + + } } - `print.numSummaryIPSUR` <- function (x, ...) { + if (!requireNamespace("abind", quietly = TRUE)) { + stop("abind package missing") + } else { NAs <- x$NAs table <- x$table n <- x$n @@ -181,10 +186,10 @@ print(table) } else { - table <- abind(table, t(n), along = 2) + table <- abind::abind(table, t(n), along = 2) dimnames(table)[[2]][dim(table)[2]] <- "n" if (!is.null(NAs)) { - table <- abind(table, t(NAs), along = 2) + table <- abind::abind(table, t(NAs), along = 2) dimnames(table)[[2]][dim(table)[2]] <- "NA" } nms <- dimnames(table)[[3]] @@ -195,4 +200,5 @@ } }) invisible(x) + } }