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(2518.41 + ,2527.73 + ,2521.10 + ,2502.89 + ,2514.94 + ,2480.65 + ,2514.87 + ,2543.41 + ,2558.77 + ,2592.56 + ,2582.96 + ,2611.03 + ,2600.83 + ,2606.31 + ,2634.16 + ,2613.52 + ,2625.28 + ,2608.80 + ,2631.57 + ,2665.62 + ,2654.85 + ,2639.28 + ,2634.45 + ,2649.34 + ,2649.70 + ,2672.10 + ,2656.93 + ,2665.40 + ,2656.12 + ,2648.46 + ,2680.56 + ,2696.66 + ,2696.96 + ,2668.62 + ,2702.87 + ,2714.81 + ,2708.98 + ,2716.70 + ,2715.16 + ,2687.36 + ,2667.96 + ,2681.07 + ,2660.86 + ,2630.94 + ,2644.14 + ,2656.28 + ,2567.68 + ,2506.19 + ,2561.69 + ,2560.99 + ,2572.46 + ,2504.25 + ,2446.22 + ,2400.78 + ,2296.81 + ,2511.98 + ,2483.53 + ,2540.36 + ,2534.85 + ,2447.17 + ,2439.07 + ,2485.24 + ,2432.85 + ,2386.49 + ,2395.65 + ,2402.45 + ,2329.79 + ,2386.45 + ,2469.56 + ,2460.54 + ,2453.37 + ,2466.00 + ,2464.25 + ,2484.27 + ,2429.67 + ,2412.05 + ,2390.89 + ,2425.68 + ,2463.32 + ,2463.85 + ,2498.24 + ,2509.31 + ,2513.80 + ,2523.36 + ,2528.93 + ,2549.84 + ,2536.22 + ,2494.34 + ,2455.80 + ,2441.65 + ,2461.96 + ,2382.48 + ,2386.53 + ,2336.12 + ,2337.29 + ,2329.60 + ,2389.28 + ,2415.81 + ,2455.99 + ,2462.75 + ,2470.27 + ,2516.26 + ,2522.12 + ,2495.05 + ,2442.75 + ,2431.56 + ,2417.34 + ,2451.93 + ,2501.41 + ,2506.07 + ,2531.75 + ,2557.43 + ,2545.08 + ,2537.90 + ,2517.30 + ,2579.35 + ,2588.92 + ,2587.82 + ,2586.09 + ,2549.82 + ,2571.02 + ,2561.71 + ,2495.93 + ,2505.90 + ,2485.70 + ,2469.46 + ,2518.34 + ,2512.61 + ,2474.08 + ,2452.32 + ,2469.08 + ,2435.96 + ,2424.00 + ,2446.63 + ,2467.55 + ,2460.93 + ,2457.46 + ,2531.76 + ,2537.76 + ,2549.96 + ,2560.24 + ,2538.91 + ,2556.00 + ,2577.46 + ,2569.72 + ,2610.81 + ,2608.85 + ,2603.51 + ,2585.29 + ,2569.22 + ,2601.85 + ,2604.33 + ,2575.16 + ,2570.39 + ,2601.61 + ,2597.73 + ,2603.50 + ,2602.69 + ,2589.73 + ,2579.39 + ,2558.82 + ,2595.93 + ,2613.44 + ,2604.03 + ,2622.78 + ,2635.10 + ,2620.82 + ,2670.38 + ,2662.91 + ,2658.78 + ,2672.38 + ,2666.15 + ,2669.27 + ,2691.78 + ,2691.53 + ,2698.64 + ,2692.74 + ,2672.71 + ,2677.40 + ,2679.07 + ,2688.39 + ,2696.69 + ,2663.84 + ,2710.41 + ,2686.09 + ,2683.42 + ,2702.84 + ,2672.25 + ,2631.64 + ,2624.97 + ,2654.43 + ,2608.06) > x <- c(35.18 + ,35.24 + ,35.00 + ,35.50 + ,36.32 + ,36.04 + ,36.71 + ,36.70 + ,36.17 + ,36.50 + ,36.94 + ,36.42 + ,36.40 + ,36.68 + ,36.54 + ,36.36 + ,36.23 + ,36.39 + ,36.44 + ,36.43 + ,36.47 + ,36.42 + ,36.44 + ,36.44 + ,36.51 + ,36.51 + ,36.26 + ,36.41 + ,36.19 + ,36.45 + ,36.38 + ,36.70 + ,36.69 + ,37.00 + ,37.20 + ,37.28 + ,37.18 + ,37.13 + ,36.87 + ,36.88 + ,36.85 + ,36.87 + ,37.40 + ,37.21 + ,37.40 + ,36.94 + ,36.66 + ,36.59 + ,37.15 + ,37.00 + ,36.47 + ,36.51 + ,36.17 + ,36.62 + ,35.97 + ,36.48 + ,36.34 + ,37.05 + ,37.11 + ,36.92 + ,36.89 + ,36.94 + ,37.19 + ,36.78 + ,36.25 + ,36.67 + ,36.84 + ,36.54 + ,37.09 + ,37.02 + ,37.04 + ,37.47 + ,37.36 + ,37.38 + ,37.18 + ,37.19 + ,37.35 + ,37.33 + ,37.98 + ,37.72 + ,37.75 + ,37.94 + ,37.82 + ,38.07 + ,38.00 + ,38.00 + ,38.00 + ,37.94 + ,38.24 + ,38.52 + ,38.82 + ,38.73 + ,38.58 + ,37.67 + ,37.79 + ,37.65 + ,38.23 + ,38.10 + ,38.46 + ,38.18 + ,38.38 + ,38.78 + ,38.99 + ,38.90 + ,38.88 + ,38.82 + ,38.84 + ,39.16 + ,39.34 + ,39.92 + ,39.54 + ,38.64 + ,38.47 + ,38.01 + ,37.81 + ,38.20 + ,38.31 + ,38.41 + ,38.46 + ,38.59 + ,38.71 + ,38.90 + ,38.65 + ,38.95 + ,38.84 + ,38.97 + ,39.20 + ,39.01 + ,38.78 + ,38.80 + ,39.60 + ,39.42 + ,39.32 + ,39.28 + ,39.49 + ,39.12 + ,39.08 + ,39.45 + ,39.73 + ,39.44 + ,39.34 + ,39.40 + ,39.52 + ,39.60 + ,39.42 + ,39.30 + ,39.43 + ,39.75 + ,39.23 + ,39.39 + ,39.63 + ,39.56 + ,39.31 + ,39.48 + ,39.65 + ,39.27 + ,38.71 + ,38.66 + ,38.78 + ,38.83 + ,38.82 + ,38.62 + ,38.39 + ,38.57 + ,38.60 + ,38.11 + ,38.16 + ,38.40 + ,39.18 + ,39.03 + ,39.12 + ,39.22 + ,39.39 + ,39.77 + ,39.65 + ,39.81 + ,39.79 + ,40.32 + ,40.33 + ,40.48 + ,41.12 + ,41.24 + ,40.82 + ,41.06 + ,40.29 + ,40.18 + ,39.91 + ,39.81 + ,40.25 + ,39.93 + ,39.90 + ,39.95) > 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 -233.1829 -78.5844 -0.3714 92.1980 174.7102 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2112.064 196.636 10.741 <2e-16 *** x 11.619 5.162 2.251 0.0255 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 96.44 on 190 degrees of freedom Multiple R-squared: 0.02597, Adjusted R-squared: 0.02085 F-statistic: 5.067 on 1 and 190 DF, p-value: 0.02553 > postscript(file="/var/www/rcomp/tmp/1gtz41289940208.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/2gtz41289940208.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.314e-12 -6.508e-14 3.827e-14 1.240e-13 3.139e-13 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.112e+03 8.383e-13 2.520e+15 <2e-16 *** x 1.162e+01 2.200e-14 5.280e+14 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.111e-13 on 190 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 2.788e+29 on 1 and 190 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/3q3h71289940208.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 -233.1829 -78.5844 -0.3714 92.1980 174.7102 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.630e-14 1.966e+02 8.29e-17 1 x -3.861e-16 5.162e+00 -7.48e-17 1 Residual standard error: 96.44 on 190 degrees of freedom Multiple R-squared: 5.447e-34, Adjusted R-squared: -0.005263 F-statistic: 1.035e-31 on 1 and 190 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/4jcya1289940208.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 -35.684 -13.957 1.147 13.173 36.817 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.554e+03 1.137e+00 2248 <2e-16 *** m$residuals -1.212e-16 1.185e-02 -1.02e-14 1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 15.75 on 190 degrees of freedom Multiple R-squared: 4.389e-28, Adjusted R-squared: -0.005263 F-statistic: 8.338e-26 on 1 and 190 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/5u3fv1289940208.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 -104.6047 -15.5429 0.8684 19.3816 195.4052 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.1694 2.3655 0.072 0.943 Residuals 0.9414 0.0246 38.266 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 32.69 on 189 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.8857, Adjusted R-squared: 0.8851 F-statistic: 1464 on 1 and 189 DF, p-value: < 2.2e-16 > abline(m5) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6u3fv1289940208.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/7mdfg1289940208.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/8mdfg1289940208.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/9f4e11289940208.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/10tvts1289940208.tab") > > try(system("convert tmp/1gtz41289940208.ps tmp/1gtz41289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/2gtz41289940208.ps tmp/2gtz41289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/3q3h71289940208.ps tmp/3q3h71289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/4jcya1289940208.ps tmp/4jcya1289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/5u3fv1289940208.ps tmp/5u3fv1289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/6u3fv1289940208.ps tmp/6u3fv1289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/7mdfg1289940208.ps tmp/7mdfg1289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/8mdfg1289940208.ps tmp/8mdfg1289940208.png",intern=TRUE)) character(0) > try(system("convert tmp/9f4e11289940208.ps tmp/9f4e11289940208.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.03 1.80 4.85