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. > par4 = '8' > par3 = 'c0828e0381730befd1f7a025057c74fb' > par2 = 's3' > par1 = 'a-101530532' > par4 <- '8' > par3 <- 'c0828e0381730befd1f7a025057c74fb' > par2 <- 's3' > 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 Q7 (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_May_mock4.wasp/ > #Source of accompanying publication: > # > library(digest) > par4 <- as.numeric(par4) > 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' + } + } > attach(anscombe) > anslm<-lm(y1~x1) > y5<-predict(anslm)+rnorm(length(x1), sd=sd(resid(anslm)*1.5)) > x5 <- x1 > y5<-scale(y5, scale=FALSE) > y5<- y5+mean(y1) > allmeans<-c(mean(y1), mean(y2), mean(y3), mean(y5)) > names(allmeans)<-c('Mean Y1', 'Mean Y2', 'Mean Y3', 'Mean Y5') > allmeans Mean Y1 Mean Y2 Mean Y3 Mean Y5 7.500909 7.500909 7.500000 7.500909 > allsd<- c(sd(y1), sd(y2), sd(y3), sd(y5)) > names(allsd)<-c('sd Y1', 'sd Y2', 'sd Y3', 'sd Y5') > allsd sd Y1 sd Y2 sd Y3 sd Y5 2.031568 2.031657 2.030424 2.305193 > allcor<-c(cor(x1,y1), cor(x2,y2), cor(x3,y3), cor(x5,y5)) > names(allcor)<-c('cor(x1,y1)','cor(x2,y2)', 'cor(x3,y3)', 'cor(x5,y5)') > allcor cor(x1,y1) cor(x2,y2) cor(x3,y3) cor(x5,y5) 0.8164205 0.8162365 0.8162867 0.6364923 > postscript(file="/var/wessaorg/rcomp/tmp/1tkcs1337528370.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > layout(matrix(c(1,2,3,4), 2,2)) > plot(x1, y1) > plot(x2, y2) > plot(x3, y3) > plot(x5, y5) > dev.off() null device 1 > answer <- 'p23' > answer <- digest(answer,ser=F) > > #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/2gg3w1337528370.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Based on the statistical evidence given, which of the stated pairs of covariates are most dissimilar?',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock5.wasp?par1=',par1,'&par2=p13&par3=',answer,'&par0=1&par4=',par4,sep=''),'{x1,y1} and {x3,y3}','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock5.wasp?par1=',par1,'&par2=p23&par3=',answer,'&par0=1&par4=',par4,sep=''),'{x2,y2} and {x3,y3}','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock5.wasp?par1=',par1,'&par2=p15&par3=',answer,'&par0=1&par4=',par4,sep=''),'{x1,y1} and {x5,y5}','',target='')) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink(paste('http://www.wessa.net/rwasp_May_mock5.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/3p13n1337528370.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Means of the Y variables of each pair',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Mean Y1',1,TRUE) > a<-table.element(a,'Mean Y2',1,TRUE) > a<-table.element(a,'Mean Y3',1,TRUE) > a<-table.element(a,'Mean Y5',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,round(mean(y1),3)) > a<-table.element(a,round(mean(y2),3)) > a<-table.element(a,round(mean(y3),3)) > a<-table.element(a,round(mean(y5),3)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/47nh41337528370.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Standard Deviations of the Y variables of each pair',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'sd Y1',1,TRUE) > a<-table.element(a,'sd Y2',1,TRUE) > a<-table.element(a,'sd Y3',1,TRUE) > a<-table.element(a,'sd Y5',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,round(sd(y1),3)) > a<-table.element(a,round(sd(y2),3)) > a<-table.element(a,round(sd(y3),3)) > a<-table.element(a,round(sd(y5),3)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/5pstg1337528370.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Correlations of each X-Y variable pair.',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'cor(x1,y1)',1,TRUE) > a<-table.element(a,'cor(x2,y2)',1,TRUE) > a<-table.element(a,'cor(x3,y3)',1,TRUE) > a<-table.element(a,'cor(x5,y5)',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,round(cor(x1,y1),3)) > a<-table.element(a,round(cor(x2,y2),3)) > a<-table.element(a,round(cor(x3,y3),3)) > a<-table.element(a,round(cor(x5,y5),3)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/6avnp1337528370.tab") > > try(system("convert tmp/1tkcs1337528370.ps tmp/1tkcs1337528370.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.588 0.155 0.737