R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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. > y <- c(14731798.37,16471559.62,15213975.95,17637387.4,17972385.83,16896235.55,16697955.94,19691579.52,15930700.75,17444615.98,17699369.88,15189796.81,15672722.75,17180794.3,17664893.45,17862884.98,16162288.88,17463628.82,16772112.17,19106861.48,16721314.25,18161267.85,18509941.2,17802737.97,16409869.75,17967742.04,20286602.27,19537280.81,18021889.62,20194317.23,19049596.62,20244720.94,21473302.24,19673603.19,21053177.29,20159479.84,18203628.31,21289464.94,20432335.71,17180395.07,15816786.32,15071819.75,14521120.61,15668789.39,14346884.11,13881008.13,15465943.69,14238232.92,13557713.21,16127590.29,16793894.2,16014007.43,16867867.15,16014583.21,15878594.85,18664899.14,17962530.06,17332692.2,19542066.35,17203555.19) > x <- c(13768040.14,17487530.67,16198106.13,17535166.38,16571771.60,16198892.67,16554237.93,19554176.37,15903762.33,18003781.65,18329610.38,16260733.42,14851949.20,18174068.44,18406552.23,18466459.42,16016524.60,17428458.32,17167191.42,19629987.60,17183629.01,18344657.85,19301440.71,18147463.68,16192909.22,18374420.60,20515191.95,18957217.20,16471529.53,18746813.27,19009453.59,19211178.55,20547653.75,19325754.03,20605542.58,20056915.06,16141449.72,20359793.22,19711553.27,15638580.70,14384486.00,13855616.12,14308336.46,15290621.44,14423755.53,13779681.49,15686348.94,14733828.17,12522497.94,16189383.57,16059123.25,16007123.26,15806842.33,15159951.13,15692144.17,18908869.11,16969881.42,16997477.78,19858875.65,17681170.13) > par1 = '0' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), 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: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > par1 <- as.numeric(par1) > library(lattice) > z <- as.data.frame(cbind(x,y)) > m <- lm(y~x) > summary(m) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -1375030 -521914 -131644 467584 1746814 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.841e+06 8.229e+05 2.237 0.0292 * x 9.055e-01 4.764e-02 19.008 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 728000 on 58 degrees of freedom Multiple R-squared: 0.8617, Adjusted R-squared: 0.8593 F-statistic: 361.3 on 1 and 58 DF, p-value: < 2.2e-16 > postscript(file="/var/www/html/rcomp/tmp/1ii5b1291139028.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(z,main='Scatterplot, lowess, and regression line') > lines(lowess(z),col='red') > abline(m) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2ii5b1291139028.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > m2 <- lm(m$fitted.values ~ x) > summary(m2) Call: lm(formula = m$fitted.values ~ x) Residuals: Min 1Q Median 3Q Max -2.010e-08 -3.278e-10 4.761e-10 1.152e-09 2.577e-09 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.841e+06 3.257e-09 5.651e+14 <2e-16 *** x 9.055e-01 1.886e-16 4.802e+15 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.881e-09 on 58 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 2.306e+31 on 1 and 58 DF, p-value: < 2.2e-16 > z2 <- as.data.frame(cbind(x,m$fitted.values)) > names(z2) <- list('x','Fitted') > plot(z2,main='Scatterplot, lowess, and regression line') > lines(lowess(z2),col='red') > abline(m2) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/33j691291139029.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > m3 <- lm(m$residuals ~ x) > summary(m3) Call: lm(formula = m$residuals ~ x) Residuals: Min 1Q Median 3Q Max -1375030 -521914 -131644 467584 1746814 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.831e-10 8.229e+05 7.09e-16 1 x -3.047e-17 4.764e-02 -6.40e-16 1 Residual standard error: 728000 on 58 degrees of freedom Multiple R-squared: 3.322e-32, Adjusted R-squared: -0.01724 F-statistic: 1.927e-30 on 1 and 58 DF, p-value: 1 > z3 <- as.data.frame(cbind(x,m$residuals)) > names(z3) <- list('x','Residuals') > plot(z3,main='Scatterplot, lowess, and regression line') > lines(lowess(z3),col='red') > abline(m3) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4eboc1291139029.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > m4 <- lm(m$fitted.values ~ m$residuals) > summary(m4) Call: lm(formula = m$fitted.values ~ m$residuals) Residuals: Min 1Q Median 3Q Max -4200269 -1160466 -71325 1472551 3118950 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.738e+07 2.346e+05 74.1 <2e-16 *** m$residuals -6.090e-16 3.277e-01 -1.86e-15 1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1817000 on 58 degrees of freedom Multiple R-squared: 3.552e-30, Adjusted R-squared: -0.01724 F-statistic: 2.06e-28 on 1 and 58 DF, p-value: 1 > z4 <- as.data.frame(cbind(m$residuals,m$fitted.values)) > names(z4) <- list('Residuals','Fitted') > plot(z4,main='Scatterplot, lowess, and regression line') > lines(lowess(z4),col='red') > abline(m4) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5ok5x1291139029.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > myr <- as.ts(m$residuals) > z5 <- as.data.frame(cbind(lag(myr,1),myr)) > names(z5) <- list('Lagged Residuals','Residuals') > plot(z5,main='Lag plot') > m5 <- lm(z5) > summary(m5) Call: lm(formula = z5) Residuals: Min 1Q Median 3Q Max -1403829 -431610 -146838 386541 1680778 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.268e+04 8.262e+04 -0.154 0.879 Residuals 5.008e-01 1.153e-01 4.344 5.81e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 634600 on 57 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.2488, Adjusted R-squared: 0.2356 F-statistic: 18.87 on 1 and 57 DF, p-value: 5.807e-05 > abline(m5) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6ok5x1291139029.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(m$residuals,main='Residual Histogram',xlab='Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/7zb4i1291139029.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if (par1 > 0) + { + densityplot(~m$residuals,col='black',main=paste('Density Plot bw = ',par1),bw=par1) + } else { + densityplot(~m$residuals,col='black',main='Density Plot') + } > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8zb4i1291139029.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(m$residuals,main='Residual Autocorrelation Function') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/99lm31291139029.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > qqline(x) > grid() > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Simple Linear Regression',5,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Statistics',1,TRUE) > a<-table.element(a,'Estimate',1,TRUE) > a<-table.element(a,'S.D.',1,TRUE) > a<-table.element(a,'T-STAT (H0: coeff=0)',1,TRUE) > a<-table.element(a,'P-value (two-sided)',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'constant term',header=TRUE) > a<-table.element(a,m$coefficients[[1]]) > sd <- sqrt(vcov(m)[1,1]) > a<-table.element(a,sd) > tstat <- m$coefficients[[1]]/sd > a<-table.element(a,tstat) > pval <- 2*(1-pt(abs(tstat),length(x)-2)) > a<-table.element(a,pval) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'slope',header=TRUE) > a<-table.element(a,m$coefficients[[2]]) > sd <- sqrt(vcov(m)[2,2]) > a<-table.element(a,sd) > tstat <- m$coefficients[[2]]/sd > a<-table.element(a,tstat) > pval <- 2*(1-pt(abs(tstat),length(x)-2)) > a<-table.element(a,pval) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/10ou1c1291139029.tab") > > try(system("convert tmp/1ii5b1291139028.ps tmp/1ii5b1291139028.png",intern=TRUE)) character(0) > try(system("convert tmp/2ii5b1291139028.ps tmp/2ii5b1291139028.png",intern=TRUE)) character(0) > try(system("convert tmp/33j691291139029.ps tmp/33j691291139029.png",intern=TRUE)) character(0) > try(system("convert tmp/4eboc1291139029.ps tmp/4eboc1291139029.png",intern=TRUE)) character(0) > try(system("convert tmp/5ok5x1291139029.ps tmp/5ok5x1291139029.png",intern=TRUE)) character(0) > try(system("convert tmp/6ok5x1291139029.ps tmp/6ok5x1291139029.png",intern=TRUE)) character(0) > try(system("convert tmp/7zb4i1291139029.ps tmp/7zb4i1291139029.png",intern=TRUE)) character(0) > try(system("convert tmp/8zb4i1291139029.ps tmp/8zb4i1291139029.png",intern=TRUE)) character(0) > try(system("convert tmp/99lm31291139029.ps tmp/99lm31291139029.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.860 1.397 4.232