ttestbox <- function(){ initializeDialog(title=gettextRcmdr("Single-Sample t-Test")) # xBox <- variableListBox(top, Numeric(), title=gettextRcmdr("Variable (pick one)")) onOK <- function(){ # x <- getSelection(xBox) # if (length(x) == 0){ # errorCondition(recall=ttestbox, message=gettextRcmdr("You must select a variable.")) # return() # } alternative <- as.character(tclvalue(alternativeVariable)) level <- tclvalue(confidenceLevel) mu <- tclvalue(muVariable) nx <-tclvalue(nxVariable) mx <-tclvalue(mxVariable) vx <-tclvalue(vxVariable) closeDialog() doItAndPrint(paste("tt.test(nx=", nx, ", mx=", mx, ", vx=", vx, ", alternative='", alternative, "', mu=", mu, ", conf.level=", level, ")", sep="")) tkdestroy(top) tkfocus(CommanderWindow()) } OKCancelHelp(helpSubject="t.test") radioButtons(top, name="alternative", buttons=c("twosided", "less", "greater"), values=c("two.sided", "less", "greater"), labels=gettextRcmdr(c("Population mean = mu0", "Population mean < mu0", "Population mean > mu0")), title=gettextRcmdr("Alternative Hypothesis")) rightFrame <- tkframe(top) confidenceFrame <- tkframe(rightFrame) confidenceLevel <- tclVar(".95") confidenceField <- tkentry(confidenceFrame, width="6", textvariable=confidenceLevel) muFrame <- tkframe(rightFrame) muVariable <- tclVar("0.0") muField <- tkentry(muFrame, width="8", textvariable=muVariable) nxFrame <- tkframe(rightFrame) nxVariable <- tclVar("") nxField <- tkentry(nxFrame, width="6", textvariable=nxVariable) mxFrame <- tkframe(rightFrame) mxVariable <- tclVar("") mxField <- tkentry(mxFrame, width="6", textvariable=mxVariable) vxFrame <- tkframe(rightFrame) vxVariable <- tclVar("") vxField <- tkentry(vxFrame, width="6", textvariable=vxVariable) # tkgrid(getFrame(xBox), sticky="nw") tkgrid(tklabel(rightFrame, text=""), sticky="w") tkgrid(tklabel(muFrame, text=gettextRcmdr("Null hypothesis: mu = ")), muField, sticky="w") tkgrid(muFrame, sticky="w") tkgrid(tklabel(confidenceFrame, text=gettextRcmdr("Confidence Level: ")), confidenceField, sticky="w") tkgrid(confidenceFrame, sticky="w") tkgrid(tklabel(nxFrame, text=gettextRcmdr("Número de observaciones= ")), nxField, sticky="w") tkgrid(nxFrame, sticky="w") tkgrid(tklabel(mxFrame, text=gettextRcmdr("Media de la muestra= ")), mxField, sticky="w") tkgrid(mxFrame, sticky="w") tkgrid(tklabel(vxFrame, text=gettextRcmdr("Varianza de la muestra= ")), vxField, sticky="w") tkgrid(vxFrame, sticky="w") tkgrid(alternativeFrame, rightFrame, sticky="nw") tkgrid(buttonsFrame, columnspan=2, sticky="w") tkgrid.configure(confidenceField, sticky="e") dialogSuffix(rows=4, columns=2) }