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(1.335001067,1.547562509,1.458615023,1.360976553,1.386294361,1.458615023,1.568615918,1.481604541,1.458615023,1.547562509,1.547562509,1.589235205,1.609437912,1.435084525,1.458615023,1.568615918,1.568615918,1.568615918,1.435084525,1.526056303,1.568615918,1.504077397,1.481604541,1.458615023,1.360976553,1.30833282,1.386294361,1.410986974,1.30833282,1.335001067,1.335001067,1.335001067,1.193922468,1.193922468,1.193922468,1.16315081,1.223775432,1.435084525,1.589235205,1.62924054,1.704748092,1.722766598,1.85629799,1.808288771,1.960094784,2.054123734,2.066862759,2.00148,2.014903021,1.916922612,1.648658626,1.547562509,1.410986974,1.360976553,0.955511445,0.993251773,0.587786665,0,-1.203972804,0.262364264) > x <- c(5.081404365,5.003946306,4.934473933,4.905274778,4.86753445,4.844187086,4.804021045,4.762173935,4.718498871,4.727387819,5.003946306,5.056245805,5.056245805,4.990432587,4.919980926,4.882801923,4.828313737,4.812184355,4.762173935,4.736198448,4.709530201,4.718498871,4.9698133,5.010635294,5.003946306,4.8978398,4.812184355,4.753590191,4.762173935,4.709530201,4.65396035,4.624972813,4.553876892,4.532599493,4.820281566,4.86753445,4.820281566,4.744932128,4.663439094,4.65396035,4.65396035,4.615120517,4.553876892,4.532599493,4.430816799,4.465908119,4.753590191,4.787491743,4.762173935,4.691347882,4.65396035,4.672828834,4.691347882,4.691347882,4.682131227,4.672828834,4.59511985,4.634728988,4.875197323,4.919980926) > 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.060878783 2 0.241952215 3 0.124763035 4 0.015254615 5 0.025230342 6 0.088059906 7 0.181732627 8 0.077709692 9 0.036965523 10 0.129526516 11 0.241952215 12 0.304885541 13 0.325088248 14 0.123980676 15 0.118871383 16 0.213758385 17 0.191608016 18 0.185051150 19 0.031189676 20 0.111601980 21 0.143320502 22 0.082427897 23 0.162118603 24 0.155723915 25 0.055366259 26 -0.040411562 27 0.002729593 28 0.003602688 29 -0.095562029 30 -0.090294349 31 -0.112884433 32 -0.124668357 33 -0.294648649 34 -0.303298271 35 -0.186350647 36 -0.197913209 37 -0.156497683 38 0.024180590 39 0.145202975 40 0.181355040 41 0.256862592 42 0.259092050 43 0.367726873 44 0.311068032 45 0.421497660 46 0.529791824 47 0.659478473 48 0.607877268 49 0.611008172 50 0.484235776 51 0.200773126 52 0.107347367 53 -0.021699862 54 -0.071710283 55 -0.480922117 56 -0.446963369 57 -0.884018492 58 -1.455703374 59 -2.561921736 60 -1.077379376 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1kfyu1256584689.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/2f1na1256584689.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/3o9db1256584689.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/4kpd51256584689.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/5kj6u1256584689.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/6ztlq1256584689.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/7anb11256584689.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/8h4rk1256584689.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. 4.431 4.670 4.758 4.772 4.877 5.081 > > #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/99k1s1256584689.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/107rfv1256584689.tab") > > system("convert tmp/1kfyu1256584689.ps tmp/1kfyu1256584689.png") > system("convert tmp/2f1na1256584689.ps tmp/2f1na1256584689.png") > system("convert tmp/3o9db1256584689.ps tmp/3o9db1256584689.png") > system("convert tmp/4kpd51256584689.ps tmp/4kpd51256584689.png") > system("convert tmp/5kj6u1256584689.ps tmp/5kj6u1256584689.png") > system("convert tmp/6ztlq1256584689.ps tmp/6ztlq1256584689.png") > system("convert tmp/7anb11256584689.ps tmp/7anb11256584689.png") > system("convert tmp/8h4rk1256584689.ps tmp/8h4rk1256584689.png") > > > proc.time() user system elapsed 1.594 1.182 2.462