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(102.3,0,105.8,0,106.7,0,109.6,0,111.9,0,113.3,0,114.6,0,115.7,0,117.3,0,119.8,0,120.6,0,121.4,0,123.5,0,125.2,0,126,0,126.8,0,128.1,0,128.2,0,129.3,0,130.6,0,131.4,0,131.1,0,131.2,0,131.2,0,131.5,0,133.5,0,133.7,0,133.5,0,134,0,135.9,0,135.9,0,137.2,0,138.4,0,140.9,0,143,0,144.1,0,146.8,0,149.1,0,149.6,0,151.2,0,153.3,0,156.9,0,157.2,0,158.5,0,160,0,162.5,0,162.9,0,164.7,0,165,0,167.2,0,168.6,0,169.5,0,169.8,0,171.9,0,172,0,173.7,0,173.9,0,175.9,0,175.6,0,176.1,0,176.3,0,179.4,0,179.7,0,179.9,0,180.4,0,182.5,0,183.6,0,183.9,0,184.5,0,187.6,0,188,0,188.5,0,188.6,0,191.9,0,193.5,0,194.9,0,194.9,0,196.2,0,196.2,0,198,0,198.6,0,201.3,0,203.5,0,204.1,0,204.8,1,206.5,1,207.8,1,208.6,1,209.7,1,210,1,211.7,1,212.4,1,213.7,1,214.8,1,216.4,1,217.5,1,218.6,1,220.4,1,221.8,1,222.5,1,223.4,1,225.5,1,226.5,1,227.8,1,228.5,1,229.1,1,229.9,1),dim=c(2,107),dimnames=list(c('Y','X'),1:107)) > y <- array(NA,dim=c(2,107),dimnames=list(c('Y','X'),1:107)) > 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 = 'No Linear Trend' > par2 = 'Do not include Seasonal 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 Y X 1 102.3 0 2 105.8 0 3 106.7 0 4 109.6 0 5 111.9 0 6 113.3 0 7 114.6 0 8 115.7 0 9 117.3 0 10 119.8 0 11 120.6 0 12 121.4 0 13 123.5 0 14 125.2 0 15 126.0 0 16 126.8 0 17 128.1 0 18 128.2 0 19 129.3 0 20 130.6 0 21 131.4 0 22 131.1 0 23 131.2 0 24 131.2 0 25 131.5 0 26 133.5 0 27 133.7 0 28 133.5 0 29 134.0 0 30 135.9 0 31 135.9 0 32 137.2 0 33 138.4 0 34 140.9 0 35 143.0 0 36 144.1 0 37 146.8 0 38 149.1 0 39 149.6 0 40 151.2 0 41 153.3 0 42 156.9 0 43 157.2 0 44 158.5 0 45 160.0 0 46 162.5 0 47 162.9 0 48 164.7 0 49 165.0 0 50 167.2 0 51 168.6 0 52 169.5 0 53 169.8 0 54 171.9 0 55 172.0 0 56 173.7 0 57 173.9 0 58 175.9 0 59 175.6 0 60 176.1 0 61 176.3 0 62 179.4 0 63 179.7 0 64 179.9 0 65 180.4 0 66 182.5 0 67 183.6 0 68 183.9 0 69 184.5 0 70 187.6 0 71 188.0 0 72 188.5 0 73 188.6 0 74 191.9 0 75 193.5 0 76 194.9 0 77 194.9 0 78 196.2 0 79 196.2 0 80 198.0 0 81 198.6 0 82 201.3 0 83 203.5 0 84 204.1 0 85 204.8 1 86 206.5 1 87 207.8 1 88 208.6 1 89 209.7 1 90 210.0 1 91 211.7 1 92 212.4 1 93 213.7 1 94 214.8 1 95 216.4 1 96 217.5 1 97 218.6 1 98 220.4 1 99 221.8 1 100 222.5 1 101 223.4 1 102 225.5 1 103 226.5 1 104 227.8 1 105 228.5 1 106 229.1 1 107 229.9 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 155.1 62.6 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -52.8321 -21.5321 0.8652 19.6179 48.9679 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 155.132 2.815 55.10 <2e-16 *** X 62.603 6.073 10.31 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 25.8 on 105 degrees of freedom Multiple R-squared: 0.503, Adjusted R-squared: 0.4983 F-statistic: 106.3 on 1 and 105 DF, p-value: < 2.2e-16 > postscript(file="/var/www/html/rcomp/tmp/15x4x1227563559.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/2y1n91227563559.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/343m61227563559.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/4kaqy1227563559.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/5e7y01227563559.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 = 107 Frequency = 1 1 2 3 4 5 6 -52.8321429 -49.3321429 -48.4321429 -45.5321429 -43.2321429 -41.8321429 7 8 9 10 11 12 -40.5321429 -39.4321429 -37.8321429 -35.3321429 -34.5321429 -33.7321429 13 14 15 16 17 18 -31.6321429 -29.9321429 -29.1321429 -28.3321429 -27.0321429 -26.9321429 19 20 21 22 23 24 -25.8321429 -24.5321429 -23.7321429 -24.0321429 -23.9321429 -23.9321429 25 26 27 28 29 30 -23.6321429 -21.6321429 -21.4321429 -21.6321429 -21.1321429 -19.2321429 31 32 33 34 35 36 -19.2321429 -17.9321429 -16.7321429 -14.2321429 -12.1321429 -11.0321429 37 38 39 40 41 42 -8.3321429 -6.0321429 -5.5321429 -3.9321429 -1.8321429 1.7678571 43 44 45 46 47 48 2.0678571 3.3678571 4.8678571 7.3678571 7.7678571 9.5678571 49 50 51 52 53 54 9.8678571 12.0678571 13.4678571 14.3678571 14.6678571 16.7678571 55 56 57 58 59 60 16.8678571 18.5678571 18.7678571 20.7678571 20.4678571 20.9678571 61 62 63 64 65 66 21.1678571 24.2678571 24.5678571 24.7678571 25.2678571 27.3678571 67 68 69 70 71 72 28.4678571 28.7678571 29.3678571 32.4678571 32.8678571 33.3678571 73 74 75 76 77 78 33.4678571 36.7678571 38.3678571 39.7678571 39.7678571 41.0678571 79 80 81 82 83 84 41.0678571 42.8678571 43.4678571 46.1678571 48.3678571 48.9678571 85 86 87 88 89 90 -12.9347826 -11.2347826 -9.9347826 -9.1347826 -8.0347826 -7.7347826 91 92 93 94 95 96 -6.0347826 -5.3347826 -4.0347826 -2.9347826 -1.3347826 -0.2347826 97 98 99 100 101 102 0.8652174 2.6652174 4.0652174 4.7652174 5.6652174 7.7652174 103 104 105 106 107 8.7652174 10.0652174 10.7652174 11.3652174 12.1652174 > postscript(file="/var/www/html/rcomp/tmp/6lp561227563559.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 = 107 Frequency = 1 lag(myerror, k = 1) myerror 0 -52.8321429 NA 1 -49.3321429 -52.8321429 2 -48.4321429 -49.3321429 3 -45.5321429 -48.4321429 4 -43.2321429 -45.5321429 5 -41.8321429 -43.2321429 6 -40.5321429 -41.8321429 7 -39.4321429 -40.5321429 8 -37.8321429 -39.4321429 9 -35.3321429 -37.8321429 10 -34.5321429 -35.3321429 11 -33.7321429 -34.5321429 12 -31.6321429 -33.7321429 13 -29.9321429 -31.6321429 14 -29.1321429 -29.9321429 15 -28.3321429 -29.1321429 16 -27.0321429 -28.3321429 17 -26.9321429 -27.0321429 18 -25.8321429 -26.9321429 19 -24.5321429 -25.8321429 20 -23.7321429 -24.5321429 21 -24.0321429 -23.7321429 22 -23.9321429 -24.0321429 23 -23.9321429 -23.9321429 24 -23.6321429 -23.9321429 25 -21.6321429 -23.6321429 26 -21.4321429 -21.6321429 27 -21.6321429 -21.4321429 28 -21.1321429 -21.6321429 29 -19.2321429 -21.1321429 30 -19.2321429 -19.2321429 31 -17.9321429 -19.2321429 32 -16.7321429 -17.9321429 33 -14.2321429 -16.7321429 34 -12.1321429 -14.2321429 35 -11.0321429 -12.1321429 36 -8.3321429 -11.0321429 37 -6.0321429 -8.3321429 38 -5.5321429 -6.0321429 39 -3.9321429 -5.5321429 40 -1.8321429 -3.9321429 41 1.7678571 -1.8321429 42 2.0678571 1.7678571 43 3.3678571 2.0678571 44 4.8678571 3.3678571 45 7.3678571 4.8678571 46 7.7678571 7.3678571 47 9.5678571 7.7678571 48 9.8678571 9.5678571 49 12.0678571 9.8678571 50 13.4678571 12.0678571 51 14.3678571 13.4678571 52 14.6678571 14.3678571 53 16.7678571 14.6678571 54 16.8678571 16.7678571 55 18.5678571 16.8678571 56 18.7678571 18.5678571 57 20.7678571 18.7678571 58 20.4678571 20.7678571 59 20.9678571 20.4678571 60 21.1678571 20.9678571 61 24.2678571 21.1678571 62 24.5678571 24.2678571 63 24.7678571 24.5678571 64 25.2678571 24.7678571 65 27.3678571 25.2678571 66 28.4678571 27.3678571 67 28.7678571 28.4678571 68 29.3678571 28.7678571 69 32.4678571 29.3678571 70 32.8678571 32.4678571 71 33.3678571 32.8678571 72 33.4678571 33.3678571 73 36.7678571 33.4678571 74 38.3678571 36.7678571 75 39.7678571 38.3678571 76 39.7678571 39.7678571 77 41.0678571 39.7678571 78 41.0678571 41.0678571 79 42.8678571 41.0678571 80 43.4678571 42.8678571 81 46.1678571 43.4678571 82 48.3678571 46.1678571 83 48.9678571 48.3678571 84 -12.9347826 48.9678571 85 -11.2347826 -12.9347826 86 -9.9347826 -11.2347826 87 -9.1347826 -9.9347826 88 -8.0347826 -9.1347826 89 -7.7347826 -8.0347826 90 -6.0347826 -7.7347826 91 -5.3347826 -6.0347826 92 -4.0347826 -5.3347826 93 -2.9347826 -4.0347826 94 -1.3347826 -2.9347826 95 -0.2347826 -1.3347826 96 0.8652174 -0.2347826 97 2.6652174 0.8652174 98 4.0652174 2.6652174 99 4.7652174 4.0652174 100 5.6652174 4.7652174 101 7.7652174 5.6652174 102 8.7652174 7.7652174 103 10.0652174 8.7652174 104 10.7652174 10.0652174 105 11.3652174 10.7652174 106 12.1652174 11.3652174 107 NA 12.1652174 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -49.3321429 -52.8321429 [2,] -48.4321429 -49.3321429 [3,] -45.5321429 -48.4321429 [4,] -43.2321429 -45.5321429 [5,] -41.8321429 -43.2321429 [6,] -40.5321429 -41.8321429 [7,] -39.4321429 -40.5321429 [8,] -37.8321429 -39.4321429 [9,] -35.3321429 -37.8321429 [10,] -34.5321429 -35.3321429 [11,] -33.7321429 -34.5321429 [12,] -31.6321429 -33.7321429 [13,] -29.9321429 -31.6321429 [14,] -29.1321429 -29.9321429 [15,] -28.3321429 -29.1321429 [16,] -27.0321429 -28.3321429 [17,] -26.9321429 -27.0321429 [18,] -25.8321429 -26.9321429 [19,] -24.5321429 -25.8321429 [20,] -23.7321429 -24.5321429 [21,] -24.0321429 -23.7321429 [22,] -23.9321429 -24.0321429 [23,] -23.9321429 -23.9321429 [24,] -23.6321429 -23.9321429 [25,] -21.6321429 -23.6321429 [26,] -21.4321429 -21.6321429 [27,] -21.6321429 -21.4321429 [28,] -21.1321429 -21.6321429 [29,] -19.2321429 -21.1321429 [30,] -19.2321429 -19.2321429 [31,] -17.9321429 -19.2321429 [32,] -16.7321429 -17.9321429 [33,] -14.2321429 -16.7321429 [34,] -12.1321429 -14.2321429 [35,] -11.0321429 -12.1321429 [36,] -8.3321429 -11.0321429 [37,] -6.0321429 -8.3321429 [38,] -5.5321429 -6.0321429 [39,] -3.9321429 -5.5321429 [40,] -1.8321429 -3.9321429 [41,] 1.7678571 -1.8321429 [42,] 2.0678571 1.7678571 [43,] 3.3678571 2.0678571 [44,] 4.8678571 3.3678571 [45,] 7.3678571 4.8678571 [46,] 7.7678571 7.3678571 [47,] 9.5678571 7.7678571 [48,] 9.8678571 9.5678571 [49,] 12.0678571 9.8678571 [50,] 13.4678571 12.0678571 [51,] 14.3678571 13.4678571 [52,] 14.6678571 14.3678571 [53,] 16.7678571 14.6678571 [54,] 16.8678571 16.7678571 [55,] 18.5678571 16.8678571 [56,] 18.7678571 18.5678571 [57,] 20.7678571 18.7678571 [58,] 20.4678571 20.7678571 [59,] 20.9678571 20.4678571 [60,] 21.1678571 20.9678571 [61,] 24.2678571 21.1678571 [62,] 24.5678571 24.2678571 [63,] 24.7678571 24.5678571 [64,] 25.2678571 24.7678571 [65,] 27.3678571 25.2678571 [66,] 28.4678571 27.3678571 [67,] 28.7678571 28.4678571 [68,] 29.3678571 28.7678571 [69,] 32.4678571 29.3678571 [70,] 32.8678571 32.4678571 [71,] 33.3678571 32.8678571 [72,] 33.4678571 33.3678571 [73,] 36.7678571 33.4678571 [74,] 38.3678571 36.7678571 [75,] 39.7678571 38.3678571 [76,] 39.7678571 39.7678571 [77,] 41.0678571 39.7678571 [78,] 41.0678571 41.0678571 [79,] 42.8678571 41.0678571 [80,] 43.4678571 42.8678571 [81,] 46.1678571 43.4678571 [82,] 48.3678571 46.1678571 [83,] 48.9678571 48.3678571 [84,] -12.9347826 48.9678571 [85,] -11.2347826 -12.9347826 [86,] -9.9347826 -11.2347826 [87,] -9.1347826 -9.9347826 [88,] -8.0347826 -9.1347826 [89,] -7.7347826 -8.0347826 [90,] -6.0347826 -7.7347826 [91,] -5.3347826 -6.0347826 [92,] -4.0347826 -5.3347826 [93,] -2.9347826 -4.0347826 [94,] -1.3347826 -2.9347826 [95,] -0.2347826 -1.3347826 [96,] 0.8652174 -0.2347826 [97,] 2.6652174 0.8652174 [98,] 4.0652174 2.6652174 [99,] 4.7652174 4.0652174 [100,] 5.6652174 4.7652174 [101,] 7.7652174 5.6652174 [102,] 8.7652174 7.7652174 [103,] 10.0652174 8.7652174 [104,] 10.7652174 10.0652174 [105,] 11.3652174 10.7652174 [106,] 12.1652174 11.3652174 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -49.3321429 -52.8321429 2 -48.4321429 -49.3321429 3 -45.5321429 -48.4321429 4 -43.2321429 -45.5321429 5 -41.8321429 -43.2321429 6 -40.5321429 -41.8321429 7 -39.4321429 -40.5321429 8 -37.8321429 -39.4321429 9 -35.3321429 -37.8321429 10 -34.5321429 -35.3321429 11 -33.7321429 -34.5321429 12 -31.6321429 -33.7321429 13 -29.9321429 -31.6321429 14 -29.1321429 -29.9321429 15 -28.3321429 -29.1321429 16 -27.0321429 -28.3321429 17 -26.9321429 -27.0321429 18 -25.8321429 -26.9321429 19 -24.5321429 -25.8321429 20 -23.7321429 -24.5321429 21 -24.0321429 -23.7321429 22 -23.9321429 -24.0321429 23 -23.9321429 -23.9321429 24 -23.6321429 -23.9321429 25 -21.6321429 -23.6321429 26 -21.4321429 -21.6321429 27 -21.6321429 -21.4321429 28 -21.1321429 -21.6321429 29 -19.2321429 -21.1321429 30 -19.2321429 -19.2321429 31 -17.9321429 -19.2321429 32 -16.7321429 -17.9321429 33 -14.2321429 -16.7321429 34 -12.1321429 -14.2321429 35 -11.0321429 -12.1321429 36 -8.3321429 -11.0321429 37 -6.0321429 -8.3321429 38 -5.5321429 -6.0321429 39 -3.9321429 -5.5321429 40 -1.8321429 -3.9321429 41 1.7678571 -1.8321429 42 2.0678571 1.7678571 43 3.3678571 2.0678571 44 4.8678571 3.3678571 45 7.3678571 4.8678571 46 7.7678571 7.3678571 47 9.5678571 7.7678571 48 9.8678571 9.5678571 49 12.0678571 9.8678571 50 13.4678571 12.0678571 51 14.3678571 13.4678571 52 14.6678571 14.3678571 53 16.7678571 14.6678571 54 16.8678571 16.7678571 55 18.5678571 16.8678571 56 18.7678571 18.5678571 57 20.7678571 18.7678571 58 20.4678571 20.7678571 59 20.9678571 20.4678571 60 21.1678571 20.9678571 61 24.2678571 21.1678571 62 24.5678571 24.2678571 63 24.7678571 24.5678571 64 25.2678571 24.7678571 65 27.3678571 25.2678571 66 28.4678571 27.3678571 67 28.7678571 28.4678571 68 29.3678571 28.7678571 69 32.4678571 29.3678571 70 32.8678571 32.4678571 71 33.3678571 32.8678571 72 33.4678571 33.3678571 73 36.7678571 33.4678571 74 38.3678571 36.7678571 75 39.7678571 38.3678571 76 39.7678571 39.7678571 77 41.0678571 39.7678571 78 41.0678571 41.0678571 79 42.8678571 41.0678571 80 43.4678571 42.8678571 81 46.1678571 43.4678571 82 48.3678571 46.1678571 83 48.9678571 48.3678571 84 -12.9347826 48.9678571 85 -11.2347826 -12.9347826 86 -9.9347826 -11.2347826 87 -9.1347826 -9.9347826 88 -8.0347826 -9.1347826 89 -7.7347826 -8.0347826 90 -6.0347826 -7.7347826 91 -5.3347826 -6.0347826 92 -4.0347826 -5.3347826 93 -2.9347826 -4.0347826 94 -1.3347826 -2.9347826 95 -0.2347826 -1.3347826 96 0.8652174 -0.2347826 97 2.6652174 0.8652174 98 4.0652174 2.6652174 99 4.7652174 4.0652174 100 5.6652174 4.7652174 101 7.7652174 5.6652174 102 8.7652174 7.7652174 103 10.0652174 8.7652174 104 10.7652174 10.0652174 105 11.3652174 10.7652174 106 12.1652174 11.3652174 > 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/7a4j71227563559.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/8zomk1227563559.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/9orxb1227563559.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/10fviu1227563559.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/11wfhk1227563559.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/12v84z1227563560.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/135sx61227563560.tab") > > system("convert tmp/15x4x1227563559.ps tmp/15x4x1227563559.png") > system("convert tmp/2y1n91227563559.ps tmp/2y1n91227563559.png") > system("convert tmp/343m61227563559.ps tmp/343m61227563559.png") > system("convert tmp/4kaqy1227563559.ps tmp/4kaqy1227563559.png") > system("convert tmp/5e7y01227563559.ps tmp/5e7y01227563559.png") > system("convert tmp/6lp561227563559.ps tmp/6lp561227563559.png") > system("convert tmp/7a4j71227563559.ps tmp/7a4j71227563559.png") > system("convert tmp/8zomk1227563559.ps tmp/8zomk1227563559.png") > system("convert tmp/9orxb1227563559.ps tmp/9orxb1227563559.png") > > > proc.time() user system elapsed 2.014 1.438 2.732