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(517.1199087,517.0744627,514.5648647,508.7858096,504.8207603,504.8445305,526.5614874,534.1825531,535.3522205,532.016917,526.0104562,527.1764411,526.4294825,526.4057371,524.439701,519.7595598,516.8558793,514.774708,535.965484,539.6165305,540.6477596,536.8295819,530.5440604,531.6540228,529.3297649,529.5356456,526.1520693,524.6103316,523.7862159,520.875225,538.3326109,539.1901334,540.6477596,527.7366768,519.4477837,515.617106,518.6848754,513.9805444,505.1712581,503.3418322,496.0413289,485.1515227,508.4840214,510.87474,504.6414569,500.6425871,493.3781511,497.0965701,498.5388651,495.0141412,486.9086157,486.9137501,474.9252573,476.2761804,497.9297139,498.3302118,496.9597569,495.0737319,496.2489295,505.7321425,514.1196359,518.0222003,522.5380369,523.4147495,517.1363457,521.5294814,541.0268016) > x <- c(543.058008,541.7453276,539.031539,533.6065967,530.8653313,536.5202699,562.3726523,570.448946,570.9737297,572.9589863,563.4536361,563.5059893,560.1223081,558.8166068,556.2292693,550.4089389,548.0109488,551.3936888,577.4738089,581.1178882,579.5964113,569.1493653,560.2918882,560.7896219,559.6588246,556.4746176,550.4207482,546.7988661,546.2810632,549.2094318,574.251687,578.8635418,572.3774978,555.984712,543.9816173,539.8268241,539.9462936,533.5522467,525.8089006,522.0785382,514.7630523,513.1179202,544.7990455,550.9972777,535.7182095,525.7632547,516.162765,516.8684552,518.0550164,512.3690076,505.511622,503.1480895,493.7641137,500.7404517,529.5705808,534.0945609,520.5535515,510.9559668,505.5719533,510.2705165,513.7149015,514.0924041,513.1042779,512.4177983,506.1294301,514.0243185,542.0885537) > 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 -0.3159474 2 0.4201593 3 -0.4736844 4 -3.0227998 5 -5.3557356 6 -8.6988419 7 -2.3740553 8 0.4384908 9 1.2957088 10 -3.2215905 11 -3.5686901 12 -2.4338756 13 -1.1662347 14 -0.4125826 15 -0.8381518 16 -2.0529444 17 -3.5288930 18 -7.6241034 19 -1.9610898 20 -0.4796804 21 1.4574161 22 3.8592729 23 2.8473774 24 3.6609957 25 2.0099997 26 4.1117156 27 4.3325340 28 4.9472175 29 4.4313949 30 -0.2231084 31 2.3244463 32 0.4361308 33 5.7554628 34 2.6044302 35 1.4620227 36 0.1050545 37 3.1016933 38 2.2042942 39 -1.9947051 40 -1.6031220 41 -4.5480807 42 -14.4583967 43 -9.9884257 44 -11.2880534 45 -8.4243792 46 -6.4961991 47 -8.0446291 48 -4.7463688 49 -4.0105368 50 -4.1498855 51 -8.1726133 52 -6.7602626 53 -13.1616589 54 -15.9643562 55 -11.4759045 56 -13.7689251 57 -7.0772402 58 -3.2489888 59 1.1317800 60 7.8175300 61 14.1542816 62 17.8320859 63 22.9362399 64 24.2216735 65 21.6872818 66 21.3799043 67 24.1681459 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/12j9w1260304085.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/2kcus1260304085.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/3nttk1260304085.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/40w6q1260304085.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/5n6yr1260304085.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/65no41260304085.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/7etfq1260304085.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/8chyx1260304085.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. 493.8 516.5 541.7 539.6 559.2 581.1 > > #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/9fvpf1260304085.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/108qvd1260304085.tab") > system("convert tmp/12j9w1260304085.ps tmp/12j9w1260304085.png") > system("convert tmp/2kcus1260304085.ps tmp/2kcus1260304085.png") > system("convert tmp/3nttk1260304085.ps tmp/3nttk1260304085.png") > system("convert tmp/40w6q1260304085.ps tmp/40w6q1260304085.png") > system("convert tmp/5n6yr1260304085.ps tmp/5n6yr1260304085.png") > system("convert tmp/65no41260304085.ps tmp/65no41260304085.png") > system("convert tmp/7etfq1260304085.ps tmp/7etfq1260304085.png") > system("convert tmp/8chyx1260304085.ps tmp/8chyx1260304085.png") > > > proc.time() user system elapsed 1.574 1.161 1.921