R version 2.11.1 (2010-05-31) Copyright (C) 2010 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(64.033 + ,65.679 + ,62.776 + ,67.024 + ,67.988 + ,69.529 + ,70.158 + ,69.410 + ,74.049 + ,66.197 + ,67.043 + ,67.459 + ,65.512 + ,64.665 + ,65.382 + ,66.607 + ,58.387 + ,57.564 + ,58.431 + ,65.012 + ,64.176 + ,65.509 + ,65.163 + ,62.158 + ,64.429 + ,61.325 + ,65.339 + ,69.921 + ,70.782 + ,73.287 + ,70.300 + ,71.579 + ,70.700 + ,75.740 + ,75.850 + ,76.381 + ,77.388 + ,75.519 + ,75.573 + ,76.668 + ,79.387 + ,76.876 + ,81.021 + ,82.883 + ,84.016 + ,85.047 + ,85.757 + ,84.792 + ,83.811 + ,84.691 + ,83.496 + ,85.470 + ,85.212 + ,84.802 + ,85.809 + ,85.119 + ,85.228 + ,85.302 + ,85.883 + ,86.315 + ,86.195 + ,88.227 + ,86.411 + ,89.120 + ,88.030 + ,89.372 + ,91.869 + ,92.845 + ,92.787 + ,94.711 + ,94.204 + ,97.217 + ,95.118 + ,93.688 + ,93.140 + ,91.516 + ,90.957 + ,90.372 + ,89.749 + ,85.813 + ,86.026 + ,83.933 + ,83.602 + ,83.384 + ,76.369 + ,60.808 + ,48.071 + ,42.604 + ,41.402 + ,62.121 + ,79.739 + ,79.006 + ,74.472 + ,75.956 + ,75.041 + ,74.873 + ,72.922 + ,70.472 + ,71.423 + ,71.363 + ,73.297 + ,72.081 + ,70.488 + ,65.544 + ,64.450 + ,61.698 + ,61.352 + ,61.072 + ,63.722 + ,61.987 + ,53.802 + ,47.818 + ,50.998 + ,58.438 + ,60.143 + ,61.854 + ,70.987 + ,70.389 + ,72.175 + ,70.243 + ,69.616 + ,69.443 + ,70.833 + ,71.059 + ,72.218 + ,72.647 + ,73.299 + ,73.756 + ,75.557 + ,78.172 + ,75.624 + ,76.959 + ,74.994 + ,76.841 + ,78.043 + ,75.187 + ,73.387 + ,70.798 + ,68.722 + ,68.396 + ,68.466 + ,67.675 + ,65.248 + ,62.974 + ,59.801 + ,57.894 + ,58.592 + ,59.249 + ,59.554 + ,59.753 + ,60.877 + ,60.532 + ,58.452 + ,56.955 + ,56.437 + ,55.588 + ,56.702 + ,57.062 + ,57.826 + ,58.755 + ,60.250 + ,61.142 + ,60.690 + ,58.495 + ,56.020 + ,55.814 + ,56.489 + ,56.587 + ,55.714 + ,55.611 + ,56.093 + ,55.929 + ,54.181 + ,54.810 + ,56.189 + ,57.427 + ,59.432 + ,58.951) > x <- c(67.643 + ,69.371 + ,66.294 + ,70.768 + ,71.774 + ,73.388 + ,74.040 + ,73.238 + ,78.121 + ,69.825 + ,71.099 + ,70.676 + ,69.515 + ,68.246 + ,68.594 + ,70.405 + ,61.223 + ,60.542 + ,61.952 + ,68.173 + ,67.240 + ,68.739 + ,69.234 + ,65.570 + ,67.408 + ,64.630 + ,68.848 + ,73.370 + ,74.292 + ,76.525 + ,74.368 + ,75.674 + ,74.868 + ,79.824 + ,80.022 + ,79.942 + ,80.622 + ,80.079 + ,79.212 + ,80.626 + ,83.551 + ,80.407 + ,85.053 + ,86.399 + ,88.536 + ,89.008 + ,89.652 + ,88.904 + ,87.472 + ,88.631 + ,87.221 + ,88.759 + ,90.127 + ,88.709 + ,90.030 + ,88.697 + ,88.762 + ,89.475 + ,88.936 + ,90.411 + ,90.004 + ,92.725 + ,90.252 + ,93.226 + ,92.575 + ,93.125 + ,95.987 + ,97.175 + ,97.321 + ,98.577 + ,99.026 + ,101.851 + ,99.958 + ,97.875 + ,97.927 + ,95.149 + ,94.551 + ,93.999 + ,93.297 + ,89.901 + ,89.742 + ,87.096 + ,86.863 + ,86.718 + ,80.020 + ,63.483 + ,51.289 + ,44.071 + ,43.654 + ,66.115 + ,84.518 + ,83.395 + ,78.307 + ,80.049 + ,78.346 + ,78.317 + ,75.918 + ,73.739 + ,74.530 + ,74.179 + ,76.974 + ,75.408 + ,73.336 + ,69.210 + ,67.286 + ,64.606 + ,64.159 + ,64.423 + ,66.411 + ,64.270 + ,56.521 + ,50.599 + ,54.751 + ,62.227 + ,63.932 + ,65.391 + ,75.744 + ,74.590 + ,76.035 + ,74.427 + ,73.354 + ,73.081 + ,75.309 + ,75.463 + ,75.910 + ,76.151 + ,76.882 + ,78.632 + ,80.137 + ,82.490 + ,79.896 + ,81.303 + ,79.344 + ,81.355 + ,82.328 + ,79.669 + ,77.249 + ,75.101 + ,72.520 + ,72.438 + ,72.653 + ,71.429 + ,69.189 + ,66.451 + ,63.354 + ,61.379 + ,61.880 + ,62.274 + ,62.429 + ,63.905 + ,63.917 + ,64.295 + ,61.930 + ,60.440 + ,59.353 + ,58.695 + ,60.569 + ,60.386 + ,60.938 + ,61.795 + ,63.304 + ,64.270 + ,63.492 + ,61.333 + ,59.341 + ,58.412 + ,58.725 + ,59.277 + ,58.562 + ,57.858 + ,58.790 + ,58.243 + ,57.044 + ,57.339 + ,59.429 + ,60.575 + ,61.950 + ,61.712) > 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 -1.12395 -0.32315 -0.01929 0.32504 1.12052 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.102544 0.213713 -5.159 6.64e-07 *** x 0.966305 0.002834 341.007 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4643 on 176 degrees of freedom Multiple R-squared: 0.9985, Adjusted R-squared: 0.9985 F-statistic: 1.163e+05 on 1 and 176 DF, p-value: < 2.2e-16 > postscript(file="/var/www/rcomp/tmp/15bz21290610851.ps",horizontal=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/rcomp/tmp/25bz21290610851.ps",horizontal=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 -8.590e-15 -2.989e-15 -9.766e-18 2.422e-15 2.904e-14 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.103e+00 1.971e-15 -5.593e+14 <2e-16 *** x 9.663e-01 2.614e-17 3.697e+16 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.283e-15 on 176 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 1.367e+33 on 1 and 176 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/rcomp/tmp/3y2g41290610851.ps",horizontal=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 -1.12395 -0.32315 -0.01929 0.32504 1.12052 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.379e-17 2.137e-01 1.11e-16 1 x -2.125e-19 2.834e-03 -7.50e-17 1 Residual standard error: 0.4643 on 176 degrees of freedom Multiple R-squared: 5.342e-34, Adjusted R-squared: -0.005682 F-statistic: 9.401e-32 on 1 and 176 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/rcomp/tmp/49cx71290610851.ps",horizontal=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 -29.7220 -9.8811 -0.2926 8.4613 26.5141 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.080e+01 8.945e-01 79.15 <2e-16 *** m$residuals -9.366e-16 1.938e+00 -4.83e-16 1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.93 on 176 degrees of freedom Multiple R-squared: 3.223e-32, Adjusted R-squared: -0.005682 F-statistic: 5.672e-30 on 1 and 176 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/rcomp/tmp/5jlxa1290610851.ps",horizontal=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 -1.1656 -0.2706 0.0102 0.3552 1.2573 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.002143 0.032653 0.066 0.948 Residuals 0.358749 0.070696 5.075 9.86e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4344 on 175 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.1283, Adjusted R-squared: 0.1233 F-statistic: 25.75 on 1 and 175 DF, p-value: 9.855e-07 > abline(m5) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6jlxa1290610851.ps",horizontal=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/rcomp/tmp/7uced1290610851.ps",horizontal=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/rcomp/tmp/8uced1290610851.ps",horizontal=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/rcomp/tmp/95mdy1290610851.ps",horizontal=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/101dtp1290610851.tab") > > try(system("convert tmp/15bz21290610851.ps tmp/15bz21290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/25bz21290610851.ps tmp/25bz21290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/3y2g41290610851.ps tmp/3y2g41290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/49cx71290610851.ps tmp/49cx71290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/5jlxa1290610851.ps tmp/5jlxa1290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/6jlxa1290610851.ps tmp/6jlxa1290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/7uced1290610851.ps tmp/7uced1290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/8uced1290610851.ps tmp/8uced1290610851.png",intern=TRUE)) character(0) > try(system("convert tmp/95mdy1290610851.ps tmp/95mdy1290610851.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.050 0.840 3.868