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(267366 + ,0 + ,267413 + ,262813 + ,258113 + ,267037 + ,269645 + ,264777 + ,0 + ,267366 + ,267413 + ,262813 + ,258113 + ,267037 + ,258863 + ,0 + ,264777 + ,267366 + ,267413 + ,262813 + ,258113 + ,254844 + ,0 + ,258863 + ,264777 + ,267366 + ,267413 + ,262813 + ,254868 + ,0 + ,254844 + ,258863 + ,264777 + ,267366 + ,267413 + ,277267 + ,0 + ,254868 + ,254844 + ,258863 + ,264777 + ,267366 + ,285351 + ,0 + ,277267 + ,254868 + ,254844 + ,258863 + ,264777 + ,286602 + ,0 + ,285351 + ,277267 + ,254868 + ,254844 + ,258863 + ,283042 + ,0 + ,286602 + ,285351 + ,277267 + ,254868 + ,254844 + ,276687 + ,0 + ,283042 + ,286602 + ,285351 + ,277267 + ,254868 + ,277915 + ,0 + ,276687 + ,283042 + ,286602 + ,285351 + ,277267 + ,277128 + ,0 + ,277915 + ,276687 + ,283042 + ,286602 + ,285351 + ,277103 + ,0 + ,277128 + ,277915 + ,276687 + ,283042 + ,286602 + ,275037 + ,0 + ,277103 + ,277128 + ,277915 + ,276687 + ,283042 + ,270150 + ,0 + ,275037 + ,277103 + ,277128 + ,277915 + ,276687 + ,267140 + ,0 + ,270150 + ,275037 + ,277103 + ,277128 + ,277915 + ,264993 + ,0 + ,267140 + ,270150 + ,275037 + ,277103 + ,277128 + ,287259 + ,0 + ,264993 + ,267140 + ,270150 + ,275037 + ,277103 + ,291186 + ,0 + ,287259 + ,264993 + ,267140 + ,270150 + ,275037 + ,292300 + ,0 + ,291186 + ,287259 + ,264993 + ,267140 + ,270150 + ,288186 + ,0 + ,292300 + ,291186 + ,287259 + ,264993 + ,267140 + ,281477 + ,0 + ,288186 + ,292300 + ,291186 + ,287259 + ,264993 + ,282656 + ,0 + ,281477 + ,288186 + ,292300 + ,291186 + ,287259 + ,280190 + ,0 + ,282656 + ,281477 + ,288186 + ,292300 + ,291186 + ,280408 + ,0 + ,280190 + ,282656 + ,281477 + ,288186 + ,292300 + ,276836 + ,0 + ,280408 + ,280190 + ,282656 + ,281477 + ,288186 + ,275216 + ,0 + ,276836 + ,280408 + ,280190 + ,282656 + ,281477 + ,274352 + ,0 + ,275216 + ,276836 + ,280408 + ,280190 + ,282656 + ,271311 + ,0 + ,274352 + ,275216 + ,276836 + ,280408 + ,280190 + ,289802 + ,0 + ,271311 + ,274352 + ,275216 + ,276836 + ,280408 + ,290726 + ,0 + ,289802 + ,271311 + ,274352 + ,275216 + ,276836 + ,292300 + ,0 + ,290726 + ,289802 + ,271311 + ,274352 + ,275216 + ,278506 + ,0 + ,292300 + ,290726 + ,289802 + ,271311 + ,274352 + ,269826 + ,0 + ,278506 + ,292300 + ,290726 + ,289802 + ,271311 + ,265861 + ,0 + ,269826 + ,278506 + ,292300 + ,290726 + ,289802 + ,269034 + ,0 + ,265861 + ,269826 + ,278506 + ,292300 + ,290726 + ,264176 + ,0 + ,269034 + ,265861 + ,269826 + ,278506 + ,292300 + ,255198 + ,0 + ,264176 + ,269034 + ,265861 + ,269826 + ,278506 + ,253353 + ,0 + ,255198 + ,264176 + ,269034 + ,265861 + ,269826 + ,246057 + ,0 + ,253353 + ,255198 + ,264176 + ,269034 + ,265861 + ,235372 + ,0 + ,246057 + ,253353 + ,255198 + ,264176 + ,269034 + ,258556 + ,0 + ,235372 + ,246057 + ,253353 + ,255198 + ,264176 + ,260993 + ,0 + ,258556 + ,235372 + ,246057 + ,253353 + ,255198 + ,254663 + ,0 + ,260993 + ,258556 + ,235372 + ,246057 + ,253353 + ,250643 + ,0 + ,254663 + ,260993 + ,258556 + ,235372 + ,246057 + ,243422 + ,0 + ,250643 + ,254663 + ,260993 + ,258556 + ,235372 + ,247105 + ,0 + ,243422 + ,250643 + ,254663 + ,260993 + ,258556 + ,248541 + ,0 + ,247105 + ,243422 + ,250643 + ,254663 + ,260993 + ,245039 + ,0 + ,248541 + ,247105 + ,243422 + ,250643 + ,254663 + ,237080 + ,0 + ,245039 + ,248541 + ,247105 + ,243422 + ,250643 + ,237085 + ,0 + ,237080 + ,245039 + ,248541 + ,247105 + ,243422 + ,225554 + ,0 + ,237085 + ,237080 + ,245039 + ,248541 + ,247105 + ,226839 + ,0 + ,225554 + ,237085 + ,237080 + ,245039 + ,248541 + ,247934 + ,0 + ,226839 + ,225554 + ,237085 + ,237080 + ,245039 + ,248333 + ,1 + ,247934 + ,226839 + ,225554 + ,237085 + ,237080 + ,246969 + ,1 + ,248333 + ,247934 + ,226839 + ,225554 + ,237085 + ,245098 + ,1 + ,246969 + ,248333 + ,247934 + ,226839 + ,225554 + ,246263 + ,1 + ,245098 + ,246969 + ,248333 + ,247934 + ,226839 + ,255765 + ,1 + ,246263 + ,245098 + ,246969 + ,248333 + ,247934 + ,264319 + ,1 + ,255765 + ,246263 + ,245098 + ,246969 + ,248333 + ,268347 + ,1 + ,264319 + ,255765 + ,246263 + ,245098 + ,246969 + ,273046 + ,1 + ,268347 + ,264319 + ,255765 + ,246263 + ,245098 + ,273963 + ,1 + ,273046 + ,268347 + ,264319 + ,255765 + ,246263 + ,267430 + ,1 + ,273963 + ,273046 + ,268347 + ,264319 + ,255765 + ,271993 + ,1 + ,267430 + ,273963 + ,273046 + ,268347 + ,264319 + ,292710 + ,1 + ,271993 + ,267430 + ,273963 + ,273046 + ,268347 + ,295881 + ,1 + ,292710 + ,271993 + ,267430 + ,273963 + ,273046) + ,dim=c(7 + ,67) + ,dimnames=list(c('y' + ,'x' + ,'y1' + ,'y2' + ,'y3' + ,'y4' + ,'y5') + ,1:67)) > y <- array(NA,dim=c(7,67),dimnames=list(c('y','x','y1','y2','y3','y4','y5'),1:67)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > 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 y x y1 y2 y3 y4 y5 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 1 267366 0 267413 262813 258113 267037 269645 1 0 0 0 0 0 0 0 0 0 2 264777 0 267366 267413 262813 258113 267037 0 1 0 0 0 0 0 0 0 0 3 258863 0 264777 267366 267413 262813 258113 0 0 1 0 0 0 0 0 0 0 4 254844 0 258863 264777 267366 267413 262813 0 0 0 1 0 0 0 0 0 0 5 254868 0 254844 258863 264777 267366 267413 0 0 0 0 1 0 0 0 0 0 6 277267 0 254868 254844 258863 264777 267366 0 0 0 0 0 1 0 0 0 0 7 285351 0 277267 254868 254844 258863 264777 0 0 0 0 0 0 1 0 0 0 8 286602 0 285351 277267 254868 254844 258863 0 0 0 0 0 0 0 1 0 0 9 283042 0 286602 285351 277267 254868 254844 0 0 0 0 0 0 0 0 1 0 10 276687 0 283042 286602 285351 277267 254868 0 0 0 0 0 0 0 0 0 1 11 277915 0 276687 283042 286602 285351 277267 0 0 0 0 0 0 0 0 0 0 12 277128 0 277915 276687 283042 286602 285351 0 0 0 0 0 0 0 0 0 0 13 277103 0 277128 277915 276687 283042 286602 1 0 0 0 0 0 0 0 0 0 14 275037 0 277103 277128 277915 276687 283042 0 1 0 0 0 0 0 0 0 0 15 270150 0 275037 277103 277128 277915 276687 0 0 1 0 0 0 0 0 0 0 16 267140 0 270150 275037 277103 277128 277915 0 0 0 1 0 0 0 0 0 0 17 264993 0 267140 270150 275037 277103 277128 0 0 0 0 1 0 0 0 0 0 18 287259 0 264993 267140 270150 275037 277103 0 0 0 0 0 1 0 0 0 0 19 291186 0 287259 264993 267140 270150 275037 0 0 0 0 0 0 1 0 0 0 20 292300 0 291186 287259 264993 267140 270150 0 0 0 0 0 0 0 1 0 0 21 288186 0 292300 291186 287259 264993 267140 0 0 0 0 0 0 0 0 1 0 22 281477 0 288186 292300 291186 287259 264993 0 0 0 0 0 0 0 0 0 1 23 282656 0 281477 288186 292300 291186 287259 0 0 0 0 0 0 0 0 0 0 24 280190 0 282656 281477 288186 292300 291186 0 0 0 0 0 0 0 0 0 0 25 280408 0 280190 282656 281477 288186 292300 1 0 0 0 0 0 0 0 0 0 26 276836 0 280408 280190 282656 281477 288186 0 1 0 0 0 0 0 0 0 0 27 275216 0 276836 280408 280190 282656 281477 0 0 1 0 0 0 0 0 0 0 28 274352 0 275216 276836 280408 280190 282656 0 0 0 1 0 0 0 0 0 0 29 271311 0 274352 275216 276836 280408 280190 0 0 0 0 1 0 0 0 0 0 30 289802 0 271311 274352 275216 276836 280408 0 0 0 0 0 1 0 0 0 0 31 290726 0 289802 271311 274352 275216 276836 0 0 0 0 0 0 1 0 0 0 32 292300 0 290726 289802 271311 274352 275216 0 0 0 0 0 0 0 1 0 0 33 278506 0 292300 290726 289802 271311 274352 0 0 0 0 0 0 0 0 1 0 34 269826 0 278506 292300 290726 289802 271311 0 0 0 0 0 0 0 0 0 1 35 265861 0 269826 278506 292300 290726 289802 0 0 0 0 0 0 0 0 0 0 36 269034 0 265861 269826 278506 292300 290726 0 0 0 0 0 0 0 0 0 0 37 264176 0 269034 265861 269826 278506 292300 1 0 0 0 0 0 0 0 0 0 38 255198 0 264176 269034 265861 269826 278506 0 1 0 0 0 0 0 0 0 0 39 253353 0 255198 264176 269034 265861 269826 0 0 1 0 0 0 0 0 0 0 40 246057 0 253353 255198 264176 269034 265861 0 0 0 1 0 0 0 0 0 0 41 235372 0 246057 253353 255198 264176 269034 0 0 0 0 1 0 0 0 0 0 42 258556 0 235372 246057 253353 255198 264176 0 0 0 0 0 1 0 0 0 0 43 260993 0 258556 235372 246057 253353 255198 0 0 0 0 0 0 1 0 0 0 44 254663 0 260993 258556 235372 246057 253353 0 0 0 0 0 0 0 1 0 0 45 250643 0 254663 260993 258556 235372 246057 0 0 0 0 0 0 0 0 1 0 46 243422 0 250643 254663 260993 258556 235372 0 0 0 0 0 0 0 0 0 1 47 247105 0 243422 250643 254663 260993 258556 0 0 0 0 0 0 0 0 0 0 48 248541 0 247105 243422 250643 254663 260993 0 0 0 0 0 0 0 0 0 0 49 245039 0 248541 247105 243422 250643 254663 1 0 0 0 0 0 0 0 0 0 50 237080 0 245039 248541 247105 243422 250643 0 1 0 0 0 0 0 0 0 0 51 237085 0 237080 245039 248541 247105 243422 0 0 1 0 0 0 0 0 0 0 52 225554 0 237085 237080 245039 248541 247105 0 0 0 1 0 0 0 0 0 0 53 226839 0 225554 237085 237080 245039 248541 0 0 0 0 1 0 0 0 0 0 54 247934 0 226839 225554 237085 237080 245039 0 0 0 0 0 1 0 0 0 0 55 248333 1 247934 226839 225554 237085 237080 0 0 0 0 0 0 1 0 0 0 56 246969 1 248333 247934 226839 225554 237085 0 0 0 0 0 0 0 1 0 0 57 245098 1 246969 248333 247934 226839 225554 0 0 0 0 0 0 0 0 1 0 58 246263 1 245098 246969 248333 247934 226839 0 0 0 0 0 0 0 0 0 1 59 255765 1 246263 245098 246969 248333 247934 0 0 0 0 0 0 0 0 0 0 60 264319 1 255765 246263 245098 246969 248333 0 0 0 0 0 0 0 0 0 0 61 268347 1 264319 255765 246263 245098 246969 1 0 0 0 0 0 0 0 0 0 62 273046 1 268347 264319 255765 246263 245098 0 1 0 0 0 0 0 0 0 0 63 273963 1 273046 268347 264319 255765 246263 0 0 1 0 0 0 0 0 0 0 64 267430 1 273963 273046 268347 264319 255765 0 0 0 1 0 0 0 0 0 0 65 271993 1 267430 273963 273046 268347 264319 0 0 0 0 1 0 0 0 0 0 66 292710 1 271993 267430 273963 273046 268347 0 0 0 0 0 1 0 0 0 0 67 295881 1 292710 271993 267430 273963 273046 0 0 0 0 0 0 1 0 0 0 M11 t 1 0 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 1 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 1 23 24 0 24 25 0 25 26 0 26 27 0 27 28 0 28 29 0 29 30 0 30 31 0 31 32 0 32 33 0 33 34 0 34 35 1 35 36 0 36 37 0 37 38 0 38 39 0 39 40 0 40 41 0 41 42 0 42 43 0 43 44 0 44 45 0 45 46 0 46 47 1 47 48 0 48 49 0 49 50 0 50 51 0 51 52 0 52 53 0 53 54 0 54 55 0 55 56 0 56 57 0 57 58 0 58 59 1 59 60 0 60 61 0 61 62 0 62 63 0 63 64 0 64 65 0 65 66 0 66 67 0 67 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x y1 y2 y3 y4 2.139e+04 4.571e+03 9.374e-01 1.340e-01 1.269e-01 -2.598e-01 y5 M1 M2 M3 M4 M5 2.464e-03 -3.682e+03 -8.617e+03 -7.066e+03 -9.288e+03 -5.147e+03 M6 M7 M8 M9 M10 M11 1.798e+04 7.825e+02 -6.646e+03 -1.524e+04 -1.031e+04 -1.107e+03 t -6.879e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7057.99 -1798.14 46.38 2195.43 5616.38 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.139e+04 1.075e+04 1.989 0.052452 . x 4.571e+03 2.099e+03 2.178 0.034369 * y1 9.374e-01 1.429e-01 6.559 3.50e-08 *** y2 1.340e-01 1.949e-01 0.688 0.494989 y3 1.269e-01 1.986e-01 0.639 0.525927 y4 -2.598e-01 1.987e-01 -1.307 0.197298 y5 2.464e-03 1.491e-01 0.017 0.986887 M1 -3.682e+03 2.465e+03 -1.494 0.141845 M2 -8.617e+03 2.764e+03 -3.118 0.003072 ** M3 -7.066e+03 2.705e+03 -2.612 0.011979 * M4 -9.288e+03 2.399e+03 -3.872 0.000326 *** M5 -5.147e+03 2.443e+03 -2.107 0.040389 * M6 1.798e+04 2.230e+03 8.065 1.76e-10 *** M7 7.825e+02 3.409e+03 0.230 0.819408 M8 -6.646e+03 4.501e+03 -1.477 0.146322 M9 -1.524e+04 4.516e+03 -3.374 0.001474 ** M10 -1.031e+04 4.464e+03 -2.309 0.025271 * M11 -1.107e+03 2.654e+03 -0.417 0.678425 t -6.879e+01 3.604e+01 -1.909 0.062263 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3382 on 48 degrees of freedom Multiple R-squared: 0.9724, Adjusted R-squared: 0.962 F-statistic: 93.88 on 18 and 48 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,] 0.0355083895 0.0710167790 0.9644916 [2,] 0.0087188775 0.0174377550 0.9912811 [3,] 0.0023983507 0.0047967015 0.9976016 [4,] 0.0007746473 0.0015492946 0.9992254 [5,] 0.0001953909 0.0003907819 0.9998046 [6,] 0.0004251273 0.0008502546 0.9995749 [7,] 0.0016228362 0.0032456724 0.9983772 [8,] 0.0005665615 0.0011331231 0.9994334 [9,] 0.0002812158 0.0005624317 0.9997188 [10,] 0.0001016996 0.0002033992 0.9998983 [11,] 0.0001283461 0.0002566921 0.9998717 [12,] 0.0541125428 0.1082250857 0.9458875 [13,] 0.0349889021 0.0699778041 0.9650111 [14,] 0.0518788321 0.1037576642 0.9481212 [15,] 0.0758682112 0.1517364223 0.9241318 [16,] 0.0466920185 0.0933840370 0.9533080 [17,] 0.0414070405 0.0828140810 0.9585930 [18,] 0.0722440453 0.1444880905 0.9277560 [19,] 0.1218666858 0.2437333716 0.8781333 [20,] 0.2776732464 0.5553464928 0.7223268 [21,] 0.2990255013 0.5980510026 0.7009745 [22,] 0.5193715984 0.9612568032 0.4806284 [23,] 0.4617664958 0.9235329916 0.5382335 [24,] 0.7010520879 0.5978958243 0.2989479 > postscript(file="/var/www/html/rcomp/tmp/1h1571258742250.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/2i4lf1258742250.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/398t81258742250.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/45w6d1258742250.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/5omku1258742250.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 = 67 Frequency = 1 1 2 3 4 5 6 -195.66415 -1261.36125 -5564.69964 -213.21963 603.68224 534.90156 7 8 9 10 11 12 3867.93216 1003.57723 1022.07160 -2229.03632 -1812.82501 -3181.11425 13 14 15 16 17 18 996.19066 2265.00255 -1729.53992 2204.33111 -280.60313 1423.06865 19 20 21 22 23 24 1152.23878 2600.55581 2200.90210 -368.37970 -657.37902 -3566.36852 25 26 27 28 29 30 2335.73502 2011.36605 2864.13998 5616.38013 46.26468 -2280.90215 31 32 33 34 35 36 -1315.93663 4576.21685 -5290.88603 -1416.24636 -4533.64325 4637.44070 37 38 39 40 41 42 -1399.19033 -2962.59027 1366.15228 743.39217 -7057.98972 1971.93148 43 44 45 46 47 48 1845.78084 -2914.08204 1633.95088 -89.33650 3147.97815 -79.91483 49 50 51 52 53 54 -1783.44650 -3981.43690 3264.09810 -4106.57231 4011.38483 325.69777 55 56 57 58 59 60 -5039.49484 -5266.26785 433.96144 4102.99889 3855.86913 2189.95690 61 62 63 64 65 66 46.37530 3929.01982 -200.15080 -4244.31147 2677.26110 -1974.69731 67 -510.52031 > postscript(file="/var/www/html/rcomp/tmp/6czm21258742250.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 = 67 Frequency = 1 lag(myerror, k = 1) myerror 0 -195.66415 NA 1 -1261.36125 -195.66415 2 -5564.69964 -1261.36125 3 -213.21963 -5564.69964 4 603.68224 -213.21963 5 534.90156 603.68224 6 3867.93216 534.90156 7 1003.57723 3867.93216 8 1022.07160 1003.57723 9 -2229.03632 1022.07160 10 -1812.82501 -2229.03632 11 -3181.11425 -1812.82501 12 996.19066 -3181.11425 13 2265.00255 996.19066 14 -1729.53992 2265.00255 15 2204.33111 -1729.53992 16 -280.60313 2204.33111 17 1423.06865 -280.60313 18 1152.23878 1423.06865 19 2600.55581 1152.23878 20 2200.90210 2600.55581 21 -368.37970 2200.90210 22 -657.37902 -368.37970 23 -3566.36852 -657.37902 24 2335.73502 -3566.36852 25 2011.36605 2335.73502 26 2864.13998 2011.36605 27 5616.38013 2864.13998 28 46.26468 5616.38013 29 -2280.90215 46.26468 30 -1315.93663 -2280.90215 31 4576.21685 -1315.93663 32 -5290.88603 4576.21685 33 -1416.24636 -5290.88603 34 -4533.64325 -1416.24636 35 4637.44070 -4533.64325 36 -1399.19033 4637.44070 37 -2962.59027 -1399.19033 38 1366.15228 -2962.59027 39 743.39217 1366.15228 40 -7057.98972 743.39217 41 1971.93148 -7057.98972 42 1845.78084 1971.93148 43 -2914.08204 1845.78084 44 1633.95088 -2914.08204 45 -89.33650 1633.95088 46 3147.97815 -89.33650 47 -79.91483 3147.97815 48 -1783.44650 -79.91483 49 -3981.43690 -1783.44650 50 3264.09810 -3981.43690 51 -4106.57231 3264.09810 52 4011.38483 -4106.57231 53 325.69777 4011.38483 54 -5039.49484 325.69777 55 -5266.26785 -5039.49484 56 433.96144 -5266.26785 57 4102.99889 433.96144 58 3855.86913 4102.99889 59 2189.95690 3855.86913 60 46.37530 2189.95690 61 3929.01982 46.37530 62 -200.15080 3929.01982 63 -4244.31147 -200.15080 64 2677.26110 -4244.31147 65 -1974.69731 2677.26110 66 -510.52031 -1974.69731 67 NA -510.52031 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1261.36125 -195.66415 [2,] -5564.69964 -1261.36125 [3,] -213.21963 -5564.69964 [4,] 603.68224 -213.21963 [5,] 534.90156 603.68224 [6,] 3867.93216 534.90156 [7,] 1003.57723 3867.93216 [8,] 1022.07160 1003.57723 [9,] -2229.03632 1022.07160 [10,] -1812.82501 -2229.03632 [11,] -3181.11425 -1812.82501 [12,] 996.19066 -3181.11425 [13,] 2265.00255 996.19066 [14,] -1729.53992 2265.00255 [15,] 2204.33111 -1729.53992 [16,] -280.60313 2204.33111 [17,] 1423.06865 -280.60313 [18,] 1152.23878 1423.06865 [19,] 2600.55581 1152.23878 [20,] 2200.90210 2600.55581 [21,] -368.37970 2200.90210 [22,] -657.37902 -368.37970 [23,] -3566.36852 -657.37902 [24,] 2335.73502 -3566.36852 [25,] 2011.36605 2335.73502 [26,] 2864.13998 2011.36605 [27,] 5616.38013 2864.13998 [28,] 46.26468 5616.38013 [29,] -2280.90215 46.26468 [30,] -1315.93663 -2280.90215 [31,] 4576.21685 -1315.93663 [32,] -5290.88603 4576.21685 [33,] -1416.24636 -5290.88603 [34,] -4533.64325 -1416.24636 [35,] 4637.44070 -4533.64325 [36,] -1399.19033 4637.44070 [37,] -2962.59027 -1399.19033 [38,] 1366.15228 -2962.59027 [39,] 743.39217 1366.15228 [40,] -7057.98972 743.39217 [41,] 1971.93148 -7057.98972 [42,] 1845.78084 1971.93148 [43,] -2914.08204 1845.78084 [44,] 1633.95088 -2914.08204 [45,] -89.33650 1633.95088 [46,] 3147.97815 -89.33650 [47,] -79.91483 3147.97815 [48,] -1783.44650 -79.91483 [49,] -3981.43690 -1783.44650 [50,] 3264.09810 -3981.43690 [51,] -4106.57231 3264.09810 [52,] 4011.38483 -4106.57231 [53,] 325.69777 4011.38483 [54,] -5039.49484 325.69777 [55,] -5266.26785 -5039.49484 [56,] 433.96144 -5266.26785 [57,] 4102.99889 433.96144 [58,] 3855.86913 4102.99889 [59,] 2189.95690 3855.86913 [60,] 46.37530 2189.95690 [61,] 3929.01982 46.37530 [62,] -200.15080 3929.01982 [63,] -4244.31147 -200.15080 [64,] 2677.26110 -4244.31147 [65,] -1974.69731 2677.26110 [66,] -510.52031 -1974.69731 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1261.36125 -195.66415 2 -5564.69964 -1261.36125 3 -213.21963 -5564.69964 4 603.68224 -213.21963 5 534.90156 603.68224 6 3867.93216 534.90156 7 1003.57723 3867.93216 8 1022.07160 1003.57723 9 -2229.03632 1022.07160 10 -1812.82501 -2229.03632 11 -3181.11425 -1812.82501 12 996.19066 -3181.11425 13 2265.00255 996.19066 14 -1729.53992 2265.00255 15 2204.33111 -1729.53992 16 -280.60313 2204.33111 17 1423.06865 -280.60313 18 1152.23878 1423.06865 19 2600.55581 1152.23878 20 2200.90210 2600.55581 21 -368.37970 2200.90210 22 -657.37902 -368.37970 23 -3566.36852 -657.37902 24 2335.73502 -3566.36852 25 2011.36605 2335.73502 26 2864.13998 2011.36605 27 5616.38013 2864.13998 28 46.26468 5616.38013 29 -2280.90215 46.26468 30 -1315.93663 -2280.90215 31 4576.21685 -1315.93663 32 -5290.88603 4576.21685 33 -1416.24636 -5290.88603 34 -4533.64325 -1416.24636 35 4637.44070 -4533.64325 36 -1399.19033 4637.44070 37 -2962.59027 -1399.19033 38 1366.15228 -2962.59027 39 743.39217 1366.15228 40 -7057.98972 743.39217 41 1971.93148 -7057.98972 42 1845.78084 1971.93148 43 -2914.08204 1845.78084 44 1633.95088 -2914.08204 45 -89.33650 1633.95088 46 3147.97815 -89.33650 47 -79.91483 3147.97815 48 -1783.44650 -79.91483 49 -3981.43690 -1783.44650 50 3264.09810 -3981.43690 51 -4106.57231 3264.09810 52 4011.38483 -4106.57231 53 325.69777 4011.38483 54 -5039.49484 325.69777 55 -5266.26785 -5039.49484 56 433.96144 -5266.26785 57 4102.99889 433.96144 58 3855.86913 4102.99889 59 2189.95690 3855.86913 60 46.37530 2189.95690 61 3929.01982 46.37530 62 -200.15080 3929.01982 63 -4244.31147 -200.15080 64 2677.26110 -4244.31147 65 -1974.69731 2677.26110 66 -510.52031 -1974.69731 > 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/7f1a41258742250.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/8ptgf1258742250.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/9qbew1258742250.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/10hofn1258742250.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/11tu8r1258742250.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/12v6hf1258742250.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/13bftv1258742250.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/14e0911258742250.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/15e3f81258742250.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/162ogd1258742250.tab") + } > > system("convert tmp/1h1571258742250.ps tmp/1h1571258742250.png") > system("convert tmp/2i4lf1258742250.ps tmp/2i4lf1258742250.png") > system("convert tmp/398t81258742250.ps tmp/398t81258742250.png") > system("convert tmp/45w6d1258742250.ps tmp/45w6d1258742250.png") > system("convert tmp/5omku1258742250.ps tmp/5omku1258742250.png") > system("convert tmp/6czm21258742250.ps tmp/6czm21258742250.png") > system("convert tmp/7f1a41258742250.ps tmp/7f1a41258742250.png") > system("convert tmp/8ptgf1258742250.ps tmp/8ptgf1258742250.png") > system("convert tmp/9qbew1258742250.ps tmp/9qbew1258742250.png") > system("convert tmp/10hofn1258742250.ps tmp/10hofn1258742250.png") > > > proc.time() user system elapsed 2.569 1.625 5.759