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(11881.4,10374.2,13828,13490.5,13092.2,13184.4,12398.4,13882.3,15861.5,13286.1,15634.9,14211,13646.8,12224.6,15916.4,16535.9,15796,14418.6,15044.5,14944.2,16754.8,14254,15454.9,15644.8,14568.3,12520.2,14803,15873.2,14755.3,12875.1,14291.1,14205.3,15859.4,15258.9,15498.6,15106.5,15023.6,12083,15761.3,16943,15070.3,13659.6,14768.9,14725.1,15998.1,15370.6,14956.9,15469.7,15101.8,11703.7,16283.6,16726.5,14968.9,14861,14583.3,15305.8,17903.9,16379.4,15420.3,17870.5,15912.8,13866.5,17823.2,17872,17420.4,16704.4,15991.2,16583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19823.1,20844.4,19640.2,17735.4,19813.6,22160,20664.3,17877.4,20906.5,21164.1,21374.4,22952.3,21343.5,23899.3,22392.9,18274.1,22786.7,22321.5,17842.2,16373.5,15993.8,16446.1,17729,16643,16196.7,18252.1) > x <- c(286.1,307,358.1,341.8,378.8,375.2,295.6,362.7,409.6,336.8,389.1,389.3,355.9,542,648.4,452,582.4,506.5,555.5,530.4,609.4,543.9,616.2,634.6,541.7,549.8,627.6,797.4,689.8,1576.6,1572.1,1626.4,1972.4,1509.6,1584.9,1880,1324,1777.7,2172.4,1780.3,2134.9,1838.4,1557,1755.2,1702,1577.5,1485.9,2179.1,1740.9,1724.5,2328.1,1774.1,2224.2,1536.3,1521.2,2051.8,2483.1,1929.8,1808.6,2584.9,1997.9,1639.9,2379.1,1715,2750.9,1865.4,1647.4,2180.4,2593,2057.2,2635.8,2315.4,1863.6,2038,2235.8,2222.1,2636.9,2076.8,1935.5,2086.3,2470.9,1854.6,2041.3,2170.8,1905.5,2130.2,2791.2,2539.7,2661.3,1764.9,2176.9,2458.5,2179,2242.5,2089.6,2661.6,2112,2367.3,2543,2603.9,3146.7,1789.2,2114.8,2236.3,2288.1,2173.2,1877.7,2807.4,2357.4,2107.7,2856.8,2510.8,2875,2229.7,2055.1,2545.4,2775.1,2252.2,2091.7,2433) > par2 = '36' > 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: > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > x <- as.ts(x) > y <- as.ts(y) > mylm <- lm(y~x) > cbind(mylm$resid) [,1] 1 -1345.52405 2 -2903.54291 3 426.00618 4 128.14003 5 -360.12638 6 -259.17289 7 -851.62353 8 469.12117 9 2334.28267 10 -64.10234 11 2157.52892 12 733.14261 13 250.15554 14 -1624.55119 15 1808.53459 16 2905.58602 17 1848.61522 18 655.76793 19 1162.52323 20 1123.25450 21 2741.76405 22 400.22891 23 1425.32969 24 1570.48963 25 719.87827 26 -1347.91708 27 745.71030 28 1403.03743 29 546.76948 30 -3489.70653 31 -2062.76467 32 -2280.59646 33 -1467.80397 34 -942.99439 35 -886.38819 36 -1996.03109 37 -727.00342 38 -4770.78613 39 -2052.20889 40 82.89191 41 -2652.02671 42 -3341.77967 43 -1548.24865 44 -2073.97683 45 -671.61972 46 -996.39491 47 -1187.36725 48 -2360.10010 49 -1662.50602 50 -5020.72902 51 -1908.49726 52 -118.53264 53 -2970.56186 54 -1405.81609 55 -1646.80007 56 -2214.46702 57 -665.08358 58 -844.22102 59 -1508.62024 60 -946.01278 61 -1476.40784 62 -2652.22204 63 -492.90502 64 1170.67046 65 -1799.74586 66 -362.63084 67 -545.75847 68 -1249.36108 69 287.29187 70 305.30275 71 -1730.87738 72 425.28310 73 -804.55409 74 -2345.11198 75 1234.43246 76 -187.85566 77 147.14794 78 459.24487 79 278.01929 80 147.64538 81 2533.08102 82 129.22963 83 1944.76399 84 1985.78155 85 410.36503 86 -1545.49855 87 146.46370 88 1225.49213 89 958.91874 90 520.73739 91 1099.74925 92 64.93193 93 3521.04305 94 610.64124 95 2210.92135 96 1841.38928 97 1973.55520 98 -552.01303 99 1098.96810 100 3297.28825 101 481.75670 102 995.65134 103 3233.04693 104 3195.21669 105 3279.56372 106 5136.84590 107 4246.56141 108 4541.77300 109 4129.55907 110 617.91076 111 3309.05568 112 3685.16319 113 -1679.69806 114 -1579.33524 115 -1534.49105 116 -2274.36756 117 -1549.98876 118 -1364.54455 119 -1420.58485 120 -195.06419 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1zfcf1257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(y,type='l',main='Run Sequence Plot of Y[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2m64g1257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,type='l',main='Run Sequence Plot of X[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/36fr21257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Scatter Plot',xlab='X[t]',ylab='Y[t]') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4imyq1257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mylm$resid,type='l',main='Run Sequence Plot of e[t]',xlab='time or index',ylab='value') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5vi6n1257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mylm$resid,main='Histogram of e[t]') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6sj2y1257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if (par1 > 0) + { + densityplot(~mylm$resid,col='black',main=paste('Density Plot of e[t] bw = ',par1),bw=par1) + } else { + densityplot(~mylm$resid,col='black',main='Density Plot of e[t]') + } > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/7x6mi1257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mylm$resid,main='QQ plot of e[t]') > qqline(mylm$resid) > grid() > dev.off() null device 1 > if (par2 > 0) + { + postscript(file="/var/www/html/rcomp/tmp/8oi121257165474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + acf(mylm$resid,lag.max=par2,main='Residual Autocorrelation Function') + grid() + dev.off() + } null device 1 > summary(x) Min. 1st Qu. Median Mean 3rd Qu. Max. 286.1 1445.0 1918.0 1724.0 2238.0 3147.0 > > #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,'Model: Y[t] = c + b X[t] + e[t]',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'c',1,TRUE) > a<-table.element(a,mylm$coeff[[1]]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'b',1,TRUE) > a<-table.element(a,mylm$coeff[[2]]) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/9wq281257165474.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Descriptive Statistics about e[t]',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'# observations',header=TRUE) > a<-table.element(a,length(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'minimum',header=TRUE) > a<-table.element(a,min(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Q1',header=TRUE) > a<-table.element(a,quantile(mylm$resid,0.25)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'median',header=TRUE) > a<-table.element(a,median(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mean',header=TRUE) > a<-table.element(a,mean(mylm$resid)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Q3',header=TRUE) > a<-table.element(a,quantile(mylm$resid,0.75)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'maximum',header=TRUE) > a<-table.element(a,max(mylm$resid)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/1041pr1257165474.tab") > > system("convert tmp/1zfcf1257165474.ps tmp/1zfcf1257165474.png") > system("convert tmp/2m64g1257165474.ps tmp/2m64g1257165474.png") > system("convert tmp/36fr21257165474.ps tmp/36fr21257165474.png") > system("convert tmp/4imyq1257165474.ps tmp/4imyq1257165474.png") > system("convert tmp/5vi6n1257165474.ps tmp/5vi6n1257165474.png") > system("convert tmp/6sj2y1257165474.ps tmp/6sj2y1257165474.png") > system("convert tmp/7x6mi1257165474.ps tmp/7x6mi1257165474.png") > system("convert tmp/8oi121257165474.ps tmp/8oi121257165474.png") > > > proc.time() user system elapsed 1.622 1.210 2.597