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(3844,4096,3844,4096,4096,4761,4761,4225,3136,3364,2809,3844,3025,3600,3481,3364,2809,3249,3249,2809,2916,2809,3249,3249,3025,2401,2500,2401,2916,3364,3364,2704,3136,2704,3481,2809,2704,2809,2601,2500,3136,2704,2116,2304,2116,2304,2304,2401,2809,2304,2601,2304,2500,3025,2704,2809,2704,3025,2809,2809,3136,2916,2704,3025,2916,3481,3136,3136,2601,2809,2704,2601,2116,2401,2116,3025,3249,2809,2704,2809,2500,2916,2809,2500,2601,2704,2209,2601,2401,2809,2704,2025,2809,2601,2304,2304,2304,2304,1600,1849,1600,1521,1521,1296,1681,1521,1600,1521,2116,1600,1369,1369,1936,1681,1600,1296,1444,1849,1764,2025,2116) > x <- c(1089,1521,2025,2116,2025,2025,2401,2500,2916,3481,3364,3136,2304,2500,2704,2809,3025,1849,1764,1444,1681,1681,1521,1156,729,225,196,961,1681,1849,2116,1764,2025,2025,1600,1225,1296,1444,1521,1024,576,441,144,841,1296,961,784,900,1444,729,1600,1600,1936,2209,2025,1764,1444,2116,1369,1681,1600,1089,1156,1296,1296,1444,1764,1225,625,576,484,729,289,900,900,1156,1369,1296,1089,1089,1089,1369,1600,1225,1369,1849,1764,1089,1521,1600,1369,1936,1764,1849,1600,900,900,961,324,576,484,676,784,529,289,144,81,361,441,324,324,225,576,324,361,900,1089,1225,1296,2209,2116) > par2 = '1' > 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 1344.7546655 2 1334.7991730 3 777.1844318 4 974.0039924 5 1029.1844318 6 1694.1844318 7 1466.1861328 8 870.1546658 9 -471.0987714 10 -585.7025984 11 -1069.7563192 12 103.4979685 13 -210.9951571 14 245.1546658 15 2.4534610 16 -178.2162768 17 -864.1940230 18 288.9070398 19 340.4492085 20 94.4903140 21 57.7786202 22 -49.2213798 23 487.7991730 24 709.1273090 25 744.0509092 26 425.6656504 27 542.2506256 28 -20.6288923 29 57.7786202 30 403.9070398 31 242.0039924 32 -204.5507915 33 69.1844318 34 -362.8155682 35 671.8952751 36 227.2871956 37 79.2343253 38 94.4903140 39 -160.2008270 40 40.1692650 41 947.8268128 42 597.6879042 43 189.7823052 44 -44.8634777 45 -508.7656747 46 -117.6288923 47 -10.2999058 48 16.3601934 49 94.4903140 50 23.0509092 51 -208.1047249 52 -505.1047249 53 -512.8478857 54 -153.3892039 55 -362.8155682 56 -99.5507915 57 -10.5096860 58 -96.9960076 59 139.9686981 60 -49.2213798 61 326.8952751 62 416.7546655 63 164.1273090 64 400.2343253 65 291.2343253 66 766.4903140 67 227.4492085 68 554.2871956 69 383.1142685 70 620.8268128 71 571.6136306 72 320.0509092 73 101.8574293 74 16.3601934 75 -268.6398066 76 485.1273090 77 579.9686981 78 184.2343253 79 204.7546655 80 309.7546655 81 0.7546655 82 246.9686981 83 -0.1047249 84 -81.7128044 85 -68.0313019 86 -256.0929602 87 -699.5507915 88 101.7546655 89 -360.2008270 90 -0.1047249 91 34.9686981 92 -987.8478857 93 -99.5507915 94 -359.0929602 95 -505.1047249 96 -80.6398066 97 -80.6398066 98 -117.6288923 99 -435.3658166 100 -339.1731872 101 -532.3863694 102 -727.8110327 103 -793.2999058 104 -863.6733999 105 -333.1425707 106 -405.2176948 107 -288.0158521 108 -536.8018194 109 9.6879042 110 -435.3658166 111 -666.3658166 112 -606.3343496 113 -252.1731872 114 -354.3658166 115 -457.8018194 116 -1088.6398066 117 -1055.2453345 118 -732.7128044 119 -860.7656747 120 -1153.3892039 121 -1005.9960076 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1cw501256749651.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/2sxi71256749651.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/3w2p41256749651.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/49zca1256749651.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/5ydyo1256749651.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/6oof21256749651.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/72r9u1256749651.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/8dbd11256749651.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. 81 841 1296 1350 1764 3481 > > #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/9ugbn1256749651.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/103z3f1256749651.tab") > > system("convert tmp/1cw501256749651.ps tmp/1cw501256749651.png") > system("convert tmp/2sxi71256749651.ps tmp/2sxi71256749651.png") > system("convert tmp/3w2p41256749651.ps tmp/3w2p41256749651.png") > system("convert tmp/49zca1256749651.ps tmp/49zca1256749651.png") > system("convert tmp/5ydyo1256749651.ps tmp/5ydyo1256749651.png") > system("convert tmp/6oof21256749651.ps tmp/6oof21256749651.png") > system("convert tmp/72r9u1256749651.ps tmp/72r9u1256749651.png") > system("convert tmp/8dbd11256749651.ps tmp/8dbd11256749651.png") > > > proc.time() user system elapsed 1.671 1.232 2.441