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(-546.2822267,1826.31645,-2364.368971,-7683.034989,8098.450913,3896.416493,7234.713659,4239.293805,-27.74271189,4664.187374,-2668.810117,-1634.428903,-702.3820934,-1143.982814,-3012.718515,-10735.23279,10397.07509,7834.750176,12488.85274,4959.499749,4482.35088,1442.97386,-2521.137305,-3139.965807,-2461.386288,-758.6416306,-5108.454014,-13408.57613,8459.603987,3491.91794,7013.424426,2027.684151,767.6328743,1028.926296,-2421.954199,-3841.208803,-2877.408922,983.4389398,-4558.502407,-11485.94799,7431.75032,5661.560414,5066.556246,6901.454036,90.21117925,1376.084013,-3543.486326,-5784.029152,-3579.80472,-1978.140623,-9069.1933,-12651.54637,1693.2274,484.9164955,4304.958758,2721.130582,-3393.498839,-725.6776606,-2761.164048,-4480.650575) > x <- c(-705.0084872,-202.9003768,-759.5994856,-453.6981186,-596.9524877,-303.9108648,509.5501548,273.2294983,1125.974397,955.525251,-718.4957424,41.88905895,290.9786539,-85.65812042,-270.4611865,962.3077913,978.9971442,303.8052559,1414.485331,242.9932982,714.7695571,922.9782038,-256.9610079,-174.539615,133.3852059,574.4007144,-474.9035694,44.22325619,139.5762583,-321.877373,656.5372456,-227.1966048,-240.6808641,799.9645768,-271.7164591,-37.44939178,-697.7733622,1088.349218,-109.0324021,-546.9392933,4.43696275,480.7953962,134.5859782,305.8592089,-58.16950155,590.8646403,-529.8536656,-675.5467323,10.58933136,-316.6321065,-218.2180341,402.1378426,-1280.109699,-879.0355445,-578.4927039,-304.5020347,-558.1934767,-293.9809305,-541.6000177,-413.1001712) > 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 1715.64535 2 2477.29579 3 72.70669 4 -6227.40388 5 10013.69494 6 4871.47478 7 5599.88859 8 3362.67267 9 -3640.28438 10 1598.50951 11 -363.61045 12 -1768.82447 13 -1635.94907 14 -869.15993 15 -2144.97915 16 -13822.67155 17 7256.09072 18 6860.03072 19 7950.66145 20 4179.88751 21 2189.10619 22 -1518.28106 23 -1696.71150 24 -2579.97827 25 -2889.33529 26 -2601.53124 27 -3584.78799 28 -13550.46067 29 8011.79181 30 4524.61942 31 4907.01049 32 2756.61476 33 1539.82597 34 -1537.65548 35 -1550.18746 36 -3721.05732 37 -638.69430 38 -2508.38726 39 -4208.68620 40 -9731.16476 41 7417.51490 42 4118.99123 43 4634.75473 44 5920.14474 45 276.84042 46 -519.62795 47 -1843.52010 48 -3616.62577 49 -3613.77921 50 -962.26790 51 -8369.06926 52 -13941.75307 53 5800.29204 54 3305.18714 55 6160.97698 56 3698.08556 57 -1602.60803 58 217.52173 59 -1023.51119 60 -3155.27267 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1pdx71257392385.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/2ikyt1257392385.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/3bxlk1257392385.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/4jcg51257392385.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/5hw8n1257392385.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/699641257392385.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/7njrj1257392385.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/8te921257392385.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. -1.280e+03 -4.232e+02 -9.735e+01 -1.494e-15 3.299e+02 1.414e+03 > > #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/98ox71257392385.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/108blb1257392385.tab") > > system("convert tmp/1pdx71257392385.ps tmp/1pdx71257392385.png") > system("convert tmp/2ikyt1257392385.ps tmp/2ikyt1257392385.png") > system("convert tmp/3bxlk1257392385.ps tmp/3bxlk1257392385.png") > system("convert tmp/4jcg51257392385.ps tmp/4jcg51257392385.png") > system("convert tmp/5hw8n1257392385.ps tmp/5hw8n1257392385.png") > system("convert tmp/699641257392385.ps tmp/699641257392385.png") > system("convert tmp/7njrj1257392385.ps tmp/7njrj1257392385.png") > system("convert tmp/8te921257392385.ps tmp/8te921257392385.png") > > > proc.time() user system elapsed 1.558 1.140 2.071