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(0.6348,1.5291,0.634,1.5358,0.62915,1.5355,0.62168,1.5287,0.61328,1.5334,0.6089,1.5225,0.60857,1.5135,0.62672,1.5144,0.62291,1.4913,0.62393,1.4793,0.61838,1.4663,0.62012,1.4749,0.61659,1.4745,0.6116,1.4775,0.61573,1.4678,0.61407,1.4658,0.62823,1.4572,0.64405,1.4721,0.6387,1.4624,0.63633,1.4636,0.63059,1.4649,0.62994,1.465,0.63709,1.4673,0.64217,1.4679,0.65711,1.4621,0.66977,1.4674,0.68255,1.4695,0.68902,1.4964,0.71322,1.5155,0.70224,1.5411,0.70045,1.5476,0.69919,1.54,0.69693,1.5474,0.69763,1.5485,0.69278,1.559,0.70196,1.5544,0.69215,1.5657,0.6769,1.5734,0.67124,1.567,0.66532,1.5547,0.67157,1.54,0.66428,1.5192,0.66576,1.527,0.66942,1.5387,0.6813,1.5431,0.69144,1.5426,0.69862,1.5216,0.695,1.5364,0.69867,1.5469,0.68968,1.5501,0.69233,1.5494,0.68293,1.5475,0.68399,1.5448,0.66895,1.5391,0.68756,1.5578,0.68527,1.5528,0.6776,1.5496,0.68137,1.549,0.67933,1.5449,0.67922,1.5479),dim=c(2,60),dimnames=list(c('Britse_pond','Zwitserse_frank'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Britse_pond','Zwitserse_frank'),1:60)) > 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 Britse_pond Zwitserse_frank M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 0.63480 1.5291 1 0 0 0 0 0 0 0 0 0 0 1 2 0.63400 1.5358 0 1 0 0 0 0 0 0 0 0 0 2 3 0.62915 1.5355 0 0 1 0 0 0 0 0 0 0 0 3 4 0.62168 1.5287 0 0 0 1 0 0 0 0 0 0 0 4 5 0.61328 1.5334 0 0 0 0 1 0 0 0 0 0 0 5 6 0.60890 1.5225 0 0 0 0 0 1 0 0 0 0 0 6 7 0.60857 1.5135 0 0 0 0 0 0 1 0 0 0 0 7 8 0.62672 1.5144 0 0 0 0 0 0 0 1 0 0 0 8 9 0.62291 1.4913 0 0 0 0 0 0 0 0 1 0 0 9 10 0.62393 1.4793 0 0 0 0 0 0 0 0 0 1 0 10 11 0.61838 1.4663 0 0 0 0 0 0 0 0 0 0 1 11 12 0.62012 1.4749 0 0 0 0 0 0 0 0 0 0 0 12 13 0.61659 1.4745 1 0 0 0 0 0 0 0 0 0 0 13 14 0.61160 1.4775 0 1 0 0 0 0 0 0 0 0 0 14 15 0.61573 1.4678 0 0 1 0 0 0 0 0 0 0 0 15 16 0.61407 1.4658 0 0 0 1 0 0 0 0 0 0 0 16 17 0.62823 1.4572 0 0 0 0 1 0 0 0 0 0 0 17 18 0.64405 1.4721 0 0 0 0 0 1 0 0 0 0 0 18 19 0.63870 1.4624 0 0 0 0 0 0 1 0 0 0 0 19 20 0.63633 1.4636 0 0 0 0 0 0 0 1 0 0 0 20 21 0.63059 1.4649 0 0 0 0 0 0 0 0 1 0 0 21 22 0.62994 1.4650 0 0 0 0 0 0 0 0 0 1 0 22 23 0.63709 1.4673 0 0 0 0 0 0 0 0 0 0 1 23 24 0.64217 1.4679 0 0 0 0 0 0 0 0 0 0 0 24 25 0.65711 1.4621 1 0 0 0 0 0 0 0 0 0 0 25 26 0.66977 1.4674 0 1 0 0 0 0 0 0 0 0 0 26 27 0.68255 1.4695 0 0 1 0 0 0 0 0 0 0 0 27 28 0.68902 1.4964 0 0 0 1 0 0 0 0 0 0 0 28 29 0.71322 1.5155 0 0 0 0 1 0 0 0 0 0 0 29 30 0.70224 1.5411 0 0 0 0 0 1 0 0 0 0 0 30 31 0.70045 1.5476 0 0 0 0 0 0 1 0 0 0 0 31 32 0.69919 1.5400 0 0 0 0 0 0 0 1 0 0 0 32 33 0.69693 1.5474 0 0 0 0 0 0 0 0 1 0 0 33 34 0.69763 1.5485 0 0 0 0 0 0 0 0 0 1 0 34 35 0.69278 1.5590 0 0 0 0 0 0 0 0 0 0 1 35 36 0.70196 1.5544 0 0 0 0 0 0 0 0 0 0 0 36 37 0.69215 1.5657 1 0 0 0 0 0 0 0 0 0 0 37 38 0.67690 1.5734 0 1 0 0 0 0 0 0 0 0 0 38 39 0.67124 1.5670 0 0 1 0 0 0 0 0 0 0 0 39 40 0.66532 1.5547 0 0 0 1 0 0 0 0 0 0 0 40 41 0.67157 1.5400 0 0 0 0 1 0 0 0 0 0 0 41 42 0.66428 1.5192 0 0 0 0 0 1 0 0 0 0 0 42 43 0.66576 1.5270 0 0 0 0 0 0 1 0 0 0 0 43 44 0.66942 1.5387 0 0 0 0 0 0 0 1 0 0 0 44 45 0.68130 1.5431 0 0 0 0 0 0 0 0 1 0 0 45 46 0.69144 1.5426 0 0 0 0 0 0 0 0 0 1 0 46 47 0.69862 1.5216 0 0 0 0 0 0 0 0 0 0 1 47 48 0.69500 1.5364 0 0 0 0 0 0 0 0 0 0 0 48 49 0.69867 1.5469 1 0 0 0 0 0 0 0 0 0 0 49 50 0.68968 1.5501 0 1 0 0 0 0 0 0 0 0 0 50 51 0.69233 1.5494 0 0 1 0 0 0 0 0 0 0 0 51 52 0.68293 1.5475 0 0 0 1 0 0 0 0 0 0 0 52 53 0.68399 1.5448 0 0 0 0 1 0 0 0 0 0 0 53 54 0.66895 1.5391 0 0 0 0 0 1 0 0 0 0 0 54 55 0.68756 1.5578 0 0 0 0 0 0 1 0 0 0 0 55 56 0.68527 1.5528 0 0 0 0 0 0 0 1 0 0 0 56 57 0.67760 1.5496 0 0 0 0 0 0 0 0 1 0 0 57 58 0.68137 1.5490 0 0 0 0 0 0 0 0 0 1 0 58 59 0.67933 1.5449 0 0 0 0 0 0 0 0 0 0 1 59 60 0.67922 1.5479 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Zwitserse_frank M1 M2 0.2611413 0.2410007 0.0048897 -0.0009750 M3 M4 M5 M6 0.0004157 -0.0045106 0.0019071 -0.0037586 M7 M8 M9 M10 -0.0030662 -0.0010884 -0.0031144 -0.0006872 M11 t -0.0002320 0.0011423 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.025031 -0.011767 -0.005113 0.007192 0.051808 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.2611413 0.1380323 1.892 0.0648 . Zwitserse_frank 0.2410007 0.0935795 2.575 0.0133 * M1 0.0048897 0.0132631 0.369 0.7141 M2 -0.0009750 0.0132830 -0.073 0.9418 M3 0.0004157 0.0132225 0.031 0.9751 M4 -0.0045106 0.0132023 -0.342 0.7342 M5 0.0019071 0.0131750 0.145 0.8855 M6 -0.0037586 0.0131582 -0.286 0.7764 M7 -0.0030662 0.0131594 -0.233 0.8168 M8 -0.0010884 0.0131432 -0.083 0.9344 M9 -0.0031144 0.0131138 -0.237 0.8133 M10 -0.0006872 0.0130970 -0.052 0.9584 M11 -0.0002320 0.0130943 -0.018 0.9859 t 0.0011423 0.0001975 5.785 6.07e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.0207 on 46 degrees of freedom Multiple R-squared: 0.6698, Adjusted R-squared: 0.5765 F-statistic: 7.178 on 13 and 46 DF, p-value: 2.326e-07 > 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.04137849 0.08275699 0.95862151 [2,] 0.57010417 0.85979166 0.42989583 [3,] 0.55087020 0.89825960 0.44912980 [4,] 0.42783544 0.85567089 0.57216456 [5,] 0.35934017 0.71868034 0.64065983 [6,] 0.33916971 0.67833942 0.66083029 [7,] 0.34471139 0.68942278 0.65528861 [8,] 0.42856460 0.85712920 0.57143540 [9,] 0.50794172 0.98411655 0.49205828 [10,] 0.59066324 0.81867352 0.40933676 [11,] 0.67516301 0.64967398 0.32483699 [12,] 0.62644885 0.74710230 0.37355115 [13,] 0.67289167 0.65421667 0.32710833 [14,] 0.76473398 0.47053204 0.23526602 [15,] 0.78789057 0.42421886 0.21210943 [16,] 0.80634728 0.38730544 0.19365272 [17,] 0.82202324 0.35595352 0.17797676 [18,] 0.80709768 0.38580464 0.19290232 [19,] 0.79383590 0.41232819 0.20616410 [20,] 0.86163782 0.27672437 0.13836218 [21,] 0.87057656 0.25884687 0.12942344 [22,] 0.88943069 0.22113861 0.11056931 [23,] 0.90219293 0.19561414 0.09780707 [24,] 0.91559633 0.16880734 0.08440367 [25,] 0.91623685 0.16752630 0.08376315 [26,] 0.84924793 0.30150414 0.15075207 [27,] 0.84637669 0.30724661 0.15362331 > postscript(file="/var/www/html/rcomp/tmp/1wlth1258707809.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/21ozf1258707809.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/3ujjf1258707809.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/4yg921258707809.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/52qxl1258707809.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 = 60 Frequency = 1 1 2 3 4 5 -8.875317e-04 1.420147e-03 -5.890555e-03 -7.937769e-03 -2.503051e-02 6 7 8 9 10 -2.226018e-02 -2.225592e-02 -7.442977e-03 -4.802102e-03 -4.459675e-03 11 12 13 14 15 -8.474129e-03 -1.018105e-02 -1.964665e-02 -2.063727e-02 -1.670256e-02 16 17 18 19 20 -1.409658e-02 -5.424017e-03 1.132849e-02 6.481462e-03 7.021010e-04 21 22 23 24 25 -4.467442e-03 -8.711124e-03 -3.712889e-03 -1.518062e-04 1.015400e-02 26 27 28 29 30 2.625908e-02 3.599997e-02 3.977104e-02 5.180788e-02 3.918168e-02 31 32 33 34 35 3.399044e-02 3.144189e-02 2.828224e-02 2.514756e-02 1.616959e-02 36 37 38 39 40 2.508387e-02 6.518565e-03 -5.864757e-03 -1.251535e-02 -1.168706e-02 41 42 43 44 45 -9.454395e-03 -7.208159e-03 -9.442703e-03 -1.172257e-02 -1.921616e-05 46 47 48 49 50 6.671702e-03 1.731525e-02 8.754127e-03 3.861620e-03 -1.177199e-03 51 52 53 54 55 -8.915007e-04 -6.049619e-03 -1.189896e-02 -2.104183e-02 -8.773284e-03 56 57 58 59 60 -1.297844e-02 -1.899348e-02 -1.864846e-02 -2.129782e-02 -2.350514e-02 > postscript(file="/var/www/html/rcomp/tmp/69bxd1258707809.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -8.875317e-04 NA 1 1.420147e-03 -8.875317e-04 2 -5.890555e-03 1.420147e-03 3 -7.937769e-03 -5.890555e-03 4 -2.503051e-02 -7.937769e-03 5 -2.226018e-02 -2.503051e-02 6 -2.225592e-02 -2.226018e-02 7 -7.442977e-03 -2.225592e-02 8 -4.802102e-03 -7.442977e-03 9 -4.459675e-03 -4.802102e-03 10 -8.474129e-03 -4.459675e-03 11 -1.018105e-02 -8.474129e-03 12 -1.964665e-02 -1.018105e-02 13 -2.063727e-02 -1.964665e-02 14 -1.670256e-02 -2.063727e-02 15 -1.409658e-02 -1.670256e-02 16 -5.424017e-03 -1.409658e-02 17 1.132849e-02 -5.424017e-03 18 6.481462e-03 1.132849e-02 19 7.021010e-04 6.481462e-03 20 -4.467442e-03 7.021010e-04 21 -8.711124e-03 -4.467442e-03 22 -3.712889e-03 -8.711124e-03 23 -1.518062e-04 -3.712889e-03 24 1.015400e-02 -1.518062e-04 25 2.625908e-02 1.015400e-02 26 3.599997e-02 2.625908e-02 27 3.977104e-02 3.599997e-02 28 5.180788e-02 3.977104e-02 29 3.918168e-02 5.180788e-02 30 3.399044e-02 3.918168e-02 31 3.144189e-02 3.399044e-02 32 2.828224e-02 3.144189e-02 33 2.514756e-02 2.828224e-02 34 1.616959e-02 2.514756e-02 35 2.508387e-02 1.616959e-02 36 6.518565e-03 2.508387e-02 37 -5.864757e-03 6.518565e-03 38 -1.251535e-02 -5.864757e-03 39 -1.168706e-02 -1.251535e-02 40 -9.454395e-03 -1.168706e-02 41 -7.208159e-03 -9.454395e-03 42 -9.442703e-03 -7.208159e-03 43 -1.172257e-02 -9.442703e-03 44 -1.921616e-05 -1.172257e-02 45 6.671702e-03 -1.921616e-05 46 1.731525e-02 6.671702e-03 47 8.754127e-03 1.731525e-02 48 3.861620e-03 8.754127e-03 49 -1.177199e-03 3.861620e-03 50 -8.915007e-04 -1.177199e-03 51 -6.049619e-03 -8.915007e-04 52 -1.189896e-02 -6.049619e-03 53 -2.104183e-02 -1.189896e-02 54 -8.773284e-03 -2.104183e-02 55 -1.297844e-02 -8.773284e-03 56 -1.899348e-02 -1.297844e-02 57 -1.864846e-02 -1.899348e-02 58 -2.129782e-02 -1.864846e-02 59 -2.350514e-02 -2.129782e-02 60 NA -2.350514e-02 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.420147e-03 -8.875317e-04 [2,] -5.890555e-03 1.420147e-03 [3,] -7.937769e-03 -5.890555e-03 [4,] -2.503051e-02 -7.937769e-03 [5,] -2.226018e-02 -2.503051e-02 [6,] -2.225592e-02 -2.226018e-02 [7,] -7.442977e-03 -2.225592e-02 [8,] -4.802102e-03 -7.442977e-03 [9,] -4.459675e-03 -4.802102e-03 [10,] -8.474129e-03 -4.459675e-03 [11,] -1.018105e-02 -8.474129e-03 [12,] -1.964665e-02 -1.018105e-02 [13,] -2.063727e-02 -1.964665e-02 [14,] -1.670256e-02 -2.063727e-02 [15,] -1.409658e-02 -1.670256e-02 [16,] -5.424017e-03 -1.409658e-02 [17,] 1.132849e-02 -5.424017e-03 [18,] 6.481462e-03 1.132849e-02 [19,] 7.021010e-04 6.481462e-03 [20,] -4.467442e-03 7.021010e-04 [21,] -8.711124e-03 -4.467442e-03 [22,] -3.712889e-03 -8.711124e-03 [23,] -1.518062e-04 -3.712889e-03 [24,] 1.015400e-02 -1.518062e-04 [25,] 2.625908e-02 1.015400e-02 [26,] 3.599997e-02 2.625908e-02 [27,] 3.977104e-02 3.599997e-02 [28,] 5.180788e-02 3.977104e-02 [29,] 3.918168e-02 5.180788e-02 [30,] 3.399044e-02 3.918168e-02 [31,] 3.144189e-02 3.399044e-02 [32,] 2.828224e-02 3.144189e-02 [33,] 2.514756e-02 2.828224e-02 [34,] 1.616959e-02 2.514756e-02 [35,] 2.508387e-02 1.616959e-02 [36,] 6.518565e-03 2.508387e-02 [37,] -5.864757e-03 6.518565e-03 [38,] -1.251535e-02 -5.864757e-03 [39,] -1.168706e-02 -1.251535e-02 [40,] -9.454395e-03 -1.168706e-02 [41,] -7.208159e-03 -9.454395e-03 [42,] -9.442703e-03 -7.208159e-03 [43,] -1.172257e-02 -9.442703e-03 [44,] -1.921616e-05 -1.172257e-02 [45,] 6.671702e-03 -1.921616e-05 [46,] 1.731525e-02 6.671702e-03 [47,] 8.754127e-03 1.731525e-02 [48,] 3.861620e-03 8.754127e-03 [49,] -1.177199e-03 3.861620e-03 [50,] -8.915007e-04 -1.177199e-03 [51,] -6.049619e-03 -8.915007e-04 [52,] -1.189896e-02 -6.049619e-03 [53,] -2.104183e-02 -1.189896e-02 [54,] -8.773284e-03 -2.104183e-02 [55,] -1.297844e-02 -8.773284e-03 [56,] -1.899348e-02 -1.297844e-02 [57,] -1.864846e-02 -1.899348e-02 [58,] -2.129782e-02 -1.864846e-02 [59,] -2.350514e-02 -2.129782e-02 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.420147e-03 -8.875317e-04 2 -5.890555e-03 1.420147e-03 3 -7.937769e-03 -5.890555e-03 4 -2.503051e-02 -7.937769e-03 5 -2.226018e-02 -2.503051e-02 6 -2.225592e-02 -2.226018e-02 7 -7.442977e-03 -2.225592e-02 8 -4.802102e-03 -7.442977e-03 9 -4.459675e-03 -4.802102e-03 10 -8.474129e-03 -4.459675e-03 11 -1.018105e-02 -8.474129e-03 12 -1.964665e-02 -1.018105e-02 13 -2.063727e-02 -1.964665e-02 14 -1.670256e-02 -2.063727e-02 15 -1.409658e-02 -1.670256e-02 16 -5.424017e-03 -1.409658e-02 17 1.132849e-02 -5.424017e-03 18 6.481462e-03 1.132849e-02 19 7.021010e-04 6.481462e-03 20 -4.467442e-03 7.021010e-04 21 -8.711124e-03 -4.467442e-03 22 -3.712889e-03 -8.711124e-03 23 -1.518062e-04 -3.712889e-03 24 1.015400e-02 -1.518062e-04 25 2.625908e-02 1.015400e-02 26 3.599997e-02 2.625908e-02 27 3.977104e-02 3.599997e-02 28 5.180788e-02 3.977104e-02 29 3.918168e-02 5.180788e-02 30 3.399044e-02 3.918168e-02 31 3.144189e-02 3.399044e-02 32 2.828224e-02 3.144189e-02 33 2.514756e-02 2.828224e-02 34 1.616959e-02 2.514756e-02 35 2.508387e-02 1.616959e-02 36 6.518565e-03 2.508387e-02 37 -5.864757e-03 6.518565e-03 38 -1.251535e-02 -5.864757e-03 39 -1.168706e-02 -1.251535e-02 40 -9.454395e-03 -1.168706e-02 41 -7.208159e-03 -9.454395e-03 42 -9.442703e-03 -7.208159e-03 43 -1.172257e-02 -9.442703e-03 44 -1.921616e-05 -1.172257e-02 45 6.671702e-03 -1.921616e-05 46 1.731525e-02 6.671702e-03 47 8.754127e-03 1.731525e-02 48 3.861620e-03 8.754127e-03 49 -1.177199e-03 3.861620e-03 50 -8.915007e-04 -1.177199e-03 51 -6.049619e-03 -8.915007e-04 52 -1.189896e-02 -6.049619e-03 53 -2.104183e-02 -1.189896e-02 54 -8.773284e-03 -2.104183e-02 55 -1.297844e-02 -8.773284e-03 56 -1.899348e-02 -1.297844e-02 57 -1.864846e-02 -1.899348e-02 58 -2.129782e-02 -1.864846e-02 59 -2.350514e-02 -2.129782e-02 > 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/7o1qm1258707809.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/8r2fj1258707809.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/925bc1258707809.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/10i2lt1258707809.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/113y6w1258707809.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/12yhml1258707809.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/13zg8b1258707809.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/14nbfq1258707809.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/15moyb1258707809.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/16x4z91258707809.tab") + } > > system("convert tmp/1wlth1258707809.ps tmp/1wlth1258707809.png") > system("convert tmp/21ozf1258707809.ps tmp/21ozf1258707809.png") > system("convert tmp/3ujjf1258707809.ps tmp/3ujjf1258707809.png") > system("convert tmp/4yg921258707809.ps tmp/4yg921258707809.png") > system("convert tmp/52qxl1258707809.ps tmp/52qxl1258707809.png") > system("convert tmp/69bxd1258707809.ps tmp/69bxd1258707809.png") > system("convert tmp/7o1qm1258707809.ps tmp/7o1qm1258707809.png") > system("convert tmp/8r2fj1258707809.ps tmp/8r2fj1258707809.png") > system("convert tmp/925bc1258707809.ps tmp/925bc1258707809.png") > system("convert tmp/10i2lt1258707809.ps tmp/10i2lt1258707809.png") > > > proc.time() user system elapsed 2.336 1.520 3.441