R version 2.8.1 (2008-12-22) Copyright (C) 2008 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(416.25,398.35,400.00,427.25,391.25,397.20,394.80,391.50,407.65,418.10,429.10,452.85,427.75,420.90,433.45,427.15,427.90,415.35,432.60,431.65,439.60,466.10,459.50,499.75,530.00,568.25,564.25,587.00,661.00,625.00,622.95,637.25,621.05,600.60,614.10,648.75,639.75,660.20,670.40,658.25,673.60,666.50,654.75,665.75,672.00,742.50,790.25,784.25,846.75,914.75,988.50,887.75,853.00,888.25,937.50,912.50,822.25,880.00,729.50,778.00) > x <- c(195.00,231.00,238.00,290.00,265.00,252.00,213.00,218.00,213.00,222.00,209.00,211.00,180.00,190.00,183.50,202.00,194.00,186.00,185.50,192.50,184.50,194.00,219.00,263.00,265.00,292.00,288.00,339.00,376.00,338.00,326.00,316.00,343.00,313.00,324.00,326.00,334.00,342.00,353.00,350.50,368.00,371.00,366.00,363.00,330.00,352.00,370.00,347.00,371.00,410.50,579.00,426.00,406.00,435.00,465.00,367.00,300.00,201.00,199.50,174.00) > 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 -34.82017785 2 -108.88779472 3 -118.15927578 4 -172.04027794 5 -169.03498844 6 -142.80223790 7 -84.35398629 8 -95.45504419 9 -71.50398629 10 -75.09589051 11 -43.81313997 12 -23.18356313 13 0.08299585 14 -22.36911995 15 0.32225532 16 -34.84165891 17 -21.60996627 18 -21.67827363 19 -3.64816784 20 -15.51964890 21 4.91204374 22 16.59003373 23 -29.01525577 24 -57.41456528 25 -30.28498844 26 -34.16070110 27 -31.91985478 28 -88.74064535 29 -72.46847380 30 -49.18043377 31 -32.50789481 32 -2.60577901 33 -60.93149167 34 -34.57514427 35 -38.23747165 36 -6.70789481 37 -28.18958745 38 -20.22128009 39 -27.18360747 40 -35.43307852 41 -47.38678117 42 -59.16741591 43 -63.11635801 44 -47.43572327 45 10.30125887 46 46.47660411 47 66.14279567 48 96.02766201 49 121.08258409 50 127.45422669 51 -61.69142452 52 76.27094720 53 72.72517880 54 62.72904298 55 65.17269559 56 193.07343041 57 207.35760627 58 419.56855267 59 271.40887004 60 359.69426533 > library(lattice) > postscript(file="/var/www/rcomp/tmp/1lkbf1257949382.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/rcomp/tmp/2dgyt1257949382.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/rcomp/tmp/3ey9x1257949382.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/rcomp/tmp/4sw6i1257949382.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/rcomp/tmp/5bnqu1257949382.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/rcomp/tmp/6jkji1257949382.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/rcomp/tmp/7skr81257949382.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/rcomp/tmp/863aw1257949382.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. 174.0 210.5 296.0 292.6 352.2 579.0 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/9ggp81257949382.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/rcomp/tmp/107qog1257949382.tab") > > system("convert tmp/1lkbf1257949382.ps tmp/1lkbf1257949382.png") > system("convert tmp/2dgyt1257949382.ps tmp/2dgyt1257949382.png") > system("convert tmp/3ey9x1257949382.ps tmp/3ey9x1257949382.png") > system("convert tmp/4sw6i1257949382.ps tmp/4sw6i1257949382.png") > system("convert tmp/5bnqu1257949382.ps tmp/5bnqu1257949382.png") > system("convert tmp/6jkji1257949382.ps tmp/6jkji1257949382.png") > system("convert tmp/7skr81257949382.ps tmp/7skr81257949382.png") > system("convert tmp/863aw1257949382.ps tmp/863aw1257949382.png") > > > proc.time() user system elapsed 1.950 1.730 3.451