R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > par1 = 'a-119065415-2012' > par1 <- 'a-119065415-2012' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: aston2 > #To cite this work: I. Holliday, 2012, MC Exam Q1 (v1.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_mcq20101.wasp/ > #Source of accompanying publication: > # > if (exists('par1')) { + mylist <- list('aston2', + 'a-119062746-2012', + 'a-102697687-2012', + 'a-119223174-2012', + 'a-119209536-2012', + 'a-119043099-2012', + 'a-119208193-2012', + 'a-119043468-2012', + 'a-109086158-2012', + 'a-119019636-2012', + 'a-103823050-2012', + 'a-119037320-2012', + 'a-119084069-2012', + 'a-129140960-2012', + 'a-119015351-2012', + 'a-081860034-2012', + 'a-119045369-2012', + 'a-103135584-2012', + 'a-119095102-2012', + 'a-119057236-2012', + 'a-119080061-2012', + 'a-119209547-2012', + 'a-119026612-2012', + 'a-119049057-2012', + 'a-119036068-2012', + 'a-119025464-2012', + 'a-119083497-2012', + 'a-119027745-2012', + 'a-119017609-2012', + 'a-119022304-2012', + 'a-102196939-2012', + 'a-119076178-2012', + 'a-119184783-2012', + 'a-129075961-2012', + 'a-119104437-2012', + 'a-119047215-2012', + 'a-119029196-2012', + 'a-119120611-2012', + 'a-119022061-2012', + 'a-100932571-2012', + 'a-119027583-2012', + 'a-119042645-2012', + 'a-119048072-2012', + 'a-119041970-2012', + 'a-119008984-2012', + 'a-119038589-2012', + 'a-119009121-2012', + 'a-119055531-2012', + 'a-119034721-2012', + 'a-119016598-2012', + 'a-119055391-2012', + 'a-119054132-2012', + 'a-119210901-2012', + 'a-119034798-2012', + 'a-119014516-2012', + 'a-129160474-2012', + 'a-119062229-2012', + 'a-071390039-2012', + 'a-119207093-2012', + 'a-119106877-2012', + 'a-119035762-2012', + 'a-119012316-2012', + 'a-119073225-2012', + 'a-101853394-2012', + 'a-119106268-2012', + 'a-119035153-2012', + 'a-119074093-2012', + 'a-119031937-2012', + 'a-119106604-2012', + 'a-119207598-2012', + 'a-119207990-2012', + 'a-119033241-2012', + 'a-119186536-2012', + 'a-103247717-2012', + 'a-119215319-2012', + 'a-119036459-2012', + 'a-119208230-2012', + 'a-119036002-2012', + 'a-119194586-2012', + 'a-119213278-2012', + 'a-119059012-2012', + 'a-119071645-2012', + 'a-109110039-2012a', + 'a-119035979-2012', + 'a-119020713-2012', + 'a-119026715-2012', + 'a-119063846-2012', + 'a-119078013-2012', + 'a-119083420-2012', + 'a-119034961-2012', + 'a-119074691-2012', + 'a-102791734-2012', + 'a-119215010-2012', + 'a-119010976-2012', + 'a-119015915-2012', + 'a-129013871-2012', + 'a-119020159-2012', + 'a-103182762-2012', + 'a-101181943-2012', + 'a-119006980-2012', + 'a-119214644-2012', + 'a-119042047-2012', + 'a-119051784-2012', + 'a-129004189-2012', + 'a-119055874-2012', + 'a-119058325-2012', + 'a-119065415-2012', + 'a-119167801-2012', + 'a-119016370-2012', + 'a-119060834-2012', + 'a-119101045-2012', + 'a-119094150-2012', + 'a-119092400-2012', + 'a-119037261-2012', + 'a-119169355-2012', + 'a-123456789-2012') + if (length(which(mylist == par1)) > 0) { + par1 <- paste(par1,'_',runif(1),'_',date(),sep='') + } else { + + #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab + load(file="/var/fisher/rcomp/createtable") + + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Error',1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'The User ID you entered does not exist! ') + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/1lqcx1368093334.tab") + stop('The User ID you entered does not exist!') + } + library(digest) + myran <- runif(1) + if (myran <= 1) { + nx1 <- rnorm(100) + nx2 <- rnorm(100, sd=2.0, mean=0.0) + nx3 <- rnorm(100, sd=2.0, mean=-2.0) + answer <- 'nx1' + } + if (myran < 0.66) { + nx2 <- rnorm(100) + nx3 <- rnorm(100, sd=2.0, mean=0.0) + nx1 <- rnorm(100, sd=2.0, mean=-2.0) + answer <- 'nx2' + } + if (myran < 0.33) { + nx3 <- rnorm(100) + nx1 <- rnorm(100, sd=2.0, mean=0.0) + nx2 <- rnorm(100, sd=2.0, mean=-2.0) + answer <- 'nx3' + } + answer <- digest(answer,ser=F) + allmeans<- c(mean(nx1),mean(nx2),mean(nx3)) + names(allmeans)<-c('Sample 1', 'Sample 2', 'Sample 3') + allmeans + allsd<- c(sd(nx1), sd(nx2), sd(nx3)) + names(allsd)<- c('Sample 1', 'Sample 2', 'Sample 3') + allsd + + #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab + load(file="/var/fisher/rcomp/createtable") + + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Identify the sample most similar to a standard normal distribution.',1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock2.wasp?par1=',par1,'&par2=nx1&par3=',answer,'&par0=1',sep=''),'The sample called nx1','',target='')) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock2.wasp?par1=',par1,'&par2=nx2&par3=',answer,'&par0=1',sep=''),'The sample called nx2','',target='')) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock2.wasp?par1=',par1,'&par2=nx3&par3=',answer,'&par0=1',sep=''),'The sample called nx3','',target='')) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock2.wasp?par1=',par1,'&par2=wnga&par3=',answer,'&par0=1',sep=''),'Avoid Guessing Penalty','',target='')) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/2kn831368093334.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Means of the three samples',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Sample',1,TRUE) + a<-table.element(a,'nx1',1,TRUE) + a<-table.element(a,'nx2',1,TRUE) + a<-table.element(a,'nx3',1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Value',1,TRUE) + a<-table.element(a,round(mean(nx1),3)) + a<-table.element(a,round(mean(nx2),3)) + a<-table.element(a,round(mean(nx3),3)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/3a86s1368093334.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Standard deviations of the three samples',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Sample',1,TRUE) + a<-table.element(a,'nx1',1,TRUE) + a<-table.element(a,'nx2',1,TRUE) + a<-table.element(a,'nx3',1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Value',1,TRUE) + a<-table.element(a,round(sd(nx1),3)) + a<-table.element(a,round(sd(nx2),3)) + a<-table.element(a,round(sd(nx3),3)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/432rt1368093334.tab") + postscript(file="/var/fisher/rcomp/tmp/5t6rd1368093334.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + hist(nx1) + dev.off() + postscript(file="/var/fisher/rcomp/tmp/6ngbg1368093334.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + hist(nx2) + dev.off() + postscript(file="/var/fisher/rcomp/tmp/7eu211368093334.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + hist(nx3) + dev.off() + postscript(file="/var/fisher/rcomp/tmp/8h2mo1368093334.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + pairs(x=cbind(nx1, nx2, nx3)) + dev.off() + } null device 1 > > try(system("convert tmp/5t6rd1368093334.ps tmp/5t6rd1368093334.png",intern=TRUE)) character(0) > try(system("convert tmp/6ngbg1368093334.ps tmp/6ngbg1368093334.png",intern=TRUE)) character(0) > try(system("convert tmp/7eu211368093334.ps tmp/7eu211368093334.png",intern=TRUE)) character(0) > try(system("convert tmp/8h2mo1368093334.ps tmp/8h2mo1368093334.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.432 0.454 2.865