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(-1700.130876,-1990.143684,-1951.137618,-2164.706355,-2003.007565,-2269.612017,-2166.984657,-1727.249475,-2124.114711,-1729.681416,-1404.283836,-1735.492063,-1850.995434,-1703.136941,-2213.23331,-2245.156491,-2024.800693,-2253.103257,-2172.073607,-1699.604597,-2164.26296,-1941.771043,-1575.609985,-2225.32226,-2290.8728,-2118.227245,-2850.922001,-2302.926035,-2283.760266,-3090.088446,-2015.055411,-2018.274414,-1990.108645,-2447.63089,-1899.688158,-2020.002177,-2142.937488,-2428.003531,-2667.306095,-2801.99882,-2982.833728,-2961.804078,-2181.919969,-2437.956362,-2474.636955,-2608.382914,-2364.914581,-2829.141004,-3544.374169,-2641.087092,-3011.461087,-2159.937488,-2855.51971,-2501.09248,-2347.0507,-2149.564848,-2255.47051,-2406.405821,-1926.498805,-2200.724551,-2281.168622,-2203.967138,-2544.471187,-2268.594497,-2152.765654,-2787.986689,-2354.96175,-2025.025761,-1761.391659,-2536.388302,-1995.58169,-1985.634924) > x <- c(-1813.130876,-2101.143684,-2058.137618,-2267.706355,-2101.007565,-2368.612017,-2303.984657,-1874.249475,-2271.114711,-1868.681416,-1534.283836,-1863.492063,-1977.995434,-1826.136941,-2331.23331,-2358.156491,-2133.800693,-2364.103257,-2322.073607,-1858.604597,-2322.26296,-2088.771043,-1712.609985,-2362.32226,-2426.8728,-2251.227245,-2975.922001,-2422.926035,-2397.760266,-3206.088446,-2168.055411,-2180.274414,-2151.108645,-2596.63089,-2038.688158,-2154.002177,-2272.937488,-2554.003531,-2789.306095,-2918.99882,-3094.833728,-3074.804078,-2330.919969,-2594.956362,-2631.636955,-2755.382914,-2500.914581,-2961.141004,-3669.374169,-2764.087092,-3128.461087,-2273.937488,-2966.51971,-2613.09248,-2491.0507,-2299.564848,-2404.47051,-2541.405821,-2049.498805,-2315.724551,-2398.168622,-2314.967138,-2649.471187,-2370.594497,-2247.765654,-2880.986689,-2478.96175,-2156.025761,-1885.391659,-2651.388302,-2101.58169,-2090.634924) > 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 -18.1101017 2 -17.9468448 3 -22.2698623 4 -24.6957968 5 -30.9478672 6 -27.9378969 7 9.5766886 8 16.3489586 9 19.3298033 10 8.3071370 11 -3.2045147 12 -2.7318401 13 -2.8718082 14 -8.0124135 15 -9.2186474 16 -14.0164281 17 -19.7015588 18 -15.9717621 19 22.7125543 20 28.2314503 21 30.7139765 22 17.9602246 23 5.1348885 24 10.0148609 25 9.4996983 26 5.1804290 27 2.6235929 28 -6.5299457 29 -12.7189652 30 -4.6476327 31 24.5557275 32 33.6475041 33 32.4284408 34 23.7747470 35 9.5840533 36 5.4501740 37 2.3434941 38 0.4545740 39 -1.7780744 40 -5.8039556 41 -9.4832641 42 -8.6337063 43 21.7789991 44 31.7621697 45 32.0376767 46 22.9671295 47 10.0558243 48 9.5125732 49 7.8320946 50 -0.9674937 51 -4.2306899 52 -13.6489949 53 -11.4470274 54 -13.1016104 55 17.9817369 56 22.5434915 57 22.3314353 58 9.3599529 59 -6.3347482 60 -12.3351333 61 -9.7158980 62 -16.3408223 63 -19.8283708 64 -24.9230066 65 -32.8455709 66 -30.0894638 67 -2.1090629 68 2.4653731 69 -6.5673528 70 -9.8139714 71 -22.9435549 72 -24.0257758 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/10ytv1256912414.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/2deva1256912414.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/30wcz1256912414.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/4ycqn1256912414.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/57hd01256912414.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/6s6tg1256912414.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/76rzx1256912414.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/81xfr1256912414.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. -3669 -2595 -2327 -2379 -2126 -1534 > > #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/9eybc1256912414.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/10wbpb1256912414.tab") > > system("convert tmp/10ytv1256912414.ps tmp/10ytv1256912414.png") > system("convert tmp/2deva1256912414.ps tmp/2deva1256912414.png") > system("convert tmp/30wcz1256912414.ps tmp/30wcz1256912414.png") > system("convert tmp/4ycqn1256912414.ps tmp/4ycqn1256912414.png") > system("convert tmp/57hd01256912414.ps tmp/57hd01256912414.png") > system("convert tmp/6s6tg1256912414.ps tmp/6s6tg1256912414.png") > system("convert tmp/76rzx1256912414.ps tmp/76rzx1256912414.png") > system("convert tmp/81xfr1256912414.ps tmp/81xfr1256912414.png") > > > proc.time() user system elapsed 1.666 1.212 15.819