R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(-19.05358195,-43.46849122,-49.82643774,-42.99465168,-40.97875866,-28.48902609,-39.65161444,-52.80393537,-37.91982839,15.96695292,35.10338081,33.56132732,10.08847154,-12.72643774,-5.142330764,7.389455289,1.563294829,-4.657240038,8.990439042,13.14838556,9.648385555,65.72489943,69.07722035,40.22489943,2.479187856,-16.04598885,-15.82447023,-28.85625629,-29.26089813,-36.3758074,-29.02812832,-42.85893062,-46.76357246,18.79142279,18.91195766,12.74472747,14.11392517,19.99901589,19.46722984,34.3933903,42.81490892,50.18410662,61.25794616,76.97482294,109.3533043,162.9559787,117.7082996,61.83544379,-31.96919806,-84.137412,-102.2486632,-87.24402135,-88.33375391,-76.90759345,-65.46553997,-56.11223529,-16.90759345,21.13713437,50.25766924,26.18481345) > x <- c(3278.397949,3153.10596,3161.180194,3130.213256,3118.064786,3081.668613,3000.397031,2956.091623,2971.220093,3357.120296,3416.494173,3409.204939,3290.467184,3164.480194,3179.278664,3149.671725,3127.894021,3053.761674,3009.816266,3002.797031,3002.777031,3351.371061,3395.956469,3351.201061,3113.895551,2951.152389,2884.609276,2914.296215,2825.955399,2700.008409,2656.033001,2544.764481,2455.843665,2871.210807,2945.173154,2774.860756,2664.282236,2539.325247,2569.262185,2591.929889,2526.026777,2415.688257,2393.710553,2239.106625,2306.409737,2677.461471,2721.226879,2602.859124,2513.748308,2483.441369,2586.930655,2675.951471,2713.377644,2734.965348,2742.604583,2646.204532,2734.905348,3112.706317,3187.138664,3068.300909) > 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 -19.256545 2 -43.606544 3 -49.968673 4 -43.120844 5 -41.098657 6 -28.590069 7 -39.710552 8 -52.839920 9 -37.963651 10 15.723206 11 34.828874 12 33.290597 13 9.879256 14 -12.870383 15 -5.293943 16 7.253182 17 1.438304 18 -4.743825 19 8.926621 20 13.088204 21 9.588215 22 65.484131 23 68.813353 24 39.984219 25 2.361449 26 -16.079415 27 -15.823422 28 -28.870588 29 -29.229462 30 -36.279122 31 -28.908660 32 -42.681817 33 -46.540392 34 18.799413 35 18.881630 36 12.802634 37 14.229119 38 20.178947 39 19.631652 40 34.546068 41 43.001730 42 50.428091 43 61.513317 44 77.310290 45 109.653903 46 163.064345 47 117.793992 48 61.982460 49 -31.776016 50 -83.928529 51 -102.093395 52 -87.134873 53 -88.243995 54 -76.829018 55 -65.390922 56 -55.987675 57 -16.828987 58 21.020012 59 50.101985 60 26.090696 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1h4yj1257433939.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/freestat/rcomp/tmp/2tz621257433939.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/freestat/rcomp/tmp/3po9l1257433939.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/freestat/rcomp/tmp/48dm41257433939.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/freestat/rcomp/tmp/5wcbq1257433939.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/freestat/rcomp/tmp/6pu2e1257433939.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/freestat/rcomp/tmp/7s3g71257433939.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/freestat/rcomp/tmp/8nk4a1257433939.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. 2239 2654 2930 2887 3128 3416 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/94sug1257433939.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/freestat/rcomp/tmp/10ijyo1257433939.tab") > > system("convert tmp/1h4yj1257433939.ps tmp/1h4yj1257433939.png") > system("convert tmp/2tz621257433939.ps tmp/2tz621257433939.png") > system("convert tmp/3po9l1257433939.ps tmp/3po9l1257433939.png") > system("convert tmp/48dm41257433939.ps tmp/48dm41257433939.png") > system("convert tmp/5wcbq1257433939.ps tmp/5wcbq1257433939.png") > system("convert tmp/6pu2e1257433939.ps tmp/6pu2e1257433939.png") > system("convert tmp/7s3g71257433939.ps tmp/7s3g71257433939.png") > system("convert tmp/8nk4a1257433939.ps tmp/8nk4a1257433939.png") > > > proc.time() user system elapsed 2.545 1.912 2.811