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(9.566151798,10.1585264,8.675824146,8.49107495,6.150900994,3.328024789,2.524800673,4.548854048,2.704278807,3.633603244,12.10954987,12.70192447,8.815998101,1.57024569,-1.180777783,0.717175271,-4.162302863,-3.966704149,-2.052630515,-4.583132122,-4.220081962,-9.256162024,-4.04326556,-9.523920864,-8.538301891,-4.367933722,-2.009284847,-7.653860088,-0.568803499,-7.929806713,-6.76148549,-7.212508963,-1.135385169,-12.89756555,-10.03891668,-11.1802678,-8.313993526,-9.638046901,-12.08175237,-11.12837455,-7.61076941,-2.385846259,5.577203902,4.151973357,6.778073679,10.66486982,4.795064035,0.592402302,7.721419347,1.836362757,17.51348655,17.11783543,-0.587795425,15.36972868,6.50283962,-1.050538193,-1.805962952,1.055602646,-5.343220184,-12.14439735) > x <- c(4.120575483,8.926511718,-4.46024537,4.727882162,4.432447952,6.950256655,-5.32280306,-14.69266743,9.590894311,23.81920504,2.589069408,-9.504994357,-4.66481116,-0.229193754,4.008248556,5.383133174,-0.630564198,4.148431753,-9.51138505,-26.78764011,7.089985394,10.64478195,-8.66297919,-18.5246209,-13.93557738,-14.03466139,7.721960062,0.405521803,-2.811832441,15.73565743,-12.38854196,-18.25109965,12.66670905,11.26625459,8.322876048,1.079497504,-5.869817274,-6.599952905,10.76077988,8.019226242,2.303242442,11.71054912,-15.01182537,-19.98990534,-5.734654326,1.602333524,10.6078153,-13.65884666,0.998690786,-4.683954969,37.83385373,8.819708971,8.615611775,48.25943771,-31.23279409,-22.29124044,-0.374802185,5.6841057,7.232050034,-26.2158943) > 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 8.9884408 2 8.9070159 3 9.3011573 4 7.8282187 5 5.5294650 6 2.3535882 7 3.2710658 8 6.6087884 9 1.3596208 10 0.2941144 11 11.7465584 12 14.0345392 13 9.4700117 14 1.6023790 15 -1.7427403 16 -0.0375482 17 -4.0738968 18 -4.5483206 19 -0.7191198 20 -0.8274642 21 -5.2141087 22 -10.7485767 23 -2.8287027 24 -6.9267408 25 -6.5845127 26 -2.4002528 27 -3.0919154 28 -7.7107149 29 -0.1745803 30 -10.1359698 31 -5.0245930 32 -4.6536770 33 -2.9112771 34 -14.4771116 35 -11.2057966 36 -11.3316150 37 -7.4910362 38 -8.7127235 39 -13.5904301 40 -12.2526823 41 -7.9336875 42 -4.0276831 43 7.6818847 44 6.9545885 45 7.5820809 46 10.4402202 47 3.3078322 48 2.5073934 49 7.5814014 50 2.4930604 51 12.2091226 52 15.8812988 53 -1.7957173 54 8.6036820 55 10.8817249 56 2.0747277 57 -1.7534151 58 0.2586824 59 -6.3571646 60 -8.4688890 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/160nk1256828761.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/29dmi1256828761.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/3ata01256828761.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/49bfc1256828761.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/5epcj1256828761.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/6nhdi1256828761.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/7us1x1256828761.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/8rg2t1256828761.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. -3.123e+01 -8.873e+00 1.341e+00 -3.333e-11 8.095e+00 4.826e+01 > > #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/9lqe81256828761.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/10yull1256828762.tab") > > system("convert tmp/160nk1256828761.ps tmp/160nk1256828761.png") > system("convert tmp/29dmi1256828761.ps tmp/29dmi1256828761.png") > system("convert tmp/3ata01256828761.ps tmp/3ata01256828761.png") > system("convert tmp/49bfc1256828761.ps tmp/49bfc1256828761.png") > system("convert tmp/5epcj1256828761.ps tmp/5epcj1256828761.png") > system("convert tmp/6nhdi1256828761.ps tmp/6nhdi1256828761.png") > system("convert tmp/7us1x1256828761.ps tmp/7us1x1256828761.png") > system("convert tmp/8rg2t1256828761.ps tmp/8rg2t1256828761.png") > > > proc.time() user system elapsed 1.655 1.170 2.535