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(91.46,90.24,93.90,96.34,93.90,86.59,75.61,70.73,74.39,84.15,89.02,87.80,74.39,70.73,74.39,78.05,82.93,82.93,79.27,75.61,76.83,78.05,80.49,81.71,78.05,82.93,85.37,84.15,86.59,87.80,86.59,85.37,84.15,81.71,80.49,84.15,89.02,96.34,100.00,100.00,100.00,98.78,96.34,93.90,93.90,92.68,91.46,91.46,86.59,91.46,91.46,95.12,95.12,95.12,92.68,91.46,93.90,98.78,97.56,92.68,80.49,79.27,82.93,91.46,97.56,100.00,98.78,96.34,96.34,92.68,91.46,92.68,89.02,91.46,92.68,91.46,92.68,95.12,96.34,95.12,91.46,80.49,76.83,76.83,73.17,76.83,78.05,76.83,76.83,78.05,81.71,81.71,82.93,75.61,70.73,68.29,65.85,69.51,70.73,67.07,65.85,65.85,65.85,67.07,68.29,69.51,70.73,65.85,59.76,63.41,67.07,71.95,76.83,79.27,78.05,78.05,80.49,82.93,87.80) > x <- c(90.70,89.53,90.70,90.70,89.53,87.21,82.56,80.23,82.56,84.88,87.21,84.88,80.23,76.74,77.91,77.91,80.23,82.56,83.72,82.56,81.40,79.07,81.40,84.88,88.37,93.02,94.19,91.86,90.70,90.70,91.86,93.02,93.02,93.02,93.02,94.19,97.67,100.00,98.84,98.84,98.84,98.84,98.84,98.84,98.84,98.84,97.67,98.84,98.84,100.00,97.67,98.84,97.67,96.51,96.51,96.51,100.00,103.49,103.49,100.00,93.02,90.70,90.70,96.51,98.84,100.00,98.84,97.67,96.51,95.35,94.19,94.19,94.19,94.19,94.19,95.35,95.35,94.19,91.86,90.70,88.37,88.37,88.37,88.37,86.05,84.88,84.88,86.05,86.05,86.05,86.05,84.88,82.56,76.74,72.09,72.09,75.58,76.74,75.58,72.09,70.93,72.09,74.42,77.91,79.07,79.07,81.40,79.07,80.23,80.23,81.40,80.23,81.40,83.72,87.21,89.53,91.86,94.19,97.67) > 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 5.8183466 2 5.8729169 3 8.2583466 4 10.6983466 5 9.5329169 6 4.7502701 7 -1.1641299 8 -3.5058830 9 -2.3841299 10 4.8485170 11 7.1802701 12 8.4985170 13 0.1541170 14 0.2960405 15 2.6814702 16 6.3414702 17 8.6941170 18 6.1558701 19 1.2321935 20 -1.1641299 21 1.3195467 22 5.0777936 23 4.9795467 24 2.4085170 25 -5.0534065 26 -5.2390065 27 -4.0735769 28 -2.7553300 29 0.9483466 30 2.1583466 31 -0.3153300 32 -2.7990065 33 -4.0190065 34 -6.4590065 35 -7.6790065 36 -5.2935769 37 -4.2146066 38 0.5671465 39 5.4908231 40 5.4908231 41 5.4908231 42 4.2708231 43 1.8308231 44 -0.6091769 45 -0.6091769 46 -1.8291769 47 -1.7746066 48 -3.0491769 49 -7.9191769 50 -4.3128535 51 -1.7746066 52 0.6108231 53 1.8853934 54 3.1490700 55 0.7090700 56 -0.5109300 57 -1.8728535 58 -0.7947770 59 -2.0147770 60 -3.0928535 61 -7.6790065 62 -6.3716534 63 -2.7116534 64 -0.5109300 65 3.0508231 66 4.2271465 67 4.2708231 68 3.1053934 69 4.3690700 70 1.9727465 71 2.0164231 72 3.2364231 73 -0.4235769 74 2.0164231 75 3.2364231 76 0.7527465 77 1.9727465 78 5.6764231 79 9.4346700 80 9.4783466 81 8.3565935 82 -2.6134065 83 -6.2734065 84 -6.2734065 85 -7.4060534 86 -2.4714830 87 -1.2514830 88 -3.7460534 89 -3.7460534 90 -2.5260534 91 1.1339466 92 2.4085170 93 6.1558701 94 5.1760405 95 5.3616405 96 2.9216405 97 -3.3202829 98 -0.9239595 99 1.5597171 100 1.7016405 101 1.7453171 102 0.4816405 103 -2.0566064 104 -4.6385298 105 -4.6822064 106 -3.4622064 107 -4.7804533 108 -7.1222064 109 -14.4758830 110 -10.8258830 111 -8.4404533 112 -2.2858830 113 1.3195467 114 1.2321935 115 -3.7897299 116 -6.3170831 117 -6.4153300 118 -6.5135769 119 -5.4346066 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1yk1b1258138080.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/22una1258138080.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/3wbee1258138080.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/4h2sb1258138080.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/5gi6j1258138080.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/64omu1258138080.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/7vw9o1258138080.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/8tam51258138080.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. 70.93 82.56 90.70 89.00 96.51 103.50 > > #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/9ifba1258138080.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/10yw351258138080.tab") > > system("convert tmp/1yk1b1258138080.ps tmp/1yk1b1258138080.png") > system("convert tmp/22una1258138080.ps tmp/22una1258138080.png") > system("convert tmp/3wbee1258138080.ps tmp/3wbee1258138080.png") > system("convert tmp/4h2sb1258138080.ps tmp/4h2sb1258138080.png") > system("convert tmp/5gi6j1258138080.ps tmp/5gi6j1258138080.png") > system("convert tmp/64omu1258138080.ps tmp/64omu1258138080.png") > system("convert tmp/7vw9o1258138080.ps tmp/7vw9o1258138080.png") > system("convert tmp/8tam51258138080.ps tmp/8tam51258138080.png") > > > proc.time() user system elapsed 1.721 1.267 2.709