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(-728.6536239,-142.7511303,-787.4949964,-451.4486862,-608.6620624,-296.7188762,552.6397207,292.2142193,1109.976956,676.0328384,-795.667833,6.748639935,337.1910648,-28.2329969,-301.334858,959.2260214,975.7066251,338.5370335,1429.849533,239.3427171,703.4676389,668.1531457,-323.5548664,-180.6756105,268.5288785,671.1955607,-437.4322114,24.26534452,196.6884971,-230.2832497,696.8676478,-136.156074,-155.3059685,529.5866478,-321.7732118,76.40069887,-616.1635797,1191.089993,-111.028839,-541.98817,71.06336825,581.3435659,176.8095,446.251913,-59.83651764,361.9772745,-545.3283088,-584.3486789,89.33123317,-271.0948937,-267.8957385,356.7999528,-1291.339839,-888.6439591,-571.7600768,-228.9650974,-610.0780403,-549.9429329,-611.468584,-351.2567187) > x <- c(561278.953403,531688.863508,530476.739984,516554.039015,529717.931445,516329.925670,498702.735525,485559.950110,484415.489208,585513.012854,591640.832901,591184.538059,562076.281333,530999.465840,532933.809615,518188.961997,533223.711085,511609.605386,506174.094115,496165.453587,496047.989229,579981.128842,586091.473023,574269.182369,514907.874461,476875.512441,457465.603353,455610.427846,455500.237443,418876.375959,412242.387427,379690.136583,355843.920372,462294.800073,474151.341638,429638.357104,404162.558230,376383.480981,379651.991480,377545.637891,378910.852584,349587.403733,345057.419945,308009.944364,317241.810145,413015.475329,416106.506654,384505.026884,365277.427820,359238.927542,378922.695756,397396.594516,419572.566945,425088.005901,429181.353756,403454.736163,421312.533750,517493.790015,532462.390475,500425.214996) > 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 -747.42297 2 -155.90372 3 -800.41750 4 -461.72839 5 -621.44053 6 -306.95604 7 545.74853 8 287.81778 9 1105.79776 10 652.66340 11 -820.20045 12 -17.69736 13 318.27037 14 -41.25472 15 -314.72376 16 948.63597 17 962.26270 18 329.19587 19 1421.54014 20 232.93315 21 697.08037 22 645.83376 23 -347.03411 24 -201.91076 25 258.56164 26 668.44760 27 -436.49580 28 25.55390 29 197.99797 30 -222.02187 31 706.38829 32 -120.45640 33 -135.07982 34 529.60638 35 -324.00408 36 82.61925 37 -605.10924 38 1207.41734 39 -95.32192 40 -525.88143 41 86.91097 42 602.75732 43 199.08313 44 475.55786 45 -32.28295 46 371.35117 47 -536.54115 48 -569.56296 49 107.76672 50 -251.51319 51 -252.05039 52 369.13861 53 -1283.21061 54 -881.56167 55 -565.45478 56 -217.77640 57 -602.27909 58 -560.40102 59 -624.76800 60 -358.47487 > library(lattice) > postscript(file="/var/www/html/freestat/rcomp/tmp/1c9ss1257363632.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/28y7a1257363632.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/30t9r1257363632.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/4eacg1257363632.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/5o2zr1257363632.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/62da71257363632.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/7jpbh1257363632.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/8w7c01257363632.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. 308000 401900 468200 462400 521100 591600 > > #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/95ir21257363632.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/108y1m1257363632.tab") > > system("convert tmp/1c9ss1257363632.ps tmp/1c9ss1257363632.png") > system("convert tmp/28y7a1257363632.ps tmp/28y7a1257363632.png") > system("convert tmp/30t9r1257363632.ps tmp/30t9r1257363632.png") > system("convert tmp/4eacg1257363632.ps tmp/4eacg1257363632.png") > system("convert tmp/5o2zr1257363632.ps tmp/5o2zr1257363632.png") > system("convert tmp/62da71257363632.ps tmp/62da71257363632.png") > system("convert tmp/7jpbh1257363632.ps tmp/7jpbh1257363632.png") > system("convert tmp/8w7c01257363632.ps tmp/8w7c01257363632.png") > > > proc.time() user system elapsed 2.617 1.969 3.022