R version 2.8.0 (2008-10-20) 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(4.2025,4.4521,4.3681,4.2025,4.3264,4.2436,4.2436,4.3264,4.2849,4.2436,4.2849,4.2436,4.3681,4.2849,4.3681,5.1984,5.4289,5.5225,6.3504,6.9169,6.6564,7.2900,7.8961,8.8209,9.2416,10.7584,11.0889,12.2500,12.6736,12.7449,13.6161,14.5924,14.3641,15.6816,16.4836,16.4025,16.2409,15.5236,16.1604,15.0544,16.1604,16.2409,16.7281,15.9201,16.0801,16.0801,17.5561,18.4900,18.2329,14.5924,9.9225,6.2001,3.2761,1.5876,1.1236,0.7056,0.6084,0.4900,0.1296,0.1225) > x <- c(1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.5625,1.5625,1.5625,2.2500,2.2500,2.2500,3.0625,3.0625,4.0000,4.0000,5.0625,5.0625,6.2500,6.2500,6.2500,7.5625,7.5625,7.5625,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,9.0000,10.5625,10.5625,10.5625,10.5625,7.5625,4.0000,1.0000,1.0000,0.2500,0.0625,0.0625,0.0625,0.0625,0.0625) > 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 0.42696800 2 0.67656800 3 0.59256800 4 0.42696800 5 0.55086800 6 0.46806800 7 0.46806800 8 0.55086800 9 0.50936800 10 0.46806800 11 0.50936800 12 0.46806800 13 0.59256800 14 0.50936800 15 0.59256800 16 0.57127316 17 0.80177316 18 0.89537316 19 0.68243503 20 1.24893503 21 0.98843503 22 0.39195360 23 0.99805360 24 0.50352888 25 0.92422888 26 0.83246085 27 1.16296085 28 0.52624953 29 0.94984953 30 1.02114953 31 -0.09470508 32 0.88159492 33 0.65329492 34 -0.20550300 35 0.59649700 36 0.51539700 37 0.35379700 38 -0.36350300 39 0.27329700 40 -0.83270300 41 0.27329700 42 0.35379700 43 0.84099700 44 0.03299700 45 0.19299700 46 0.19299700 47 -0.69654421 48 0.23735579 49 -0.01974421 50 -3.66024421 51 -3.78830508 52 -2.11727112 53 -0.49943200 54 -2.18793200 55 -1.51647222 56 -1.65060727 57 -1.74780727 58 -1.86620727 59 -2.22660727 60 -2.23370727 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1hidd1256667074.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/freestat/rcomp/tmp/2yhye1256667074.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/freestat/rcomp/tmp/3cma31256667074.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/freestat/rcomp/tmp/45d641256667074.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/freestat/rcomp/tmp/5ngf91256667074.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/freestat/rcomp/tmp/6m2bd1256667074.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/freestat/rcomp/tmp/78txo1256667074.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/freestat/rcomp/tmp/840rj1256667075.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. 0.0625 1.0000 3.0620 4.4250 9.0000 10.5600 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9bqdq1256667075.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/freestat/rcomp/tmp/10aepi1256667075.tab") > > system("convert tmp/1hidd1256667074.ps tmp/1hidd1256667074.png") > system("convert tmp/2yhye1256667074.ps tmp/2yhye1256667074.png") > system("convert tmp/3cma31256667074.ps tmp/3cma31256667074.png") > system("convert tmp/45d641256667074.ps tmp/45d641256667074.png") > system("convert tmp/5ngf91256667074.ps tmp/5ngf91256667074.png") > system("convert tmp/6m2bd1256667074.ps tmp/6m2bd1256667074.png") > system("convert tmp/78txo1256667074.ps tmp/78txo1256667074.png") > system("convert tmp/840rj1256667075.ps tmp/840rj1256667075.png") > > > proc.time() user system elapsed 2.555 1.927 3.191