R version 2.8.0 (2008-10-20) 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(1111.92,1131.13,1144.94,1113.89,1107.30,1120.68,1140.84,1101.72,1104.24,1114.58,1130.20,1173.78,1211.92,1181.27,1203.60,1180.59,1156.85,1191.50,1191.33,1234.18,1220.33,1228.81,1207.01,1249.48,1248.29,1280.08,1280.66,1302.88,1310.61,1270.05,1270.06,1278.53,1303.80,1335.83,1377.76,1400.63,1418.03,1437.90,1406.80,1420.83,1482.37,1530.63,1504.66,1455.18,1473.96,1527.29,1545.79,1479.63,1467.97,1378.60,1330.45,1326.41,1385.97,1399.62,1276.69,1269.42,1287.83,1164.17,968.67,888.61) > 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 -84.420922 2 -114.496435 3 -121.599367 4 -74.669530 5 -106.492715 6 -109.023108 7 -124.200741 8 -102.706048 9 -88.153252 10 -84.256860 11 -83.156990 12 -87.028482 13 -136.302040 14 -123.725727 15 -125.328731 16 -117.044736 17 -101.248058 18 -135.759616 19 -118.401868 20 -146.510677 21 -129.782392 22 -108.657111 23 -101.440027 24 -88.107988 25 -57.103752 26 -39.002610 27 -43.370220 28 -34.703505 29 34.397135 30 24.104516 31 22.048178 32 30.979798 33 -1.236611 34 -41.987583 35 -55.063285 36 -34.908547 37 -54.936862 38 -47.080690 39 -17.169162 40 -38.211533 41 -61.866273 42 -99.554000 43 -94.843924 44 -52.482947 45 -58.135921 46 -21.437071 47 14.587422 48 50.520370 49 120.410608 50 245.054313 51 349.322321 52 251.132918 53 178.633125 54 205.231602 55 332.396010 56 312.003817 57 210.085354 58 346.212444 59 319.622529 60 418.865452 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1vhqs1257941013.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/freestat/rcomp/tmp/2x51h1257941013.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/freestat/rcomp/tmp/390bt1257941013.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/freestat/rcomp/tmp/4o2lv1257941013.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/freestat/rcomp/tmp/5qvck1257941013.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/freestat/rcomp/tmp/6qggn1257941013.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/freestat/rcomp/tmp/75bmq1257941013.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/freestat/rcomp/tmp/8anz41257941013.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. 888.6 1171.0 1270.0 1274.0 1389.0 1546.0 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/9oxkj1257941013.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/freestat/rcomp/tmp/10qv851257941013.tab") > > system("convert tmp/1vhqs1257941013.ps tmp/1vhqs1257941013.png") > system("convert tmp/2x51h1257941013.ps tmp/2x51h1257941013.png") > system("convert tmp/390bt1257941013.ps tmp/390bt1257941013.png") > system("convert tmp/4o2lv1257941013.ps tmp/4o2lv1257941013.png") > system("convert tmp/5qvck1257941013.ps tmp/5qvck1257941013.png") > system("convert tmp/6qggn1257941013.ps tmp/6qggn1257941013.png") > system("convert tmp/75bmq1257941013.ps tmp/75bmq1257941013.png") > system("convert tmp/8anz41257941013.ps tmp/8anz41257941013.png") > > > proc.time() user system elapsed 2.579 1.943 2.829