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(58.951,59.634,58.389,57.702,56.593,55.998,57.363,58.022,57.598,57.842,58.875,59.103,58.484,58.636,61.342,63.470,64.281,63.721,62.657,62.549,61.882,62.325,61.907,63.136,63.982,65.800,67.596,68.654,67.548,67.398,66.999,66.284,65.561,67.694,69.976,72.908,75.128,75.522,75.242,75.179,75.572,78.340,80.107,82.972,81.638,80.018,80.631,79.211,79.999,77.789,76.205,75.352,74.393,72.771,70.682,69.991,67.525,67.779,66.864,67.971,67.071,66.980,57.144,56.648,53.706,47.108,43.292,48.489,52.642,53.249,50.722,49.805,49.303,49.985,49.512,51.282,50.734,50.365,46.191,44.617,42.012,41.027,39.478,36.824,34.761,31.295,28.951,25.872,17.297,10.739,9.087,8.658,8.731,8.358,6.518,5.021,3.440,2.523,1.725,1.210,777,498,312,179,92,106) > x <- c(61.712,62.084,61.406,60.724,58.904,58.722,59.704,60.674,59.813,60.568,61.401,61.427,61.080,61.999,63.888,66.284,67.309,66.685,65.404,65.045,63.867,64.156,62.224,63.193,64.256,66.153,68.072,68.245,68.741,67.795,67.315,67.245,66.448,69.112,71.787,74.366,76.337,77.618,77.090,76.925,78.384,80.462,82.765,85.033,83.608,81.813,81.467,80.708,80.631,79.133,77.396,75.491,74.267,72.882,71.286,70.737,67.425,67.530,67.157,67.215,66.268,66.053,54.905,54.459,51.159,44.725,40.184,44.094,46.904,47.141,45.052,42.758,41.388,41.154,40.019,39.928,38.598,36.584,32.566,30.140,27.713,25.380,23.823,21.376,18.696,16.304,14.203,11.807,7.551,4.215,3.346,3.010,2.849,2.485,1.744,1.221,803,553,314,204,125,55,53,27,10,6) > 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 -67.002682 -21.294452 -8.607563 -0.006946 708.562713 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 72.05906 10.76616 6.693 1.13e-09 *** x -0.02897 0.09206 -0.315 0.754 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 88.99 on 104 degrees of freedom Multiple R-squared: 0.0009515, Adjusted R-squared: -0.008655 F-statistic: 0.09906 on 1 and 104 DF, p-value: 0.7536 > postscript(file="/var/www/html/rcomp/tmp/1hc9f1290683554.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/2hc9f1290683554.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.242e-14 -8.173e-15 -4.035e-15 -9.890e-16 4.739e-13 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.206e+01 5.687e-15 1.267e+16 <2e-16 *** x -2.897e-02 4.863e-17 -5.958e+14 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.701e-14 on 104 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 3.549e+29 on 1 and 104 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/3al801290683554.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 -67.002682 -21.294452 -8.607563 -0.006946 708.562713 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.766e-15 1.077e+01 2.57e-16 1 x 7.351e-18 9.206e-02 7.98e-17 1 Residual standard error: 88.99 on 104 degrees of freedom Multiple R-squared: 1.252e-33, Adjusted R-squared: -0.009615 F-statistic: 1.302e-31 on 1 and 104 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/43upl1290683554.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 -21.24601 -0.01752 0.21940 0.82616 1.98488 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.004e+01 2.667e-01 262.6 <2e-16 *** m$residuals 8.625e-18 3.026e-03 2.85e-15 1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.746 on 104 degrees of freedom Multiple R-squared: 4.377e-30, Adjusted R-squared: -0.009615 F-statistic: 4.552e-28 on 1 and 104 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/5d37o1290683554.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 -39.4626 -10.6987 -4.6705 -0.3830 744.0874 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.28698 7.28101 0.039 0.969 Residuals 0.55147 0.08227 6.703 1.11e-09 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 74.61 on 103 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.3037, Adjusted R-squared: 0.297 F-statistic: 44.93 on 1 and 103 DF, p-value: 1.115e-09 > abline(m5) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6d37o1290683554.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/7odor1290683554.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/8odor1290683554.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/9h45c1290683554.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/10dell1290683554.tab") > > try(system("convert tmp/1hc9f1290683554.ps tmp/1hc9f1290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/2hc9f1290683554.ps tmp/2hc9f1290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/3al801290683554.ps tmp/3al801290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/43upl1290683554.ps tmp/43upl1290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/5d37o1290683554.ps tmp/5d37o1290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/6d37o1290683554.ps tmp/6d37o1290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/7odor1290683554.ps tmp/7odor1290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/8odor1290683554.ps tmp/8odor1290683554.png",intern=TRUE)) character(0) > try(system("convert tmp/9h45c1290683554.ps tmp/9h45c1290683554.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.803 1.363 4.944