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(-489.655367,-447.6900293,-537.3677823,-481.4102379,-503.7985479,-581.5953765,-494.8534187,-446.578747,-524.8000885,-579.7086071,-653.407384,-847.3550966,-531.7339354,-455.9861327,-562.2051181,-515.2549594,-509.8456254,-612.3288157,-470.5160829,-457.8351585,-551.5732196,-562.0428617,-516.3417287,-798.8804249,-494.0911623,-494.2911623,-549.4996808,-494.2534187,-504.6475737,-606.2817381,-521.1265498,-486.5573154,-630.0568175,-546.8751679,-544.5016292,-915.6313089,-528.6226531,-480.2479814,-598.5478913,-565.6654263,-566.6899392,-844.5683272,-486.7818283,-499.9872656,-576.1595813,-552.459989,-618.924919,-862.4963291,-504.7098302,-523.2000885,-624.5719965,-541.8903469,-612.415585,-655.7054357,-555.9580406,-526.4736273,-618.4004061,-605.1949688,-683.0163103,-952.4118256) > x <- c(210.5719011,211.8997081,210.0843833,216.9714191,212.5325759,213.3266004,211.6320939,213.8495876,209.7836603,207.8165281,209.5503598,197.7604812,218.7340218,222.8200937,222.6256364,227.2831783,230.9728651,223.1882391,226.6908408,227.3001901,222.3150821,223.6556123,227.8932506,219.077975,237.9620698,239.3620698,240.1949375,247.6320939,250.0126723,241.7479499,247.8635157,248.1117083,241.5191789,244.6548894,252.0347448,237.994072,260.2839013,263.301395,261.6975884,263.8558533,268.7959015,249.7504089,270.4517565,270.1824554,266.7364317,273.7251544,269.6086247,263.3813488,283.9826964,285.5836603,285.0489138,291.8846243,289.7983114,285.6105526,292.9853472,298.2038049,291.9685765,288.9378776,284.5719503,273.9959999) > 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 67.090692 2 109.736744 3 19.128346 4 78.616601 5 53.952671 6 -23.437092 7 62.436159 8 111.847652 9 31.541871 10 -24.375119 11 -97.185029 12 -297.176946 13 29.196520 14 107.039090 15 0.720414 16 50.058310 17 57.359200 18 -49.114859 19 94.493519 20 107.486832 21 11.193104 22 1.410698 23 49.284301 24 -237.773638 25 76.696752 26 77.214477 27 22.432937 28 81.491934 29 72.318208 30 -33.552953 31 54.737444 32 89.433917 33 -57.445314 34 27.343890 35 33.500789 36 -344.826988 37 53.608781 38 103.530402 39 -15.591716 40 18.397206 41 19.905261 42 -267.736998 43 100.662263 44 87.318765 45 9.379810 46 36.662244 47 -31.913068 48 -278.676956 49 89.671038 50 72.001531 51 -29.644521 52 56.541527 53 -15.053281 54 -60.490030 55 43.038131 56 75.197841 57 -19.925493 58 -8.273775 59 -88.333355 60 -363.150741 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1nabu1257334728.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/2fg3w1257334728.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/3re741257334728.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/4umz91257334728.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/5iaj31257334728.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/66gw51257334728.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/76t4z1257334728.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/8y7f51257334728.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. 197.8 222.5 243.2 246.4 269.8 298.2 > > #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/9qt8s1257334728.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/10ywqp1257334728.tab") > > system("convert tmp/1nabu1257334728.ps tmp/1nabu1257334728.png") > system("convert tmp/2fg3w1257334728.ps tmp/2fg3w1257334728.png") > system("convert tmp/3re741257334728.ps tmp/3re741257334728.png") > system("convert tmp/4umz91257334728.ps tmp/4umz91257334728.png") > system("convert tmp/5iaj31257334728.ps tmp/5iaj31257334728.png") > system("convert tmp/66gw51257334728.ps tmp/66gw51257334728.png") > system("convert tmp/76t4z1257334728.ps tmp/76t4z1257334728.png") > system("convert tmp/8y7f51257334728.ps tmp/8y7f51257334728.png") > > > proc.time() user system elapsed 1.586 1.162 2.107