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(97,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1) > x <- c(244.576,241.572,240.541,236.089,236.997,264.579,270.349,269.645,267.037,258.113,262.813,267.413,267.366,264.777,258.863,254.844,254.868,277.267,285.351,286.602,283.042,276.687,277.915,277.128,277.103,275.037,270.150,267.140,264.993,287.259,291.186,292.300,288.186,281.477,282.656,280.190,280.408,276.836,275.216,274.352,271.311,289.802,290.726,292.300,278.506,269.826,265.861,269.034,264.176,255.198,253.353,246.057,235.372,258.556,260.993,254.663,250.643,243.422,247.105,248.541,245.039,237.080,237.085,225.554,226.839,247.934,248.333,246.969,245.098,246.263,255.765,264.319,268.347,273.046,273.963,267.430,271.993,292.710,295.881) > 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 -10.07020814 2 -2.20901904 3 -5.09394382 4 -10.49247449 5 -3.92961154 6 -16.08238043 7 -12.54744738 8 7.22628003 9 8.65849746 10 -6.04215116 11 -6.89913811 12 -7.87406149 13 -5.98249163 14 9.25313373 15 -1.60762780 16 -7.82849365 17 6.17581110 18 -13.80660390 19 -2.95662144 20 14.56776352 21 10.12922597 22 2.58936470 23 0.50962428 24 -6.63153557 25 -5.33601968 26 3.09341331 27 0.31685909 28 -4.92302800 29 10.49187646 30 -18.51439401 31 -3.01002970 32 14.68978233 33 6.65187686 34 8.34852056 35 2.05999128 36 -1.68232153 37 0.05677993 38 14.21609001 39 -0.87448045 40 8.17054864 41 12.32510125 42 -13.55827014 43 1.70746264 44 16.28978233 45 15.51562869 46 10.35874500 47 -1.25243517 48 3.31668833 49 1.74533568 50 13.63500137 51 0.60407391 52 2.49543066 53 8.47892118 54 -12.06269270 55 0.07441854 56 7.23904138 57 16.41799617 58 6.02280525 59 -6.61659537 60 4.34097203 61 5.81283762 62 1.38527572 63 8.88617254 64 -1.38207929 65 5.64840407 66 -10.46790221 67 -6.59633578 68 10.15901106 69 8.72342012 70 -7.36762026 71 -10.76329896 72 -12.52901520 73 -9.60653507 74 1.13629862 75 -7.69922415 76 -11.17101230 77 0.54742783 78 -15.83667823 79 -8.76791346 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ut1f1258912155.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/2yjj11258912155.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/3u8js1258912155.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/4mcw51258912155.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/51p951258912155.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/6urkc1258912155.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/7ezh41258912155.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/8ig4k1258912155.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. 225.6 249.6 267.1 264.6 277.1 295.9 > > #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/9mq2n1258912155.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/10o52y1258912155.tab") > > system("convert tmp/1ut1f1258912155.ps tmp/1ut1f1258912155.png") > system("convert tmp/2yjj11258912155.ps tmp/2yjj11258912155.png") > system("convert tmp/3u8js1258912155.ps tmp/3u8js1258912155.png") > system("convert tmp/4mcw51258912155.ps tmp/4mcw51258912155.png") > system("convert tmp/51p951258912155.ps tmp/51p951258912155.png") > system("convert tmp/6urkc1258912155.ps tmp/6urkc1258912155.png") > system("convert tmp/7ezh41258912155.ps tmp/7ezh41258912155.png") > system("convert tmp/8ig4k1258912155.ps tmp/8ig4k1258912155.png") > > > proc.time() user system elapsed 1.596 1.186 2.419