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(-5170.50,-497.52,-1876.75,-1192.58,-2008.81,-2833.00,-1953.88,555.46,-1245.97,-1986.18,-629.35,-3235.95,-3666.73,-417.52,-877.69,437.22,-1671.54,-1294.54,-1190.94,2369.91,-1462.35,124.86,1882.04,-1498.67,-1616.48,2041.89,1984.77,1598.30,-1359.99,1549.07,860.58,3527.58,672.48,2057.94,3652.74,1591.34,639.43,2854.25,3826.51,2640.07,-1553.31,1778.22,1834.93,1420.19,2381.17,-149.45,2519.81,247.92,-2280.63,1897.08,1763.13,-715.00,-2669.55,-2334.49,-1822.31,421.48,-1048.11,-1109.28,1567.45,671.20) > x <- c(-4305.27,-644.87,-2540.32,-1512.92,-1307.62,-2973.97,-1802.42,340.42,-1597.07,-1779.22,-850.42,-3760.12,-3088.73,-316.68,-1314.97,990.38,123.02,-844.38,-609.18,2823.23,-1186.57,-53.58,745.18,-1426.87,-821.22,1824.68,1466.89,1846.63,-908.92,854.39,683.63,3226.03,287.23,1457.39,2568.19,1111.59,655.84,2277.64,3474.73,2698.27,165.27,1392.87,1633.02,1458.01,2264.26,-518.65,2353.89,-218.96,-1851.00,1250.15,1356.80,47.52,-1823.32,-2457.82,-1837.72,648.05,-894.10,-1050.84,1707.86,564.62) > 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 -512.539607 2 200.178093 3 871.674565 4 444.279302 5 -594.069005 6 384.599449 7 -3.804673 8 187.152508 9 481.932924 10 -61.205232 11 290.736880 12 832.201358 13 -324.969339 14 -74.897441 15 545.003112 16 -634.292629 17 -1804.637945 18 -380.987921 19 -531.855655 20 -684.600869 21 -178.575498 22 182.829239 23 1075.814311 24 45.090031 25 -727.985203 26 67.730984 27 397.711368 28 -399.607174 29 -376.610763 30 624.687759 31 120.946527 32 37.271499 33 361.719867 34 481.159614 35 874.162171 36 388.687771 37 -70.136899 38 390.024212 39 67.127836 40 -279.244066 41 -1732.119092 42 271.245134 43 68.131893 44 -157.261176 45 -68.579690 46 411.688070 47 -26.912237 48 484.817274 49 -277.994969 50 544.516847 51 295.180011 52 -766.412937 53 -696.862532 54 324.676112 55 165.957125 56 -279.658737 57 -80.764827 58 27.645414 59 -280.319048 60 60.325902 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1n5yb1257153025.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/2karj1257153025.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/3yrr11257153025.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/47kck1257153025.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/5uqc31257153025.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/6wpls1257153025.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/7h9341257153025.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/8ay841257153025.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.305e+03 -1.309e+03 8.527e+01 -8.333e-04 1.409e+03 3.475e+03 > > #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/9s8641257153025.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/100ayz1257153025.tab") > > system("convert tmp/1n5yb1257153025.ps tmp/1n5yb1257153025.png") > system("convert tmp/2karj1257153025.ps tmp/2karj1257153025.png") > system("convert tmp/3yrr11257153025.ps tmp/3yrr11257153025.png") > system("convert tmp/47kck1257153025.ps tmp/47kck1257153025.png") > system("convert tmp/5uqc31257153025.ps tmp/5uqc31257153025.png") > system("convert tmp/6wpls1257153025.ps tmp/6wpls1257153025.png") > system("convert tmp/7h9341257153025.ps tmp/7h9341257153025.png") > system("convert tmp/8ay841257153025.ps tmp/8ay841257153025.png") > > > proc.time() user system elapsed 1.595 1.167 2.608