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(10.574,10.653,10.805,10.872,10.625,10.407,10.463,10.556,10.646,10.702,11.353,11.346,11.451,11.964,12.574,13.031,13.812,14.544,14.931,14.886,16.005,17.064,15.168,16.050,15.839,15.137,14.954,15.648,15.305,15.579,16.348,15.928,16.171,15.937,15.713,15.594,15.683,16.438,17.032,17.696,17.745,19.394,20.148,20.108,18.584,18.441,18.391,19.178,18.079,18.483,19.644,19.195,19.650,20.830,23.595,22.937,21.814,21.928,21.777,21.383,21.467) > x <- c(1.2111,1.2409,1.2737,1.3295,1.3621,1.3035,1.3257,1.2964,1.2957,1.2331,1.2092,1.2093,1.2198,1.2042,1.2023,1.1769,1.1797,1.2118,1.1875,1.2104,1.2537,1.2868,1.2713,1.2767,1.2851,1.266,1.2696,1.32,1.317,1.2954,1.3211,1.3318,1.3605,1.3453,1.3505,1.3707,1.3705,1.4179,1.4447,1.4761,1.4721,1.487,1.5167,1.5812,1.554,1.5508,1.5764,1.5611,1.4735,1.4303,1.2757,1.2727,1.3917,1.2816,1.2644,1.3308,1.3275,1.4098,1.4134,1.4138,1.4272) > 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 -3.12493619 2 -3.60163928 3 -4.06128563 4 -5.03483034 5 -5.88974714 6 -5.01498872 7 -5.37296887 8 -4.73358966 9 -4.63053624 10 -3.40718680 11 -2.31050546 12 -2.31937024 13 -2.41017166 14 -1.60626669 15 -0.96083595 16 -0.03018299 17 0.69860330 18 0.83201038 19 1.67215081 20 1.20011723 21 1.51166946 22 1.95342878 23 0.34646898 24 1.12777110 25 0.76012996 26 0.41430208 27 0.16417016 28 -0.08167667 29 -0.36873341 30 0.30805809 31 0.59781080 32 -0.02172018 33 -0.31391074 34 -0.26446486 35 -0.58543319 36 -1.08111783 37 -0.98838828 38 -1.11729185 39 -1.02305167 40 -0.94459117 41 -0.82100015 42 0.55014830 43 0.75030999 44 -0.49247018 45 -1.50925126 46 -1.59257844 47 -2.11996096 48 -1.04765031 49 -0.51310701 50 0.69647599 51 4.74041886 52 4.34736212 53 2.58327932 54 5.81639710 55 8.90213848 56 7.00592758 57 5.94446517 58 4.52375496 59 4.30562305 60 3.90416394 61 3.73828403 > library(lattice) > postscript(file="/var/www/html/rcomp/tmp/1m7wm1257953167.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/24dud1257953167.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/3dib81257953167.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/4sfzm1257953167.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/5nhq71257953167.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/61rfc1257953167.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/7mqyz1257953167.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/8tdv71257953167.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.177 1.266 1.320 1.336 1.413 1.581 > > #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/9ng8k1257953167.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/1034l51257953167.tab") > > system("convert tmp/1m7wm1257953167.ps tmp/1m7wm1257953167.png") > system("convert tmp/24dud1257953167.ps tmp/24dud1257953167.png") > system("convert tmp/3dib81257953167.ps tmp/3dib81257953167.png") > system("convert tmp/4sfzm1257953167.ps tmp/4sfzm1257953167.png") > system("convert tmp/5nhq71257953167.ps tmp/5nhq71257953167.png") > system("convert tmp/61rfc1257953167.ps tmp/61rfc1257953167.png") > system("convert tmp/7mqyz1257953167.ps tmp/7mqyz1257953167.png") > system("convert tmp/8tdv71257953167.ps tmp/8tdv71257953167.png") > > > proc.time() user system elapsed 1.609 1.191 2.411