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(255.00 + ,280.20 + ,299.90 + ,339.20 + ,374.20 + ,393.50 + ,389.20 + ,381.70 + ,375.20 + ,369.00 + ,357.40 + ,352.10 + ,346.50 + ,342.90 + ,340.30 + ,328.30 + ,322.90 + ,314.30 + ,308.90 + ,294.00 + ,285.60 + ,281.20 + ,280.30 + ,278.80 + ,274.50 + ,270.40 + ,263.40 + ,259.90 + ,258.00 + ,262.70 + ,284.70 + ,311.30 + ,322.10 + ,327.00 + ,331.30 + ,333.30 + ,321.40 + ,327.00 + ,320.00 + ,314.70 + ,316.70 + ,314.40 + ,321.30 + ,318.20 + ,307.20 + ,301.30 + ,287.50 + ,277.70 + ,274.40 + ,258.80 + ,253.30 + ,251.00 + ,248.40 + ,249.50 + ,246.10 + ,244.50 + ,243.60 + ,244.00 + ,240.80 + ,249.80 + ,248.00 + ,259.40 + ,260.50 + ,260.80 + ,261.30 + ,259.50 + ,256.60 + ,257.90 + ,256.50 + ,254.20 + ,253.30 + ,253.80 + ,255.50 + ,257.10 + ,257.30 + ,253.20 + ,252.80 + ,252.00 + ,250.70 + ,252.20 + ,250.00 + ,251.00 + ,253.40 + ,251.20 + ,255.60 + ,261.10 + ,258.90 + ,259.90 + ,261.20 + ,264.70 + ,267.10 + ,266.40 + ,267.70 + ,268.60 + ,267.50 + ,268.50 + ,268.50 + ,270.50 + ,270.90 + ,270.10 + ,269.30 + ,269.80 + ,270.10 + ,264.90 + ,263.70 + ,264.80 + ,263.70 + ,255.90 + ,276.20 + ,360.10 + ,380.50 + ,373.70 + ,369.80 + ,366.60 + ,359.30 + ,345.80 + ,326.20 + ,324.50 + ,328.10 + ,327.50 + ,324.40 + ,316.50 + ,310.90 + ,301.50 + ,291.70 + ,290.40 + ,287.40 + ,277.70 + ,281.60 + ,288.00 + ,276.00 + ,272.90 + ,283.00 + ,283.30 + ,276.80 + ,284.50 + ,282.70 + ,281.20 + ,287.40 + ,283.10 + ,284.00 + ,285.50 + ,289.20 + ,292.50 + ,296.40 + ,305.20 + ,303.90 + ,311.50 + ,316.30 + ,316.70 + ,322.50 + ,317.10 + ,309.80 + ,303.80 + ,290.30 + ,293.70 + ,291.70 + ,296.50 + ,289.10 + ,288.50 + ,293.80 + ,297.70 + ,305.40 + ,302.70 + ,302.50 + ,303.00 + ,294.50 + ,294.10 + ,294.50 + ,297.10 + ,289.40 + ,292.40 + ,287.90 + ,286.60 + ,280.50 + ,272.40 + ,269.20 + ,270.60 + ,267.30 + ,262.50 + ,266.80 + ,268.80 + ,263.10 + ,261.20 + ,266.00 + ,262.50 + ,265.20 + ,261.30 + ,253.70 + ,249.20 + ,239.10 + ,236.40 + ,235.20 + ,245.20 + ,246.20 + ,247.70 + ,251.40 + ,253.30 + ,254.80 + ,250.00 + ,249.30 + ,241.50 + ,243.30 + ,248.00 + ,253.00 + ,252.90 + ,251.50 + ,251.60 + ,253.50 + ,259.80 + ,334.10 + ,448.00 + ,445.80 + ,445.00 + ,448.20 + ,438.20 + ,439.80 + ,423.40 + ,410.80 + ,408.40 + ,406.70 + ,405.90 + ,402.70 + ,405.10 + ,399.60 + ,386.50 + ,381.40 + ,375.20 + ,357.70 + ,359.00 + ,355.00 + ,352.70 + ,344.40 + ,343.80 + ,338.00 + ,339.00 + ,333.30 + ,334.40 + ,328.30 + ,330.70 + ,330.00 + ,331.60 + ,351.20 + ,389.40 + ,410.90 + ,442.80 + ,462.80 + ,466.90 + ,461.70 + ,439.20 + ,430.30 + ,416.10 + ,402.50 + ,397.30 + ,403.30 + ,395.90 + ,387.80 + ,378.60 + ,377.10 + ,370.40 + ,362.00 + ,350.30 + ,348.20 + ,344.60 + ,343.50 + ,342.80 + ,347.60 + ,346.60 + ,349.50 + ,342.10 + ,342.00 + ,342.80 + ,339.30 + ,348.20 + ,333.70 + ,334.70 + ,354.00 + ,367.70 + ,363.30 + ,358.40 + ,353.10 + ,343.10 + ,344.60 + ,344.40 + ,333.90 + ,331.70 + ,324.30 + ,321.20 + ,322.40 + ,321.70 + ,320.50 + ,312.80 + ,309.70 + ,315.60 + ,309.70 + ,304.60 + ,302.50 + ,301.50 + ,298.80 + ,291.30 + ,293.60 + ,294.60 + ,285.90 + ,297.60 + ,301.10 + ,293.80 + ,297.70 + ,292.90 + ,292.10 + ,287.20 + ,288.20 + ,283.80 + ,299.90 + ,292.40 + ,293.30 + ,300.80 + ,293.70 + ,293.10 + ,294.40 + ,292.10 + ,291.90 + ,282.50 + ,277.90 + ,287.50 + ,289.20 + ,285.60 + ,293.20 + ,290.80 + ,283.10 + ,275.00 + ,287.80 + ,287.80 + ,287.40 + ,284.00 + ,277.80 + ,277.60 + ,304.90 + ,294.00 + ,300.90 + ,324.00 + ,332.90 + ,341.60 + ,333.40 + ,348.20 + ,344.70 + ,344.70 + ,329.30 + ,323.50 + ,323.20 + ,317.40 + ,330.10 + ,329.20 + ,334.90 + ,315.80 + ,315.40 + ,319.60 + ,317.30 + ,313.80 + ,315.80 + ,311.30) > x <- c(87.28 + ,87.28 + ,87.09 + ,86.92 + ,87.59 + ,90.72 + ,90.69 + ,90.30 + ,89.55 + ,88.94 + ,88.41 + ,87.82 + ,87.07 + ,86.82 + ,86.40 + ,86.02 + ,85.66 + ,85.32 + ,85.00 + ,84.67 + ,83.94 + ,82.83 + ,81.95 + ,81.19 + ,80.48 + ,78.86 + ,69.47 + ,68.77 + ,70.06 + ,73.95 + ,75.80 + ,77.79 + ,81.57 + ,83.07 + ,84.34 + ,85.10 + ,85.25 + ,84.26 + ,83.63 + ,86.44 + ,85.30 + ,84.10 + ,83.36 + ,82.48 + ,81.58 + ,80.47 + ,79.34 + ,82.13 + ,81.69 + ,80.70 + ,79.88 + ,79.16 + ,78.38 + ,77.42 + ,76.47 + ,75.46 + ,74.48 + ,78.27 + ,80.70 + ,79.91 + ,78.75 + ,77.78 + ,81.14 + ,81.08 + ,80.03 + ,78.91 + ,78.01 + ,76.90 + ,75.97 + ,81.93 + ,80.27 + ,78.67 + ,77.42 + ,76.16 + ,74.70 + ,76.39 + ,76.04 + ,74.65 + ,73.29 + ,71.79 + ,74.39 + ,74.91 + ,74.54 + ,73.08 + ,72.75 + ,71.32 + ,70.38 + ,70.35 + ,70.01 + ,69.36 + ,67.77 + ,69.26 + ,69.80 + ,68.38 + ,67.62 + ,68.39 + ,66.95 + ,65.21 + ,66.64 + ,63.45 + ,60.66 + ,62.34 + ,60.32 + ,58.64 + ,60.46 + ,58.59 + ,61.87 + ,61.85 + ,67.44 + ,77.06 + ,91.74 + ,93.15 + ,94.15 + ,93.11 + ,91.51 + ,89.96 + ,88.16 + ,86.98 + ,88.03 + ,86.24 + ,84.65 + ,83.23 + ,81.70 + ,80.25 + ,78.80 + ,77.51 + ,76.20 + ,75.04 + ,74.00 + ,75.49 + ,77.14 + ,76.15 + ,76.27 + ,78.19 + ,76.49 + ,77.31 + ,76.65 + ,74.99 + ,73.51 + ,72.07 + ,70.59 + ,71.96 + ,76.29 + ,74.86 + ,74.93 + ,71.90 + ,71.01 + ,77.47 + ,75.78 + ,76.60 + ,76.07 + ,74.57 + ,73.02 + ,72.65 + ,73.16 + ,71.53 + ,69.78 + ,67.98 + ,69.96 + ,72.16 + ,70.47 + ,68.86 + ,67.37 + ,65.87 + ,72.16 + ,71.34 + ,69.93 + ,68.44 + ,67.16 + ,66.01 + ,67.25 + ,70.91 + ,69.75 + ,68.59 + ,67.48 + ,66.31 + ,64.81 + ,66.58 + ,65.97 + ,64.70 + ,64.70 + ,60.94 + ,59.08 + ,58.42 + ,57.77 + ,57.11 + ,53.31 + ,49.96 + ,49.40 + ,48.84 + ,48.30 + ,47.74 + ,47.24 + ,46.76 + ,46.29 + ,48.90 + ,49.23 + ,48.53 + ,48.03 + ,54.34 + ,53.79 + ,53.24 + ,52.96 + ,52.17 + ,51.70 + ,58.55 + ,78.20 + ,77.03 + ,76.19 + ,77.15 + ,75.87 + ,95.47 + ,109.67 + ,112.28 + ,112.01 + ,107.93 + ,105.96 + ,105.06 + ,102.98 + ,102.20 + ,105.23 + ,101.85 + ,99.89 + ,96.23 + ,94.76 + ,91.51 + ,91.63 + ,91.54 + ,85.23 + ,87.83 + ,87.38 + ,84.44 + ,85.19 + ,84.03 + ,86.73 + ,102.52 + ,104.45 + ,106.98 + ,107.02 + ,99.26 + ,94.45 + ,113.44 + ,157.33 + ,147.38 + ,171.89 + ,171.95 + ,132.71 + ,126.02 + ,121.18 + ,115.45 + ,110.48 + ,117.85 + ,117.63 + ,124.65 + ,109.59 + ,111.27 + ,99.78 + ,98.21 + ,99.20 + ,97.97 + ,89.55 + ,87.91 + ,93.34 + ,94.42 + ,93.20 + ,90.29 + ,91.46 + ,89.98 + ,88.35 + ,88.41 + ,82.44 + ,79.89 + ,75.69 + ,75.66 + ,84.50 + ,96.73 + ,87.48 + ,82.39 + ,83.48 + ,79.31 + ,78.16 + ,72.77 + ,72.45 + ,68.46 + ,67.62 + ,68.76 + ,70.07 + ,68.55 + ,65.30 + ,58.96 + ,59.17 + ,62.37 + ,66.28 + ,55.62 + ,55.23 + ,55.85 + ,56.75 + ,50.89 + ,53.88 + ,52.95 + ,55.08 + ,53.61 + ,58.78 + ,61.85 + ,55.91 + ,53.32 + ,46.41 + ,44.57 + ,50.00 + ,50.00 + ,53.36 + ,46.23 + ,50.45 + ,49.07 + ,45.85 + ,48.45 + ,49.96 + ,46.53 + ,50.51 + ,47.58 + ,48.05 + ,46.84 + ,47.67 + ,49.16 + ,55.54 + ,55.82 + ,58.22 + ,56.19 + ,57.77 + ,63.19 + ,54.76 + ,55.74 + ,62.54 + ,61.39 + ,69.60 + ,79.23 + ,80.00 + ,93.68 + ,107.63 + ,100.18 + ,97.30 + ,90.45 + ,80.64 + ,80.58 + ,75.82 + ,85.59 + ,89.35 + ,89.42 + ,104.73 + ,95.32 + ,89.27 + ,90.44 + ,86.97 + ,79.98 + ,81.22 + ,87.35 + ,83.64 + ,82.22 + ,94.40 + ,102.18) > 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 -104.102 -23.006 -1.580 28.305 106.624 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 165.55010 7.74054 21.39 <2e-16 *** x 1.84168 0.09701 18.98 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 34.65 on 358 degrees of freedom Multiple R-squared: 0.5017, Adjusted R-squared: 0.5003 F-statistic: 360.4 on 1 and 358 DF, p-value: < 2.2e-16 > postscript(file="/var/www/rcomp/tmp/1ok6k1289486257.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/2ztn51289486257.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 -5.785e-13 -1.350e-14 1.807e-15 1.537e-14 4.194e-14 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.656e+02 7.830e-15 2.114e+16 <2e-16 *** x 1.842e+00 9.813e-17 1.877e+16 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.505e-14 on 358 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 3.522e+32 on 1 and 358 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/3a34q1289486257.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 -104.102 -23.006 -1.580 28.305 106.624 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.180e-15 7.741e+00 -1.52e-16 1 x 2.231e-17 9.701e-02 2.30e-16 1 Residual standard error: 34.65 on 358 degrees of freedom Multiple R-squared: 2.387e-34, Adjusted R-squared: -0.002793 F-statistic: 8.546e-32 on 1 and 358 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/4a34q1289486257.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 -60.717 -19.643 -1.406 17.430 173.877 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.084e+02 1.832e+00 168.3 <2e-16 *** m$residuals 1.125e-16 5.303e-02 2.12e-15 1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 34.77 on 358 degrees of freedom Multiple R-squared: 5.974e-31, Adjusted R-squared: -0.002793 F-statistic: 2.139e-28 on 1 and 358 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/52c3b1289486257.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 -65.087 -5.544 -1.755 4.048 88.714 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.09077 0.73155 0.124 0.901 Residuals 0.91218 0.02119 43.055 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 13.86 on 357 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.8385, Adjusted R-squared: 0.8381 F-statistic: 1854 on 1 and 357 DF, p-value: < 2.2e-16 > abline(m5) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6dlle1289486257.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/7dlle1289486257.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/8oukh1289486257.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/9oukh1289486257.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/102m081289486257.tab") > > try(system("convert tmp/1ok6k1289486257.ps tmp/1ok6k1289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/2ztn51289486257.ps tmp/2ztn51289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/3a34q1289486257.ps tmp/3a34q1289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/4a34q1289486257.ps tmp/4a34q1289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/52c3b1289486257.ps tmp/52c3b1289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/6dlle1289486257.ps tmp/6dlle1289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/7dlle1289486257.ps tmp/7dlle1289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/8oukh1289486257.ps tmp/8oukh1289486257.png",intern=TRUE)) character(0) > try(system("convert tmp/9oukh1289486257.ps tmp/9oukh1289486257.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.200 0.890 4.093