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(0.7461,0.7775,0.7790,0.7744,0.7905,0.7719,0.7811,0.7557,0.7637,0.7595,0.7471,0.7615,0.7487,0.7389,0.7337,0.7510,0.7382,0.7159,0.7542,0.7636,0.7433,0.7658,0.7627,0.7480,0.7692,0.7850,0.7913,0.7720,0.7880,0.8070,0.8268,0.8244,0.8487,0.8572,0.8214,0.8827,0.9216,0.8865,0.8816,0.8884,0.9466,0.9180,0.9337,0.9559,0.9626,0.9434,0.8639,0.7996,0.6680,0.6572,0.6928,0.6438,0.6454,0.6873,0.7265,0.7912,0.8114,0.8281,0.8393) > x <- c(0.5270,0.4720,0.0000,0.0520,0.3130,0.3640,0.3630,-0.1550,0.0520,0.5680,0.6680,1.3780,0.2520,-0.4020,-0.0500,0.5550,0.0500,0.1500,0.4500,0.2990,0.1990,0.4960,0.4440,-0.3930,-0.4440,0.1980,0.4940,0.1330,0.3880,0.4840,0.2780,0.3690,0.1650,0.1550,0.0870,0.4140,0.3600,0.9750,0.2700,0.3590,0.1690,0.3810,0.1540,0.4860,0.9250,0.7280,-0.0140,0.0460,-0.8190,-1.6740,-0.7880,0.2790,0.3960,-0.1410,-0.0190,0.0990,0.7420,0.0050,0.4480) > 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 -0.0706216793 2 -0.0351817758 3 0.0009879417 4 -0.0074316034 5 -0.0105027820 6 -0.0328488743 7 -0.0235754215 8 -0.0109268756 9 -0.0181316034 10 -0.0602332438 11 -0.0799785229 12 -0.1177300048 13 -0.0478221617 14 -0.0095840362 15 -0.0406394187 16 -0.0677783575 17 -0.0434846978 18 -0.0731299770 19 -0.0568658144 20 -0.0363744429 21 -0.0493291638 22 -0.0486446428 23 -0.0479250976 24 -0.0011451113 25 0.0238009811 26 -0.0075557110 27 -0.0229977372 28 -0.0157812795 29 -0.0185117413 30 -0.0065632093 31 0.0283680657 32 0.0192838617 33 0.0585682312 34 0.0678027591 35 0.0369975489 36 0.0742784861 37 0.1171449368 38 0.0368714702 39 0.0837556881 40 0.0840183896 41 0.1561744200 42 0.1120024282 43 0.1443762119 44 0.1421898851 45 0.1166441097 46 0.1119143096 47 0.0869162808 48 0.0182091133 49 -0.0498542222 50 0.0021479144 51 -0.0273312587 52 -0.1547053871 53 -0.1616993636 54 -0.0803552147 55 -0.0501164552 56 0.0059161154 57 -0.0211140295 58 0.0497206778 59 0.0283810912 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1ceo81260533220.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/2f4tr1260533220.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/3607s1260533220.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/4xow11260533220.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/5av751260533220.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/6rohh1260533220.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/7ek1n1260533220.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/8jdbr1260533220.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.6740 0.0510 0.2780 0.2159 0.4490 1.3780 > > #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/9g4xa1260533220.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/10gzcr1260533220.tab") > > system("convert tmp/1ceo81260533220.ps tmp/1ceo81260533220.png") > system("convert tmp/2f4tr1260533220.ps tmp/2f4tr1260533220.png") > system("convert tmp/3607s1260533220.ps tmp/3607s1260533220.png") > system("convert tmp/4xow11260533220.ps tmp/4xow11260533220.png") > system("convert tmp/5av751260533220.ps tmp/5av751260533220.png") > system("convert tmp/6rohh1260533220.ps tmp/6rohh1260533220.png") > system("convert tmp/7ek1n1260533220.ps tmp/7ek1n1260533220.png") > system("convert tmp/8jdbr1260533220.ps tmp/8jdbr1260533220.png") > > > proc.time() user system elapsed 1.641 1.206 4.260