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. > x <- array(list(77 + ,77 + ,58 + ,51 + ,53 + ,54 + ,68 + ,70 + ,59 + ,59 + ,76 + ,76 + ,76 + ,77 + ,69 + ,73 + ,71 + ,71 + ,65 + ,64 + ,70 + ,75 + ,166 + ,56 + ,51 + ,52 + ,64 + ,64 + ,52 + ,57 + ,65 + ,66 + ,92 + ,101 + ,62 + ,62 + ,76 + ,75 + ,61 + ,61 + ,119 + ,124 + ,61 + ,61 + ,65 + ,66 + ,66 + ,70 + ,54 + ,59 + ,50 + ,50 + ,63 + ,61 + ,58 + ,60 + ,39 + ,41 + ,101 + ,100 + ,71 + ,71 + ,75 + ,73 + ,79 + ,76 + ,52 + ,52 + ,68 + ,63 + ,64 + ,65 + ,56 + ,54 + ,69 + ,69 + ,88 + ,86 + ,65 + ,67 + ,54 + ,53 + ,80 + ,80 + ,63 + ,59 + ,78 + ,80 + ,85 + ,82 + ,54 + ,55 + ,73 + ,65 + ,49 + ,65 + ,54 + ,56 + ,75 + ,75 + ,82 + ,85 + ,56 + ,57 + ,74 + ,73 + ,102 + ,107 + ,64 + ,65 + ,65 + ,64 + ,66 + ,65 + ,73 + ,74 + ,75 + ,70 + ,57 + ,58 + ,68 + ,69 + ,71 + ,71 + ,71 + ,76 + ,78 + ,75 + ,97 + ,98 + ,60 + ,59 + ,64 + ,63 + ,64 + ,62 + ,52 + ,51 + ,80 + ,76 + ,62 + ,61 + ,66 + ,66 + ,55 + ,54 + ,56 + ,57 + ,50 + ,50 + ,50 + ,65 + ,50 + ,55 + ,63 + ,64 + ,69 + ,70 + ,69 + ,70 + ,61 + ,60 + ,55 + ,56 + ,53 + ,52 + ,60 + ,55 + ,56 + ,56 + ,59 + ,61 + ,62 + ,66 + ,53 + ,53 + ,57 + ,59 + ,57 + ,56 + ,70 + ,68 + ,56 + ,56 + ,84 + ,86 + ,69 + ,71 + ,88 + ,87 + ,56 + ,57 + ,103 + ,101 + ,50 + ,50 + ,52 + ,52 + ,55 + ,65 + ,55 + ,55 + ,63 + ,63 + ,47 + ,47 + ,45 + ,45 + ,62 + ,63 + ,53 + ,51 + ,52 + ,51 + ,57 + ,55 + ,64 + ,64 + ,59 + ,55 + ,84 + ,90 + ,79 + ,79 + ,55 + ,57 + ,67 + ,67 + ,76 + ,77 + ,62 + ,62 + ,83 + ,83 + ,96 + ,94 + ,75 + ,76 + ,65 + ,66 + ,78 + ,77 + ,69 + ,73 + ,68 + ,68 + ,55 + ,55 + ,67 + ,65 + ,52 + ,56 + ,47 + ,65 + ,45 + ,45 + ,68 + ,68 + ,44 + ,44 + ,62 + ,61 + ,87 + ,89 + ,56 + ,53 + ,50 + ,47 + ,83 + ,84 + ,53 + ,53 + ,64 + ,62 + ,62 + ,65 + ,90 + ,91 + ,85 + ,83 + ,66 + ,68 + ,52 + ,53 + ,53 + ,55 + ,54 + ,55 + ,64 + ,66 + ,55 + ,55 + ,55 + ,55 + ,59 + ,55 + ,70 + ,67 + ,88 + ,86 + ,57 + ,58 + ,47 + ,47 + ,47 + ,45 + ,55 + ,65 + ,48 + ,44 + ,54 + ,58 + ,69 + ,68 + ,59 + ,65 + ,58 + ,65 + ,57 + ,56 + ,51 + ,50 + ,54 + ,54 + ,53 + ,52 + ,59 + ,58 + ,56 + ,58 + ,59 + ,59 + ,63 + ,62 + ,66 + ,66 + ,96 + ,95 + ,53 + ,50 + ,76 + ,75 + ,54 + ,65 + ,61 + ,61 + ,82 + ,65 + ,62 + ,64 + ,71 + ,68 + ,60 + ,65 + ,66 + ,67 + ,81 + ,82 + ,68 + ,68 + ,80 + ,78 + ,43 + ,65 + ,82 + ,65 + ,63 + ,59 + ,70 + ,70 + ,56 + ,56 + ,60 + ,55 + ,58 + ,54 + ,76 + ,75 + ,50 + ,49 + ,88 + ,93 + ,89 + ,86 + ,59 + ,59 + ,51 + ,51 + ,62 + ,61 + ,74 + ,71 + ,83 + ,80 + ,81 + ,65 + ,90 + ,91 + ,79 + ,81) + ,dim=c(2 + ,200) + ,dimnames=list(c('dWt' + ,'dTg') + ,1:200)) > y <- array(NA,dim=c(2,200),dimnames=list(c('dWt','dTg'),1:200)) > 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 = '1' > par1 = '2' > ylab = 'Y Variable Name' > xlab = 'X Variable Name' > main = 'Title Goes Here' > 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] "dTg" > (V2<-dimnames(y)[[1]][cat2]) [1] "dWt" > 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 18.9905 0.7079 > sumlmxdf<-summary(lmxdf) > (aov.xdf<-aov(lmxdf) ) Call: aov(formula = lmxdf) Terms: X Residuals Sum of Squares 22722.59 11826.43 Deg. of Freedom 1 198 Residual standard error: 7.728484 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 22723 22722.6 380.43 < 2.2e-16 *** Residuals 198 11826 59.7 --- 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/1pnkq1338545263.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/2o5mk1338545263.tab") > postscript(file="/var/wessaorg/rcomp/tmp/3kmxx1338545263.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 Loading required package: survival Loading required package: splines > postscript(file="/var/wessaorg/rcomp/tmp/4hzyx1338545263.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/5nziu1338545263.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/69cqc1338545263.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/3kmxx1338545263.ps tmp/3kmxx1338545263.png",intern=TRUE)) character(0) > try(system("convert tmp/4hzyx1338545263.ps tmp/4hzyx1338545263.png",intern=TRUE)) character(0) > try(system("convert tmp/5nziu1338545263.ps tmp/5nziu1338545263.png",intern=TRUE)) character(0) > try(system("convert tmp/69cqc1338545263.ps tmp/69cqc1338545263.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.423 0.357 1.779