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(33.97260143,16.58856422,10.35739026,3.126967938,-1.873032062,-5.949839504,-10.41143578,-12.18101346,-16.64260974,-16.18101346,11.20452701,19.20452701,19.74293073,12.97335305,6.20377538,-2.026646945,-10.64185811,-12.10345439,-15.9498395,-17.33462834,-21.41143578,-19.87303206,4.050912124,10.05091212,11.74293073,6.434197706,0.818234915,-5.643361364,-5.720168806,-8.489746481,-8.56730555,-9.952094388,-12.64486462,-9.260827411,8.279079566,12.6638684,15.27832794,9.508750263,4.815980031,1.123961426,-0.491249737,-1.260827411,-2.953597644,-4.415193923,-6.954349272,-6.646367876,9.970346542,13.97034654,17.43119119,11.58480608,7.584806077,3.123961426,-0.260075783,-2.952094388,-6.105709271,-8.182516713,-12.95209439,-13.79772788,1.818986543,6.20377538) > x <- c(-0.317563243,0.793263584,0.245684805,-0.027819099,0.072180901,0.414346267,0.893263584,0.366767488,0.245684805,0.666767488,1.004090411,1.204090411,1.283007729,0.356511632,0.330015536,0.956511632,1.01975968,0.998676998,0.314346267,0.651098219,0.893263584,0.572180901,0.788421142,0.688421142,0.183007729,-0.39648056,-0.307307387,-0.22839007,-0.586224705,-0.612720801,-0.844630311,-0.907878359,-1.57653982,-1.787366647,-1.26029958,-1.297051532,-1.434374455,-0.760870551,-0.229532013,0.075881401,0.539129449,0.512633353,1.143971891,0.822889208,1.569897016,2.375310429,2.960212132,2.460212132,2.307219939,1.522889208,-0.077110792,-0.324118599,-0.713291772,-0.807878359,-2.023547628,-1.881382262,-2.907878359,-3.518134214,-3.733232512,-2.669984464) > 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 34.4378069 2 15.4264947 3 9.9974811 4 3.1677208 5 -1.9787715 6 -6.5568246 7 -11.7199975 8 -12.7182993 9 -17.0025189 10 -17.1577760 11 9.7336126 12 17.4406281 13 17.8634241 14 12.4510912 15 5.7203283 16 -3.4278622 17 -12.1357268 18 -13.5664386 19 -16.4103324 20 -18.2884367 21 -22.7199975 22 -20.7112326 23 2.8959364 24 9.0424286 25 11.4748386 26 7.0150109 27 1.2684164 28 -5.3087877 29 -4.8613951 30 -7.5921581 31 -7.3299878 32 -8.6221231 33 -10.3353562 34 -6.6424741 35 10.1253206 36 14.5639481 37 17.3795751 38 10.6233665 39 5.1522266 40 1.0128011 41 -1.2810325 42 -2.0117955 43 -4.6294276 44 -5.6206627 45 -9.2541265 46 -10.1260131 47 5.6338657 48 10.3663269 49 14.0512932 50 9.3538917 51 7.6977674 52 3.5987700 53 0.7848413 54 -1.7686153 55 -3.1413692 56 -5.4264378 57 -8.6922785 58 -8.6439345 59 7.2878822 60 10.1150952 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/13ecd1257102611.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/2k2za1257102611.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/3bx1t1257102611.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/420b31257102611.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/521hw1257102611.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/6cssb1257102611.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/7r92h1257102611.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/83nes1257102611.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.733e+00 -7.252e-01 2.457e-01 -1.667e-11 8.405e-01 2.960e+00 > > #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/9wt6u1257102612.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/10vpjj1257102612.tab") > > system("convert tmp/13ecd1257102611.ps tmp/13ecd1257102611.png") > system("convert tmp/2k2za1257102611.ps tmp/2k2za1257102611.png") > system("convert tmp/3bx1t1257102611.ps tmp/3bx1t1257102611.png") > system("convert tmp/420b31257102611.ps tmp/420b31257102611.png") > system("convert tmp/521hw1257102611.ps tmp/521hw1257102611.png") > system("convert tmp/6cssb1257102611.ps tmp/6cssb1257102611.png") > system("convert tmp/7r92h1257102611.ps tmp/7r92h1257102611.png") > system("convert tmp/83nes1257102611.ps tmp/83nes1257102611.png") > > > proc.time() user system elapsed 1.585 1.162 2.160