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(-6835.58,-8091.96,-7994.72,-8159.67,-8675.12,-7545.83,-8002.34,-9158.94,-8084.08,-7350.48,-8140.15,-5988.62,-7288.80,-8371.28,-7884.61,-9077.73,-9559.79,-8916.76,-8863.60,-10697.64,-8544.77,-8832.06,-9371.06,-7300.63,-8533.03,-9145.60,-9176.81,-9285.81,-8384.11,-8968.39,-8691.86,-9640.87,-8577.85,-9148.81,-9449.63,-8187.95,-7930.75,-9174.37,-10376.75,-10235.42,-9606.76,-10859.78,-11019.26,-11201.82,-11100.12,-9810.93,-11917.02,-9531.82,-9621.01,-10477.57,-10983.99,-9619.59,-8091.42,-8208.30,-7846.90,-8597.63,-8007.56,-7471.42,-9044.47,-7585.88) > x <- c(745.52,1962.64,2092.88,2034.73,568.28,1482.67,1282.26,1534.16,1621.42,1465.32,1373.15,1386.28,756.10,1359.02,1600.69,1299.97,161.31,622.74,552.60,570.36,806.43,1212.24,1806.54,1433.47,543.97,1453.00,1795.89,1608.99,484.29,1541.01,1094.14,1412.93,1612.35,1309.29,1626.17,874.45,794.25,1416.23,1575.25,1255.68,-787.86,1038.52,934.94,581.78,1069.98,1104.77,1152.28,880.48,169.49,953.93,1009.01,297.91,259.98,1164.90,924.60,840.77,1042.04,1026.08,637.53,1338.82) > 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 2217.12671 2 444.97384 3 487.02268 4 346.71462 5 452.69482 6 1194.49833 7 822.91508 8 -440.43133 9 597.45094 10 1397.20065 11 646.58907 12 2792.55504 13 1759.42327 14 421.44687 15 805.70558 16 -259.97980 17 -259.51553 18 187.97658 19 270.85945 20 -1570.70661 21 482.12518 22 22.86710 23 -767.97644 24 1460.54757 25 605.08655 26 -392.69856 27 -569.21335 28 -599.01167 29 779.29684 30 -252.78412 31 213.11375 32 -870.98830 33 107.52448 34 -335.00929 35 -770.11195 36 810.12069 37 1101.30664 38 -405.88672 39 -1675.65383 40 -1398.90125 41 95.73950 42 -1931.23644 43 -2046.82286 44 -2079.72601 45 -2184.90809 46 -910.46087 47 -3036.68395 48 -536.30462 49 -324.20193 50 -1513.18016 51 -2042.94113 52 -377.20184 53 1167.04157 54 666.68814 55 1129.91887 56 414.71309 57 919.49191 58 1462.39520 59 53.99909 60 1215.40693 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1l5y31257379716.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/2srid1257379716.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/3y8py1257379716.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/4vq1z1257379716.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/5cf3f1257379716.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/684xt1257379716.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/7plxm1257379716.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/8ilcy1257379716.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. -787.9 784.7 1129.0 1096.0 1456.0 2093.0 > > #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/9lrmz1257379716.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/100rq31257379716.tab") > > system("convert tmp/1l5y31257379716.ps tmp/1l5y31257379716.png") > system("convert tmp/2srid1257379716.ps tmp/2srid1257379716.png") > system("convert tmp/3y8py1257379716.ps tmp/3y8py1257379716.png") > system("convert tmp/4vq1z1257379716.ps tmp/4vq1z1257379716.png") > system("convert tmp/5cf3f1257379716.ps tmp/5cf3f1257379716.png") > system("convert tmp/684xt1257379716.ps tmp/684xt1257379716.png") > system("convert tmp/7plxm1257379716.ps tmp/7plxm1257379716.png") > system("convert tmp/8ilcy1257379716.ps tmp/8ilcy1257379716.png") > > > proc.time() user system elapsed 1.597 1.185 2.456