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(100,100,93.5483871,88.17204301,89.24731183,91.39784946,92.47311828,91.39784946,88.17204301,87.09677419,84.94623656,92.47311828,93.5483871,93.5483871,91.39784946,90.32258065,91.39784946,93.5483871,93.5483871,92.47311828,91.39784946,89.24731183,86.02150538,88.17204301,87.09677419,87.09677419,86.02150538,84.94623656,84.94623656,86.02150538,86.02150538,84.94623656,86.02150538,82.79569892,77.41935484,80.64516129,78.49462366,75.2688172,75.2688172,75.2688172,77.41935484,78.49462366,76.34408602,73.11827957,68.8172043,65.59139785,69.89247312,82.79569892,84.94623656,80.64516129,74.19354839,70.96774194,74.19354839,82.79569892,86.02150538,86.02150538,82.79569892,78.49462366,79.56989247,87.09677419) > x <- c(100,114.242116,115.8697864,108.0366226,100.3051882,98.1688708,97.5584944,105.4933876,104.8830112,105.4933876,114.0386572,88.40284842,96.64292981,113.733469,110.681587,111.190234,103.1536114,102.2380468,102.4415056,115.4628688,107.9348932,113.5300102,116.8870804,90.13224822,101.2207528,117.0905392,120.0406918,113.3265514,109.155646,107.121058,107.121058,119.9389624,112.1057986,114.3438454,119.5320448,94.60834181,105.2899288,118.311292,122.0752798,116.276704,106.5106816,111.698881,114.5473042,116.3784334,117.7009156,116.6836216,120.4476094,96.54120041,105.595117,117.0905392,115.6663276,105.7985758,95.93082401,94.09969481,94.81180061,106.5106816,95.62563581,99.7965412,104.4760936,83.82502543) > 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 13.43260328 2 17.26136610 3 11.24732609 4 3.76516245 5 2.76196003 6 4.33818324 7 5.24936222 8 6.30726126 9 2.91736497 10 2.00618599 11 2.15290605 12 2.78801470 13 6.07849629 14 10.67301167 15 7.70202485 16 6.76349757 17 5.67825022 18 7.58265311 19 7.63734972 20 10.06266405 21 6.96362060 22 6.31723979 23 3.99392743 24 -1.04813937 25 0.85755714 26 5.12389285 27 4.84172491 28 1.96146790 29 0.84018737 30 1.36849007 31 1.36849007 32 3.73910778 33 2.70855705 34 0.08441332 35 -3.89716716 36 -7.37169563 37 -6.65066116 38 -6.37588447 39 -5.36399716 40 -6.92285059 41 -7.39775031 42 -4.92771789 43 -6.31250297 44 -9.04603991 45 -12.99158721 46 -16.49087671 47 -11.17791413 48 -4.70154019 49 -0.11700334 50 -1.32772005 51 -8.16220923 52 -14.04080135 53 -13.46778056 54 -5.35789953 55 -1.94065493 56 1.20440023 57 -4.94767495 58 -8.12746967 59 -5.79417879 60 -3.81900314 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/124ry1257600858.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/28eoj1257600858.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/3zo2x1257600858.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/42wja1257600858.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/5ghhr1257600858.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/61ewz1257600858.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/7liuq1257600858.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/8rxnn1257600858.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. 83.83 101.00 107.50 107.60 115.50 122.10 > > #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/9jtu01257600858.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/10lux41257600858.tab") > > system("convert tmp/124ry1257600858.ps tmp/124ry1257600858.png") > system("convert tmp/28eoj1257600858.ps tmp/28eoj1257600858.png") > system("convert tmp/3zo2x1257600858.ps tmp/3zo2x1257600858.png") > system("convert tmp/42wja1257600858.ps tmp/42wja1257600858.png") > system("convert tmp/5ghhr1257600858.ps tmp/5ghhr1257600858.png") > system("convert tmp/61ewz1257600858.ps tmp/61ewz1257600858.png") > system("convert tmp/7liuq1257600858.ps tmp/7liuq1257600858.png") > system("convert tmp/8rxnn1257600858.ps tmp/8rxnn1257600858.png") > > > proc.time() user system elapsed 1.604 1.184 2.177