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(34359.65199,38587.02116,39828.34883,25986.36384,23275.05495,17536.29032,18772.05119,17652.20376,13809.9006,8724.299812,16880.69725,30459.84012,46817.26404,48434.47313,33761.22827,23046.26404,19412.02669,18194.0587,16429.72728,14460.31681,6857.947638,8866.128469,13765.73302,26895.93617,44300.32807,40044.92511,20984.05693,7217.188746,-3365.781217,-1398.080623,-6766.60414,-11243.17094,-18608.92805,-24943.61165,-24305.5909,-4494.039323,13943.06444,-1778.359277,-9378.922319,-23034.8075,-28900.61363,-22818.44406,-26936.8075,-37226.46857,-33849.20671,-46097.09564,-37418.45908,-19433.11086,-7315.340504,-16251.85078,-27402.16718,-37091.92054,-36045.35375,-31317.06936,-28183.27647,-25545.39129,-29559.05236,-36135.66442,-24894.58339,-7562.619362) > x <- c(-9.025408898,0.961051813,-0.763484335,-1.03592439,2.248061689,-0.848089637,-4.983828298,0.25823367,-6.879841767,-6.638261166,0.217477947,-0.810495567,-10.47131954,0.209299231,-1.704377914,2.62868046,4.578783287,1.179951675,-0.727402164,4.535347277,-2.951113434,1.060226936,2.350536321,3.393009597,-5.868982764,1.957546649,4.794110187,2.330673725,3.685793615,3.979608164,0.265243998,6.254041485,0.521670132,1.201464026,4.406962455,7.330398012,-4.44210984,2.078921143,5.999608617,4.262563712,4.255415527,5.171085938,3.762563712,7.433697522,3.320983111,0.95204822,4.243525993,7.964281264,-2.961628926,3.265725365,4.685931471,-3.114549896,-0.703347383,-6.424721877,-9.75929215,-7.222247245,-9.551113434,-11.50520279,-7.029257573,-2.322522958) > 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 28817.098315 2 39177.208410 3 39359.488865 4 25350.196925 5 24655.602105 6 17015.473769 7 15711.454583 8 17810.786490 9 9584.951603 10 4647.706802 11 17014.251664 12 29962.110296 13 40386.768618 14 48563.004949 15 32714.560338 16 24660.551294 17 22223.882909 18 18918.673570 19 15983.025576 20 17245.498735 21 5045.652506 22 9517.219713 23 15209.210415 24 28979.602188 25 40696.153195 26 41247.065368 27 23928.146593 28 8648.468411 29 -1102.314909 30 1045.818829 31 -6603.716329 32 -7402.529367 33 -18288.567527 34 -24205.785926 35 -21599.250807 36 7.598764 37 11215.140143 38 -501.682269 39 -5694.529382 40 -20417.143476 41 -26287.339346 42 -19642.851497 43 -24626.196250 44 -32661.393680 45 -31809.772557 46 -45512.437546 47 -34812.486225 48 -14542.201551 49 -9134.093258 50 -14246.350715 51 -24524.510667 52 -39004.582910 53 -36477.283280 54 -35262.526708 55 -34176.511922 56 -29980.613391 57 -35424.444108 58 -43201.073282 59 -29211.289462 60 -8988.893595 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1wpil1256746904.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/206j71256746904.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/3ymad1256746904.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/4lm3i1256746904.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/5req41256746904.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/633551256746904.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/724d01256746904.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/86rcn1256746904.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.151e+01 -2.954e+00 9.566e-01 4.471e-17 3.817e+00 7.964e+00 > > #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/9r2lj1256746904.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/10lk2q1256746904.tab") > > system("convert tmp/1wpil1256746904.ps tmp/1wpil1256746904.png") > system("convert tmp/206j71256746904.ps tmp/206j71256746904.png") > system("convert tmp/3ymad1256746904.ps tmp/3ymad1256746904.png") > system("convert tmp/4lm3i1256746904.ps tmp/4lm3i1256746904.png") > system("convert tmp/5req41256746904.ps tmp/5req41256746904.png") > system("convert tmp/633551256746904.ps tmp/633551256746904.png") > system("convert tmp/724d01256746904.ps tmp/724d01256746904.png") > system("convert tmp/86rcn1256746904.ps tmp/86rcn1256746904.png") > > > proc.time() user system elapsed 1.574 1.145 2.173