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(0.163174,0.201921,0.232752,0.228971,0.245583,0.254378,0.224034,0.230488,0.145256,0.151829,0.165472,0.196739,0.187848,0.204079,0.207498,0.240080,0.239256,0.228852,0.245555,0.222047,0.266542,0.267053,0.231662,0.206036,0.257087,0.216368,0.225624,0.231318,0.253926,0.227463,0.263592,0.260886,0.232007,0.233059,0.299560,0.270942,0.283427,0.301381,0.316548,0.292079,0.312963,0.361612,0.358814,0.358174,0.220870,0.288982,0.291079,0.327455,0.335642,0.284180,0.325792,0.326291,0.356246,0.335943,0.414564,0.374787,0.361182,0.393189,0.344907,0.352865) > x <- c(0.892201,1.007095,0.966709,1.003381,0.950054,0.942173,0.938196,0.731490,0.815207,0.841577,0.896191,0.918043,0.819296,0.907075,0.892324,0.927952,0.897811,0.917274,0.909615,0.876498,0.918068,0.888221,0.928924,0.921158,0.832321,0.918037,0.902913,0.934450,0.886786,0.903352,0.883465,0.849764,0.906730,0.872937,0.909101,0.916899,0.861511,0.926093,0.890331,0.917292,0.887005,0.922855,0.879873,0.683812,0.839532,0.874177,0.909158,0.926634,0.854157,0.939830,0.917559,0.967147,0.918967,0.971321,0.974110,0.965109,0.989029,0.944283,0.980111,0.976797) > 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 -0.101416 -0.042565 -0.002185 0.050137 0.145817 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.04096 0.12863 0.318 0.7513 x 0.25065 0.14175 1.768 0.0823 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.06204 on 58 degrees of freedom Multiple R-squared: 0.05115, Adjusted R-squared: 0.03479 F-statistic: 3.127 on 1 and 58 DF, p-value: 0.08228 > postscript(file="/var/www/html/rcomp/tmp/1i8dl1289584229.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/html/rcomp/tmp/2i8dl1289584229.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 -3.025e-17 -1.481e-17 -1.355e-18 1.514e-17 4.388e-17 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.096e-02 3.762e-17 1.089e+15 <2e-16 *** x 2.507e-01 4.146e-17 6.045e+15 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.815e-17 on 58 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 3.655e+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/3shuo1289584229.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 -0.101416 -0.042565 -0.002185 0.050137 0.145817 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.385e-17 1.286e-01 4.19e-16 1 x -6.342e-17 1.418e-01 -4.47e-16 1 Residual standard error: 0.06204 on 58 degrees of freedom Multiple R-squared: 2.102e-33, Adjusted R-squared: -0.01724 F-statistic: 1.219e-31 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/4lqt81289584229.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 -0.055608 -0.004940 0.001903 0.007449 0.025423 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.680e-01 1.860e-03 144.1 <2e-16 *** m$residuals 2.203e-17 3.049e-02 7.23e-16 1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.0144 on 58 degrees of freedom Multiple R-squared: 3.098e-29, Adjusted R-squared: -0.01724 F-statistic: 1.797e-27 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/5wzbc1289584229.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 -0.1399585 -0.0244631 -0.0007275 0.0285181 0.0891245 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.002552 0.005324 0.479 0.633 Residuals 0.733027 0.087435 8.384 1.59e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.04089 on 57 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.5522, Adjusted R-squared: 0.5443 F-statistic: 70.29 on 1 and 57 DF, p-value: 1.59e-11 > abline(m5) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6wzbc1289584229.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/html/rcomp/tmp/769ax1289584229.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/html/rcomp/tmp/869ax1289584229.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/html/rcomp/tmp/969ax1289584229.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/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/10vapq1289584229.tab") > > try(system("convert tmp/1i8dl1289584229.ps tmp/1i8dl1289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/2i8dl1289584229.ps tmp/2i8dl1289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/3shuo1289584229.ps tmp/3shuo1289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/4lqt81289584229.ps tmp/4lqt81289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/5wzbc1289584229.ps tmp/5wzbc1289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/6wzbc1289584229.ps tmp/6wzbc1289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/769ax1289584229.ps tmp/769ax1289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/869ax1289584229.ps tmp/869ax1289584229.png",intern=TRUE)) character(0) > try(system("convert tmp/969ax1289584229.ps tmp/969ax1289584229.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.801 1.351 2.849