R version 2.8.1 (2008-12-22) 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(1.6387531550,1.3499707810,0.8051002773,0.1826650254,0.0938826513,0.2163179032,0.3163179032,0.2163179032,0.0826650254,-0.1173349746,0.3377945217,1.0826650254,1.2826650254,1.0938826513,0.4051002773,0.0051002773,-0.0724644709,-0.1500292190,-0.2388115931,-0.4388115931,-0.6388115931,-0.3724644709,0.1602297736,1.3153592699,1.7817063921,1.4929240181,0.8153592699,0.4265768958,0.3377945217,0.3490121477,0.4377945217,0.6153592699,0.6265768958,0.4041416440,0.2592711403,0.0929240181,-0.1182936079,-0.3407288597,-0.0519464856,0.0368358884,-0.1295112338,-0.4958583560,-0.7958583560,-0.9407288597,-0.9743817375,-1.0080346152,-0.8743817375,-0.5509878523,-0.1397702264,-0.1846407301,0.1256182625,-0.0080346152,-0.0631641116,-0.3622054783,-0.7948997227,-1.1724644709,-1.4948997227,-1.7285526005,-1.7173349746,-1.3612468450,-1.0500292190) > x <- c(3.8196874184,1.7176731695,0.8257301652,0.5297586631,-0.2722555858,-0.9762840837,-1.0762840837,-0.9762840837,-0.9702413369,-1.2702413369,3.1378156589,2.7297586631,2.7297586631,1.9277444142,0.7257301652,0.3257301652,-1.0782983326,-1.7823268305,-2.7843410795,-2.9843410795,-3.3843410795,-2.7782983326,2.2337871610,3.7418441568,4.0478869037,2.2458726547,0.3418441568,-0.9601700921,-1.3621843411,-1.7641985900,-1.3621843411,0.3418441568,-0.5601700921,-0.9561415942,2.5519154015,1.3458726547,0.1478869037,-0.4480845985,-1.3460703495,-1.0440561006,-1.3500988474,-2.5561415942,-4.0561415942,-4.2480845985,-4.5420418516,-2.0359991048,4.1579581484,3.5358014100,1.8337871610,-0.0581558432,-1.3420418516,-0.0359991048,1.6559438994,1.2378156589,0.3257301652,-0.9782983326,-2.0742698348,-0.9682270879,2.7297586631,2.2196874184,1.2176731695) > 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 1.044644389 2 1.082806331 3 0.676667378 4 0.100267114 5 0.136228899 6 0.368167746 7 0.483721604 8 0.368167746 9 0.233574988 10 0.080236562 11 -0.150256878 12 0.658082233 13 0.858082233 14 0.794044018 15 0.292221236 16 -0.045563331 17 0.095252523 18 0.127191370 19 0.194260871 20 0.025368588 21 -0.112415979 22 0.059668113 23 -0.187210315 24 0.733358134 25 1.152103801 26 1.143604169 27 0.762189314 28 0.575920391 29 0.549666743 30 0.623413095 31 0.649666743 32 0.562189314 33 0.713704958 34 0.552858552 35 -0.137650164 36 -0.116411107 37 -0.141295727 38 -0.271034416 39 0.157419388 40 0.199226894 41 0.080481227 42 -0.098279716 43 -0.164971842 44 -0.279987803 45 -0.267918987 46 -0.691358201 47 -1.521104654 48 -1.100941391 49 -0.424994882 50 -0.175595253 51 0.334357550 52 -0.002435365 53 -0.320727278 54 -0.554733571 55 -0.845563331 56 -1.020301335 57 -1.172270733 58 -1.577955932 59 -2.141917767 60 -1.706493879 61 -1.239424378 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1u4xu1257333519.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/rcomp/tmp/29dwk1257333519.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/rcomp/tmp/32qjc1257333519.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/rcomp/tmp/4pxzy1257333519.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/rcomp/tmp/54ovx1257333519.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/rcomp/tmp/66mpy1257333519.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/rcomp/tmp/70e4b1257333519.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/rcomp/tmp/8ze0m1257333519.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. -4.542e+00 -1.346e+00 -2.723e-01 -3.279e-12 1.718e+00 4.158e+00 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/988b81257333519.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/rcomp/tmp/10t9hz1257333519.tab") > > system("convert tmp/1u4xu1257333519.ps tmp/1u4xu1257333519.png") > system("convert tmp/29dwk1257333519.ps tmp/29dwk1257333519.png") > system("convert tmp/32qjc1257333519.ps tmp/32qjc1257333519.png") > system("convert tmp/4pxzy1257333519.ps tmp/4pxzy1257333519.png") > system("convert tmp/54ovx1257333519.ps tmp/54ovx1257333519.png") > system("convert tmp/66mpy1257333519.ps tmp/66mpy1257333519.png") > system("convert tmp/70e4b1257333519.ps tmp/70e4b1257333519.png") > system("convert tmp/8ze0m1257333519.ps tmp/8ze0m1257333519.png") > > > proc.time() user system elapsed 1.930 1.650 3.504