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(258961,258647,256304,250498,247883,249552,262626,264416,273049,272441,267564,265952,263937,264765,263386,258985,257334,257477,271486,274488,281274,272674,269704,268227,276444,272247,268516,263406,263619,265905,281681,287413,289423,281242,273878,269022,272630,270287,260447,262248,252806,238663,258438,266719,263279,258064,248828,248284,253376,251846,239494,239709,228793,229521,249999,254016,251178,242936,241478,243985,246546,247323,247599,248985,241326,242967,263281,268145,263948) > x <- c(87130,88620,89563,89056,88542,89504,89428,86040,96240,94423,93028,92285,91685,94260,93858,92437,92980,92099,92803,88551,98334,98329,96455,97109,97687,98512,98673,96028,98014,95580,97838,97760,99913,97588,93942,93656,93365,92881,93120,91063,90930,91946,94624,95484,95862,95530,94574,94677,93845,91533,91214,90922,89563,89945,91850,92505,92437,93876,93561,94119,95264,96089,97160,98644,96266,97938,99757,101550,102449) > 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 9610.2729 2 7074.9619 3 3326.1254 4 -1724.0325 5 -3572.7547 6 -3337.9166 7 9849.3851 8 16690.2589 9 10116.9685 10 12217.7753 11 9420.4591 12 8916.1330 13 7795.6207 14 4784.7778 15 4005.0845 16 1722.5295 17 -737.9819 18 718.4242 19 13677.8920 20 23018.8280 21 15220.2065 22 6627.6605 23 6451.4437 24 3999.4521 25 11354.7624 26 5927.8418 27 1956.8209 28 790.0208 29 -1957.7334 30 3956.9049 31 16366.6496 32 22214.9330 33 21015.2131 34 16300.3528 35 14371.8562 36 9942.2287 37 13984.0552 38 12362.6086 39 2166.3043 40 7033.9062 41 -2209.8157 42 -17867.4814 43 -2084.8781 44 4914.0229 45 910.4957 46 -3809.5545 47 -11620.3374 48 -12317.8912 49 -5985.5349 50 -4068.7758 51 -15945.2065 52 -15294.8892 53 -24184.8746 54 -24026.3651 55 -6388.3634 56 -3347.8458 57 -6084.4705 58 -16471.7501 59 -17460.1441 60 -15785.0176 61 -14930.9983 62 -15383.9188 63 -16704.5793 64 -17530.9455 65 -21644.7927 66 -22496.4317 67 -4894.2201 68 -2703.2474 69 -8240.4881 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1tqhf1257369715.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/2dmbn1257369715.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/3n6mn1257369715.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/455ev1257369715.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/5kv6d1257369715.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/6n15k1257369715.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/730xj1257369715.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/8xj0f1257369715.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. 86040 91850 93880 94090 96460 102400 > > #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/9lrg41257369715.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/10o18a1257369715.tab") > > system("convert tmp/1tqhf1257369715.ps tmp/1tqhf1257369715.png") > system("convert tmp/2dmbn1257369715.ps tmp/2dmbn1257369715.png") > system("convert tmp/3n6mn1257369715.ps tmp/3n6mn1257369715.png") > system("convert tmp/455ev1257369715.ps tmp/455ev1257369715.png") > system("convert tmp/5kv6d1257369715.ps tmp/5kv6d1257369715.png") > system("convert tmp/6n15k1257369715.ps tmp/6n15k1257369715.png") > system("convert tmp/730xj1257369715.ps tmp/730xj1257369715.png") > system("convert tmp/8xj0f1257369715.ps tmp/8xj0f1257369715.png") > > > proc.time() user system elapsed 1.573 1.193 2.817