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(2360 + ,2 + ,2267 + ,1746 + ,2214 + ,2 + ,2360 + ,2267 + ,2825 + ,2 + ,2214 + ,2360 + ,2355 + ,2 + ,2825 + ,2214 + ,2333 + ,2 + ,2355 + ,2825 + ,3016 + ,2 + ,2333 + ,2355 + ,2155 + ,2 + ,3016 + ,2333 + ,2172 + ,2 + ,2155 + ,3016 + ,2150 + ,2 + ,2172 + ,2155 + ,2533 + ,2 + ,2150 + ,2172 + ,2058 + ,2 + ,2533 + ,2150 + ,2160 + ,2 + ,2058 + ,2533 + ,2260 + ,2 + ,2160 + ,2058 + ,2498 + ,2 + ,2260 + ,2160 + ,2695 + ,2 + ,2498 + ,2260 + ,2799 + ,2 + ,2695 + ,2498 + ,2947 + ,2 + ,2799 + ,2695 + ,2930 + ,2 + ,2947 + ,2799 + ,2318 + ,2 + ,2930 + ,2947 + ,2540 + ,2 + ,2318 + ,2930 + ,2570 + ,2 + ,2540 + ,2318 + ,2669 + ,2 + ,2570 + ,2540 + ,2450 + ,2 + ,2669 + ,2570 + ,2842 + ,2 + ,2450 + ,2669 + ,3440 + ,2 + ,2842 + ,2450 + ,2678 + ,2 + ,3440 + ,2842 + ,2981 + ,2 + ,2678 + ,3440 + ,2260 + ,2.21 + ,2981 + ,2678 + ,2844 + ,2.25 + ,2260 + ,2981 + ,2546 + ,2.25 + ,2844 + ,2260 + ,2456 + ,2.45 + ,2546 + ,2844 + ,2295 + ,2.5 + ,2456 + ,2546 + ,2379 + ,2.5 + ,2295 + ,2456 + ,2479 + ,2.64 + ,2379 + ,2295 + ,2057 + ,2.75 + ,2479 + ,2379 + ,2280 + ,2.93 + ,2057 + ,2479 + ,2351 + ,3 + ,2280 + ,2057 + ,2276 + ,3.17 + ,2351 + ,2280 + ,2548 + ,3.25 + ,2276 + ,2351 + ,2311 + ,3.39 + ,2548 + ,2276 + ,2201 + ,3.5 + ,2311 + ,2548 + ,2725 + ,3.5 + ,2201 + ,2311 + ,2408 + ,3.65 + ,2725 + ,2201 + ,2139 + ,3.75 + ,2408 + ,2725 + ,1898 + ,3.75 + ,2139 + ,2408 + ,2537 + ,3.9 + ,1898 + ,2139 + ,2069 + ,4 + ,2537 + ,1898 + ,2063 + ,4 + ,2069 + ,2537 + ,2524 + ,4 + ,2063 + ,2069 + ,2437 + ,4 + ,2524 + ,2063 + ,2189 + ,4 + ,2437 + ,2524 + ,2793 + ,4 + ,2189 + ,2437 + ,2074 + ,4 + ,2793 + ,2189 + ,2622 + ,4 + ,2074 + ,2793 + ,2278 + ,4 + ,2622 + ,2074 + ,2144 + ,4 + ,2278 + ,2622 + ,2427 + ,4 + ,2144 + ,2278 + ,2139 + ,4 + ,2427 + ,2144 + ,1828 + ,4.18 + ,2139 + ,2427 + ,2072 + ,4.25 + ,1828 + ,2139 + ,1800 + ,4.25 + ,2072 + ,1828) + ,dim=c(4 + ,61) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2') + ,1:61)) > y <- array(NA,dim=c(4,61),dimnames=list(c('Y','X','Y1','Y2'),1:61)) > 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 2360 2.00 2267 1746 1 0 0 0 0 0 0 0 0 0 0 1 2 2214 2.00 2360 2267 0 1 0 0 0 0 0 0 0 0 0 2 3 2825 2.00 2214 2360 0 0 1 0 0 0 0 0 0 0 0 3 4 2355 2.00 2825 2214 0 0 0 1 0 0 0 0 0 0 0 4 5 2333 2.00 2355 2825 0 0 0 0 1 0 0 0 0 0 0 5 6 3016 2.00 2333 2355 0 0 0 0 0 1 0 0 0 0 0 6 7 2155 2.00 3016 2333 0 0 0 0 0 0 1 0 0 0 0 7 8 2172 2.00 2155 3016 0 0 0 0 0 0 0 1 0 0 0 8 9 2150 2.00 2172 2155 0 0 0 0 0 0 0 0 1 0 0 9 10 2533 2.00 2150 2172 0 0 0 0 0 0 0 0 0 1 0 10 11 2058 2.00 2533 2150 0 0 0 0 0 0 0 0 0 0 1 11 12 2160 2.00 2058 2533 0 0 0 0 0 0 0 0 0 0 0 12 13 2260 2.00 2160 2058 1 0 0 0 0 0 0 0 0 0 0 13 14 2498 2.00 2260 2160 0 1 0 0 0 0 0 0 0 0 0 14 15 2695 2.00 2498 2260 0 0 1 0 0 0 0 0 0 0 0 15 16 2799 2.00 2695 2498 0 0 0 1 0 0 0 0 0 0 0 16 17 2947 2.00 2799 2695 0 0 0 0 1 0 0 0 0 0 0 17 18 2930 2.00 2947 2799 0 0 0 0 0 1 0 0 0 0 0 18 19 2318 2.00 2930 2947 0 0 0 0 0 0 1 0 0 0 0 19 20 2540 2.00 2318 2930 0 0 0 0 0 0 0 1 0 0 0 20 21 2570 2.00 2540 2318 0 0 0 0 0 0 0 0 1 0 0 21 22 2669 2.00 2570 2540 0 0 0 0 0 0 0 0 0 1 0 22 23 2450 2.00 2669 2570 0 0 0 0 0 0 0 0 0 0 1 23 24 2842 2.00 2450 2669 0 0 0 0 0 0 0 0 0 0 0 24 25 3440 2.00 2842 2450 1 0 0 0 0 0 0 0 0 0 0 25 26 2678 2.00 3440 2842 0 1 0 0 0 0 0 0 0 0 0 26 27 2981 2.00 2678 3440 0 0 1 0 0 0 0 0 0 0 0 27 28 2260 2.21 2981 2678 0 0 0 1 0 0 0 0 0 0 0 28 29 2844 2.25 2260 2981 0 0 0 0 1 0 0 0 0 0 0 29 30 2546 2.25 2844 2260 0 0 0 0 0 1 0 0 0 0 0 30 31 2456 2.45 2546 2844 0 0 0 0 0 0 1 0 0 0 0 31 32 2295 2.50 2456 2546 0 0 0 0 0 0 0 1 0 0 0 32 33 2379 2.50 2295 2456 0 0 0 0 0 0 0 0 1 0 0 33 34 2479 2.64 2379 2295 0 0 0 0 0 0 0 0 0 1 0 34 35 2057 2.75 2479 2379 0 0 0 0 0 0 0 0 0 0 1 35 36 2280 2.93 2057 2479 0 0 0 0 0 0 0 0 0 0 0 36 37 2351 3.00 2280 2057 1 0 0 0 0 0 0 0 0 0 0 37 38 2276 3.17 2351 2280 0 1 0 0 0 0 0 0 0 0 0 38 39 2548 3.25 2276 2351 0 0 1 0 0 0 0 0 0 0 0 39 40 2311 3.39 2548 2276 0 0 0 1 0 0 0 0 0 0 0 40 41 2201 3.50 2311 2548 0 0 0 0 1 0 0 0 0 0 0 41 42 2725 3.50 2201 2311 0 0 0 0 0 1 0 0 0 0 0 42 43 2408 3.65 2725 2201 0 0 0 0 0 0 1 0 0 0 0 43 44 2139 3.75 2408 2725 0 0 0 0 0 0 0 1 0 0 0 44 45 1898 3.75 2139 2408 0 0 0 0 0 0 0 0 1 0 0 45 46 2537 3.90 1898 2139 0 0 0 0 0 0 0 0 0 1 0 46 47 2069 4.00 2537 1898 0 0 0 0 0 0 0 0 0 0 1 47 48 2063 4.00 2069 2537 0 0 0 0 0 0 0 0 0 0 0 48 49 2524 4.00 2063 2069 1 0 0 0 0 0 0 0 0 0 0 49 50 2437 4.00 2524 2063 0 1 0 0 0 0 0 0 0 0 0 50 51 2189 4.00 2437 2524 0 0 1 0 0 0 0 0 0 0 0 51 52 2793 4.00 2189 2437 0 0 0 1 0 0 0 0 0 0 0 52 53 2074 4.00 2793 2189 0 0 0 0 1 0 0 0 0 0 0 53 54 2622 4.00 2074 2793 0 0 0 0 0 1 0 0 0 0 0 54 55 2278 4.00 2622 2074 0 0 0 0 0 0 1 0 0 0 0 55 56 2144 4.00 2278 2622 0 0 0 0 0 0 0 1 0 0 0 56 57 2427 4.00 2144 2278 0 0 0 0 0 0 0 0 1 0 0 57 58 2139 4.00 2427 2144 0 0 0 0 0 0 0 0 0 1 0 58 59 1828 4.18 2139 2427 0 0 0 0 0 0 0 0 0 0 1 59 60 2072 4.25 1828 2139 0 0 0 0 0 0 0 0 0 0 0 60 61 1800 4.25 2072 1828 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 M1 M2 2.433e+03 -3.151e+02 -1.258e-03 1.771e-01 2.509e+02 1.407e+02 M3 M4 M5 M6 M7 M8 3.154e+02 2.129e+02 1.478e+02 4.510e+02 2.248e+01 -9.496e+01 M9 M10 M11 t 2.392e-01 2.063e+02 -1.629e+02 1.032e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -495.72 -148.88 -33.33 142.41 697.50 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.433e+03 7.516e+02 3.238 0.00227 ** X -3.151e+02 1.487e+02 -2.119 0.03968 * Y1 -1.258e-03 1.626e-01 -0.008 0.99386 Y2 1.771e-01 1.635e-01 1.083 0.28443 M1 2.509e+02 1.674e+02 1.499 0.14085 M2 1.407e+02 1.776e+02 0.792 0.43225 M3 3.154e+02 1.674e+02 1.884 0.06610 . M4 2.129e+02 1.814e+02 1.173 0.24685 M5 1.478e+02 1.744e+02 0.847 0.40123 M6 4.510e+02 1.683e+02 2.679 0.01028 * M7 2.248e+01 1.910e+02 0.118 0.90683 M8 -9.496e+01 1.689e+02 -0.562 0.57666 M9 2.392e-01 1.610e+02 0.001 0.99882 M10 2.063e+02 1.635e+02 1.262 0.21345 M11 -1.629e+02 1.702e+02 -0.957 0.34367 t 1.032e+01 6.705e+00 1.538 0.13096 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 248.4 on 45 degrees of freedom Multiple R-squared: 0.5442, Adjusted R-squared: 0.3922 F-statistic: 3.581 on 15 and 45 DF, p-value: 0.0004559 > 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.62305651 0.7538870 0.3769435 [2,] 0.45893028 0.9178606 0.5410697 [3,] 0.36310612 0.7262122 0.6368939 [4,] 0.23681690 0.4736338 0.7631831 [5,] 0.17917826 0.3583565 0.8208217 [6,] 0.22076587 0.4415317 0.7792341 [7,] 0.74515871 0.5096826 0.2548413 [8,] 0.75657768 0.4868446 0.2434223 [9,] 0.79001478 0.4199704 0.2099852 [10,] 0.71825591 0.5634882 0.2817441 [11,] 0.82261967 0.3547607 0.1773803 [12,] 0.79866808 0.4026638 0.2013319 [13,] 0.84851955 0.3029609 0.1514805 [14,] 0.78557489 0.4288502 0.2144251 [15,] 0.71149691 0.5770062 0.2885031 [16,] 0.61835889 0.7632822 0.3816411 [17,] 0.51172139 0.9765572 0.4882786 [18,] 0.42872607 0.8574521 0.5712739 [19,] 0.39219977 0.7843995 0.6078002 [20,] 0.29941023 0.5988205 0.7005898 [21,] 0.27879021 0.5575804 0.7212098 [22,] 0.23025768 0.4605154 0.7697423 [23,] 0.13660367 0.2732073 0.8633963 [24,] 0.07747479 0.1549496 0.9225252 > postscript(file="/var/www/html/rcomp/tmp/15vqg1258655144.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/2y6tl1258655144.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/3je4f1258655144.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/43sbk1258655144.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/5q78d1258655144.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 = 61 Frequency = 1 1 2 3 4 5 6 -10.944083 -149.260739 260.122092 -91.063637 -167.150390 285.601644 7 8 9 10 11 12 -152.475316 -150.424195 -125.392614 38.145656 -73.538214 -213.204314 13 14 15 16 17 18 -290.132472 29.784077 24.410134 178.679132 346.653403 -2.062732 19 20 21 22 23 24 -222.135530 109.231522 142.411602 -14.299726 120.447378 321.413062 25 26 27 28 29 30 697.500347 -33.328881 -22.180264 -449.465764 147.295705 -335.725850 31 32 33 34 35 36 -48.373333 -33.817478 -39.589881 -83.275748 -126.435140 -38.188724 37 38 39 40 41 42 -131.298183 -92.290253 7.285086 -79.794285 -148.876984 103.489164 43 44 45 46 47 48 272.062126 48.471568 -242.224486 274.963211 240.904014 -52.102788 49 50 51 52 53 54 230.593113 245.095795 -269.637048 441.644554 -177.921734 -51.302226 55 56 57 58 59 60 150.922053 26.538584 264.795379 -215.533392 -161.378038 -17.917236 61 -495.718723 > postscript(file="/var/www/html/rcomp/tmp/6t6861258655144.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -10.944083 NA 1 -149.260739 -10.944083 2 260.122092 -149.260739 3 -91.063637 260.122092 4 -167.150390 -91.063637 5 285.601644 -167.150390 6 -152.475316 285.601644 7 -150.424195 -152.475316 8 -125.392614 -150.424195 9 38.145656 -125.392614 10 -73.538214 38.145656 11 -213.204314 -73.538214 12 -290.132472 -213.204314 13 29.784077 -290.132472 14 24.410134 29.784077 15 178.679132 24.410134 16 346.653403 178.679132 17 -2.062732 346.653403 18 -222.135530 -2.062732 19 109.231522 -222.135530 20 142.411602 109.231522 21 -14.299726 142.411602 22 120.447378 -14.299726 23 321.413062 120.447378 24 697.500347 321.413062 25 -33.328881 697.500347 26 -22.180264 -33.328881 27 -449.465764 -22.180264 28 147.295705 -449.465764 29 -335.725850 147.295705 30 -48.373333 -335.725850 31 -33.817478 -48.373333 32 -39.589881 -33.817478 33 -83.275748 -39.589881 34 -126.435140 -83.275748 35 -38.188724 -126.435140 36 -131.298183 -38.188724 37 -92.290253 -131.298183 38 7.285086 -92.290253 39 -79.794285 7.285086 40 -148.876984 -79.794285 41 103.489164 -148.876984 42 272.062126 103.489164 43 48.471568 272.062126 44 -242.224486 48.471568 45 274.963211 -242.224486 46 240.904014 274.963211 47 -52.102788 240.904014 48 230.593113 -52.102788 49 245.095795 230.593113 50 -269.637048 245.095795 51 441.644554 -269.637048 52 -177.921734 441.644554 53 -51.302226 -177.921734 54 150.922053 -51.302226 55 26.538584 150.922053 56 264.795379 26.538584 57 -215.533392 264.795379 58 -161.378038 -215.533392 59 -17.917236 -161.378038 60 -495.718723 -17.917236 61 NA -495.718723 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -149.260739 -10.944083 [2,] 260.122092 -149.260739 [3,] -91.063637 260.122092 [4,] -167.150390 -91.063637 [5,] 285.601644 -167.150390 [6,] -152.475316 285.601644 [7,] -150.424195 -152.475316 [8,] -125.392614 -150.424195 [9,] 38.145656 -125.392614 [10,] -73.538214 38.145656 [11,] -213.204314 -73.538214 [12,] -290.132472 -213.204314 [13,] 29.784077 -290.132472 [14,] 24.410134 29.784077 [15,] 178.679132 24.410134 [16,] 346.653403 178.679132 [17,] -2.062732 346.653403 [18,] -222.135530 -2.062732 [19,] 109.231522 -222.135530 [20,] 142.411602 109.231522 [21,] -14.299726 142.411602 [22,] 120.447378 -14.299726 [23,] 321.413062 120.447378 [24,] 697.500347 321.413062 [25,] -33.328881 697.500347 [26,] -22.180264 -33.328881 [27,] -449.465764 -22.180264 [28,] 147.295705 -449.465764 [29,] -335.725850 147.295705 [30,] -48.373333 -335.725850 [31,] -33.817478 -48.373333 [32,] -39.589881 -33.817478 [33,] -83.275748 -39.589881 [34,] -126.435140 -83.275748 [35,] -38.188724 -126.435140 [36,] -131.298183 -38.188724 [37,] -92.290253 -131.298183 [38,] 7.285086 -92.290253 [39,] -79.794285 7.285086 [40,] -148.876984 -79.794285 [41,] 103.489164 -148.876984 [42,] 272.062126 103.489164 [43,] 48.471568 272.062126 [44,] -242.224486 48.471568 [45,] 274.963211 -242.224486 [46,] 240.904014 274.963211 [47,] -52.102788 240.904014 [48,] 230.593113 -52.102788 [49,] 245.095795 230.593113 [50,] -269.637048 245.095795 [51,] 441.644554 -269.637048 [52,] -177.921734 441.644554 [53,] -51.302226 -177.921734 [54,] 150.922053 -51.302226 [55,] 26.538584 150.922053 [56,] 264.795379 26.538584 [57,] -215.533392 264.795379 [58,] -161.378038 -215.533392 [59,] -17.917236 -161.378038 [60,] -495.718723 -17.917236 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -149.260739 -10.944083 2 260.122092 -149.260739 3 -91.063637 260.122092 4 -167.150390 -91.063637 5 285.601644 -167.150390 6 -152.475316 285.601644 7 -150.424195 -152.475316 8 -125.392614 -150.424195 9 38.145656 -125.392614 10 -73.538214 38.145656 11 -213.204314 -73.538214 12 -290.132472 -213.204314 13 29.784077 -290.132472 14 24.410134 29.784077 15 178.679132 24.410134 16 346.653403 178.679132 17 -2.062732 346.653403 18 -222.135530 -2.062732 19 109.231522 -222.135530 20 142.411602 109.231522 21 -14.299726 142.411602 22 120.447378 -14.299726 23 321.413062 120.447378 24 697.500347 321.413062 25 -33.328881 697.500347 26 -22.180264 -33.328881 27 -449.465764 -22.180264 28 147.295705 -449.465764 29 -335.725850 147.295705 30 -48.373333 -335.725850 31 -33.817478 -48.373333 32 -39.589881 -33.817478 33 -83.275748 -39.589881 34 -126.435140 -83.275748 35 -38.188724 -126.435140 36 -131.298183 -38.188724 37 -92.290253 -131.298183 38 7.285086 -92.290253 39 -79.794285 7.285086 40 -148.876984 -79.794285 41 103.489164 -148.876984 42 272.062126 103.489164 43 48.471568 272.062126 44 -242.224486 48.471568 45 274.963211 -242.224486 46 240.904014 274.963211 47 -52.102788 240.904014 48 230.593113 -52.102788 49 245.095795 230.593113 50 -269.637048 245.095795 51 441.644554 -269.637048 52 -177.921734 441.644554 53 -51.302226 -177.921734 54 150.922053 -51.302226 55 26.538584 150.922053 56 264.795379 26.538584 57 -215.533392 264.795379 58 -161.378038 -215.533392 59 -17.917236 -161.378038 60 -495.718723 -17.917236 > 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/7uebi1258655144.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/8e3v81258655144.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/9q0dl1258655144.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/10r93i1258655144.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/11az4s1258655144.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/12vrww1258655144.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/13r9p21258655145.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/14lfpk1258655145.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/15labk1258655145.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/16gucc1258655145.tab") + } > system("convert tmp/15vqg1258655144.ps tmp/15vqg1258655144.png") > system("convert tmp/2y6tl1258655144.ps tmp/2y6tl1258655144.png") > system("convert tmp/3je4f1258655144.ps tmp/3je4f1258655144.png") > system("convert tmp/43sbk1258655144.ps tmp/43sbk1258655144.png") > system("convert tmp/5q78d1258655144.ps tmp/5q78d1258655144.png") > system("convert tmp/6t6861258655144.ps tmp/6t6861258655144.png") > system("convert tmp/7uebi1258655144.ps tmp/7uebi1258655144.png") > system("convert tmp/8e3v81258655144.ps tmp/8e3v81258655144.png") > system("convert tmp/9q0dl1258655144.ps tmp/9q0dl1258655144.png") > system("convert tmp/10r93i1258655144.ps tmp/10r93i1258655144.png") > > > proc.time() user system elapsed 2.463 1.615 7.848