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(208069.33,204924.3308,200204.3298,198002.3304,195100.3314,191309.3301,213682.3307,225694.331,230493.3285,229175.3283,216142.3298,216627.3287,220120.3312,220029.3308,218358.3289,214826.3304,210619.331,209587.3283,236955.3304,241995.3303,241792.3279,242535.3288,238459.329,240251.3279,244666.3303,244490.3306,241486.3289,240455.33,236003.33,236911.3289,264493.3316,270263.3304,269559.3281,266951.3293,258027.3289,262727.3294,267327.33,267280.3298,264691.3277,258777.3302,254758.3291,254782.3285,277181.3311,285265.3298,286516.328,282956.3278,276601.3282,277829.329,277042.3294,277017.3297,274951.3278,270064.3299,267054.3293,264907.3281,287173.3299,291100.3296,292214.3288,288100.3275,281391.3283,282570.3289,280104.3292,280322.3292,276750.3289,275130.328,274266.3298,271225.3284,289716.3295,290640.3307,292214.3276,278420.3278,269740.3297,265775.3283,268948.3304,264090.3305,255112.3287,253267.33,245971.3306,235286.3291,258470.3308) > x <- c(258881.9875,255059.9883,247697.9873,244778.9879,240900.9888,239932.9876,270246.9882,283892.9885,282347.986,273569.9859,254755.9873,254353.9863,255842.9886,254489.9882,251994.9864,246338.9879,244018.9884,245952.9859,279805.9879,283110.9877,281096.9855,275963.9864,270693.9865,271900.9855,274411.9877,272432.9881,268360.9865,268585.9875,264767.9875,269973.9865,304743.989,309364.9879,308346.9857,298426.9868,289230.9865,291974.9869,294911.9875,293487.9873,290554.9853,284735.9877,281817.9866,287853.986,316262.9885,325411.9873,326010.9856,328281.9854,317479.9858,317538.9865,313736.987,312275.9872,309390.9854,302949.9874,300315.9868,304034.9857,333475.9874,337697.9871,335931.9864,323930.9852,313926.9859,314484.9864,313217.9867,309663.9868,302962.9864,298988.9856,298422.9873,301630.986,329764.987,335082.9882,327615.9853,309118.9855,295915.9872,291412.9859,291458.4609,284594.461,276391.4593,272482.4605,264897.461,263206.4597,296722.4612) > 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 -15811.7211 2 -15165.7964 3 -12583.6542 4 -11890.3876 5 -10945.9181 6 -13776.7887 7 -21471.3162 8 -22994.3654 9 -16662.9273 10 -9274.2982 11 -3646.2681 12 -2762.5367 13 -746.4300 14 504.5692 15 1308.2832 16 3386.2962 17 1480.4332 18 -1469.8423 19 -7679.5954 20 -5917.7235 21 -4123.0988 22 1711.1666 23 2862.3181 24 3457.1317 25 5381.5480 26 7168.4574 27 8203.3492 28 6949.1787 29 6284.1359 30 2028.4640 31 -4876.8332 32 -3690.2616 33 -3384.5387 34 3846.8054 35 4044.0358 36 6022.3464 37 7709.2262 38 9074.6481 39 9394.8008 40 9252.4887 41 8127.7635 42 2164.8400 43 -3614.1763 44 -4604.7891 45 -3947.9190 46 -9760.4543 47 -5401.2815 48 -4231.8017 49 -1247.7145 50 176.4067 51 971.9497 52 2473.5803 53 2076.1642 54 -3759.5981 55 -10695.2236 56 -10955.8960 57 -8090.2548 58 -300.8308 59 2912.8303 60 3538.3673 61 2329.0658 62 6072.1694 63 9146.6860 64 11468.3747 65 11165.7729 66 4942.8559 67 -4471.3964 68 -8822.1576 69 158.1306 70 4710.7381 71 9126.3893 72 9627.7769 73 12755.6738 74 14705.8650 75 13864.1692 76 15896.3866 77 16123.7157 78 7115.9666 79 -2943.5264 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1j6ru1257288823.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/2i0711257288823.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/35akc1257288823.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/4t1e51257288823.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/5jj3n1257288823.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/668ex1257288823.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/7vprt1257288823.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/851cf1257288823.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. 239900 270100 290600 288800 309400 337700 > > #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/93pgl1257288824.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/10arvz1257288824.tab") > > system("convert tmp/1j6ru1257288823.ps tmp/1j6ru1257288823.png") > system("convert tmp/2i0711257288823.ps tmp/2i0711257288823.png") > system("convert tmp/35akc1257288823.ps tmp/35akc1257288823.png") > system("convert tmp/4t1e51257288823.ps tmp/4t1e51257288823.png") > system("convert tmp/5jj3n1257288823.ps tmp/5jj3n1257288823.png") > system("convert tmp/668ex1257288823.ps tmp/668ex1257288823.png") > system("convert tmp/7vprt1257288823.ps tmp/7vprt1257288823.png") > system("convert tmp/851cf1257288823.ps tmp/851cf1257288823.png") > > > proc.time() user system elapsed 1.562 1.136 2.155