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(112.1,0,104.2,0,102.4,0,100.3,0,102.6,0,101.5,0,103.4,0,99.4,0,97.9,0,98,0,90.2,0,87.1,0,91.8,0,94.8,0,91.8,0,89.3,0,91.7,0,86.2,0,82.8,0,82.3,0,79.8,0,79.4,0,85.3,0,87.5,0,88.3,0,88.6,0,94.9,0,94.7,0,92.6,0,91.8,0,96.4,0,96.4,0,107.1,0,111.9,0,107.8,0,109.2,0,115.3,0,119.2,0,107.8,0,106.8,0,104.2,0,94.8,0,97.5,0,98.3,0,100.6,0,94.9,1,93.6,1,98,1,104.3,1,103.9,1,105.3,1,102.6,1,103.3,1,107.9,1,107.8,1,109.8,1,110.6,1,110.8,1,119.3,1,128.1,1,127.6,1,137.9,1,151.4,1,143.6,1,143.4,1,141.9,1,135.2,1,133.1,1,129.6,1,134.1,1,136.8,1,143.5,1,162.5,1,163.1,1,157.2,1,158.8,1,155.4,1,148.5,1,154.2,1,153.3,1,149.4,1,147.9,1,156,1,163,1,159.1,1,159.5,1,157.3,1,156.4,1,156.6,1,162.4,1,166.8,1,162.6,1,168.1,1),dim=c(2,93),dimnames=list(c('genotsmiddelen','uitvoersubsidie'),1:93)) > y <- array(NA,dim=c(2,93),dimnames=list(c('genotsmiddelen','uitvoersubsidie'),1:93)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > ylab = '' > xlab = '' > main = '' > #'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 genotsmiddelen uitvoersubsidie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 112.1 0 1 0 0 0 0 0 0 0 0 0 0 1 2 104.2 0 0 1 0 0 0 0 0 0 0 0 0 2 3 102.4 0 0 0 1 0 0 0 0 0 0 0 0 3 4 100.3 0 0 0 0 1 0 0 0 0 0 0 0 4 5 102.6 0 0 0 0 0 1 0 0 0 0 0 0 5 6 101.5 0 0 0 0 0 0 1 0 0 0 0 0 6 7 103.4 0 0 0 0 0 0 0 1 0 0 0 0 7 8 99.4 0 0 0 0 0 0 0 0 1 0 0 0 8 9 97.9 0 0 0 0 0 0 0 0 0 1 0 0 9 10 98.0 0 0 0 0 0 0 0 0 0 0 1 0 10 11 90.2 0 0 0 0 0 0 0 0 0 0 0 1 11 12 87.1 0 0 0 0 0 0 0 0 0 0 0 0 12 13 91.8 0 1 0 0 0 0 0 0 0 0 0 0 13 14 94.8 0 0 1 0 0 0 0 0 0 0 0 0 14 15 91.8 0 0 0 1 0 0 0 0 0 0 0 0 15 16 89.3 0 0 0 0 1 0 0 0 0 0 0 0 16 17 91.7 0 0 0 0 0 1 0 0 0 0 0 0 17 18 86.2 0 0 0 0 0 0 1 0 0 0 0 0 18 19 82.8 0 0 0 0 0 0 0 1 0 0 0 0 19 20 82.3 0 0 0 0 0 0 0 0 1 0 0 0 20 21 79.8 0 0 0 0 0 0 0 0 0 1 0 0 21 22 79.4 0 0 0 0 0 0 0 0 0 0 1 0 22 23 85.3 0 0 0 0 0 0 0 0 0 0 0 1 23 24 87.5 0 0 0 0 0 0 0 0 0 0 0 0 24 25 88.3 0 1 0 0 0 0 0 0 0 0 0 0 25 26 88.6 0 0 1 0 0 0 0 0 0 0 0 0 26 27 94.9 0 0 0 1 0 0 0 0 0 0 0 0 27 28 94.7 0 0 0 0 1 0 0 0 0 0 0 0 28 29 92.6 0 0 0 0 0 1 0 0 0 0 0 0 29 30 91.8 0 0 0 0 0 0 1 0 0 0 0 0 30 31 96.4 0 0 0 0 0 0 0 1 0 0 0 0 31 32 96.4 0 0 0 0 0 0 0 0 1 0 0 0 32 33 107.1 0 0 0 0 0 0 0 0 0 1 0 0 33 34 111.9 0 0 0 0 0 0 0 0 0 0 1 0 34 35 107.8 0 0 0 0 0 0 0 0 0 0 0 1 35 36 109.2 0 0 0 0 0 0 0 0 0 0 0 0 36 37 115.3 0 1 0 0 0 0 0 0 0 0 0 0 37 38 119.2 0 0 1 0 0 0 0 0 0 0 0 0 38 39 107.8 0 0 0 1 0 0 0 0 0 0 0 0 39 40 106.8 0 0 0 0 1 0 0 0 0 0 0 0 40 41 104.2 0 0 0 0 0 1 0 0 0 0 0 0 41 42 94.8 0 0 0 0 0 0 1 0 0 0 0 0 42 43 97.5 0 0 0 0 0 0 0 1 0 0 0 0 43 44 98.3 0 0 0 0 0 0 0 0 1 0 0 0 44 45 100.6 0 0 0 0 0 0 0 0 0 1 0 0 45 46 94.9 1 0 0 0 0 0 0 0 0 0 1 0 46 47 93.6 1 0 0 0 0 0 0 0 0 0 0 1 47 48 98.0 1 0 0 0 0 0 0 0 0 0 0 0 48 49 104.3 1 1 0 0 0 0 0 0 0 0 0 0 49 50 103.9 1 0 1 0 0 0 0 0 0 0 0 0 50 51 105.3 1 0 0 1 0 0 0 0 0 0 0 0 51 52 102.6 1 0 0 0 1 0 0 0 0 0 0 0 52 53 103.3 1 0 0 0 0 1 0 0 0 0 0 0 53 54 107.9 1 0 0 0 0 0 1 0 0 0 0 0 54 55 107.8 1 0 0 0 0 0 0 1 0 0 0 0 55 56 109.8 1 0 0 0 0 0 0 0 1 0 0 0 56 57 110.6 1 0 0 0 0 0 0 0 0 1 0 0 57 58 110.8 1 0 0 0 0 0 0 0 0 0 1 0 58 59 119.3 1 0 0 0 0 0 0 0 0 0 0 1 59 60 128.1 1 0 0 0 0 0 0 0 0 0 0 0 60 61 127.6 1 1 0 0 0 0 0 0 0 0 0 0 61 62 137.9 1 0 1 0 0 0 0 0 0 0 0 0 62 63 151.4 1 0 0 1 0 0 0 0 0 0 0 0 63 64 143.6 1 0 0 0 1 0 0 0 0 0 0 0 64 65 143.4 1 0 0 0 0 1 0 0 0 0 0 0 65 66 141.9 1 0 0 0 0 0 1 0 0 0 0 0 66 67 135.2 1 0 0 0 0 0 0 1 0 0 0 0 67 68 133.1 1 0 0 0 0 0 0 0 1 0 0 0 68 69 129.6 1 0 0 0 0 0 0 0 0 1 0 0 69 70 134.1 1 0 0 0 0 0 0 0 0 0 1 0 70 71 136.8 1 0 0 0 0 0 0 0 0 0 0 1 71 72 143.5 1 0 0 0 0 0 0 0 0 0 0 0 72 73 162.5 1 1 0 0 0 0 0 0 0 0 0 0 73 74 163.1 1 0 1 0 0 0 0 0 0 0 0 0 74 75 157.2 1 0 0 1 0 0 0 0 0 0 0 0 75 76 158.8 1 0 0 0 1 0 0 0 0 0 0 0 76 77 155.4 1 0 0 0 0 1 0 0 0 0 0 0 77 78 148.5 1 0 0 0 0 0 1 0 0 0 0 0 78 79 154.2 1 0 0 0 0 0 0 1 0 0 0 0 79 80 153.3 1 0 0 0 0 0 0 0 1 0 0 0 80 81 149.4 1 0 0 0 0 0 0 0 0 1 0 0 81 82 147.9 1 0 0 0 0 0 0 0 0 0 1 0 82 83 156.0 1 0 0 0 0 0 0 0 0 0 0 1 83 84 163.0 1 0 0 0 0 0 0 0 0 0 0 0 84 85 159.1 1 1 0 0 0 0 0 0 0 0 0 0 85 86 159.5 1 0 1 0 0 0 0 0 0 0 0 0 86 87 157.3 1 0 0 1 0 0 0 0 0 0 0 0 87 88 156.4 1 0 0 0 1 0 0 0 0 0 0 0 88 89 156.6 1 0 0 0 0 1 0 0 0 0 0 0 89 90 162.4 1 0 0 0 0 0 1 0 0 0 0 0 90 91 166.8 1 0 0 0 0 0 0 1 0 0 0 0 91 92 162.6 1 0 0 0 0 0 0 0 1 0 0 0 92 93 168.1 1 0 0 0 0 0 0 0 0 1 0 0 93 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) uitvoersubsidie M1 M2 73.63069 -3.15231 7.93785 8.27953 M3 M4 M5 M6 6.95871 4.07540 2.80458 0.02126 M7 M8 M9 M10 0.22545 -1.82037 -1.76619 -3.76194 M11 t -2.98097 0.93332 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -21.5237 -10.0488 0.2519 9.7642 29.5981 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 73.63069 5.68879 12.943 < 2e-16 *** uitvoersubsidie -3.15231 5.58111 -0.565 0.574 M1 7.93785 6.84679 1.159 0.250 M2 8.27953 6.84494 1.210 0.230 M3 6.95871 6.84468 1.017 0.312 M4 4.07540 6.84600 0.595 0.553 M5 2.80458 6.84890 0.409 0.683 M6 0.02126 6.85338 0.003 0.998 M7 0.22545 6.85944 0.033 0.974 M8 -1.82037 6.86707 -0.265 0.792 M9 -1.76619 6.87626 -0.257 0.798 M10 -3.76194 7.06922 -0.532 0.596 M11 -2.98097 7.06692 -0.422 0.674 t 0.93332 0.10409 8.966 1.13e-13 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 13.22 on 79 degrees of freedom Multiple R-squared: 0.7921, Adjusted R-squared: 0.7579 F-statistic: 23.15 on 13 and 79 DF, p-value: < 2.2e-16 > postscript(file="/var/www/html/rcomp/tmp/1akl81227545718.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/2kwij1227545718.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/3ja3q1227545718.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/4afg81227545718.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/52ha11227545718.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 = 93 Frequency = 1 1 2 3 4 5 6 29.5981481 20.4231481 19.0106481 18.8606481 21.4981481 22.2481481 7 8 9 10 11 12 23.0106481 20.1231481 17.6356481 18.7980820 9.2837963 2.2695106 13 14 15 16 17 18 -1.9016534 -0.1766534 -2.7891534 -3.3391534 -0.6016534 -4.2516534 19 20 21 22 23 24 -8.7891534 -8.1766534 -11.6641534 -11.0017196 -6.8160053 -8.5302910 25 26 27 28 29 30 -16.6014550 -17.5764550 -10.8889550 -9.1389550 -10.9014550 -9.8514550 31 32 33 34 35 36 -6.3889550 -5.2764550 4.4360450 10.2984788 4.4841931 1.9699074 37 38 39 40 41 42 -0.8012566 1.8237434 -9.1887566 -8.2387566 -10.5012566 -18.0512566 43 44 45 46 47 48 -16.4887566 -14.5762566 -13.2637566 -14.7490079 -17.7632937 -17.2775794 49 50 51 52 53 54 -19.8487434 -21.5237434 -19.7362434 -20.4862434 -19.4487434 -12.9987434 55 56 57 58 59 60 -14.2362434 -11.1237434 -11.3112434 -10.0488095 -3.2630952 1.6226190 61 62 63 64 65 66 -7.7485450 1.2764550 15.1639550 9.3139550 9.4514550 9.8014550 67 68 69 70 71 72 1.9639550 0.9764550 -3.5110450 2.0513889 3.0371032 5.8228175 73 74 75 76 77 78 15.9516534 15.2766534 9.7641534 13.3141534 10.2516534 5.2016534 79 80 81 82 83 84 9.7641534 9.9766534 5.0891534 4.6515873 11.0373016 14.1230159 85 86 87 88 89 90 1.3518519 0.4768519 -1.3356481 -0.2856481 0.2518519 7.9018519 91 92 93 11.1643519 8.0768519 12.5893519 > postscript(file="/var/www/html/rcomp/tmp/6l6hq1227545718.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 = 93 Frequency = 1 lag(myerror, k = 1) myerror 0 29.5981481 NA 1 20.4231481 29.5981481 2 19.0106481 20.4231481 3 18.8606481 19.0106481 4 21.4981481 18.8606481 5 22.2481481 21.4981481 6 23.0106481 22.2481481 7 20.1231481 23.0106481 8 17.6356481 20.1231481 9 18.7980820 17.6356481 10 9.2837963 18.7980820 11 2.2695106 9.2837963 12 -1.9016534 2.2695106 13 -0.1766534 -1.9016534 14 -2.7891534 -0.1766534 15 -3.3391534 -2.7891534 16 -0.6016534 -3.3391534 17 -4.2516534 -0.6016534 18 -8.7891534 -4.2516534 19 -8.1766534 -8.7891534 20 -11.6641534 -8.1766534 21 -11.0017196 -11.6641534 22 -6.8160053 -11.0017196 23 -8.5302910 -6.8160053 24 -16.6014550 -8.5302910 25 -17.5764550 -16.6014550 26 -10.8889550 -17.5764550 27 -9.1389550 -10.8889550 28 -10.9014550 -9.1389550 29 -9.8514550 -10.9014550 30 -6.3889550 -9.8514550 31 -5.2764550 -6.3889550 32 4.4360450 -5.2764550 33 10.2984788 4.4360450 34 4.4841931 10.2984788 35 1.9699074 4.4841931 36 -0.8012566 1.9699074 37 1.8237434 -0.8012566 38 -9.1887566 1.8237434 39 -8.2387566 -9.1887566 40 -10.5012566 -8.2387566 41 -18.0512566 -10.5012566 42 -16.4887566 -18.0512566 43 -14.5762566 -16.4887566 44 -13.2637566 -14.5762566 45 -14.7490079 -13.2637566 46 -17.7632937 -14.7490079 47 -17.2775794 -17.7632937 48 -19.8487434 -17.2775794 49 -21.5237434 -19.8487434 50 -19.7362434 -21.5237434 51 -20.4862434 -19.7362434 52 -19.4487434 -20.4862434 53 -12.9987434 -19.4487434 54 -14.2362434 -12.9987434 55 -11.1237434 -14.2362434 56 -11.3112434 -11.1237434 57 -10.0488095 -11.3112434 58 -3.2630952 -10.0488095 59 1.6226190 -3.2630952 60 -7.7485450 1.6226190 61 1.2764550 -7.7485450 62 15.1639550 1.2764550 63 9.3139550 15.1639550 64 9.4514550 9.3139550 65 9.8014550 9.4514550 66 1.9639550 9.8014550 67 0.9764550 1.9639550 68 -3.5110450 0.9764550 69 2.0513889 -3.5110450 70 3.0371032 2.0513889 71 5.8228175 3.0371032 72 15.9516534 5.8228175 73 15.2766534 15.9516534 74 9.7641534 15.2766534 75 13.3141534 9.7641534 76 10.2516534 13.3141534 77 5.2016534 10.2516534 78 9.7641534 5.2016534 79 9.9766534 9.7641534 80 5.0891534 9.9766534 81 4.6515873 5.0891534 82 11.0373016 4.6515873 83 14.1230159 11.0373016 84 1.3518519 14.1230159 85 0.4768519 1.3518519 86 -1.3356481 0.4768519 87 -0.2856481 -1.3356481 88 0.2518519 -0.2856481 89 7.9018519 0.2518519 90 11.1643519 7.9018519 91 8.0768519 11.1643519 92 12.5893519 8.0768519 93 NA 12.5893519 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 20.4231481 29.5981481 [2,] 19.0106481 20.4231481 [3,] 18.8606481 19.0106481 [4,] 21.4981481 18.8606481 [5,] 22.2481481 21.4981481 [6,] 23.0106481 22.2481481 [7,] 20.1231481 23.0106481 [8,] 17.6356481 20.1231481 [9,] 18.7980820 17.6356481 [10,] 9.2837963 18.7980820 [11,] 2.2695106 9.2837963 [12,] -1.9016534 2.2695106 [13,] -0.1766534 -1.9016534 [14,] -2.7891534 -0.1766534 [15,] -3.3391534 -2.7891534 [16,] -0.6016534 -3.3391534 [17,] -4.2516534 -0.6016534 [18,] -8.7891534 -4.2516534 [19,] -8.1766534 -8.7891534 [20,] -11.6641534 -8.1766534 [21,] -11.0017196 -11.6641534 [22,] -6.8160053 -11.0017196 [23,] -8.5302910 -6.8160053 [24,] -16.6014550 -8.5302910 [25,] -17.5764550 -16.6014550 [26,] -10.8889550 -17.5764550 [27,] -9.1389550 -10.8889550 [28,] -10.9014550 -9.1389550 [29,] -9.8514550 -10.9014550 [30,] -6.3889550 -9.8514550 [31,] -5.2764550 -6.3889550 [32,] 4.4360450 -5.2764550 [33,] 10.2984788 4.4360450 [34,] 4.4841931 10.2984788 [35,] 1.9699074 4.4841931 [36,] -0.8012566 1.9699074 [37,] 1.8237434 -0.8012566 [38,] -9.1887566 1.8237434 [39,] -8.2387566 -9.1887566 [40,] -10.5012566 -8.2387566 [41,] -18.0512566 -10.5012566 [42,] -16.4887566 -18.0512566 [43,] -14.5762566 -16.4887566 [44,] -13.2637566 -14.5762566 [45,] -14.7490079 -13.2637566 [46,] -17.7632937 -14.7490079 [47,] -17.2775794 -17.7632937 [48,] -19.8487434 -17.2775794 [49,] -21.5237434 -19.8487434 [50,] -19.7362434 -21.5237434 [51,] -20.4862434 -19.7362434 [52,] -19.4487434 -20.4862434 [53,] -12.9987434 -19.4487434 [54,] -14.2362434 -12.9987434 [55,] -11.1237434 -14.2362434 [56,] -11.3112434 -11.1237434 [57,] -10.0488095 -11.3112434 [58,] -3.2630952 -10.0488095 [59,] 1.6226190 -3.2630952 [60,] -7.7485450 1.6226190 [61,] 1.2764550 -7.7485450 [62,] 15.1639550 1.2764550 [63,] 9.3139550 15.1639550 [64,] 9.4514550 9.3139550 [65,] 9.8014550 9.4514550 [66,] 1.9639550 9.8014550 [67,] 0.9764550 1.9639550 [68,] -3.5110450 0.9764550 [69,] 2.0513889 -3.5110450 [70,] 3.0371032 2.0513889 [71,] 5.8228175 3.0371032 [72,] 15.9516534 5.8228175 [73,] 15.2766534 15.9516534 [74,] 9.7641534 15.2766534 [75,] 13.3141534 9.7641534 [76,] 10.2516534 13.3141534 [77,] 5.2016534 10.2516534 [78,] 9.7641534 5.2016534 [79,] 9.9766534 9.7641534 [80,] 5.0891534 9.9766534 [81,] 4.6515873 5.0891534 [82,] 11.0373016 4.6515873 [83,] 14.1230159 11.0373016 [84,] 1.3518519 14.1230159 [85,] 0.4768519 1.3518519 [86,] -1.3356481 0.4768519 [87,] -0.2856481 -1.3356481 [88,] 0.2518519 -0.2856481 [89,] 7.9018519 0.2518519 [90,] 11.1643519 7.9018519 [91,] 8.0768519 11.1643519 [92,] 12.5893519 8.0768519 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 20.4231481 29.5981481 2 19.0106481 20.4231481 3 18.8606481 19.0106481 4 21.4981481 18.8606481 5 22.2481481 21.4981481 6 23.0106481 22.2481481 7 20.1231481 23.0106481 8 17.6356481 20.1231481 9 18.7980820 17.6356481 10 9.2837963 18.7980820 11 2.2695106 9.2837963 12 -1.9016534 2.2695106 13 -0.1766534 -1.9016534 14 -2.7891534 -0.1766534 15 -3.3391534 -2.7891534 16 -0.6016534 -3.3391534 17 -4.2516534 -0.6016534 18 -8.7891534 -4.2516534 19 -8.1766534 -8.7891534 20 -11.6641534 -8.1766534 21 -11.0017196 -11.6641534 22 -6.8160053 -11.0017196 23 -8.5302910 -6.8160053 24 -16.6014550 -8.5302910 25 -17.5764550 -16.6014550 26 -10.8889550 -17.5764550 27 -9.1389550 -10.8889550 28 -10.9014550 -9.1389550 29 -9.8514550 -10.9014550 30 -6.3889550 -9.8514550 31 -5.2764550 -6.3889550 32 4.4360450 -5.2764550 33 10.2984788 4.4360450 34 4.4841931 10.2984788 35 1.9699074 4.4841931 36 -0.8012566 1.9699074 37 1.8237434 -0.8012566 38 -9.1887566 1.8237434 39 -8.2387566 -9.1887566 40 -10.5012566 -8.2387566 41 -18.0512566 -10.5012566 42 -16.4887566 -18.0512566 43 -14.5762566 -16.4887566 44 -13.2637566 -14.5762566 45 -14.7490079 -13.2637566 46 -17.7632937 -14.7490079 47 -17.2775794 -17.7632937 48 -19.8487434 -17.2775794 49 -21.5237434 -19.8487434 50 -19.7362434 -21.5237434 51 -20.4862434 -19.7362434 52 -19.4487434 -20.4862434 53 -12.9987434 -19.4487434 54 -14.2362434 -12.9987434 55 -11.1237434 -14.2362434 56 -11.3112434 -11.1237434 57 -10.0488095 -11.3112434 58 -3.2630952 -10.0488095 59 1.6226190 -3.2630952 60 -7.7485450 1.6226190 61 1.2764550 -7.7485450 62 15.1639550 1.2764550 63 9.3139550 15.1639550 64 9.4514550 9.3139550 65 9.8014550 9.4514550 66 1.9639550 9.8014550 67 0.9764550 1.9639550 68 -3.5110450 0.9764550 69 2.0513889 -3.5110450 70 3.0371032 2.0513889 71 5.8228175 3.0371032 72 15.9516534 5.8228175 73 15.2766534 15.9516534 74 9.7641534 15.2766534 75 13.3141534 9.7641534 76 10.2516534 13.3141534 77 5.2016534 10.2516534 78 9.7641534 5.2016534 79 9.9766534 9.7641534 80 5.0891534 9.9766534 81 4.6515873 5.0891534 82 11.0373016 4.6515873 83 14.1230159 11.0373016 84 1.3518519 14.1230159 85 0.4768519 1.3518519 86 -1.3356481 0.4768519 87 -0.2856481 -1.3356481 88 0.2518519 -0.2856481 89 7.9018519 0.2518519 90 11.1643519 7.9018519 91 8.0768519 11.1643519 92 12.5893519 8.0768519 > 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/7cjrd1227545718.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/8tajv1227545718.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/9swk11227545718.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/100cc71227545718.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/114sua1227545718.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/12yau51227545718.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/13l1xa1227545718.tab") > > system("convert tmp/1akl81227545718.ps tmp/1akl81227545718.png") > system("convert tmp/2kwij1227545718.ps tmp/2kwij1227545718.png") > system("convert tmp/3ja3q1227545718.ps tmp/3ja3q1227545718.png") > system("convert tmp/4afg81227545718.ps tmp/4afg81227545718.png") > system("convert tmp/52ha11227545718.ps tmp/52ha11227545718.png") > system("convert tmp/6l6hq1227545718.ps tmp/6l6hq1227545718.png") > system("convert tmp/7cjrd1227545718.ps tmp/7cjrd1227545718.png") > system("convert tmp/8tajv1227545718.ps tmp/8tajv1227545718.png") > system("convert tmp/9swk11227545718.ps tmp/9swk11227545718.png") > > > proc.time() user system elapsed 2.031 1.449 2.411