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(152.60,153.32,165.50,139.18,136.53,115.92,96.65,83.77,84.66,106.03,86.92,54.66,151.66,121.27,132.95,119.64,122.16,117.44,106.69,87.45,80.98,110.30,87.01,55.73,146.00,137.54,138.54,135.62,107.27,99.04,91.36,68.35,82.59,98.41,71.25,47.58,130.83,113.60,125.69,113.60,97.12,104.43,91.84,75.11,89.24,110.23,78.42,68.45,122.81,129.66,159.06,139.03,102.16,113.59,81.46,77.36,87.57,101.23,87.21,64.94,133.12,117.99,135.90,125.67,108.03,128.31,84.74,86.38,92.24,95.83,92.33,54.27) > x <- c(103.1,103.1,103.3,103.5,103.3,103.5,103.8,103.9,103.9,104.2,104.6,104.9,105.2,105.2,105.6,105.6,106.2,106.3,106.4,106.9,107.2,107.3,107.3,107.4,107.55,107.87,108.37,108.38,107.92,108.03,108.14,108.3,108.64,108.66,109.04,109.03,109.03,109.54,109.75,109.83,109.65,109.82,109.95,110.12,110.15,110.2,109.99,110.14,110.14,110.81,110.97,110.99,109.73,109.81,110.02,110.18,110.21,110.25,110.36,110.51,110.64,110.95,111.18,111.19,111.69,111.7,111.83,111.77,111.73,112.01,111.86,112.04) > 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 33.7955168 2 34.5155168 3 47.1923403 4 21.3691638 5 18.2223403 6 -1.8908362 7 -20.4156010 8 -33.0471893 9 -32.1571893 10 -10.0419541 11 -28.1583071 12 -59.6730719 13 38.0721633 14 7.6821633 15 20.3558103 16 7.0458103 17 11.0562807 18 6.5846924 19 -3.9168958 20 -21.9148371 21 -27.6396019 22 1.9288098 23 -21.3611902 24 -52.3927784 25 38.2498392 26 30.5847567 27 32.8268154 28 29.9316566 29 0.4389626 30 -7.5177845 31 -14.9245316 32 -37.5370728 33 -22.4524729 34 -6.5827905 35 -32.7988259 36 -56.4936671 37 26.7563329 38 10.7932328 39 23.4048974 40 11.5136268 41 -5.4135143 42 2.3187857 43 -9.9482791 44 -26.2559791 45 -12.0514556 46 9.0627503 47 -23.2689144 48 -32.8662968 49 21.4937032 50 30.0080619 51 59.8055206 52 39.8252030 53 -0.1747849 54 11.4539445 55 -20.1543909 56 -23.8569321 57 -13.5724086 58 0.1869561 59 -13.5597910 60 -35.4571733 61 33.0457619 62 18.6858383 63 37.1671853 64 26.9620265 65 10.5640852 66 30.8689263 67 -12.3781384 68 -10.8871854 69 -5.1265501 70 -0.8409973 71 -4.7136149 72 -42.3264737 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1areb1290621322.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/2areb1290621322.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/33ivv1290621322.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/43ivv1290621322.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/53ivv1290621322.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/63ivv1290621322.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/7oicj1290621322.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/8oicj1290621322.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. 103.1 106.4 109.0 108.4 110.2 112.0 > > #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/99js71290621322.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/10vjrd1290621322.tab") > > try(system("convert tmp/1areb1290621322.ps tmp/1areb1290621322.png",intern=TRUE)) character(0) > try(system("convert tmp/2areb1290621322.ps tmp/2areb1290621322.png",intern=TRUE)) character(0) > try(system("convert tmp/33ivv1290621322.ps tmp/33ivv1290621322.png",intern=TRUE)) character(0) > try(system("convert tmp/43ivv1290621322.ps tmp/43ivv1290621322.png",intern=TRUE)) character(0) > try(system("convert tmp/53ivv1290621322.ps tmp/53ivv1290621322.png",intern=TRUE)) character(0) > try(system("convert tmp/63ivv1290621322.ps tmp/63ivv1290621322.png",intern=TRUE)) character(0) > try(system("convert tmp/7oicj1290621322.ps tmp/7oicj1290621322.png",intern=TRUE)) character(0) > try(system("convert tmp/8oicj1290621322.ps tmp/8oicj1290621322.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.830 1.368 22.248