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(1980 + ,197632 + ,1980 + ,238592 + ,1981 + ,716800 + ,1981 + ,348160 + ,1981 + ,471040 + ,1981 + ,307200 + ,1981 + ,302080 + ,1981 + ,295936 + ,1981 + ,195584 + ,1981 + ,155648 + ,1981 + ,141312 + ,1982 + ,266240 + ,1983 + ,323584 + ,1983 + ,276480 + ,1983 + ,194560 + ,1983 + ,179200 + ,1983 + ,168960 + ,1983 + ,134144 + ,1983 + ,121856 + ,1984 + ,286720 + ,1984 + ,276480 + ,1984 + ,174080 + ,1984 + ,163840 + ,1984 + ,143360 + ,1984 + ,136192 + ,1984 + ,122880 + ,1984 + ,120832 + ,1984 + ,306176 + ,1984 + ,289792 + ,1984 + ,219136 + ,1984 + ,204800 + ,1984 + ,185344 + ,1984 + ,168960 + ,1984 + ,161792 + ,1984 + ,143360 + ,1984 + ,121856 + ,1984 + ,110592 + ,1984 + ,81920 + ,1985 + ,72704 + ,1987 + ,92160 + ,1987 + ,61440 + ,1987 + ,46080 + ,1988 + ,40960 + ,1988 + ,33792 + ,1988 + ,27648 + ,1988 + ,30720 + ,1988 + ,16384 + ,1989 + ,54272 + ,1989 + ,36864 + ,1989 + ,12288 + ,1990 + ,9216 + ,1991 + ,7168 + ,1992 + ,4096 + ,1993 + ,2048 + ,1994 + ,972.8 + ,1995 + ,870.4 + ,1995 + ,901.12 + ,1995 + ,829.44 + ,1995 + ,1013.76 + ,1995 + ,1290.24 + ,1995 + ,944.128 + ,1995 + ,905.216 + ,1995 + ,685.056 + ,1995 + ,774.144 + ,1995 + ,702.464 + ,1996 + ,302.08 + ,1996 + ,269.312 + ,1996 + ,265.216 + ,1996 + ,211.968 + ,1996 + ,177.152 + ,1997 + ,185.344 + ,1997 + ,151.552 + ,1997 + ,144.384 + ,1997 + ,156.672 + ,1997 + ,124.928 + ,1997 + ,120.832 + ,1997 + ,120.832 + ,1997 + ,106.496 + ,1997 + ,112.64 + ,1997 + ,106.496 + ,1997 + ,104.448 + ,1997 + ,103.424 + ,1997 + ,99.9424 + ,1997 + ,87.4496 + ,1997 + ,81.92 + ,1997 + ,103.424 + ,1997 + ,101.1712 + ,1997 + ,99.4304 + ,1997 + ,97.5872 + ,1997 + ,95.3344 + ,1998 + ,97.4848 + ,1998 + ,95.8464 + ,1998 + ,88.3712 + ,1998 + ,85.9136 + ,1998 + ,80.384 + ,1998 + ,80.0768 + ,1998 + ,87.7568 + ,1998 + ,87.6544 + ,1998 + ,76.0832 + ,1998 + ,62.5664 + ,1998 + ,79.0528 + ,1998 + ,78.1312 + ,1998 + ,68.096 + ,1998 + ,67.8912 + ,1998 + ,65.3312 + ,1998 + ,77.2096 + ,1998 + ,74.9568 + ,1998 + ,67.6864 + ,1998 + ,64.4096 + ,1998 + ,60.7232 + ,1998 + ,83.5584 + ,1998 + ,70.3488 + ,1998 + ,67.6864 + ,1998 + ,60.3136 + ,1998 + ,61.952 + ,1998 + ,62.464 + ,1998 + ,54.784 + ,1998 + ,56.4224 + ,1998 + ,60.5184 + ,1998 + ,57.0368 + ,1998 + ,54.0672 + ,1998 + ,53.5552 + ,1998 + ,53.5552 + ,1998 + ,55.9104 + ,1998 + ,47.5136 + ,1998 + ,53.1456 + ,1998 + ,51.5072 + ,1998 + ,53.248 + ,1998 + ,48.5376 + ,1998 + ,49.0496 + ,1998 + ,43.6224 + ,1999 + ,44.1344 + ,1999 + ,38.6048 + ,1999 + ,37.376 + ,1999 + ,31.4368 + ,1999 + ,35.4304 + ,1999 + ,34.5088 + ,1999 + ,32.9728 + ,1999 + ,32.8704 + ,1999 + ,32.256 + ,1999 + ,32.1536 + ,1999 + ,30.3104 + ,1999 + ,28.9792 + ,1999 + ,33.0752 + ,1999 + ,28.2624 + ,1999 + ,27.7504 + ,1999 + ,25.088 + ,1999 + ,29.4912 + ,1999 + ,28.0576 + ,1999 + ,26.9312 + ,1999 + ,18.944 + ,1999 + ,21.6064 + ,1999 + ,21.0944 + ,1999 + ,20.3776 + ,1999 + ,22.9376 + ,1999 + ,21.6064 + ,1999 + ,21.0944 + ,1999 + ,21.0944 + ,1999 + ,18.944 + ,1999 + ,22.8352 + ,1999 + ,22.528 + ,1999 + ,21.8112 + ,1999 + ,21.8112 + ,1999 + ,18.8416 + ,1999 + ,17.7152 + ,1999 + ,17.3056 + ,1999 + ,16.896 + ,1999 + ,16.6912 + ,1999 + ,15.36 + ,2000 + ,19.73 + ,2000 + ,16.86 + ,2000 + ,16.83 + ,2000 + ,16.76 + ,2000 + ,16.73 + ,2000 + ,16.45 + ,2000 + ,15.82 + ,2000 + ,15.8 + ,2000 + ,15.44 + ,2000 + ,14.29 + ,2000 + ,11.95 + ,2000 + ,15.65 + ,2000 + ,15.06 + ,2000 + ,14.89 + ,2000 + ,14.72 + ,2000 + ,14.58 + ,2000 + ,14.33 + ,2000 + ,14.29 + ,2000 + ,13.88 + ,2000 + ,13.8 + ,2000 + ,13.63 + ,2000 + ,13.47 + ,2000 + ,12.95 + ,2000 + ,12.74 + ,2000 + ,12.54 + ,2000 + ,12.48 + ,2000 + ,11.81 + ,2000 + ,15.22 + ,2000 + ,12.27 + ,2000 + ,11.5 + ,2000 + ,14.57 + ,2000 + ,12.42 + ,2000 + ,11.24 + ,2000 + ,10.06 + ,2000 + ,10.91 + ,2000 + ,10.82 + ,2000 + ,10.41 + ,2000 + ,9.25 + ,2000 + ,8.02 + ,2000 + ,11.5 + ,2000 + ,10.06 + ,2000 + ,9.58 + ,2000 + ,9.14 + ,2000 + ,8.94 + ,2000 + ,7.45 + ,2000 + ,7.27 + ,2000 + ,7.27 + ,2000 + ,7.14 + ,2000 + ,7.88 + ,2000 + ,7.25 + ,2000 + ,6.9 + ,2001 + ,7.31 + ,2001 + ,7.26 + ,2001 + ,6.84 + ,2001 + ,7.48 + ,2001 + ,6.48 + ,2001 + ,5.72 + ,2001 + ,6.82 + ,2001 + ,6.56 + ,2001 + ,6.49 + ,2001 + ,5.87 + ,2001 + ,6.33 + ,2001 + ,6.33 + ,2001 + ,5.75 + ,2001 + ,4.41 + ,2001 + ,2.99 + ,2001 + ,4.57 + ,2002 + ,4.31 + ,2002 + ,3.71 + ,2002 + ,2.65 + ,2002 + ,2.88 + ,2002 + ,3.74 + ,2002 + ,2.59 + ,2002 + ,2.07 + ,2002 + ,2.59 + ,2002 + ,2.88 + ,2002 + ,2.59 + ,2002 + ,2.68 + ,2003 + ,2.58 + ,2003 + ,1.51 + ,2003 + ,1.93 + ,2003 + ,1.78 + ,2003 + ,1.61 + ,2003 + ,1.51 + ,2003 + ,1.42 + ,2003 + ,1.39 + ,2004 + ,1.94 + ,2004 + ,1.94 + ,2004 + ,1.7 + ,2004 + ,1.57 + ,2004 + ,1.41 + ,2004 + ,1.38 + ,2004 + ,1.24 + ,2004 + ,1.22 + ,2004 + ,1.15 + ,2004 + ,1.24 + ,2004 + ,1.21 + ,2004 + ,1.2 + ,2004 + ,0.671 + ,2004 + ,0.598 + ,2005 + ,0.719 + ,2005 + ,0.719 + ,2005 + ,0.719 + ,2005 + ,0.575 + ,2005 + ,0.598 + ,2007 + ,0.426 + ,2007 + ,0.411 + ,2007 + ,0.377 + ,2007 + ,0.371 + ,2007 + ,0.367 + ,2007 + ,0.35 + ,2007 + ,0.333 + ,2007 + ,0.306 + ,2007 + ,0.302 + ,2007 + ,0.287 + ,2010 + ,0.164 + ,2010 + ,0.134 + ,2010 + ,0.0909 + ,2010 + ,0.0688 + ,2010 + ,0.115 + ,2010 + ,0.113 + ,2010 + ,0.0821) + ,dim=c(2 + ,291) + ,dimnames=list(c('Year' + ,'CPGB') + ,1:291)) > y <- array(NA,dim=c(2,291),dimnames=list(c('Year','CPGB'),1:291)) > 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' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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] "CPGB" > (V2<-dimnames(y)[[1]][cat2]) [1] "Year" > 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 19131308 -9563 > sumlmxdf<-summary(lmxdf) > (aov.xdf<-aov(lmxdf) ) Call: aov(formula = lmxdf) Terms: X Residuals Sum of Squares 1.239775e+12 8.974233e+11 Deg. of Freedom 1 289 Residual standard error: 55724.96 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 1.2398e+12 1.2398e+12 399.25 < 2.2e-16 *** Residuals 289 8.9742e+11 3.1053e+09 --- 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) + }# end cols + a<-table.row.end(a) + } #end rows > 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/15xmr1311000602.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/2hud01311000602.tab") > postscript(file="/var/wessaorg/rcomp/tmp/35aw51311000602.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/4p1he1311000602.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/5z2981311000602.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/6h7qc1311000602.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/35aw51311000602.ps tmp/35aw51311000602.png",intern=TRUE)) character(0) > try(system("convert tmp/4p1he1311000602.ps tmp/4p1he1311000602.png",intern=TRUE)) character(0) > try(system("convert tmp/5z2981311000602.ps tmp/5z2981311000602.png",intern=TRUE)) character(0) > try(system("convert tmp/6h7qc1311000602.ps tmp/6h7qc1311000602.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.409 0.229 1.635