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 + ,123297 + ,116476 + ,109375 + ,106370 + ,106.2 + ,117925 + ,114813 + ,123297 + ,116476 + ,109375 + ,107.7 + ,126466 + ,117925 + ,114813 + ,123297 + ,116476 + ,109.9 + ,131235 + ,126466 + ,117925 + ,114813 + ,123297 + ,111.7 + ,120546 + ,131235 + ,126466 + ,117925 + ,114813 + ,114.9 + ,123791 + ,120546 + ,131235 + ,126466 + ,117925 + ,116 + ,129813 + ,123791 + ,120546 + ,131235 + ,126466 + ,118.3 + ,133463 + ,129813 + ,123791 + ,120546 + ,131235 + ,120.4 + ,122987 + ,133463 + ,129813 + ,123791 + ,120546 + ,126 + ,125418 + ,122987 + ,133463 + ,129813 + ,123791 + ,128.1 + ,130199 + ,125418 + ,122987 + ,133463 + ,129813 + ,130.1 + ,133016 + ,130199 + ,125418 + ,122987 + ,133463 + ,130.8 + ,121454 + ,133016 + ,130199 + ,125418 + ,122987 + ,133.6 + ,122044 + ,121454 + ,133016 + ,130199 + ,125418 + ,134.2 + ,128313 + ,122044 + ,121454 + ,133016 + ,130199 + ,135.5 + ,131556 + ,128313 + ,122044 + ,121454 + ,133016 + ,136.2 + ,120027 + ,131556 + ,128313 + ,122044 + ,121454 + ,139.1 + ,123001 + ,120027 + ,131556 + ,128313 + ,122044 + ,139 + ,130111 + ,123001 + ,120027 + ,131556 + ,128313 + ,139.6 + ,132524 + ,130111 + ,123001 + ,120027 + ,131556 + ,138.7 + ,123742 + ,132524 + ,130111 + ,123001 + ,120027 + ,140.9 + ,124931 + ,123742 + ,132524 + ,130111 + ,123001 + ,141.3 + ,133646 + ,124931 + ,123742 + ,132524 + ,130111 + ,141.8 + ,136557 + ,133646 + ,124931 + ,123742 + ,132524 + ,142 + ,127509 + ,136557 + ,133646 + ,124931 + ,123742 + ,144.5 + ,128945 + ,127509 + ,136557 + ,133646 + ,124931 + ,144.6 + ,137191 + ,128945 + ,127509 + ,136557 + ,133646 + ,145.5 + ,139716 + ,137191 + ,128945 + ,127509 + ,136557 + ,146.8 + ,129083 + ,139716 + ,137191 + ,128945 + ,127509 + ,149.5 + ,131604 + ,129083 + ,139716 + ,137191 + ,128945 + ,149.9 + ,139413 + ,131604 + ,129083 + ,139716 + ,137191 + ,150.1 + ,143125 + ,139413 + ,131604 + ,129083 + ,139716 + ,150.9 + ,133948 + ,143125 + ,139413 + ,131604 + ,129083 + ,152.8 + ,137116 + ,133948 + ,143125 + ,139413 + ,131604 + ,153.1 + ,144864 + ,137116 + ,133948 + ,143125 + ,139413 + ,154 + ,149277 + ,144864 + ,137116 + ,133948 + ,143125 + ,154.9 + ,138796 + ,149277 + ,144864 + ,137116 + ,133948 + ,156.9 + ,143258 + ,138796 + ,149277 + ,144864 + ,137116 + ,158.4 + ,150034 + ,143258 + ,138796 + ,149277 + ,144864 + ,159.7 + ,154708 + ,150034 + ,143258 + ,138796 + ,149277 + ,160.2 + ,144888 + ,154708 + ,150034 + ,143258 + ,138796 + ,163.2 + ,148762 + ,144888 + ,154708 + ,150034 + ,143258 + ,163.7 + ,156500 + ,148762 + ,144888 + ,154708 + ,150034 + ,164.4 + ,161088 + ,156500 + ,148762 + ,144888 + ,154708 + ,163.7 + ,152772 + ,161088 + ,156500 + ,148762 + ,144888 + ,165.5 + ,158011 + ,152772 + ,161088 + ,156500 + ,148762 + ,165.6 + ,163318 + ,158011 + ,152772 + ,161088 + ,156500 + ,166.8 + ,169969 + ,163318 + ,158011 + ,152772 + ,161088 + ,167.5 + ,162269 + ,169969 + ,163318 + ,158011 + ,152772 + ,170.6 + ,165765 + ,162269 + ,169969 + ,163318 + ,158011 + ,170.9 + ,170600 + ,165765 + ,162269 + ,169969 + ,163318 + ,172 + ,174681 + ,170600 + ,165765 + ,162269 + ,169969 + ,171.8 + ,166364 + ,174681 + ,170600 + ,165765 + ,162269 + ,173.9 + ,170240 + ,166364 + ,174681 + ,170600 + ,165765 + ,174 + ,176150 + ,170240 + ,166364 + ,174681 + ,170600 + ,173.8 + ,182056 + ,176150 + ,170240 + ,166364 + ,174681 + ,173.9 + ,172218 + ,182056 + ,176150 + ,170240 + ,166364 + ,176 + ,177856 + ,172218 + ,182056 + ,176150 + ,170240 + ,176.6 + ,182253 + ,177856 + ,172218 + ,182056 + ,176150 + ,178.2 + ,188090 + ,182253 + ,177856 + ,172218 + ,182056 + ,179.2 + ,176863 + ,188090 + ,182253 + ,177856 + ,172218 + ,181.3 + ,183273 + ,176863 + ,188090 + ,182253 + ,177856 + ,181.8 + ,187969 + ,183273 + ,176863 + ,188090 + ,182253 + ,182.9 + ,194650 + ,187969 + ,183273 + ,176863 + ,188090 + ,183.8 + ,183036 + ,194650 + ,187969 + ,183273 + ,176863 + ,186.3 + ,189516 + ,183036 + ,194650 + ,187969 + ,183273 + ,187.4 + ,193805 + ,189516 + ,183036 + ,194650 + ,187969 + ,189.2 + ,200499 + ,193805 + ,189516 + ,183036 + ,194650 + ,189.7 + ,188142 + ,200499 + ,193805 + ,189516 + ,183036 + ,191.9 + ,193732 + ,188142 + ,200499 + ,193805 + ,189516 + ,192.6 + ,197126 + ,193732 + ,188142 + ,200499 + ,193805 + ,193.7 + ,205140 + ,197126 + ,193732 + ,188142 + ,200499 + ,194.2 + ,191751 + ,205140 + ,197126 + ,193732 + ,188142 + ,197.6 + ,196700 + ,191751 + ,205140 + ,197126 + ,193732 + ,199.3 + ,199784 + ,196700 + ,191751 + ,205140 + ,197126 + ,201.4 + ,207360 + ,199784 + ,196700 + ,191751 + ,205140 + ,203 + ,196101 + ,207360 + ,199784 + ,196700 + ,191751 + ,206.3 + ,200824 + ,196101 + ,207360 + ,199784 + ,196700 + ,207.1 + ,205743 + ,200824 + ,196101 + ,207360 + ,199784 + ,209.8 + ,212489 + ,205743 + ,200824 + ,196101 + ,207360 + ,211.1 + ,200810 + ,212489 + ,205743 + ,200824 + ,196101 + ,215.3 + ,203683 + ,200810 + ,212489 + ,205743 + ,200824 + ,217.4 + ,207286 + ,203683 + ,200810 + ,212489 + ,205743 + ,215.5 + ,210910 + ,207286 + ,203683 + ,200810 + ,212489 + ,210.9 + ,194915 + ,210910 + ,207286 + ,203683 + ,200810 + ,212.6 + ,217920 + ,194915 + ,210910 + ,207286 + ,203683) + ,dim=c(6 + ,86) + ,dimnames=list(c('RPI' + ,'HFCE' + ,'HFCE-1' + ,'HFCE-2' + ,'HFCE-3' + ,'HFCE-4') + ,1:86)) > y <- array(NA,dim=c(6,86),dimnames=list(c('RPI','HFCE','HFCE-1','HFCE-2','HFCE-3','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-1 HFCE-2 HFCE-3 HFCE-4 Q1 Q2 Q3 t 1 114813 103.7 123297 116476 109375 106370 1 0 0 1 2 117925 106.2 114813 123297 116476 109375 0 1 0 2 3 126466 107.7 117925 114813 123297 116476 0 0 1 3 4 131235 109.9 126466 117925 114813 123297 0 0 0 4 5 120546 111.7 131235 126466 117925 114813 1 0 0 5 6 123791 114.9 120546 131235 126466 117925 0 1 0 6 7 129813 116.0 123791 120546 131235 126466 0 0 1 7 8 133463 118.3 129813 123791 120546 131235 0 0 0 8 9 122987 120.4 133463 129813 123791 120546 1 0 0 9 10 125418 126.0 122987 133463 129813 123791 0 1 0 10 11 130199 128.1 125418 122987 133463 129813 0 0 1 11 12 133016 130.1 130199 125418 122987 133463 0 0 0 12 13 121454 130.8 133016 130199 125418 122987 1 0 0 13 14 122044 133.6 121454 133016 130199 125418 0 1 0 14 15 128313 134.2 122044 121454 133016 130199 0 0 1 15 16 131556 135.5 128313 122044 121454 133016 0 0 0 16 17 120027 136.2 131556 128313 122044 121454 1 0 0 17 18 123001 139.1 120027 131556 128313 122044 0 1 0 18 19 130111 139.0 123001 120027 131556 128313 0 0 1 19 20 132524 139.6 130111 123001 120027 131556 0 0 0 20 21 123742 138.7 132524 130111 123001 120027 1 0 0 21 22 124931 140.9 123742 132524 130111 123001 0 1 0 22 23 133646 141.3 124931 123742 132524 130111 0 0 1 23 24 136557 141.8 133646 124931 123742 132524 0 0 0 24 25 127509 142.0 136557 133646 124931 123742 1 0 0 25 26 128945 144.5 127509 136557 133646 124931 0 1 0 26 27 137191 144.6 128945 127509 136557 133646 0 0 1 27 28 139716 145.5 137191 128945 127509 136557 0 0 0 28 29 129083 146.8 139716 137191 128945 127509 1 0 0 29 30 131604 149.5 129083 139716 137191 128945 0 1 0 30 31 139413 149.9 131604 129083 139716 137191 0 0 1 31 32 143125 150.1 139413 131604 129083 139716 0 0 0 32 33 133948 150.9 143125 139413 131604 129083 1 0 0 33 34 137116 152.8 133948 143125 139413 131604 0 1 0 34 35 144864 153.1 137116 133948 143125 139413 0 0 1 35 36 149277 154.0 144864 137116 133948 143125 0 0 0 36 37 138796 154.9 149277 144864 137116 133948 1 0 0 37 38 143258 156.9 138796 149277 144864 137116 0 1 0 38 39 150034 158.4 143258 138796 149277 144864 0 0 1 39 40 154708 159.7 150034 143258 138796 149277 0 0 0 40 41 144888 160.2 154708 150034 143258 138796 1 0 0 41 42 148762 163.2 144888 154708 150034 143258 0 1 0 42 43 156500 163.7 148762 144888 154708 150034 0 0 1 43 44 161088 164.4 156500 148762 144888 154708 0 0 0 44 45 152772 163.7 161088 156500 148762 144888 1 0 0 45 46 158011 165.5 152772 161088 156500 148762 0 1 0 46 47 163318 165.6 158011 152772 161088 156500 0 0 1 47 48 169969 166.8 163318 158011 152772 161088 0 0 0 48 49 162269 167.5 169969 163318 158011 152772 1 0 0 49 50 165765 170.6 162269 169969 163318 158011 0 1 0 50 51 170600 170.9 165765 162269 169969 163318 0 0 1 51 52 174681 172.0 170600 165765 162269 169969 0 0 0 52 53 166364 171.8 174681 170600 165765 162269 1 0 0 53 54 170240 173.9 166364 174681 170600 165765 0 1 0 54 55 176150 174.0 170240 166364 174681 170600 0 0 1 55 56 182056 173.8 176150 170240 166364 174681 0 0 0 56 57 172218 173.9 182056 176150 170240 166364 1 0 0 57 58 177856 176.0 172218 182056 176150 170240 0 1 0 58 59 182253 176.6 177856 172218 182056 176150 0 0 1 59 60 188090 178.2 182253 177856 172218 182056 0 0 0 60 61 176863 179.2 188090 182253 177856 172218 1 0 0 61 62 183273 181.3 176863 188090 182253 177856 0 1 0 62 63 187969 181.8 183273 176863 188090 182253 0 0 1 63 64 194650 182.9 187969 183273 176863 188090 0 0 0 64 65 183036 183.8 194650 187969 183273 176863 1 0 0 65 66 189516 186.3 183036 194650 187969 183273 0 1 0 66 67 193805 187.4 189516 183036 194650 187969 0 0 1 67 68 200499 189.2 193805 189516 183036 194650 0 0 0 68 69 188142 189.7 200499 193805 189516 183036 1 0 0 69 70 193732 191.9 188142 200499 193805 189516 0 1 0 70 71 197126 192.6 193732 188142 200499 193805 0 0 1 71 72 205140 193.7 197126 193732 188142 200499 0 0 0 72 73 191751 194.2 205140 197126 193732 188142 1 0 0 73 74 196700 197.6 191751 205140 197126 193732 0 1 0 74 75 199784 199.3 196700 191751 205140 197126 0 0 1 75 76 207360 201.4 199784 196700 191751 205140 0 0 0 76 77 196101 203.0 207360 199784 196700 191751 1 0 0 77 78 200824 206.3 196101 207360 199784 196700 0 1 0 78 79 205743 207.1 200824 196101 207360 199784 0 0 1 79 80 212489 209.8 205743 200824 196101 207360 0 0 0 80 81 200810 211.1 212489 205743 200824 196101 1 0 0 81 82 203683 215.3 200810 212489 205743 200824 0 1 0 82 83 207286 217.4 203683 200810 212489 205743 0 0 1 83 84 210910 215.5 207286 203683 200810 212489 0 0 0 84 85 194915 210.9 210910 207286 203683 200810 1 0 0 85 86 217920 212.6 194915 210910 207286 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-1` `HFCE-2` `HFCE-3` `HFCE-4` 7.377e+04 -4.416e+02 1.345e-02 6.703e-01 -1.126e-01 2.694e-01 Q1 Q2 Q3 t -1.193e+04 -1.033e+04 4.731e+02 7.201e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7945.6 -664.3 -138.3 484.0 10906.1 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.377e+04 1.260e+04 5.854 1.15e-07 *** RPI -4.416e+02 8.487e+01 -5.203 1.61e-06 *** `HFCE-1` 1.345e-02 1.771e-01 0.076 0.939630 `HFCE-2` 6.703e-01 2.131e-01 3.145 0.002371 ** `HFCE-3` -1.126e-01 2.044e-01 -0.551 0.583344 `HFCE-4` 2.694e-01 1.903e-01 1.416 0.160989 Q1 -1.193e+04 2.951e+03 -4.041 0.000126 *** Q2 -1.033e+04 5.126e+03 -2.014 0.047511 * Q3 4.731e+02 3.356e+03 0.141 0.888260 t 7.201e+02 1.293e+02 5.570 3.69e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2001 on 76 degrees of freedom Multiple R-squared: 0.9961, Adjusted R-squared: 0.9957 F-statistic: 2164 on 9 and 76 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,] 3.051715e-02 6.103430e-02 0.9694828 [2,] 7.325169e-03 1.465034e-02 0.9926748 [3,] 1.035306e-02 2.070613e-02 0.9896469 [4,] 3.931719e-03 7.863438e-03 0.9960683 [5,] 1.267193e-03 2.534386e-03 0.9987328 [6,] 4.673885e-04 9.347770e-04 0.9995326 [7,] 2.212454e-04 4.424908e-04 0.9997788 [8,] 1.394245e-04 2.788490e-04 0.9998606 [9,] 7.120401e-05 1.424080e-04 0.9999288 [10,] 1.273028e-04 2.546056e-04 0.9998727 [11,] 2.041945e-04 4.083889e-04 0.9997958 [12,] 8.977375e-05 1.795475e-04 0.9999102 [13,] 3.589123e-05 7.178245e-05 0.9999641 [14,] 1.727351e-05 3.454702e-05 0.9999827 [15,] 6.404079e-06 1.280816e-05 0.9999936 [16,] 2.762128e-06 5.524256e-06 0.9999972 [17,] 1.999967e-06 3.999935e-06 0.9999980 [18,] 6.843491e-07 1.368698e-06 0.9999993 [19,] 3.880860e-07 7.761721e-07 0.9999996 [20,] 1.395390e-07 2.790781e-07 0.9999999 [21,] 8.148898e-08 1.629780e-07 0.9999999 [22,] 6.739284e-08 1.347857e-07 0.9999999 [23,] 2.547846e-08 5.095693e-08 1.0000000 [24,] 1.225148e-08 2.450297e-08 1.0000000 [25,] 4.337328e-09 8.674655e-09 1.0000000 [26,] 8.063319e-09 1.612664e-08 1.0000000 [27,] 2.839368e-09 5.678735e-09 1.0000000 [28,] 1.318095e-09 2.636190e-09 1.0000000 [29,] 5.604469e-10 1.120894e-09 1.0000000 [30,] 9.104685e-10 1.820937e-09 1.0000000 [31,] 4.260057e-10 8.520115e-10 1.0000000 [32,] 1.787727e-10 3.575453e-10 1.0000000 [33,] 1.321816e-10 2.643632e-10 1.0000000 [34,] 3.929129e-10 7.858258e-10 1.0000000 [35,] 1.941044e-09 3.882088e-09 1.0000000 [36,] 8.222463e-10 1.644493e-09 1.0000000 [37,] 3.808722e-09 7.617444e-09 1.0000000 [38,] 1.398892e-09 2.797783e-09 1.0000000 [39,] 7.632743e-09 1.526549e-08 1.0000000 [40,] 1.093706e-08 2.187412e-08 1.0000000 [41,] 5.295129e-09 1.059026e-08 1.0000000 [42,] 1.986585e-09 3.973171e-09 1.0000000 [43,] 2.134805e-09 4.269610e-09 1.0000000 [44,] 1.264669e-09 2.529337e-09 1.0000000 [45,] 9.130360e-10 1.826072e-09 1.0000000 [46,] 8.305673e-10 1.661135e-09 1.0000000 [47,] 2.133629e-09 4.267257e-09 1.0000000 [48,] 3.397869e-09 6.795739e-09 1.0000000 [49,] 1.959482e-09 3.918963e-09 1.0000000 [50,] 1.781577e-09 3.563155e-09 1.0000000 [51,] 8.218215e-10 1.643643e-09 1.0000000 [52,] 8.545568e-10 1.709114e-09 1.0000000 [53,] 9.336454e-10 1.867291e-09 1.0000000 [54,] 8.340689e-09 1.668138e-08 1.0000000 [55,] 7.597497e-09 1.519499e-08 1.0000000 [56,] 4.759788e-08 9.519576e-08 1.0000000 [57,] 1.327899e-05 2.655798e-05 0.9999867 [58,] 1.984146e-04 3.968292e-04 0.9998016 [59,] 2.538900e-03 5.077799e-03 0.9974611 [60,] 1.997965e-03 3.995929e-03 0.9980020 [61,] 1.583167e-03 3.166334e-03 0.9984168 > postscript(file="/var/www/html/rcomp/tmp/13h3v1258726692.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/2xdp81258726692.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/3efnk1258726692.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/4v21p1258726692.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/5px7k1258726692.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 1973.945784 -599.632622 1584.626448 2084.351628 244.442573 -348.620853 7 8 9 10 11 12 -2.807372 -328.671277 489.389862 569.802837 536.981263 133.393557 13 14 15 16 17 18 -58.764046 -2403.255974 -617.220116 412.180771 -664.829196 -203.628619 19 20 21 22 23 24 1707.216522 -122.801781 547.689296 -1113.380219 485.973611 817.587298 25 26 27 28 29 30 -315.732296 -1265.943515 -469.396912 -670.516908 -2484.075103 -2100.271077 31 32 33 34 35 36 -477.569083 -596.660705 -348.888815 -828.065129 -43.767388 258.568374 37 38 39 40 41 42 -1041.434684 -815.947655 478.248719 28.259522 357.637316 -205.192264 43 44 45 46 47 48 1465.528903 1049.897897 1465.446763 2041.870164 -190.354054 988.099512 49 50 51 52 53 54 3988.086102 1363.002118 -755.138395 -1502.592923 471.706043 -67.612446 55 56 57 58 59 60 -952.855840 -95.651230 -45.978616 -7.420475 -1273.180519 -1513.749692 61 62 63 64 65 66 -832.427695 -601.984694 -292.435551 -569.093658 -69.572932 -327.318825 67 68 69 70 71 72 113.121613 -153.829039 -189.168258 -1532.792203 -1542.878257 -277.505997 73 74 75 76 77 78 -662.757059 -2849.397881 -1637.802596 -406.848630 2243.151877 189.057295 79 80 81 82 83 84 1447.765831 2598.306629 2877.764824 200.587906 435.943172 -2132.723349 85 86 -7945.631740 10906.144131 > postscript(file="/var/www/html/rcomp/tmp/64emw1258726692.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 1973.945784 NA 1 -599.632622 1973.945784 2 1584.626448 -599.632622 3 2084.351628 1584.626448 4 244.442573 2084.351628 5 -348.620853 244.442573 6 -2.807372 -348.620853 7 -328.671277 -2.807372 8 489.389862 -328.671277 9 569.802837 489.389862 10 536.981263 569.802837 11 133.393557 536.981263 12 -58.764046 133.393557 13 -2403.255974 -58.764046 14 -617.220116 -2403.255974 15 412.180771 -617.220116 16 -664.829196 412.180771 17 -203.628619 -664.829196 18 1707.216522 -203.628619 19 -122.801781 1707.216522 20 547.689296 -122.801781 21 -1113.380219 547.689296 22 485.973611 -1113.380219 23 817.587298 485.973611 24 -315.732296 817.587298 25 -1265.943515 -315.732296 26 -469.396912 -1265.943515 27 -670.516908 -469.396912 28 -2484.075103 -670.516908 29 -2100.271077 -2484.075103 30 -477.569083 -2100.271077 31 -596.660705 -477.569083 32 -348.888815 -596.660705 33 -828.065129 -348.888815 34 -43.767388 -828.065129 35 258.568374 -43.767388 36 -1041.434684 258.568374 37 -815.947655 -1041.434684 38 478.248719 -815.947655 39 28.259522 478.248719 40 357.637316 28.259522 41 -205.192264 357.637316 42 1465.528903 -205.192264 43 1049.897897 1465.528903 44 1465.446763 1049.897897 45 2041.870164 1465.446763 46 -190.354054 2041.870164 47 988.099512 -190.354054 48 3988.086102 988.099512 49 1363.002118 3988.086102 50 -755.138395 1363.002118 51 -1502.592923 -755.138395 52 471.706043 -1502.592923 53 -67.612446 471.706043 54 -952.855840 -67.612446 55 -95.651230 -952.855840 56 -45.978616 -95.651230 57 -7.420475 -45.978616 58 -1273.180519 -7.420475 59 -1513.749692 -1273.180519 60 -832.427695 -1513.749692 61 -601.984694 -832.427695 62 -292.435551 -601.984694 63 -569.093658 -292.435551 64 -69.572932 -569.093658 65 -327.318825 -69.572932 66 113.121613 -327.318825 67 -153.829039 113.121613 68 -189.168258 -153.829039 69 -1532.792203 -189.168258 70 -1542.878257 -1532.792203 71 -277.505997 -1542.878257 72 -662.757059 -277.505997 73 -2849.397881 -662.757059 74 -1637.802596 -2849.397881 75 -406.848630 -1637.802596 76 2243.151877 -406.848630 77 189.057295 2243.151877 78 1447.765831 189.057295 79 2598.306629 1447.765831 80 2877.764824 2598.306629 81 200.587906 2877.764824 82 435.943172 200.587906 83 -2132.723349 435.943172 84 -7945.631740 -2132.723349 85 10906.144131 -7945.631740 86 NA 10906.144131 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -599.632622 1973.945784 [2,] 1584.626448 -599.632622 [3,] 2084.351628 1584.626448 [4,] 244.442573 2084.351628 [5,] -348.620853 244.442573 [6,] -2.807372 -348.620853 [7,] -328.671277 -2.807372 [8,] 489.389862 -328.671277 [9,] 569.802837 489.389862 [10,] 536.981263 569.802837 [11,] 133.393557 536.981263 [12,] -58.764046 133.393557 [13,] -2403.255974 -58.764046 [14,] -617.220116 -2403.255974 [15,] 412.180771 -617.220116 [16,] -664.829196 412.180771 [17,] -203.628619 -664.829196 [18,] 1707.216522 -203.628619 [19,] -122.801781 1707.216522 [20,] 547.689296 -122.801781 [21,] -1113.380219 547.689296 [22,] 485.973611 -1113.380219 [23,] 817.587298 485.973611 [24,] -315.732296 817.587298 [25,] -1265.943515 -315.732296 [26,] -469.396912 -1265.943515 [27,] -670.516908 -469.396912 [28,] -2484.075103 -670.516908 [29,] -2100.271077 -2484.075103 [30,] -477.569083 -2100.271077 [31,] -596.660705 -477.569083 [32,] -348.888815 -596.660705 [33,] -828.065129 -348.888815 [34,] -43.767388 -828.065129 [35,] 258.568374 -43.767388 [36,] -1041.434684 258.568374 [37,] -815.947655 -1041.434684 [38,] 478.248719 -815.947655 [39,] 28.259522 478.248719 [40,] 357.637316 28.259522 [41,] -205.192264 357.637316 [42,] 1465.528903 -205.192264 [43,] 1049.897897 1465.528903 [44,] 1465.446763 1049.897897 [45,] 2041.870164 1465.446763 [46,] -190.354054 2041.870164 [47,] 988.099512 -190.354054 [48,] 3988.086102 988.099512 [49,] 1363.002118 3988.086102 [50,] -755.138395 1363.002118 [51,] -1502.592923 -755.138395 [52,] 471.706043 -1502.592923 [53,] -67.612446 471.706043 [54,] -952.855840 -67.612446 [55,] -95.651230 -952.855840 [56,] -45.978616 -95.651230 [57,] -7.420475 -45.978616 [58,] -1273.180519 -7.420475 [59,] -1513.749692 -1273.180519 [60,] -832.427695 -1513.749692 [61,] -601.984694 -832.427695 [62,] -292.435551 -601.984694 [63,] -569.093658 -292.435551 [64,] -69.572932 -569.093658 [65,] -327.318825 -69.572932 [66,] 113.121613 -327.318825 [67,] -153.829039 113.121613 [68,] -189.168258 -153.829039 [69,] -1532.792203 -189.168258 [70,] -1542.878257 -1532.792203 [71,] -277.505997 -1542.878257 [72,] -662.757059 -277.505997 [73,] -2849.397881 -662.757059 [74,] -1637.802596 -2849.397881 [75,] -406.848630 -1637.802596 [76,] 2243.151877 -406.848630 [77,] 189.057295 2243.151877 [78,] 1447.765831 189.057295 [79,] 2598.306629 1447.765831 [80,] 2877.764824 2598.306629 [81,] 200.587906 2877.764824 [82,] 435.943172 200.587906 [83,] -2132.723349 435.943172 [84,] -7945.631740 -2132.723349 [85,] 10906.144131 -7945.631740 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -599.632622 1973.945784 2 1584.626448 -599.632622 3 2084.351628 1584.626448 4 244.442573 2084.351628 5 -348.620853 244.442573 6 -2.807372 -348.620853 7 -328.671277 -2.807372 8 489.389862 -328.671277 9 569.802837 489.389862 10 536.981263 569.802837 11 133.393557 536.981263 12 -58.764046 133.393557 13 -2403.255974 -58.764046 14 -617.220116 -2403.255974 15 412.180771 -617.220116 16 -664.829196 412.180771 17 -203.628619 -664.829196 18 1707.216522 -203.628619 19 -122.801781 1707.216522 20 547.689296 -122.801781 21 -1113.380219 547.689296 22 485.973611 -1113.380219 23 817.587298 485.973611 24 -315.732296 817.587298 25 -1265.943515 -315.732296 26 -469.396912 -1265.943515 27 -670.516908 -469.396912 28 -2484.075103 -670.516908 29 -2100.271077 -2484.075103 30 -477.569083 -2100.271077 31 -596.660705 -477.569083 32 -348.888815 -596.660705 33 -828.065129 -348.888815 34 -43.767388 -828.065129 35 258.568374 -43.767388 36 -1041.434684 258.568374 37 -815.947655 -1041.434684 38 478.248719 -815.947655 39 28.259522 478.248719 40 357.637316 28.259522 41 -205.192264 357.637316 42 1465.528903 -205.192264 43 1049.897897 1465.528903 44 1465.446763 1049.897897 45 2041.870164 1465.446763 46 -190.354054 2041.870164 47 988.099512 -190.354054 48 3988.086102 988.099512 49 1363.002118 3988.086102 50 -755.138395 1363.002118 51 -1502.592923 -755.138395 52 471.706043 -1502.592923 53 -67.612446 471.706043 54 -952.855840 -67.612446 55 -95.651230 -952.855840 56 -45.978616 -95.651230 57 -7.420475 -45.978616 58 -1273.180519 -7.420475 59 -1513.749692 -1273.180519 60 -832.427695 -1513.749692 61 -601.984694 -832.427695 62 -292.435551 -601.984694 63 -569.093658 -292.435551 64 -69.572932 -569.093658 65 -327.318825 -69.572932 66 113.121613 -327.318825 67 -153.829039 113.121613 68 -189.168258 -153.829039 69 -1532.792203 -189.168258 70 -1542.878257 -1532.792203 71 -277.505997 -1542.878257 72 -662.757059 -277.505997 73 -2849.397881 -662.757059 74 -1637.802596 -2849.397881 75 -406.848630 -1637.802596 76 2243.151877 -406.848630 77 189.057295 2243.151877 78 1447.765831 189.057295 79 2598.306629 1447.765831 80 2877.764824 2598.306629 81 200.587906 2877.764824 82 435.943172 200.587906 83 -2132.723349 435.943172 84 -7945.631740 -2132.723349 85 10906.144131 -7945.631740 > 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/7novu1258726692.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/8udbc1258726692.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/9k2rs1258726692.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/10of4p1258726692.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/11yzw51258726692.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/12iyf91258726692.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/13wv1u1258726692.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/14qume1258726692.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/15y9wn1258726692.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/16gijd1258726693.tab") + } > > system("convert tmp/13h3v1258726692.ps tmp/13h3v1258726692.png") > system("convert tmp/2xdp81258726692.ps tmp/2xdp81258726692.png") > system("convert tmp/3efnk1258726692.ps tmp/3efnk1258726692.png") > system("convert tmp/4v21p1258726692.ps tmp/4v21p1258726692.png") > system("convert tmp/5px7k1258726692.ps tmp/5px7k1258726692.png") > system("convert tmp/64emw1258726692.ps tmp/64emw1258726692.png") > system("convert tmp/7novu1258726692.ps tmp/7novu1258726692.png") > system("convert tmp/8udbc1258726692.ps tmp/8udbc1258726692.png") > system("convert tmp/9k2rs1258726692.ps tmp/9k2rs1258726692.png") > system("convert tmp/10of4p1258726692.ps tmp/10of4p1258726692.png") > > > proc.time() user system elapsed 2.838 1.618 5.128