R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. > x <- array(list(101,0,98.7,1,105.1,0,98.4,1,101.7,0,102.9,0,92.2,1,94.9,1,92.8,1,98.5,1,94.3,1,87.4,1,103.4,0,101.2,0,109.6,0,111.9,0,108.9,0,105.6,0,107.8,0,97.5,1,102.4,0,105.6,0,99.8,1,96.2,1,113.1,0,107.4,0,116.8,0,112.9,0,105.3,0,109.3,0,107.9,0,101.1,0,114.7,0,116.2,0,108.4,0,113.4,0,108.7,0,112.6,0,124.2,0,114.9,0,110.5,0,121.5,0,118.1,0,111.7,0,132.7,0,119,0,116.7,0,120.1,0,113.4,0,106.6,0,116.3,0,112.6,0,111.6,0,125.1,0,110.7,0,109.6,0,114.2,0,113.4,0,116,0,109.6,0,117.8,0,115.8,0,125.3,0,113,0,120.5,0,116.6,0,111.8,0,115.2,0,118.6,0,122.4,0,116.4,0,114.5,0,119.8,0,115.8,0,127.8,0,118.8,0,119.7,0,118.6,0,120.8,0,115.9,0,109.7,0,114.8,0,116.2,0,112.2,0),dim=c(2,84),dimnames=list(c('y','x'),1:84)) > y <- array(NA,dim=c(2,84),dimnames=list(c('y','x'),1:84)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'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: Write here your technical program description (don't use hard returns!) > library(lattice) > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 101.0 0 1 0 0 0 0 0 0 0 0 0 0 1 2 98.7 1 0 1 0 0 0 0 0 0 0 0 0 2 3 105.1 0 0 0 1 0 0 0 0 0 0 0 0 3 4 98.4 1 0 0 0 1 0 0 0 0 0 0 0 4 5 101.7 0 0 0 0 0 1 0 0 0 0 0 0 5 6 102.9 0 0 0 0 0 0 1 0 0 0 0 0 6 7 92.2 1 0 0 0 0 0 0 1 0 0 0 0 7 8 94.9 1 0 0 0 0 0 0 0 1 0 0 0 8 9 92.8 1 0 0 0 0 0 0 0 0 1 0 0 9 10 98.5 1 0 0 0 0 0 0 0 0 0 1 0 10 11 94.3 1 0 0 0 0 0 0 0 0 0 0 1 11 12 87.4 1 0 0 0 0 0 0 0 0 0 0 0 12 13 103.4 0 1 0 0 0 0 0 0 0 0 0 0 13 14 101.2 0 0 1 0 0 0 0 0 0 0 0 0 14 15 109.6 0 0 0 1 0 0 0 0 0 0 0 0 15 16 111.9 0 0 0 0 1 0 0 0 0 0 0 0 16 17 108.9 0 0 0 0 0 1 0 0 0 0 0 0 17 18 105.6 0 0 0 0 0 0 1 0 0 0 0 0 18 19 107.8 0 0 0 0 0 0 0 1 0 0 0 0 19 20 97.5 1 0 0 0 0 0 0 0 1 0 0 0 20 21 102.4 0 0 0 0 0 0 0 0 0 1 0 0 21 22 105.6 0 0 0 0 0 0 0 0 0 0 1 0 22 23 99.8 1 0 0 0 0 0 0 0 0 0 0 1 23 24 96.2 1 0 0 0 0 0 0 0 0 0 0 0 24 25 113.1 0 1 0 0 0 0 0 0 0 0 0 0 25 26 107.4 0 0 1 0 0 0 0 0 0 0 0 0 26 27 116.8 0 0 0 1 0 0 0 0 0 0 0 0 27 28 112.9 0 0 0 0 1 0 0 0 0 0 0 0 28 29 105.3 0 0 0 0 0 1 0 0 0 0 0 0 29 30 109.3 0 0 0 0 0 0 1 0 0 0 0 0 30 31 107.9 0 0 0 0 0 0 0 1 0 0 0 0 31 32 101.1 0 0 0 0 0 0 0 0 1 0 0 0 32 33 114.7 0 0 0 0 0 0 0 0 0 1 0 0 33 34 116.2 0 0 0 0 0 0 0 0 0 0 1 0 34 35 108.4 0 0 0 0 0 0 0 0 0 0 0 1 35 36 113.4 0 0 0 0 0 0 0 0 0 0 0 0 36 37 108.7 0 1 0 0 0 0 0 0 0 0 0 0 37 38 112.6 0 0 1 0 0 0 0 0 0 0 0 0 38 39 124.2 0 0 0 1 0 0 0 0 0 0 0 0 39 40 114.9 0 0 0 0 1 0 0 0 0 0 0 0 40 41 110.5 0 0 0 0 0 1 0 0 0 0 0 0 41 42 121.5 0 0 0 0 0 0 1 0 0 0 0 0 42 43 118.1 0 0 0 0 0 0 0 1 0 0 0 0 43 44 111.7 0 0 0 0 0 0 0 0 1 0 0 0 44 45 132.7 0 0 0 0 0 0 0 0 0 1 0 0 45 46 119.0 0 0 0 0 0 0 0 0 0 0 1 0 46 47 116.7 0 0 0 0 0 0 0 0 0 0 0 1 47 48 120.1 0 0 0 0 0 0 0 0 0 0 0 0 48 49 113.4 0 1 0 0 0 0 0 0 0 0 0 0 49 50 106.6 0 0 1 0 0 0 0 0 0 0 0 0 50 51 116.3 0 0 0 1 0 0 0 0 0 0 0 0 51 52 112.6 0 0 0 0 1 0 0 0 0 0 0 0 52 53 111.6 0 0 0 0 0 1 0 0 0 0 0 0 53 54 125.1 0 0 0 0 0 0 1 0 0 0 0 0 54 55 110.7 0 0 0 0 0 0 0 1 0 0 0 0 55 56 109.6 0 0 0 0 0 0 0 0 1 0 0 0 56 57 114.2 0 0 0 0 0 0 0 0 0 1 0 0 57 58 113.4 0 0 0 0 0 0 0 0 0 0 1 0 58 59 116.0 0 0 0 0 0 0 0 0 0 0 0 1 59 60 109.6 0 0 0 0 0 0 0 0 0 0 0 0 60 61 117.8 0 1 0 0 0 0 0 0 0 0 0 0 61 62 115.8 0 0 1 0 0 0 0 0 0 0 0 0 62 63 125.3 0 0 0 1 0 0 0 0 0 0 0 0 63 64 113.0 0 0 0 0 1 0 0 0 0 0 0 0 64 65 120.5 0 0 0 0 0 1 0 0 0 0 0 0 65 66 116.6 0 0 0 0 0 0 1 0 0 0 0 0 66 67 111.8 0 0 0 0 0 0 0 1 0 0 0 0 67 68 115.2 0 0 0 0 0 0 0 0 1 0 0 0 68 69 118.6 0 0 0 0 0 0 0 0 0 1 0 0 69 70 122.4 0 0 0 0 0 0 0 0 0 0 1 0 70 71 116.4 0 0 0 0 0 0 0 0 0 0 0 1 71 72 114.5 0 0 0 0 0 0 0 0 0 0 0 0 72 73 119.8 0 1 0 0 0 0 0 0 0 0 0 0 73 74 115.8 0 0 1 0 0 0 0 0 0 0 0 0 74 75 127.8 0 0 0 1 0 0 0 0 0 0 0 0 75 76 118.8 0 0 0 0 1 0 0 0 0 0 0 0 76 77 119.7 0 0 0 0 0 1 0 0 0 0 0 0 77 78 118.6 0 0 0 0 0 0 1 0 0 0 0 0 78 79 120.8 0 0 0 0 0 0 0 1 0 0 0 0 79 80 115.9 0 0 0 0 0 0 0 0 1 0 0 0 80 81 109.7 0 0 0 0 0 0 0 0 0 1 0 0 81 82 114.8 0 0 0 0 0 0 0 0 0 0 1 0 82 83 116.2 0 0 0 0 0 0 0 0 0 0 0 1 83 84 112.2 0 0 0 0 0 0 0 0 0 0 0 0 84 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x M1 M2 M3 M4 100.9408 -9.5079 2.8386 1.2724 9.2896 4.3663 M5 M6 M7 M8 M9 M10 2.1978 5.0590 1.8928 -0.2877 3.7581 4.2479 M11 t 2.2531 0.1959 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.8687 -3.0055 -0.4871 2.4321 19.1846 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 100.94078 2.44636 41.262 < 2e-16 *** x -9.50788 1.97408 -4.816 8.18e-06 *** M1 2.83862 2.67304 1.062 0.29191 M2 1.27240 2.60627 0.488 0.62693 M3 9.28963 2.66166 3.490 0.00084 *** M4 4.36626 2.59832 1.680 0.09733 . M5 2.19778 2.65126 0.829 0.40995 M6 5.05900 2.64644 1.912 0.06002 . M7 1.89278 2.58833 0.731 0.46705 M8 -0.28773 2.56365 -0.112 0.91096 M9 3.75807 2.58299 1.455 0.15016 M10 4.24786 2.58072 1.646 0.10425 M11 2.25307 2.56163 0.880 0.38212 t 0.19592 0.02627 7.457 1.82e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.792 on 70 degrees of freedom Multiple R-squared: 0.7453, Adjusted R-squared: 0.698 F-statistic: 15.75 on 13 and 70 DF, p-value: 5.984e-16 > postscript(file="/var/www/html/rcomp/tmp/1hwpt1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2fl1v1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3zv4o1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4o9op1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5sy6d1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 84 Frequency = 1 1 2 3 4 5 6 -2.97532468 5.60285714 -5.71818182 1.81714286 -2.41818182 -4.27532468 7 8 9 10 11 12 -2.49714286 2.18744589 -4.15428571 0.86000000 -1.54112554 -6.38398268 13 14 15 16 17 18 -2.92640693 -3.75610390 -3.56926407 3.45818182 2.43073593 -3.92640693 19 20 21 22 23 24 1.24389610 2.43636364 -6.41324675 -3.89896104 1.60779221 0.06493506 25 26 27 28 29 30 4.42251082 0.09281385 1.27965368 2.10709957 -3.52034632 -2.57748918 31 32 33 34 35 36 -1.00718615 -5.82259740 3.53567100 4.34995671 -1.65116883 5.40597403 37 38 39 40 41 42 -2.32857143 2.94173160 6.32857143 1.75601732 -0.67142857 7.27142857 43 44 45 46 47 48 6.84173160 2.42632035 19.18458874 4.79887446 4.29774892 9.75489177 49 50 51 52 53 54 0.02034632 -5.40935065 -3.92251082 -2.89506494 -1.92251082 8.52034632 55 56 57 58 59 60 -2.90935065 -2.02476190 -1.66649351 -3.15220779 1.24666667 -3.09619048 61 62 63 64 65 66 2.06926407 1.43956710 2.72640693 -4.84614719 4.62640693 -2.33073593 67 68 69 70 71 72 -4.16043290 1.22415584 0.38242424 3.49670996 -0.70441558 -0.54727273 73 74 75 76 77 78 1.71818182 -0.91151515 2.87532468 -1.39722944 1.47532468 -2.68181818 79 80 81 82 83 84 2.48848485 -0.42692641 -10.86865801 -6.45437229 -3.25549784 -5.19835498 > postscript(file="/var/www/html/rcomp/tmp/634or1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.97532468 NA 1 5.60285714 -2.97532468 2 -5.71818182 5.60285714 3 1.81714286 -5.71818182 4 -2.41818182 1.81714286 5 -4.27532468 -2.41818182 6 -2.49714286 -4.27532468 7 2.18744589 -2.49714286 8 -4.15428571 2.18744589 9 0.86000000 -4.15428571 10 -1.54112554 0.86000000 11 -6.38398268 -1.54112554 12 -2.92640693 -6.38398268 13 -3.75610390 -2.92640693 14 -3.56926407 -3.75610390 15 3.45818182 -3.56926407 16 2.43073593 3.45818182 17 -3.92640693 2.43073593 18 1.24389610 -3.92640693 19 2.43636364 1.24389610 20 -6.41324675 2.43636364 21 -3.89896104 -6.41324675 22 1.60779221 -3.89896104 23 0.06493506 1.60779221 24 4.42251082 0.06493506 25 0.09281385 4.42251082 26 1.27965368 0.09281385 27 2.10709957 1.27965368 28 -3.52034632 2.10709957 29 -2.57748918 -3.52034632 30 -1.00718615 -2.57748918 31 -5.82259740 -1.00718615 32 3.53567100 -5.82259740 33 4.34995671 3.53567100 34 -1.65116883 4.34995671 35 5.40597403 -1.65116883 36 -2.32857143 5.40597403 37 2.94173160 -2.32857143 38 6.32857143 2.94173160 39 1.75601732 6.32857143 40 -0.67142857 1.75601732 41 7.27142857 -0.67142857 42 6.84173160 7.27142857 43 2.42632035 6.84173160 44 19.18458874 2.42632035 45 4.79887446 19.18458874 46 4.29774892 4.79887446 47 9.75489177 4.29774892 48 0.02034632 9.75489177 49 -5.40935065 0.02034632 50 -3.92251082 -5.40935065 51 -2.89506494 -3.92251082 52 -1.92251082 -2.89506494 53 8.52034632 -1.92251082 54 -2.90935065 8.52034632 55 -2.02476190 -2.90935065 56 -1.66649351 -2.02476190 57 -3.15220779 -1.66649351 58 1.24666667 -3.15220779 59 -3.09619048 1.24666667 60 2.06926407 -3.09619048 61 1.43956710 2.06926407 62 2.72640693 1.43956710 63 -4.84614719 2.72640693 64 4.62640693 -4.84614719 65 -2.33073593 4.62640693 66 -4.16043290 -2.33073593 67 1.22415584 -4.16043290 68 0.38242424 1.22415584 69 3.49670996 0.38242424 70 -0.70441558 3.49670996 71 -0.54727273 -0.70441558 72 1.71818182 -0.54727273 73 -0.91151515 1.71818182 74 2.87532468 -0.91151515 75 -1.39722944 2.87532468 76 1.47532468 -1.39722944 77 -2.68181818 1.47532468 78 2.48848485 -2.68181818 79 -0.42692641 2.48848485 80 -10.86865801 -0.42692641 81 -6.45437229 -10.86865801 82 -3.25549784 -6.45437229 83 -5.19835498 -3.25549784 84 NA -5.19835498 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.60285714 -2.97532468 [2,] -5.71818182 5.60285714 [3,] 1.81714286 -5.71818182 [4,] -2.41818182 1.81714286 [5,] -4.27532468 -2.41818182 [6,] -2.49714286 -4.27532468 [7,] 2.18744589 -2.49714286 [8,] -4.15428571 2.18744589 [9,] 0.86000000 -4.15428571 [10,] -1.54112554 0.86000000 [11,] -6.38398268 -1.54112554 [12,] -2.92640693 -6.38398268 [13,] -3.75610390 -2.92640693 [14,] -3.56926407 -3.75610390 [15,] 3.45818182 -3.56926407 [16,] 2.43073593 3.45818182 [17,] -3.92640693 2.43073593 [18,] 1.24389610 -3.92640693 [19,] 2.43636364 1.24389610 [20,] -6.41324675 2.43636364 [21,] -3.89896104 -6.41324675 [22,] 1.60779221 -3.89896104 [23,] 0.06493506 1.60779221 [24,] 4.42251082 0.06493506 [25,] 0.09281385 4.42251082 [26,] 1.27965368 0.09281385 [27,] 2.10709957 1.27965368 [28,] -3.52034632 2.10709957 [29,] -2.57748918 -3.52034632 [30,] -1.00718615 -2.57748918 [31,] -5.82259740 -1.00718615 [32,] 3.53567100 -5.82259740 [33,] 4.34995671 3.53567100 [34,] -1.65116883 4.34995671 [35,] 5.40597403 -1.65116883 [36,] -2.32857143 5.40597403 [37,] 2.94173160 -2.32857143 [38,] 6.32857143 2.94173160 [39,] 1.75601732 6.32857143 [40,] -0.67142857 1.75601732 [41,] 7.27142857 -0.67142857 [42,] 6.84173160 7.27142857 [43,] 2.42632035 6.84173160 [44,] 19.18458874 2.42632035 [45,] 4.79887446 19.18458874 [46,] 4.29774892 4.79887446 [47,] 9.75489177 4.29774892 [48,] 0.02034632 9.75489177 [49,] -5.40935065 0.02034632 [50,] -3.92251082 -5.40935065 [51,] -2.89506494 -3.92251082 [52,] -1.92251082 -2.89506494 [53,] 8.52034632 -1.92251082 [54,] -2.90935065 8.52034632 [55,] -2.02476190 -2.90935065 [56,] -1.66649351 -2.02476190 [57,] -3.15220779 -1.66649351 [58,] 1.24666667 -3.15220779 [59,] -3.09619048 1.24666667 [60,] 2.06926407 -3.09619048 [61,] 1.43956710 2.06926407 [62,] 2.72640693 1.43956710 [63,] -4.84614719 2.72640693 [64,] 4.62640693 -4.84614719 [65,] -2.33073593 4.62640693 [66,] -4.16043290 -2.33073593 [67,] 1.22415584 -4.16043290 [68,] 0.38242424 1.22415584 [69,] 3.49670996 0.38242424 [70,] -0.70441558 3.49670996 [71,] -0.54727273 -0.70441558 [72,] 1.71818182 -0.54727273 [73,] -0.91151515 1.71818182 [74,] 2.87532468 -0.91151515 [75,] -1.39722944 2.87532468 [76,] 1.47532468 -1.39722944 [77,] -2.68181818 1.47532468 [78,] 2.48848485 -2.68181818 [79,] -0.42692641 2.48848485 [80,] -10.86865801 -0.42692641 [81,] -6.45437229 -10.86865801 [82,] -3.25549784 -6.45437229 [83,] -5.19835498 -3.25549784 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.60285714 -2.97532468 2 -5.71818182 5.60285714 3 1.81714286 -5.71818182 4 -2.41818182 1.81714286 5 -4.27532468 -2.41818182 6 -2.49714286 -4.27532468 7 2.18744589 -2.49714286 8 -4.15428571 2.18744589 9 0.86000000 -4.15428571 10 -1.54112554 0.86000000 11 -6.38398268 -1.54112554 12 -2.92640693 -6.38398268 13 -3.75610390 -2.92640693 14 -3.56926407 -3.75610390 15 3.45818182 -3.56926407 16 2.43073593 3.45818182 17 -3.92640693 2.43073593 18 1.24389610 -3.92640693 19 2.43636364 1.24389610 20 -6.41324675 2.43636364 21 -3.89896104 -6.41324675 22 1.60779221 -3.89896104 23 0.06493506 1.60779221 24 4.42251082 0.06493506 25 0.09281385 4.42251082 26 1.27965368 0.09281385 27 2.10709957 1.27965368 28 -3.52034632 2.10709957 29 -2.57748918 -3.52034632 30 -1.00718615 -2.57748918 31 -5.82259740 -1.00718615 32 3.53567100 -5.82259740 33 4.34995671 3.53567100 34 -1.65116883 4.34995671 35 5.40597403 -1.65116883 36 -2.32857143 5.40597403 37 2.94173160 -2.32857143 38 6.32857143 2.94173160 39 1.75601732 6.32857143 40 -0.67142857 1.75601732 41 7.27142857 -0.67142857 42 6.84173160 7.27142857 43 2.42632035 6.84173160 44 19.18458874 2.42632035 45 4.79887446 19.18458874 46 4.29774892 4.79887446 47 9.75489177 4.29774892 48 0.02034632 9.75489177 49 -5.40935065 0.02034632 50 -3.92251082 -5.40935065 51 -2.89506494 -3.92251082 52 -1.92251082 -2.89506494 53 8.52034632 -1.92251082 54 -2.90935065 8.52034632 55 -2.02476190 -2.90935065 56 -1.66649351 -2.02476190 57 -3.15220779 -1.66649351 58 1.24666667 -3.15220779 59 -3.09619048 1.24666667 60 2.06926407 -3.09619048 61 1.43956710 2.06926407 62 2.72640693 1.43956710 63 -4.84614719 2.72640693 64 4.62640693 -4.84614719 65 -2.33073593 4.62640693 66 -4.16043290 -2.33073593 67 1.22415584 -4.16043290 68 0.38242424 1.22415584 69 3.49670996 0.38242424 70 -0.70441558 3.49670996 71 -0.54727273 -0.70441558 72 1.71818182 -0.54727273 73 -0.91151515 1.71818182 74 2.87532468 -0.91151515 75 -1.39722944 2.87532468 76 1.47532468 -1.39722944 77 -2.68181818 1.47532468 78 2.48848485 -2.68181818 79 -0.42692641 2.48848485 80 -10.86865801 -0.42692641 81 -6.45437229 -10.86865801 82 -3.25549784 -6.45437229 83 -5.19835498 -3.25549784 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/71ake1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8rnm71227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9gx1u1227723438.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > > #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, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/102bq91227723438.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/1112sz1227723438.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/120sp91227723438.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/134gzy1227723438.tab") > system("convert tmp/1hwpt1227723438.ps tmp/1hwpt1227723438.png") > system("convert tmp/2fl1v1227723438.ps tmp/2fl1v1227723438.png") > system("convert tmp/3zv4o1227723438.ps tmp/3zv4o1227723438.png") > system("convert tmp/4o9op1227723438.ps tmp/4o9op1227723438.png") > system("convert tmp/5sy6d1227723438.ps tmp/5sy6d1227723438.png") > system("convert tmp/634or1227723438.ps tmp/634or1227723438.png") > system("convert tmp/71ake1227723438.ps tmp/71ake1227723438.png") > system("convert tmp/8rnm71227723438.ps tmp/8rnm71227723438.png") > system("convert tmp/9gx1u1227723438.ps tmp/9gx1u1227723438.png") > > > proc.time() user system elapsed 1.991 1.415 2.514