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(100 + ,99.94940551 + ,102.0743739 + ,102.0237794 + ,102.6309132 + ,102.8838857 + ,103.0103719 + ,104.3258285 + ,105.211232 + ,104.7305844 + ,104.174045 + ,103.6933974 + ,104.3258285 + ,105.211232 + ,105.3124209 + ,105.5400961 + ,106.7037693 + ,106.6025803 + ,105.008854 + ,104.3258285 + ,104.174045 + ,103.4151278 + ,102.3273463 + ,101.8214015 + ,103.5669112 + ,103.8957754 + ,104.5788009 + ,105.0341513 + ,105.6665823 + ,105.6918796 + ,105.7171768 + ,105.843663 + ,105.7930686 + ,105.3883127 + ,105.9701493 + ,106.5013913 + ,107.1338224 + ,109.3599798 + ,109.3599798 + ,108.4239818 + ,107.9433342 + ,108.0951176 + ,108.3986845 + ,110.5489502 + ,111.8138123 + ,112.5474323 + ,111.6620288 + ,111.3837592 + ,113.1039717 + ,115.1783456 + ,121.0726031 + ,123.0710853 + ,123.3999494 + ,122.9193018 + ,122.3880597 + ,123.5517329 + ,124.9683784 + ,124.8671895 + ,123.2734632 + ,121.9580066 + ,122.4892487 + ,125.6767012 + ,126.7644827 + ,126.4356185 + ,125.3478371 + ,126.0055654 + ,127.4475082 + ,130.5843663 + ,133.0887933 + ,133.3417657 + ,132.8358209 + ,133.7971161 + ,136.6304073 + ,138.8818619 + ,140.6526689 + ,143.9160132 + ,149.0260562 + ,149.3296231 + ,152.6182646 + ,161.5987857 + ,162.6612699 + ,166.1269922 + ,165.9752087 + ,165.4692639 + ,166.9365039 + ,167.4930433 + ,169.2891475 + ,170.2757399 + ,171.5911966 + ,171.3635214 + ,171.641791 + ,170.0986592 + ,168.302555 + ,168.9602833 + ,170.0227675 + ,167.5942322 + ,172.6030863 + ,175.082216 + ,177.7637238 + ,182.4943081 + ,185.4793827 + ,189.1474829 + ,186.5924614 + ,184.4927903 + ,178.62383 + ,170.5793069 + ,166.7088287 + ,163.3442955) > x <- c(100 + ,108.1560276 + ,114.0150276 + ,102.1880309 + ,110.3672031 + ,96.8602511 + ,94.1944583 + ,99.51621961 + ,94.06333487 + ,97.5541476 + ,78.15062422 + ,81.2434643 + ,92.36262465 + ,96.06324371 + ,114.0523777 + ,110.6616666 + ,104.9171949 + ,90.00187193 + ,95.7008067 + ,86.02741157 + ,84.85287668 + ,100.04328 + ,80.91713823 + ,74.06539709 + ,77.30281369 + ,97.23043249 + ,90.75515676 + ,100.5614455 + ,92.01293267 + ,99.24012138 + ,105.8672755 + ,90.9920463 + ,93.30624423 + ,91.17419413 + ,77.33295039 + ,91.1277721 + ,85.01249943 + ,83.90390242 + ,104.8626302 + ,110.9039108 + ,95.43714373 + ,111.6238727 + ,108.8925403 + ,96.17511682 + ,101.9740205 + ,99.11953031 + ,86.78158147 + ,118.4195003 + ,118.7441447 + ,106.5296192 + ,134.7772694 + ,104.6778714 + ,105.2954304 + ,139.4139849 + ,103.6060491 + ,99.78182974 + ,103.4610301 + ,120.0594945 + ,96.71377168 + ,107.1308929 + ,105.3608372 + ,111.6942359 + ,132.0519998 + ,126.8037879 + ,154.4824253 + ,141.5570984 + ,109.9506882 + ,127.904198 + ,133.0888617 + ,120.0796299 + ,117.5557142 + ,143.0362309 + ,159.982927 + ,128.5991124 + ,149.7373327 + ,126.8169313 + ,140.9639674 + ,137.6691981 + ,117.9402337 + ,122.3095247 + ,127.7804207 + ,136.1677176 + ,116.2405856 + ,123.1576893 + ,116.3400234 + ,108.6119282 + ,125.8982264 + ,112.8003105 + ,107.5182447 + ,135.0955413 + ,115.5096488 + ,115.8640759 + ,104.5883906 + ,163.7213386 + ,113.4482275 + ,98.0428844 + ,116.7868521 + ,126.5330444 + ,113.0336597 + ,124.3392163 + ,109.8298759 + ,124.4434777 + ,111.5039454 + ,102.0350019 + ,116.8726598 + ,112.2073122 + ,101.1513902 + ,124.4255108) > 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 -22.5578230 2 -28.9981732 3 -31.4633779 4 -22.2482338 5 -28.0489881 6 -17.2141334 7 -14.9991594 8 -17.8529817 9 -12.6955720 10 -15.9110608 11 -1.2661100 12 -4.1698112 13 -12.2485716 14 -14.2623799 15 -28.2545924 16 -25.3704996 17 -19.7063793 18 -8.1223124 19 -14.1808104 20 -7.2853143 21 -6.5169205 22 -19.1766025 23 -5.2802055 24 -0.4182244 25 -1.2090354 26 -16.4922585 27 -10.7362450 28 -17.9635304 29 -10.6338552 30 -16.2706243 31 -21.4373027 32 -9.6569716 33 -11.5206005 34 -10.2550238 35 1.1705925 36 -9.1055763 37 -3.6821979 38 -0.5875216 39 -17.0074207 40 -22.6763976 41 -11.0397661 42 -23.5693085 43 -21.1259075 44 -9.0123075 45 -12.2905367 46 -9.3205958 47 -0.5399606 48 -25.6046313 49 -24.1387581 50 -12.4950402 51 -28.7311128 52 -3.1515678 53 -3.3065239 54 -30.5170010 55 -2.9948853 56 1.1648331 57 -0.3009529 58 -13.4060375 59 3.2902019 60 -6.1864409 61 -4.2684669 62 -6.0428503 63 -20.9041489 64 -17.1213556 65 -39.8936799 66 -29.1097376 67 -2.9060788 68 -13.8347127 69 -15.3921570 70 -4.9472362 71 -3.4758453 72 -22.4769980 73 -32.9204210 74 -6.0816407 75 -20.8713543 76 0.3487420 77 -5.6245644 78 -2.7397445 79 16.0053506 80 21.5627957 81 18.3391629 82 15.2339440 83 30.6938665 84 24.7687881 85 31.5772581 86 38.1882940 87 26.4416262 88 37.6896457 89 43.1432824 90 21.3104586 91 36.9330937 92 35.1122896 93 42.1500047 94 -3.5193650 95 36.9290694 96 46.5696912 97 36.8937772 98 31.7373531 99 44.9948146 100 40.8681772 101 55.2204448 102 47.4396695 103 55.0219911 104 60.3406661 105 42.8472958 106 38.4577911 107 43.2489609 108 21.6505581 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/13cdt1257953625.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/2hfvp1257953625.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/31mp61257953625.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/4egmy1257953625.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/5q2fu1257953625.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/6bwfw1257953625.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/7naq11257953625.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/8avnu1257953625.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. 74.07 97.14 108.40 109.90 120.10 163.70 > > #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/95nid1257953625.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/10sdq21257953625.tab") > > system("convert tmp/13cdt1257953625.ps tmp/13cdt1257953625.png") > system("convert tmp/2hfvp1257953625.ps tmp/2hfvp1257953625.png") > system("convert tmp/31mp61257953625.ps tmp/31mp61257953625.png") > system("convert tmp/4egmy1257953625.ps tmp/4egmy1257953625.png") > system("convert tmp/5q2fu1257953625.ps tmp/5q2fu1257953625.png") > system("convert tmp/6bwfw1257953625.ps tmp/6bwfw1257953625.png") > system("convert tmp/7naq11257953625.ps tmp/7naq11257953625.png") > system("convert tmp/8avnu1257953625.ps tmp/8avnu1257953625.png") > > > proc.time() user system elapsed 1.698 1.256 19.631