R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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. > par3 = '57680412a132169c7ae4a94256cc92c0' > par2 = 'nx2' > par1 = 'a-101530532' > par3 <- '57680412a132169c7ae4a94256cc92c0' > par2 <- 'nx2' > par1 <- 'a-101530532' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: aston2 > #To cite this work: I. Holliday, 2012, MC Mock Q3 (v1.1.1) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/Ian.Holliday/rwasp_May_mock2.wasp/ > #Source of accompanying publication: > # > library(digest) > par4 <- 0 > if(exists('par2')) { + if (par2 != 'wnga') { + if (digest(par2,ser=F) == par3) { + par4 = par4 + 4 + lastanswer <- 'correct' + } + if (digest(par2,ser=F) != par3) { + par4 = par4 - 2 + lastanswer <- 'incorrect' + } + } + if (par2 == 'wnga') { + lastanswer <- 'skipped question' + } + } > data(faithful) > myran <- runif(1) > if (myran <= 1) { + x1 <- rnorm(100, sd=sd(faithful$wait[1:100]), mean=mean(faithful$wait[1:100]) ) + x2 <- faithful$wait[1:100] + x3 <- faithful$wait[101:200] + answer <- 'x23' + } > if (myran < 0.66) { + x2 <- rnorm(100, sd=sd(faithful$wait[1:100]), mean=mean(faithful$wait[1:100]) ) + x3 <- faithful$wait[1:100] + x1 <- faithful$wait[101:200] + answer <- 'x31' + } > if (myran < 0.33) { + x3 <- rnorm(100, sd=sd(faithful$wait[1:100]), mean=mean(faithful$wait[1:100]) ) + x1 <- faithful$wait[1:100] + x2 <- faithful$wait[101:200] + answer <- 'x12' + } > answer <- digest(answer,ser=F) > allmeans<- c(mean(x1),mean(x2),mean(x3)) > names(allmeans)<-c('Sample 1', 'Sample 2', 'Sample 3') > allmeans Sample 1 Sample 2 Sample 3 70.95000 71.16000 69.02492 > allsd<- c(sd(x1), sd(x2), sd(x3)) > names(allsd)<- c('Sample 1', 'Sample 2', 'Sample 3') > allsd Sample 1 Sample 2 Sample 3 12.62223 14.53294 12.68434 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Your last Question',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,lastanswer,1,TRUE) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/1nvyp1337525759.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'From the information given below which two samples are bimodal?',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock3.wasp?par1=',par1,'&par2=x12&par3=',answer,'&par0=1&par4=',par4,sep=''),'Sample 1 and Sample 2','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock3.wasp?par1=',par1,'&par2=x23&par3=',answer,'&par0=1&par4=',par4,sep=''),'Sample 2 and Sample 3','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock3.wasp?par1=',par1,'&par2=x31&par3=',answer,'&par0=1&par4=',par4,sep=''),'Sample 1 and Sample 3','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock3.wasp?par1=',par1,'&par2=wnga&par3=',answer,'&par0=1&par4=',par4,sep=''),'Avoid Guessing Penalty','',target='')) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/2ar311337525759.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,'x1',1,TRUE) > a<-table.element(a,'x2',1,TRUE) > a<-table.element(a,'x3',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(x1),3)) > a<-table.element(a,round(mean(x2),3)) > a<-table.element(a,round(mean(x3),3)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/3ypbl1337525759.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,'x1',1,TRUE) > a<-table.element(a,'x2',1,TRUE) > a<-table.element(a,'x3',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(x1),3)) > a<-table.element(a,round(sd(x2),3)) > a<-table.element(a,round(sd(x3),3)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/4r8dv1337525759.tab") > postscript(file="/var/wessaorg/rcomp/tmp/5vze91337525759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(density(x1),main='Kernel Density Plot of Sample 1') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6t0da1337525759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(density(x2),main='Kernel Density Plot of Sample 2') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/75n9v1337525759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(density(x3),main='Kernel Density Plot of Sample 3') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/8wh4j1337525759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pairs(x=cbind(x1, x2, x3),main='Pairs Plot of the three samples') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/9c29n1337525759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1, main='Normal Q-Q Plot Sample 1') > qqline(x1, col='red', lwd=2) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/10udot1337525759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x2, main='Normal Q-Q Plot Sample 2') > qqline(x2, col='red', lwd=2) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/112zet1337525759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x3, main='Normal Q-Q Plot Sample 3') > qqline(x3, col='red', lwd=2) > dev.off() null device 1 > > try(system("convert tmp/5vze91337525759.ps tmp/5vze91337525759.png",intern=TRUE)) character(0) > try(system("convert tmp/6t0da1337525759.ps tmp/6t0da1337525759.png",intern=TRUE)) character(0) > try(system("convert tmp/75n9v1337525759.ps tmp/75n9v1337525759.png",intern=TRUE)) character(0) > try(system("convert tmp/8wh4j1337525759.ps tmp/8wh4j1337525759.png",intern=TRUE)) character(0) > try(system("convert tmp/9c29n1337525759.ps tmp/9c29n1337525759.png",intern=TRUE)) character(0) > try(system("convert tmp/10udot1337525759.ps tmp/10udot1337525759.png",intern=TRUE)) character(0) > try(system("convert tmp/112zet1337525759.ps tmp/112zet1337525759.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.916 0.464 2.388