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(-1911.724,-1092.9502,2107.62,1781.9164,-2191.0104,-3196.1112,1042.9483,-510.7845,1350.1454,-310.0889,528.2906,213.2038,-1599.2628,1127.863,3179.2851,938.3232,-867.7033,-3318.9066,1899.2492,-28.0477,-706.9446,2361.3973,-531.939,-326.1803,-1150.7638,1250.9782,2070.885,1756.2899,-1364.0325,-4171.1225,1808.3077,598.8945,-1071.6315,2335.7905,-846.1699,-1114.4615,-301.8415,1165.2397,581.1755,2189.5053,-1432.1288,-3959.7774,2481.9723,-904.7102,-68.7611,292.8563,-1419.0249,-1625.1425,-95.996,360.3377,1786.0998,2683.3188,-953.3848,-2681.8982,2139.734,-776.0495,258.852,2343.5493,-914.6248,-1193.5834) > x <- c(-11.152,-1.5796,13.16,11.1072,-5.6192,-3.8776,13.7234,7.109,10.9492,7.6378,2.6788,2.4724,-10.7344,0.574,15.1298,4.6936,-11.3734,-18.5268,1.4216,-4.6246,-4.2308,8.5854,-2.922,0.5006,-9.2324,0.2036,5.65,4.1602,-15.015,-20.315,2.9446,-6.449,-7.137,3.139,-9.8002,-4.357,-6.117,0.6406,0.589,2.3694,-15.0224,-19.9452,6.3754,-5.8596,-3.3378,-1.0326,-4.4502,-4.275,-3.768,11.3846,18.4804,18.5824,-4.7104,-2.5836,5.172,4.139,9.136,15.4814,1.9896,2.7668) > 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 -243.950420 2 -867.679954 3 111.720828 4 95.361890 5 -1356.996634 6 -2624.546121 7 -1037.851877 8 -1594.834222 9 -312.599456 10 -1473.825614 11 111.845477 12 -172.138079 13 5.580962 14 1028.598628 15 886.548869 16 218.259788 17 833.433934 18 -539.794841 19 1672.256586 20 656.085804 21 -82.154396 22 1054.862943 23 -104.377116 24 -414.383732 25 227.737560 26 1207.530889 27 1206.697837 28 1116.606672 29 885.872038 30 -1122.539713 31 1351.808110 32 1557.954155 33 -8.894367 34 1849.995994 35 617.895519 36 -470.653712 37 607.187744 38 1055.939107 39 479.650718 40 1819.684904 41 818.890874 42 -966.921258 43 1508.471703 44 -34.469594 45 421.459353 46 435.696923 47 -761.172431 48 -993.691621 49 459.053016 50 -1368.019328 51 -1011.551779 52 -129.703568 53 -256.321750 54 -2305.331168 55 1347.578574 56 -1412.538015 57 -1130.654479 58 -2.170945 59 -1227.211611 60 -1623.289595 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/155dw1257173930.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/2mmv51257173930.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/3y7ok1257173930.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/4ywrw1257173930.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/5trbt1257173930.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/6p8p51257173930.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/7el7u1257173930.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/8qdeb1257173930.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. -20.32000 -4.93800 0.53730 -0.08502 5.29100 18.58000 > > #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/9cts21257173930.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/106vxr1257173930.tab") > system("convert tmp/155dw1257173930.ps tmp/155dw1257173930.png") > system("convert tmp/2mmv51257173930.ps tmp/2mmv51257173930.png") > system("convert tmp/3y7ok1257173930.ps tmp/3y7ok1257173930.png") > system("convert tmp/4ywrw1257173930.ps tmp/4ywrw1257173930.png") > system("convert tmp/5trbt1257173930.ps tmp/5trbt1257173930.png") > system("convert tmp/6p8p51257173930.ps tmp/6p8p51257173930.png") > system("convert tmp/7el7u1257173930.ps tmp/7el7u1257173930.png") > system("convert tmp/8qdeb1257173930.ps tmp/8qdeb1257173930.png") > > > proc.time() user system elapsed 1.605 1.151 1.992