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. > x <- array(list(103.7 + ,114813 + ,116476 + ,106370 + ,106.2 + ,117925 + ,123297 + ,109375 + ,107.7 + ,126466 + ,114813 + ,116476 + ,109.9 + ,131235 + ,117925 + ,123297 + ,111.7 + ,120546 + ,126466 + ,114813 + ,114.9 + ,123791 + ,131235 + ,117925 + ,116 + ,129813 + ,120546 + ,126466 + ,118.3 + ,133463 + ,123791 + ,131235 + ,120.4 + ,122987 + ,129813 + ,120546 + ,126 + ,125418 + ,133463 + ,123791 + ,128.1 + ,130199 + ,122987 + ,129813 + ,130.1 + ,133016 + ,125418 + ,133463 + ,130.8 + ,121454 + ,130199 + ,122987 + ,133.6 + ,122044 + ,133016 + ,125418 + ,134.2 + ,128313 + ,121454 + ,130199 + ,135.5 + ,131556 + ,122044 + ,133016 + ,136.2 + ,120027 + ,128313 + ,121454 + ,139.1 + ,123001 + ,131556 + ,122044 + ,139 + ,130111 + ,120027 + ,128313 + ,139.6 + ,132524 + ,123001 + ,131556 + ,138.7 + ,123742 + ,130111 + ,120027 + ,140.9 + ,124931 + ,132524 + ,123001 + ,141.3 + ,133646 + ,123742 + ,130111 + ,141.8 + ,136557 + ,124931 + ,132524 + ,142 + ,127509 + ,133646 + ,123742 + ,144.5 + ,128945 + ,136557 + ,124931 + ,144.6 + ,137191 + ,127509 + ,133646 + ,145.5 + ,139716 + ,128945 + ,136557 + ,146.8 + ,129083 + ,137191 + ,127509 + ,149.5 + ,131604 + ,139716 + ,128945 + ,149.9 + ,139413 + ,129083 + ,137191 + ,150.1 + ,143125 + ,131604 + ,139716 + ,150.9 + ,133948 + ,139413 + ,129083 + ,152.8 + ,137116 + ,143125 + ,131604 + ,153.1 + ,144864 + ,133948 + ,139413 + ,154 + ,149277 + ,137116 + ,143125 + ,154.9 + ,138796 + ,144864 + ,133948 + ,156.9 + ,143258 + ,149277 + ,137116 + ,158.4 + ,150034 + ,138796 + ,144864 + ,159.7 + ,154708 + ,143258 + ,149277 + ,160.2 + ,144888 + ,150034 + ,138796 + ,163.2 + ,148762 + ,154708 + ,143258 + ,163.7 + ,156500 + ,144888 + ,150034 + ,164.4 + ,161088 + ,148762 + ,154708 + ,163.7 + ,152772 + ,156500 + ,144888 + ,165.5 + ,158011 + ,161088 + ,148762 + ,165.6 + ,163318 + ,152772 + ,156500 + ,166.8 + ,169969 + ,158011 + ,161088 + ,167.5 + ,162269 + ,163318 + ,152772 + ,170.6 + ,165765 + ,169969 + ,158011 + ,170.9 + ,170600 + ,162269 + ,163318 + ,172 + ,174681 + ,165765 + ,169969 + ,171.8 + ,166364 + ,170600 + ,162269 + ,173.9 + ,170240 + ,174681 + ,165765 + ,174 + ,176150 + ,166364 + ,170600 + ,173.8 + ,182056 + ,170240 + ,174681 + ,173.9 + ,172218 + ,176150 + ,166364 + ,176 + ,177856 + ,182056 + ,170240 + ,176.6 + ,182253 + ,172218 + ,176150 + ,178.2 + ,188090 + ,177856 + ,182056 + ,179.2 + ,176863 + ,182253 + ,172218 + ,181.3 + ,183273 + ,188090 + ,177856 + ,181.8 + ,187969 + ,176863 + ,182253 + ,182.9 + ,194650 + ,183273 + ,188090 + ,183.8 + ,183036 + ,187969 + ,176863 + ,186.3 + ,189516 + ,194650 + ,183273 + ,187.4 + ,193805 + ,183036 + ,187969 + ,189.2 + ,200499 + ,189516 + ,194650 + ,189.7 + ,188142 + ,193805 + ,183036 + ,191.9 + ,193732 + ,200499 + ,189516 + ,192.6 + ,197126 + ,188142 + ,193805 + ,193.7 + ,205140 + ,193732 + ,200499 + ,194.2 + ,191751 + ,197126 + ,188142 + ,197.6 + ,196700 + ,205140 + ,193732 + ,199.3 + ,199784 + ,191751 + ,197126 + ,201.4 + ,207360 + ,196700 + ,205140 + ,203 + ,196101 + ,199784 + ,191751 + ,206.3 + ,200824 + ,207360 + ,196700 + ,207.1 + ,205743 + ,196101 + ,199784 + ,209.8 + ,212489 + ,200824 + ,207360 + ,211.1 + ,200810 + ,205743 + ,196101 + ,215.3 + ,203683 + ,212489 + ,200824 + ,217.4 + ,207286 + ,200810 + ,205743 + ,215.5 + ,210910 + ,203683 + ,212489 + ,210.9 + ,194915 + ,207286 + ,200810 + ,212.6 + ,217920 + ,210910 + ,203683) + ,dim=c(4 + ,86) + ,dimnames=list(c('RPI' + ,'HFCE' + ,'HFCE-2' + ,'HFCE-4') + ,1:86)) > y <- array(NA,dim=c(4,86),dimnames=list(c('RPI','HFCE','HFCE-2','HFCE-4'),1:86)) > 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 Quarterly Dummies' > par1 = '2' > #'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) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > 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 HFCE RPI HFCE-2 HFCE-4 Q1 Q2 Q3 t 1 114813 103.7 116476 106370 1 0 0 1 2 117925 106.2 123297 109375 0 1 0 2 3 126466 107.7 114813 116476 0 0 1 3 4 131235 109.9 117925 123297 0 0 0 4 5 120546 111.7 126466 114813 1 0 0 5 6 123791 114.9 131235 117925 0 1 0 6 7 129813 116.0 120546 126466 0 0 1 7 8 133463 118.3 123791 131235 0 0 0 8 9 122987 120.4 129813 120546 1 0 0 9 10 125418 126.0 133463 123791 0 1 0 10 11 130199 128.1 122987 129813 0 0 1 11 12 133016 130.1 125418 133463 0 0 0 12 13 121454 130.8 130199 122987 1 0 0 13 14 122044 133.6 133016 125418 0 1 0 14 15 128313 134.2 121454 130199 0 0 1 15 16 131556 135.5 122044 133016 0 0 0 16 17 120027 136.2 128313 121454 1 0 0 17 18 123001 139.1 131556 122044 0 1 0 18 19 130111 139.0 120027 128313 0 0 1 19 20 132524 139.6 123001 131556 0 0 0 20 21 123742 138.7 130111 120027 1 0 0 21 22 124931 140.9 132524 123001 0 1 0 22 23 133646 141.3 123742 130111 0 0 1 23 24 136557 141.8 124931 132524 0 0 0 24 25 127509 142.0 133646 123742 1 0 0 25 26 128945 144.5 136557 124931 0 1 0 26 27 137191 144.6 127509 133646 0 0 1 27 28 139716 145.5 128945 136557 0 0 0 28 29 129083 146.8 137191 127509 1 0 0 29 30 131604 149.5 139716 128945 0 1 0 30 31 139413 149.9 129083 137191 0 0 1 31 32 143125 150.1 131604 139716 0 0 0 32 33 133948 150.9 139413 129083 1 0 0 33 34 137116 152.8 143125 131604 0 1 0 34 35 144864 153.1 133948 139413 0 0 1 35 36 149277 154.0 137116 143125 0 0 0 36 37 138796 154.9 144864 133948 1 0 0 37 38 143258 156.9 149277 137116 0 1 0 38 39 150034 158.4 138796 144864 0 0 1 39 40 154708 159.7 143258 149277 0 0 0 40 41 144888 160.2 150034 138796 1 0 0 41 42 148762 163.2 154708 143258 0 1 0 42 43 156500 163.7 144888 150034 0 0 1 43 44 161088 164.4 148762 154708 0 0 0 44 45 152772 163.7 156500 144888 1 0 0 45 46 158011 165.5 161088 148762 0 1 0 46 47 163318 165.6 152772 156500 0 0 1 47 48 169969 166.8 158011 161088 0 0 0 48 49 162269 167.5 163318 152772 1 0 0 49 50 165765 170.6 169969 158011 0 1 0 50 51 170600 170.9 162269 163318 0 0 1 51 52 174681 172.0 165765 169969 0 0 0 52 53 166364 171.8 170600 162269 1 0 0 53 54 170240 173.9 174681 165765 0 1 0 54 55 176150 174.0 166364 170600 0 0 1 55 56 182056 173.8 170240 174681 0 0 0 56 57 172218 173.9 176150 166364 1 0 0 57 58 177856 176.0 182056 170240 0 1 0 58 59 182253 176.6 172218 176150 0 0 1 59 60 188090 178.2 177856 182056 0 0 0 60 61 176863 179.2 182253 172218 1 0 0 61 62 183273 181.3 188090 177856 0 1 0 62 63 187969 181.8 176863 182253 0 0 1 63 64 194650 182.9 183273 188090 0 0 0 64 65 183036 183.8 187969 176863 1 0 0 65 66 189516 186.3 194650 183273 0 1 0 66 67 193805 187.4 183036 187969 0 0 1 67 68 200499 189.2 189516 194650 0 0 0 68 69 188142 189.7 193805 183036 1 0 0 69 70 193732 191.9 200499 189516 0 1 0 70 71 197126 192.6 188142 193805 0 0 1 71 72 205140 193.7 193732 200499 0 0 0 72 73 191751 194.2 197126 188142 1 0 0 73 74 196700 197.6 205140 193732 0 1 0 74 75 199784 199.3 191751 197126 0 0 1 75 76 207360 201.4 196700 205140 0 0 0 76 77 196101 203.0 199784 191751 1 0 0 77 78 200824 206.3 207360 196700 0 1 0 78 79 205743 207.1 196101 199784 0 0 1 79 80 212489 209.8 200824 207360 0 0 0 80 81 200810 211.1 205743 196101 1 0 0 81 82 203683 215.3 212489 200824 0 1 0 82 83 207286 217.4 200810 205743 0 0 1 83 84 210910 215.5 203683 212489 0 0 0 84 85 194915 210.9 207286 200810 1 0 0 85 86 217920 212.6 210910 203683 0 1 0 86 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) RPI `HFCE-2` `HFCE-4` Q1 Q2 7.469e+04 -4.430e+02 6.304e-01 2.113e-01 -1.264e+04 -1.144e+04 Q3 t -1.206e+03 7.203e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8037.50 -687.43 -74.97 493.19 10906.41 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.469e+04 1.068e+04 6.992 8.18e-10 *** RPI -4.430e+02 7.924e+01 -5.590 3.21e-07 *** `HFCE-2` 6.304e-01 1.591e-01 3.963 0.000163 *** `HFCE-4` 2.113e-01 1.497e-01 1.412 0.161906 Q1 -1.264e+04 2.487e+03 -5.082 2.50e-06 *** Q2 -1.144e+04 2.762e+03 -4.141 8.69e-05 *** Q3 -1.206e+03 6.451e+02 -1.870 0.065233 . t 7.203e+02 1.195e+02 6.030 5.15e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1980 on 78 degrees of freedom Multiple R-squared: 0.9961, Adjusted R-squared: 0.9957 F-statistic: 2839 on 7 and 78 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 1.130732e-01 2.261464e-01 0.8869268 [2,] 5.795077e-02 1.159015e-01 0.9420492 [3,] 2.234121e-02 4.468243e-02 0.9776588 [4,] 8.110494e-03 1.622099e-02 0.9918895 [5,] 4.776054e-03 9.552108e-03 0.9952239 [6,] 4.605243e-03 9.210487e-03 0.9953948 [7,] 1.767116e-03 3.534232e-03 0.9982329 [8,] 1.536827e-03 3.073654e-03 0.9984632 [9,] 2.401440e-03 4.802880e-03 0.9975986 [10,] 1.163058e-03 2.326115e-03 0.9988369 [11,] 5.169123e-04 1.033825e-03 0.9994831 [12,] 1.966164e-04 3.932329e-04 0.9998034 [13,] 9.333852e-05 1.866770e-04 0.9999067 [14,] 3.859547e-05 7.719095e-05 0.9999614 [15,] 1.514036e-05 3.028073e-05 0.9999849 [16,] 5.600477e-06 1.120095e-05 0.9999944 [17,] 2.048700e-06 4.097400e-06 0.9999980 [18,] 7.457126e-07 1.491425e-06 0.9999993 [19,] 8.018485e-07 1.603697e-06 0.9999992 [20,] 3.187968e-07 6.375936e-07 0.9999997 [21,] 1.720741e-07 3.441483e-07 0.9999998 [22,] 6.608894e-08 1.321779e-07 0.9999999 [23,] 4.571071e-08 9.142142e-08 1.0000000 [24,] 6.276423e-08 1.255285e-07 0.9999999 [25,] 3.185021e-08 6.370041e-08 1.0000000 [26,] 1.986177e-08 3.972353e-08 1.0000000 [27,] 7.099739e-09 1.419948e-08 1.0000000 [28,] 9.932074e-09 1.986415e-08 1.0000000 [29,] 7.405151e-09 1.481030e-08 1.0000000 [30,] 3.568153e-09 7.136307e-09 1.0000000 [31,] 2.452216e-09 4.904433e-09 1.0000000 [32,] 4.968532e-09 9.937064e-09 1.0000000 [33,] 5.151191e-09 1.030238e-08 1.0000000 [34,] 3.045044e-09 6.090087e-09 1.0000000 [35,] 2.593645e-09 5.187291e-09 1.0000000 [36,] 1.341144e-08 2.682289e-08 1.0000000 [37,] 1.130395e-08 2.260789e-08 1.0000000 [38,] 4.608775e-09 9.217550e-09 1.0000000 [39,] 5.686759e-08 1.137352e-07 0.9999999 [40,] 2.498363e-08 4.996726e-08 1.0000000 [41,] 4.597455e-08 9.194910e-08 1.0000000 [42,] 2.549432e-07 5.098863e-07 0.9999997 [43,] 2.334478e-07 4.668957e-07 0.9999998 [44,] 1.013211e-07 2.026423e-07 0.9999999 [45,] 8.868849e-08 1.773770e-07 0.9999999 [46,] 5.844070e-08 1.168814e-07 0.9999999 [47,] 3.067953e-08 6.135905e-08 1.0000000 [48,] 1.620515e-08 3.241030e-08 1.0000000 [49,] 1.787343e-08 3.574686e-08 1.0000000 [50,] 4.335180e-08 8.670361e-08 1.0000000 [51,] 2.483335e-08 4.966670e-08 1.0000000 [52,] 1.536082e-08 3.072164e-08 1.0000000 [53,] 7.924092e-09 1.584818e-08 1.0000000 [54,] 1.480507e-08 2.961014e-08 1.0000000 [55,] 1.713909e-08 3.427819e-08 1.0000000 [56,] 8.342032e-08 1.668406e-07 0.9999999 [57,] 1.328835e-07 2.657669e-07 0.9999999 [58,] 2.966587e-07 5.933175e-07 0.9999997 [59,] 3.372986e-07 6.745972e-07 0.9999997 [60,] 1.649247e-07 3.298494e-07 0.9999998 [61,] 7.740949e-08 1.548190e-07 0.9999999 [62,] 5.635565e-08 1.127113e-07 0.9999999 [63,] 1.772011e-08 3.544022e-08 1.0000000 [64,] 2.759845e-08 5.519691e-08 1.0000000 [65,] 9.433913e-09 1.886783e-08 1.0000000 > postscript(file="/var/www/html/rcomp/tmp/1nywu1259169675.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/292eq1259169675.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/3klty1259169675.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/4hy5f1259169675.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/5j0x01259169675.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 86 Frequency = 1 1 2 3 4 5 6 2077.76595 -560.14490 1542.19678 1955.83749 391.82690 -532.07319 7 8 9 10 11 12 -40.26005 -351.50900 484.28225 486.82866 578.69919 51.16224 13 14 15 16 17 18 -81.93906 -2463.61917 -601.37213 323.56624 -485.03075 -317.89205 19 20 21 22 23 24 1740.00262 -67.99475 624.51274 -1284.03817 690.97180 637.30491 25 26 27 28 29 30 -41.18872 -1506.54579 -304.93757 -828.35722 -2252.70743 -2353.34090 31 32 33 34 35 36 -357.57481 -606.46874 -185.87556 -971.44878 93.54120 197.03130 37 38 39 40 41 42 -911.32272 -937.22361 522.25041 100.08225 363.83781 -245.07066 43 44 45 46 47 48 1522.15419 1063.70017 1553.76191 1956.74819 -35.60905 948.13812 49 50 51 52 53 54 3888.98232 1535.91145 -714.41475 -1682.19487 410.32185 -17.31205 55 56 57 58 59 60 -792.54368 -207.62436 -50.47674 53.14454 -1281.97238 -1465.08715 61 62 63 64 65 66 -1023.05783 -476.30654 -361.38305 -394.05926 -278.27179 -179.51343 67 68 69 70 71 72 -25.03167 42.89063 -423.16652 -1370.29142 -1733.62085 -97.49861 73 74 75 76 77 78 -874.34866 -2574.90620 -1965.56059 -199.34009 2054.60316 495.31603 79 80 81 82 83 84 1263.78496 2700.82425 2794.99369 355.36622 260.67944 -2120.40353 85 86 -8037.50278 10906.41177 > postscript(file="/var/www/html/rcomp/tmp/6ankb1259169675.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 = 86 Frequency = 1 lag(myerror, k = 1) myerror 0 2077.76595 NA 1 -560.14490 2077.76595 2 1542.19678 -560.14490 3 1955.83749 1542.19678 4 391.82690 1955.83749 5 -532.07319 391.82690 6 -40.26005 -532.07319 7 -351.50900 -40.26005 8 484.28225 -351.50900 9 486.82866 484.28225 10 578.69919 486.82866 11 51.16224 578.69919 12 -81.93906 51.16224 13 -2463.61917 -81.93906 14 -601.37213 -2463.61917 15 323.56624 -601.37213 16 -485.03075 323.56624 17 -317.89205 -485.03075 18 1740.00262 -317.89205 19 -67.99475 1740.00262 20 624.51274 -67.99475 21 -1284.03817 624.51274 22 690.97180 -1284.03817 23 637.30491 690.97180 24 -41.18872 637.30491 25 -1506.54579 -41.18872 26 -304.93757 -1506.54579 27 -828.35722 -304.93757 28 -2252.70743 -828.35722 29 -2353.34090 -2252.70743 30 -357.57481 -2353.34090 31 -606.46874 -357.57481 32 -185.87556 -606.46874 33 -971.44878 -185.87556 34 93.54120 -971.44878 35 197.03130 93.54120 36 -911.32272 197.03130 37 -937.22361 -911.32272 38 522.25041 -937.22361 39 100.08225 522.25041 40 363.83781 100.08225 41 -245.07066 363.83781 42 1522.15419 -245.07066 43 1063.70017 1522.15419 44 1553.76191 1063.70017 45 1956.74819 1553.76191 46 -35.60905 1956.74819 47 948.13812 -35.60905 48 3888.98232 948.13812 49 1535.91145 3888.98232 50 -714.41475 1535.91145 51 -1682.19487 -714.41475 52 410.32185 -1682.19487 53 -17.31205 410.32185 54 -792.54368 -17.31205 55 -207.62436 -792.54368 56 -50.47674 -207.62436 57 53.14454 -50.47674 58 -1281.97238 53.14454 59 -1465.08715 -1281.97238 60 -1023.05783 -1465.08715 61 -476.30654 -1023.05783 62 -361.38305 -476.30654 63 -394.05926 -361.38305 64 -278.27179 -394.05926 65 -179.51343 -278.27179 66 -25.03167 -179.51343 67 42.89063 -25.03167 68 -423.16652 42.89063 69 -1370.29142 -423.16652 70 -1733.62085 -1370.29142 71 -97.49861 -1733.62085 72 -874.34866 -97.49861 73 -2574.90620 -874.34866 74 -1965.56059 -2574.90620 75 -199.34009 -1965.56059 76 2054.60316 -199.34009 77 495.31603 2054.60316 78 1263.78496 495.31603 79 2700.82425 1263.78496 80 2794.99369 2700.82425 81 355.36622 2794.99369 82 260.67944 355.36622 83 -2120.40353 260.67944 84 -8037.50278 -2120.40353 85 10906.41177 -8037.50278 86 NA 10906.41177 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -560.14490 2077.76595 [2,] 1542.19678 -560.14490 [3,] 1955.83749 1542.19678 [4,] 391.82690 1955.83749 [5,] -532.07319 391.82690 [6,] -40.26005 -532.07319 [7,] -351.50900 -40.26005 [8,] 484.28225 -351.50900 [9,] 486.82866 484.28225 [10,] 578.69919 486.82866 [11,] 51.16224 578.69919 [12,] -81.93906 51.16224 [13,] -2463.61917 -81.93906 [14,] -601.37213 -2463.61917 [15,] 323.56624 -601.37213 [16,] -485.03075 323.56624 [17,] -317.89205 -485.03075 [18,] 1740.00262 -317.89205 [19,] -67.99475 1740.00262 [20,] 624.51274 -67.99475 [21,] -1284.03817 624.51274 [22,] 690.97180 -1284.03817 [23,] 637.30491 690.97180 [24,] -41.18872 637.30491 [25,] -1506.54579 -41.18872 [26,] -304.93757 -1506.54579 [27,] -828.35722 -304.93757 [28,] -2252.70743 -828.35722 [29,] -2353.34090 -2252.70743 [30,] -357.57481 -2353.34090 [31,] -606.46874 -357.57481 [32,] -185.87556 -606.46874 [33,] -971.44878 -185.87556 [34,] 93.54120 -971.44878 [35,] 197.03130 93.54120 [36,] -911.32272 197.03130 [37,] -937.22361 -911.32272 [38,] 522.25041 -937.22361 [39,] 100.08225 522.25041 [40,] 363.83781 100.08225 [41,] -245.07066 363.83781 [42,] 1522.15419 -245.07066 [43,] 1063.70017 1522.15419 [44,] 1553.76191 1063.70017 [45,] 1956.74819 1553.76191 [46,] -35.60905 1956.74819 [47,] 948.13812 -35.60905 [48,] 3888.98232 948.13812 [49,] 1535.91145 3888.98232 [50,] -714.41475 1535.91145 [51,] -1682.19487 -714.41475 [52,] 410.32185 -1682.19487 [53,] -17.31205 410.32185 [54,] -792.54368 -17.31205 [55,] -207.62436 -792.54368 [56,] -50.47674 -207.62436 [57,] 53.14454 -50.47674 [58,] -1281.97238 53.14454 [59,] -1465.08715 -1281.97238 [60,] -1023.05783 -1465.08715 [61,] -476.30654 -1023.05783 [62,] -361.38305 -476.30654 [63,] -394.05926 -361.38305 [64,] -278.27179 -394.05926 [65,] -179.51343 -278.27179 [66,] -25.03167 -179.51343 [67,] 42.89063 -25.03167 [68,] -423.16652 42.89063 [69,] -1370.29142 -423.16652 [70,] -1733.62085 -1370.29142 [71,] -97.49861 -1733.62085 [72,] -874.34866 -97.49861 [73,] -2574.90620 -874.34866 [74,] -1965.56059 -2574.90620 [75,] -199.34009 -1965.56059 [76,] 2054.60316 -199.34009 [77,] 495.31603 2054.60316 [78,] 1263.78496 495.31603 [79,] 2700.82425 1263.78496 [80,] 2794.99369 2700.82425 [81,] 355.36622 2794.99369 [82,] 260.67944 355.36622 [83,] -2120.40353 260.67944 [84,] -8037.50278 -2120.40353 [85,] 10906.41177 -8037.50278 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -560.14490 2077.76595 2 1542.19678 -560.14490 3 1955.83749 1542.19678 4 391.82690 1955.83749 5 -532.07319 391.82690 6 -40.26005 -532.07319 7 -351.50900 -40.26005 8 484.28225 -351.50900 9 486.82866 484.28225 10 578.69919 486.82866 11 51.16224 578.69919 12 -81.93906 51.16224 13 -2463.61917 -81.93906 14 -601.37213 -2463.61917 15 323.56624 -601.37213 16 -485.03075 323.56624 17 -317.89205 -485.03075 18 1740.00262 -317.89205 19 -67.99475 1740.00262 20 624.51274 -67.99475 21 -1284.03817 624.51274 22 690.97180 -1284.03817 23 637.30491 690.97180 24 -41.18872 637.30491 25 -1506.54579 -41.18872 26 -304.93757 -1506.54579 27 -828.35722 -304.93757 28 -2252.70743 -828.35722 29 -2353.34090 -2252.70743 30 -357.57481 -2353.34090 31 -606.46874 -357.57481 32 -185.87556 -606.46874 33 -971.44878 -185.87556 34 93.54120 -971.44878 35 197.03130 93.54120 36 -911.32272 197.03130 37 -937.22361 -911.32272 38 522.25041 -937.22361 39 100.08225 522.25041 40 363.83781 100.08225 41 -245.07066 363.83781 42 1522.15419 -245.07066 43 1063.70017 1522.15419 44 1553.76191 1063.70017 45 1956.74819 1553.76191 46 -35.60905 1956.74819 47 948.13812 -35.60905 48 3888.98232 948.13812 49 1535.91145 3888.98232 50 -714.41475 1535.91145 51 -1682.19487 -714.41475 52 410.32185 -1682.19487 53 -17.31205 410.32185 54 -792.54368 -17.31205 55 -207.62436 -792.54368 56 -50.47674 -207.62436 57 53.14454 -50.47674 58 -1281.97238 53.14454 59 -1465.08715 -1281.97238 60 -1023.05783 -1465.08715 61 -476.30654 -1023.05783 62 -361.38305 -476.30654 63 -394.05926 -361.38305 64 -278.27179 -394.05926 65 -179.51343 -278.27179 66 -25.03167 -179.51343 67 42.89063 -25.03167 68 -423.16652 42.89063 69 -1370.29142 -423.16652 70 -1733.62085 -1370.29142 71 -97.49861 -1733.62085 72 -874.34866 -97.49861 73 -2574.90620 -874.34866 74 -1965.56059 -2574.90620 75 -199.34009 -1965.56059 76 2054.60316 -199.34009 77 495.31603 2054.60316 78 1263.78496 495.31603 79 2700.82425 1263.78496 80 2794.99369 2700.82425 81 355.36622 2794.99369 82 260.67944 355.36622 83 -2120.40353 260.67944 84 -8037.50278 -2120.40353 85 10906.41177 -8037.50278 > 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/7uv8b1259169675.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/8unuh1259169675.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/9cvhp1259169675.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 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10dnv81259169675.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + 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/119ct71259169675.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/12whhq1259169675.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/13db641259169675.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/1429og1259169675.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/153q4a1259169675.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/16njkp1259169676.tab") + } > > system("convert tmp/1nywu1259169675.ps tmp/1nywu1259169675.png") > system("convert tmp/292eq1259169675.ps tmp/292eq1259169675.png") > system("convert tmp/3klty1259169675.ps tmp/3klty1259169675.png") > system("convert tmp/4hy5f1259169675.ps tmp/4hy5f1259169675.png") > system("convert tmp/5j0x01259169675.ps tmp/5j0x01259169675.png") > system("convert tmp/6ankb1259169675.ps tmp/6ankb1259169675.png") > system("convert tmp/7uv8b1259169675.ps tmp/7uv8b1259169675.png") > system("convert tmp/8unuh1259169675.ps tmp/8unuh1259169675.png") > system("convert tmp/9cvhp1259169675.ps tmp/9cvhp1259169675.png") > system("convert tmp/10dnv81259169675.ps tmp/10dnv81259169675.png") > > > proc.time() user system elapsed 2.802 1.600 4.292