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(562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590,517945,506174,501866,516141,528222,532638,536322,536535,523597,536214,586570,596594,580523) > x <- c(2.600539231,2.625880789,2.651192323,2.664113308,2.680134041,2.66476486,2.457925425,2.346318001,2.51768424,2.500711773,2.543795355,2.510165798,2.511721922,2.558579404,2.572487499,2.585281354,2.613294526,2.592949711,2.420529078,2.365604017,2.526835704,2.538703684,2.597238762,2.576048834,2.706202657,2.6905473,2.727054231,2.673568592,2.712747819,2.709496493,2.581012964,2.600645789,2.688507243,2.814363371,2.858408868,2.863748484,2.880939043,2.955817886,2.985149293,3.046898174,3.054583926,2.967290081,2.745239743,2.789646619,2.967723378,3.038287717,3.063168393,3.002142478,3.046075156,3.091453387,3.042491693,3.071467058,3.108303919,3.020478895,2.832675709,2.852369981,2.971060632,2.988710573,3.008302013,2.899065924,2.833626591,2.814824601,2.79971602,2.840222121,2.814961963,2.745464879,2.624098563,2.629337282,2.711128027) > 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 -23528.611 2 -20519.541 3 -21566.778 4 -31015.510 5 -35120.245 6 -31777.324 7 -17535.948 8 -20033.745 9 12111.663 10 7822.143 11 -1718.219 12 -6376.504 13 -10690.401 14 -3892.584 15 -6384.807 16 -15451.013 17 -16142.635 18 -18167.344 19 3057.845 20 1496.781 21 29348.527 22 15331.637 23 8966.907 24 6957.793 25 26234.361 26 20130.689 27 16311.658 28 1262.066 29 6758.463 30 6350.670 31 30261.389 32 39974.227 33 49614.033 34 39572.822 35 25476.515 36 17952.492 37 24293.568 38 25809.211 39 13813.637 40 18976.066 41 5453.811 42 -22354.649 43 -4910.371 44 12169.209 45 20716.953 46 18604.845 47 5779.437 48 -597.181 49 9833.567 50 8494.871 51 -15099.944 52 -12356.462 53 -26730.166 54 -34033.532 55 -16435.786 56 -7743.085 57 -2405.063 58 -11055.774 59 -11900.252 60 -16936.826 61 -16424.682 62 -15332.638 63 -14319.647 64 -6945.675 65 -24349.355 66 -24018.570 67 4881.384 68 15831.524 69 14220.104 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1j1lb1256467569.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/23y7y1256467569.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/3heb51256467569.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/4s92q1256467569.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/5embc1256467569.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/674g21256467569.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/7s58k1256467569.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/8gumh1256467569.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. 2.346 2.597 2.713 2.755 2.956 3.108 > > #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/9zc2l1256467569.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/104kt01256467569.tab") > > system("convert tmp/1j1lb1256467569.ps tmp/1j1lb1256467569.png") > system("convert tmp/23y7y1256467569.ps tmp/23y7y1256467569.png") > system("convert tmp/3heb51256467569.ps tmp/3heb51256467569.png") > system("convert tmp/4s92q1256467569.ps tmp/4s92q1256467569.png") > system("convert tmp/5embc1256467569.ps tmp/5embc1256467569.png") > system("convert tmp/674g21256467569.ps tmp/674g21256467569.png") > system("convert tmp/7s58k1256467569.ps tmp/7s58k1256467569.png") > system("convert tmp/8gumh1256467569.ps tmp/8gumh1256467569.png") > > > proc.time() user system elapsed 1.710 1.510 3.214