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,111.8629088,94.1225572,67.79436315,146.0424236,125.6555043,142.8655602,130.0304429,110.0117843,132.789944,88.23529412,91.96700383,96.65128155,97.14720613,90.7345576,52.52872434,156.9085731,144.8787194,169.4294412,133.3840715,131.2776196,116.32623,89.15349111,85.08298144,89.38917804,103.0884808,85.34812923,45.9933222,152.823333,130.3692429,150.5008347,126.971423,123.2446234,126.5737013,100.2553275,91.76077777,100.2847884,121.6537366,97.28960031,62.54541884,154.9936168,147.8493568,147.3976235,156.8005499,126.8093882,131.7637239,99.20946676,87.34655799,100.7561622,110.5666307,76.46076795,56.51085142,124.9484435,118.2853776,136.4332711,128.6212315,100.7365217,111.7499754,93.43022685,83.3300599) > x <- c(100,96.66958808,91.06047327,89.04469763,82.90972831,84.04907975,91.76161262,90.09640666,85.97721297,99.82471516,70.90271691,83.87379492,99.21121823,92.81332165,95.3549518,89.65819457,86.76599474,88.25591586,101.2269939,88.25591586,96.3190184,100.4382121,74.84662577,88.08063103,100.6134969,102.1034181,98.94829097,89.39526731,92.90096407,92.28746713,104.1191937,92.98860649,95.79316389,102.716915,81.06923751,91.32340053,98.5977213,107.2743208,99.29886065,87.64241893,97.02015776,98.86064855,96.23137599,102.8045574,95.61787905,101.5775635,84.13672217,87.46713409,102.3663453,101.4022787,87.11656442,82.64680105,79.75460123,81.68273444,90.35933392,82.47151621,80.45574058,90.00876424,72.39263804,78.08939527) > 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 -20.5857603 2 -5.2262344 3 -17.0775467 4 -41.2893672 5 43.3998300 6 21.8166996 7 30.9293264 8 19.8425176 9 4.1486223 10 12.3882162 11 -1.8010747 12 -11.6877684 13 -23.1063326 14 -15.8932226 15 -24.9743420 16 -57.1991197 17 50.2172649 18 36.6231352 19 47.5554535 20 25.1284873 21 14.5565413 22 -4.7196115 23 -5.0236085 24 -22.9885703 25 -31.8406959 26 -19.7056693 27 -34.1334362 28 -63.4584732 29 39.6908881 30 17.8809117 31 25.5903111 32 13.7469618 33 7.0756426 34 3.1354375 35 -0.4549251 36 -19.7153749 37 -18.8287121 38 -6.5693716 39 -22.5600301 40 -45.0660517 41 37.5364086 42 28.4598076 43 30.7685615 44 33.2702699 45 10.8244399 46 9.5216713 47 -4.7213542 48 -20.0808801 49 -22.3140366 50 -11.4913894 51 -30.5986052 52 -45.8556935 53 25.6184345 54 16.9310113 55 25.9692971 56 26.4387191 57 0.6703828 58 1.6540664 59 1.8295819 60 -14.2516406 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1rzs11258121362.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/2okhb1258121362.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/3i76w1258121362.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/4562c1258121362.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/5c2q11258121362.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/6wxb31258121362.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/7n8ak1258121362.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/8w2qj1258121362.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.90 86.57 91.54 91.62 99.01 107.30 > > #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/9iznu1258121362.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/10pnmc1258121362.tab") > > system("convert tmp/1rzs11258121362.ps tmp/1rzs11258121362.png") > system("convert tmp/2okhb1258121362.ps tmp/2okhb1258121362.png") > system("convert tmp/3i76w1258121362.ps tmp/3i76w1258121362.png") > system("convert tmp/4562c1258121362.ps tmp/4562c1258121362.png") > system("convert tmp/5c2q11258121362.ps tmp/5c2q11258121362.png") > system("convert tmp/6wxb31258121362.ps tmp/6wxb31258121362.png") > system("convert tmp/7n8ak1258121362.ps tmp/7n8ak1258121362.png") > system("convert tmp/8w2qj1258121362.ps tmp/8w2qj1258121362.png") > > > proc.time() user system elapsed 1.550 1.187 2.030