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(87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6) > x <- c(-2806.152717,-2947.419023,-4456.870921,-4174.40494,-3784.050335,-3781.328125,-3336.329208,-3415.384571,-3999.205373,-3669.639501,-3413.184571,-4105.516208,-2646.919781,-2918.385762,-4402.526609,-3761.961494,-4175.90494,-3795.694755,-3377.129099,-3691.828341,-4189.293781,-3526.095405,-3903.60559,-4170.10494,-2536.953367,-2973.852284,-4024.260845,-4173.22715,-3815.228017,-3424.351201,-3420.351201,-3375.85131,-3774.172545,-3214.340583,-3356.784679,-3861.150119,-2730.741774,-3075.618698,-3795.539176,-4498.793023,-3809.805806,-3170.218481,-3460.851093,-3448.706673,-3506.950985,-3996.649794,-3437.340042,-3525.962036,-3174.218481,-2658.153042,-3901.7278,-3772.250335,-2894.596921,-2789.208297,-2461.042424,-2795.330507,-3247.473845,-2950.119023,-2907.219131,-3403.56236,-2273.576227) > 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 -6.74147787 2 0.50215496 3 -5.23895528 4 -4.72723801 5 -5.16864901 6 -7.42709569 7 -7.63438562 8 -7.54113049 9 -7.65289474 10 -4.52221864 11 -5.30754847 12 -0.07568223 13 -10.81085809 14 -0.15466526 15 -5.30941358 16 -2.83147270 17 -6.25013485 18 -6.94639589 19 -3.85717777 20 -6.96092139 21 0.24549047 22 -4.43108201 23 -0.99360667 24 -0.36160043 25 -4.63226981 26 3.79866301 27 2.06464465 28 1.49074043 29 3.35543758 30 -1.57800210 31 2.48305612 32 2.46232711 33 9.88213105 34 5.72771635 35 6.75337073 36 6.95445716 37 -0.49036344 38 5.94524407 39 3.25597896 40 2.42112253 41 3.83820521 42 0.30122056 43 6.56484332 44 8.85022248 45 4.96114902 46 4.98611504 47 5.32372903 48 10.77095381 49 -3.75983765 50 7.91767119 51 5.93505695 52 6.81147273 53 3.90846079 54 0.41717115 55 2.12647689 56 -0.77628166 57 2.22195188 58 -2.23905934 59 -3.88421162 60 -0.56066971 61 -3.41193520 > library(lattice) > postscript(file="/var/www/rcomp/tmp/11bck1256741606.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/2n6ct1256741606.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/3p3go1256741606.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/4g02u1256741606.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/5ew5u1256741606.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/6i72d1256741606.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/73v8v1256741606.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/8h2az1256741606.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. -4499 -3815 -3449 -3477 -3076 -2274 > > #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/963ul1256741607.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/101u621256741607.tab") > > system("convert tmp/11bck1256741606.ps tmp/11bck1256741606.png") > system("convert tmp/2n6ct1256741606.ps tmp/2n6ct1256741606.png") > system("convert tmp/3p3go1256741606.ps tmp/3p3go1256741606.png") > system("convert tmp/4g02u1256741606.ps tmp/4g02u1256741606.png") > system("convert tmp/5ew5u1256741606.ps tmp/5ew5u1256741606.png") > system("convert tmp/6i72d1256741606.ps tmp/6i72d1256741606.png") > system("convert tmp/73v8v1256741606.ps tmp/73v8v1256741606.png") > system("convert tmp/8h2az1256741606.ps tmp/8h2az1256741606.png") > > > proc.time() user system elapsed 1.940 1.730 3.637