R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 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. > x <- array(list(112285 + ,210907 + ,84786 + ,120982 + ,83123 + ,176508 + ,101193 + ,179321 + ,38361 + ,123185 + ,68504 + ,52746 + ,119182 + ,385534 + ,22807 + ,33170 + ,17140 + ,101645 + ,116174 + ,149061 + ,57635 + ,165446 + ,66198 + ,237213 + ,71701 + ,173326 + ,57793 + ,133131 + ,80444 + ,258873 + ,53855 + ,180083 + ,97668 + ,324799 + ,133824 + ,230964 + ,101481 + ,236785 + ,99645 + ,135473 + ,114789 + ,202925 + ,99052 + ,215147 + ,67654 + ,344297 + ,65553 + ,153935 + ,97500 + ,132943 + ,69112 + ,174724 + ,82753 + ,174415 + ,85323 + ,225548 + ,72654 + ,223632 + ,30727 + ,124817 + ,77873 + ,221698 + ,117478 + ,210767 + ,74007 + ,170266 + ,90183 + ,260561 + ,61542 + ,84853 + ,101494 + ,294424 + ,27570 + ,101011 + ,55813 + ,215641 + ,79215 + ,325107 + ,1423 + ,7176 + ,55461 + ,167542 + ,31081 + ,106408 + ,22996 + ,96560 + ,83122 + ,265769 + ,70106 + ,269651 + ,60578 + ,149112 + ,39992 + ,175824 + ,79892 + ,152871 + ,49810 + ,111665 + ,71570 + ,116408 + ,100708 + ,362301 + ,33032 + ,78800 + ,82875 + ,183167 + ,139077 + ,277965 + ,71595 + ,150629 + ,72260 + ,168809 + ,5950 + ,24188 + ,115762 + ,329267 + ,32551 + ,65029 + ,31701 + ,101097 + ,80670 + ,218946 + ,143558 + ,244052 + ,117105 + ,341570 + ,23789 + ,103597 + ,120733 + ,233328 + ,105195 + ,256462 + ,73107 + ,206161 + ,132068 + ,311473 + ,149193 + ,235800 + ,46821 + ,177939 + ,87011 + ,207176 + ,95260 + ,196553 + ,55183 + ,174184 + ,106671 + ,143246 + ,73511 + ,187559 + ,92945 + ,187681 + ,78664 + ,119016 + ,70054 + ,182192 + ,22618 + ,73566 + ,74011 + ,194979 + ,83737 + ,167488 + ,69094 + ,143756 + ,93133 + ,275541 + ,95536 + ,243199 + ,225920 + ,182999 + ,62133 + ,135649 + ,61370 + ,152299 + ,43836 + ,120221 + ,106117 + ,346485 + ,38692 + ,145790 + ,84651 + ,193339 + ,56622 + ,80953 + ,15986 + ,122774 + ,95364 + ,130585 + ,26706 + ,112611 + ,89691 + ,286468 + ,67267 + ,241066 + ,126846 + ,148446 + ,41140 + ,204713 + ,102860 + ,182079 + ,51715 + ,140344 + ,55801 + ,220516 + ,111813 + ,243060 + ,120293 + ,162765 + ,138599 + ,182613 + ,161647 + ,232138 + ,115929 + ,265318 + ,24266 + ,85574 + ,162901 + ,310839 + ,109825 + ,225060 + ,129838 + ,232317 + ,37510 + ,144966 + ,43750 + ,43287 + ,40652 + ,155754 + ,87771 + ,164709 + ,85872 + ,201940 + ,89275 + ,235454 + ,44418 + ,220801 + ,192565 + ,99466 + ,35232 + ,92661 + ,40909 + ,133328 + ,13294 + ,61361 + ,32387 + ,125930 + ,140867 + ,100750 + ,120662 + ,224549 + ,21233 + ,82316 + ,44332 + ,102010 + ,61056 + ,101523 + ,101338 + ,243511 + ,1168 + ,22938 + ,13497 + ,41566 + ,65567 + ,152474 + ,25162 + ,61857 + ,32334 + ,99923 + ,40735 + ,132487 + ,91413 + ,317394 + ,855 + ,21054 + ,97068 + ,209641 + ,44339 + ,22648 + ,14116 + ,31414 + ,10288 + ,46698 + ,65622 + ,131698 + ,16563 + ,91735 + ,76643 + ,244749 + ,110681 + ,184510 + ,29011 + ,79863 + ,92696 + ,128423 + ,94785 + ,97839 + ,8773 + ,38214 + ,83209 + ,151101 + ,93815 + ,272458 + ,86687 + ,172494 + ,34553 + ,108043 + ,105547 + ,328107 + ,103487 + ,250579 + ,213688 + ,351067 + ,71220 + ,158015 + ,23517 + ,98866 + ,56926 + ,85439 + ,91721 + ,229242 + ,115168 + ,351619 + ,111194 + ,84207 + ,51009 + ,120445 + ,135777 + ,324598 + ,51513 + ,131069 + ,74163 + ,204271 + ,51633 + ,165543 + ,75345 + ,141722 + ,33416 + ,116048 + ,83305 + ,250047 + ,98952 + ,299775 + ,102372 + ,195838 + ,37238 + ,173260 + ,103772 + ,254488 + ,123969 + ,104389 + ,27142 + ,136084 + ,135400 + ,199476 + ,21399 + ,92499 + ,130115 + ,224330 + ,24874 + ,135781 + ,34988 + ,74408 + ,45549 + ,81240 + ,6023 + ,14688 + ,64466 + ,181633 + ,54990 + ,271856 + ,1644 + ,7199 + ,6179 + ,46660 + ,3926 + ,17547 + ,32755 + ,133368 + ,34777 + ,95227 + ,73224 + ,152601 + ,27114 + ,98146 + ,20760 + ,79619 + ,37636 + ,59194 + ,65461 + ,139942 + ,30080 + ,118612 + ,24094 + ,72880 + ,69008 + ,65475 + ,54968 + ,99643 + ,46090 + ,71965 + ,27507 + ,77272 + ,10672 + ,49289 + ,34029 + ,135131 + ,46300 + ,108446 + ,24760 + ,89746 + ,18779 + ,44296 + ,21280 + ,77648 + ,40662 + ,181528 + ,28987 + ,134019 + ,22827 + ,124064 + ,18513 + ,92630 + ,30594 + ,121848 + ,24006 + ,52915 + ,27913 + ,81872 + ,42744 + ,58981 + ,12934 + ,53515 + ,22574 + ,60812 + ,41385 + ,56375 + ,18653 + ,65490 + ,18472 + ,80949 + ,30976 + ,76302 + ,63339 + ,104011 + ,25568 + ,98104 + ,33747 + ,67989 + ,4154 + ,30989 + ,19474 + ,135458 + ,35130 + ,73504 + ,39067 + ,63123 + ,13310 + ,61254 + ,65892 + ,74914 + ,4143 + ,31774 + ,28579 + ,81437 + ,51776 + ,87186 + ,21152 + ,50090 + ,38084 + ,65745 + ,27717 + ,56653 + ,32928 + ,158399 + ,11342 + ,46455 + ,19499 + ,73624 + ,16380 + ,38395 + ,36874 + ,91899 + ,48259 + ,139526 + ,16734 + ,52164 + ,28207 + ,51567 + ,30143 + ,70551 + ,41369 + ,84856 + ,45833 + ,102538 + ,29156 + ,86678 + ,35944 + ,85709 + ,36278 + ,34662 + ,45588 + ,150580 + ,45097 + ,99611 + ,3895 + ,19349 + ,28394 + ,99373 + ,18632 + ,86230 + ,2325 + ,30837 + ,25139 + ,31706 + ,27975 + ,89806 + ,14483 + ,62088 + ,13127 + ,40151 + ,5839 + ,27634 + ,24069 + ,76990 + ,3738 + ,37460 + ,18625 + ,54157 + ,36341 + ,49862 + ,24548 + ,84337 + ,21792 + ,64175 + ,26263 + ,59382 + ,23686 + ,119308 + ,49303 + ,76702 + ,25659 + ,103425 + ,28904 + ,70344 + ,2781 + ,43410 + ,29236 + ,104838 + ,19546 + ,62215 + ,22818 + ,69304 + ,32689 + ,53117 + ,5752 + ,19764 + ,22197 + ,86680 + ,20055 + ,84105 + ,25272 + ,77945 + ,82206 + ,89113 + ,32073 + ,91005 + ,5444 + ,40248 + ,20154 + ,64187 + ,36944 + ,50857 + ,8019 + ,56613 + ,30884 + ,62792) + ,dim=c(2 + ,288) + ,dimnames=list(c('Totsize' + ,'Timerfc') + ,1:288)) > y <- array(NA,dim=c(2,288),dimnames=list(c('Totsize','Timerfc'),1:288)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'TRUE' > par2 = '2' > par1 = '1' > ylab = 'Y Variable Name' > xlab = 'X Variable Name' > main = 'Title Goes Here' > par3 <- 'TRUE' > par2 <- '2' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: aston2 > #To cite this work: Ian E. Holliday, 2012, Simple Linear Regression (v1.0.5) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/Ian.Holliday/rwasp_Simple%20Regression%20Y%20~%20X.wasp/ > #Source of accompanying publication: > # > cat1 <- as.numeric(par1) > cat2<- as.numeric(par2) > intercept<-as.logical(par3) > x <- t(x) > xdf<-data.frame(t(y)) > (V1<-dimnames(y)[[1]][cat1]) [1] "Totsize" > (V2<-dimnames(y)[[1]][cat2]) [1] "Timerfc" > xdf <- data.frame(xdf[[cat1]], xdf[[cat2]]) > names(xdf)<-c('Y', 'X') > if(intercept == FALSE) (lmxdf<-lm(Y~ X - 1, data = xdf) ) else (lmxdf<-lm(Y~ X, data = xdf) ) Call: lm(formula = Y ~ X, data = xdf) Coefficients: (Intercept) X 7199.1708 0.3659 > sumlmxdf<-summary(lmxdf) > (aov.xdf<-aov(lmxdf) ) Call: aov(formula = lmxdf) Terms: X Residuals Sum of Squares 260789168191 208382472419 Deg. of Freedom 1 286 Residual standard error: 26992.78 Estimated effects may be unbalanced > (anova.xdf<-anova(lmxdf) ) Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X 1 2.6079e+11 2.6079e+11 357.93 < 2.2e-16 *** Residuals 286 2.0838e+11 7.2861e+08 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > #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() > nc <- ncol(sumlmxdf$'coefficients') > nr <- nrow(sumlmxdf$'coefficients') > a<-table.row.start(a) > a<-table.element(a,'Linear Regression Model', nc+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, lmxdf$call['formula'],nc+1) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'coefficients:',1,TRUE) > a<-table.element(a, ' ',nc,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, ' ',1,TRUE) > for(i in 1 : nc){ + a<-table.element(a, dimnames(sumlmxdf$'coefficients')[[2]][i],1,TRUE) + }#end header > a<-table.row.end(a) > for(i in 1: nr){ + a<-table.element(a,dimnames(sumlmxdf$'coefficients')[[1]][i] ,1,TRUE) + for(j in 1 : nc){ + a<-table.element(a, round(sumlmxdf$coefficients[i, j], digits=3), 1 ,FALSE) + } + a<-table.row.end(a) + } > a<-table.row.start(a) > a<-table.element(a, '- - - ',1,TRUE) > a<-table.element(a, ' ',nc,FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Std. Err. ',1,TRUE) > a<-table.element(a, paste(round(sumlmxdf$'sigma', digits=3), ' on ', sumlmxdf$'df'[2], 'df') ,nc, FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R-sq. ',1,TRUE) > a<-table.element(a, round(sumlmxdf$'r.squared', digits=3) ,nc, FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-sq. ',1,TRUE) > a<-table.element(a, round(sumlmxdf$'adj.r.squared', digits=3) ,nc, FALSE) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/1e8s61356093057.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'ANOVA Statistics', 5+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, ' ',1,TRUE) > a<-table.element(a, 'Df',1,TRUE) > a<-table.element(a, 'Sum Sq',1,TRUE) > a<-table.element(a, 'Mean Sq',1,TRUE) > a<-table.element(a, 'F value',1,TRUE) > a<-table.element(a, 'Pr(>F)',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, V2,1,TRUE) > a<-table.element(a, anova.xdf$Df[1]) > a<-table.element(a, round(anova.xdf$'Sum Sq'[1], digits=3)) > a<-table.element(a, round(anova.xdf$'Mean Sq'[1], digits=3)) > a<-table.element(a, round(anova.xdf$'F value'[1], digits=3)) > a<-table.element(a, round(anova.xdf$'Pr(>F)'[1], digits=3)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residuals',1,TRUE) > a<-table.element(a, anova.xdf$Df[2]) > a<-table.element(a, round(anova.xdf$'Sum Sq'[2], digits=3)) > a<-table.element(a, round(anova.xdf$'Mean Sq'[2], digits=3)) > a<-table.element(a, ' ') > a<-table.element(a, ' ') > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/26jga1356093057.tab") > postscript(file="/var/wessaorg/rcomp/tmp/3v5971356093057.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(Y~ X, data=xdf, xlab=V2, ylab=V1, main='Regression Solution') > if(intercept == TRUE) abline(coef(lmxdf), col='red') > if(intercept == FALSE) abline(0.0, coef(lmxdf), col='red') > dev.off() null device 1 > library(car) Loading required package: MASS Loading required package: nnet > postscript(file="/var/wessaorg/rcomp/tmp/4k1u51356093057.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qq.plot(resid(lmxdf), main='QQplot of Residuals of Fit') Warning message: 'qq.plot' is deprecated. Use 'qqPlot' instead. See help("Deprecated") and help("car-deprecated"). > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5tooh1356093057.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(xdf$X, resid(lmxdf), main='Scatterplot of Residuals of Model Fit') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6vy761356093057.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot.lm(lmxdf, which=4) > dev.off() null device 1 > > try(system("convert tmp/3v5971356093057.ps tmp/3v5971356093057.png",intern=TRUE)) character(0) > try(system("convert tmp/4k1u51356093057.ps tmp/4k1u51356093057.png",intern=TRUE)) character(0) > try(system("convert tmp/5tooh1356093057.ps tmp/5tooh1356093057.png",intern=TRUE)) character(0) > try(system("convert tmp/6vy761356093057.ps tmp/6vy761356093057.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.577 0.470 3.054