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(4.640826863,4.640923356,4.641116313,4.642176912,4.643236387,4.64352514,4.64352514,4.643621372,4.644871553,4.646599996,4.647271362,4.647367235,4.647367235,4.647654798,4.649665426,4.650621449,4.65138561,4.651576559,4.651576559,4.65167202,4.653388758,4.656718448,4.657572865,4.658047226,4.658047226,4.657952371,4.658900508,4.660510281,4.66079409,4.660983251,4.660983251,4.660983251,4.662967285,4.665041583,4.666641508,4.666923582,4.666923582,4.666829566,4.667581446,4.666171208,4.665606555,4.665606555,4.665606555,4.665606555,4.666641508,4.667581446,4.667581446,4.667957174,4.668144985,4.668802046,4.667205577,4.666923582,4.665794808,4.665418266,4.665418266,4.665700686,4.665229942,4.664193526,4.664664758,4.66428779) > x <- c(4.608165695,4.590056548,4.55492897,4.533674184,4.523960131,4.48863637,4.458987676,4.436751534,4.415219602,4.391976966,4.404277244,4.404277244,4.417635062,4.428433007,4.456670178,4.455509411,4.456670178,4.48638665,4.49535532,4.475061501,4.480740108,4.484131858,4.510859507,4.516338972,4.558078578,4.592084946,4.604169686,4.591071262,4.608165695,4.607168189,4.609162207,4.619073091,4.634728988,4.692264893,4.713127327,4.737075257,4.802380355,4.848900371,4.866764924,4.852030264,4.816241156,4.820281566,4.847331743,4.848900371,4.855150391,4.878246106,4.906015245,4.8978398,4.973279508,4.992471323,5.016617366,5.001930853,4.951592753,4.93375425,4.94021283,4.980863136,4.99653637,5.000584958,5.017941869,5.059425458) > 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.0144838 -0.0024751 0.0009261 0.0033440 0.0075917 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.49115 0.01534 292.86 < 2e-16 *** x 0.03562 0.00327 10.90 1.17e-15 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.005315 on 58 degrees of freedom Multiple R-squared: 0.6718, Adjusted R-squared: 0.6661 F-statistic: 118.7 on 1 and 58 DF, p-value: 1.173e-15 > postscript(file="/var/www/html/rcomp/tmp/1sl921256316459.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/2tuf81256316459.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 -2.191e-14 1.500e-16 3.081e-16 5.820e-16 9.329e-16 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.491e+00 8.414e-15 5.338e+14 <2e-16 *** x 3.562e-02 1.794e-15 1.986e+13 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.916e-15 on 58 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 3.944e+26 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/3kos61256316459.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.0144838 -0.0024751 0.0009261 0.0033440 0.0075917 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -4.045e-17 1.534e-02 -2.64e-15 1 x 8.536e-18 3.270e-03 2.61e-15 1 Residual standard error: 0.005315 on 58 degrees of freedom Multiple R-squared: 1.746e-31, Adjusted R-squared: -0.01724 F-statistic: 1.013e-29 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/45dsk1256316459.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.010466 -0.007043 -0.002747 0.006550 0.013311 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.658e+00 9.818e-04 4744 <2e-16 *** m$residuals 1.866e-13 1.879e-01 9.93e-13 1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.007605 on 58 degrees of freedom Multiple R-squared: 7.573e-26, Adjusted R-squared: -0.01724 F-statistic: 4.392e-24 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/5svqr1256316459.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 -2.607e-03 -6.697e-04 2.054e-05 6.537e-04 3.277e-03 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.0001345 0.0001487 0.905 0.369 Residuals 0.9225521 0.0286525 32.198 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.001142 on 57 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.9479, Adjusted R-squared: 0.947 F-statistic: 1037 on 1 and 57 DF, p-value: < 2.2e-16 > abline(m5) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6mabz1256316459.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/7e8fc1256316459.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/8wl5c1256316459.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/992fm1256316459.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/10fspq1256316459.tab") > > system("convert tmp/1sl921256316459.ps tmp/1sl921256316459.png") > system("convert tmp/2tuf81256316459.ps tmp/2tuf81256316459.png") > system("convert tmp/3kos61256316459.ps tmp/3kos61256316459.png") > system("convert tmp/45dsk1256316459.ps tmp/45dsk1256316459.png") > system("convert tmp/5svqr1256316459.ps tmp/5svqr1256316459.png") > system("convert tmp/6mabz1256316459.ps tmp/6mabz1256316459.png") > system("convert tmp/7e8fc1256316459.ps tmp/7e8fc1256316459.png") > system("convert tmp/8wl5c1256316459.ps tmp/8wl5c1256316459.png") > system("convert tmp/992fm1256316459.ps tmp/992fm1256316459.png") > > > proc.time() user system elapsed 1.844 1.362 3.318