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(100.00 + ,100.00 + ,91.12 + ,94.05 + ,97.82 + ,100.00 + ,97.82 + ,99.87 + ,93.13 + ,91.12 + ,94.05 + ,97.82 + ,94.05 + ,99.54 + ,93.88 + ,93.13 + ,91.12 + ,94.05 + ,91.12 + ,99.81 + ,92.55 + ,93.88 + ,93.13 + ,91.12 + ,93.13 + ,100.49 + ,94.43 + ,92.55 + ,93.88 + ,93.13 + ,93.88 + ,101.14 + ,96.25 + ,94.43 + ,92.55 + ,93.88 + ,92.55 + ,101.37 + ,100.44 + ,96.25 + ,94.43 + ,92.55 + ,94.43 + ,101.51 + ,101.50 + ,100.44 + ,96.25 + ,94.43 + ,96.25 + ,101.82 + ,99.40 + ,101.50 + ,100.44 + ,96.25 + ,100.44 + ,102.44 + ,99.69 + ,99.40 + ,101.50 + ,100.44 + ,101.50 + ,102.53 + ,101.69 + ,99.69 + ,99.40 + ,101.50 + ,99.40 + ,102.65 + ,103.67 + ,101.69 + ,99.69 + ,99.40 + ,99.69 + ,102.47 + ,103.05 + ,103.67 + ,101.69 + ,99.69 + ,101.69 + ,102.44 + ,100.95 + ,103.05 + ,103.67 + ,101.69 + ,103.67 + ,102.42 + ,102.35 + ,100.95 + ,103.05 + ,103.67 + ,103.05 + ,102.45 + ,101.65 + ,102.35 + ,100.95 + ,103.05 + ,100.95 + ,102.89 + ,99.57 + ,101.65 + ,102.35 + ,100.95 + ,102.35 + ,102.85 + ,95.68 + ,99.57 + ,101.65 + ,102.35 + ,101.65 + ,103.36 + ,96.58 + ,95.68 + ,99.57 + ,101.65 + ,99.57 + ,103.74 + ,96.33 + ,96.58 + ,95.68 + ,99.57 + ,95.68 + ,103.72 + ,95.37 + ,96.33 + ,96.58 + ,95.68 + ,96.58 + ,104.08 + ,96.00 + ,95.37 + ,96.33 + ,96.58 + ,96.33 + ,104.21 + ,96.88 + ,96.00 + ,95.37 + ,96.33 + ,95.37 + ,103.91 + ,94.85 + ,96.88 + ,96.00 + ,95.37 + ,96.00 + ,103.70 + ,92.47 + ,94.85 + ,96.88 + ,96.00 + ,96.88 + ,103.96 + ,93.99 + ,92.47 + ,94.85 + ,96.88 + ,94.85 + ,104.10 + ,93.45 + ,93.99 + ,92.47 + ,94.85 + ,92.47 + ,104.15 + ,92.27 + ,93.45 + ,93.99 + ,92.47 + ,93.99 + ,104.71 + ,90.40 + ,92.27 + ,93.45 + ,93.99 + ,93.45 + ,104.72 + ,90.43 + ,90.40 + ,92.27 + ,93.45 + ,92.27 + ,105.20 + ,91.05 + ,90.43 + ,90.40 + ,92.27 + ,90.40 + ,105.07 + ,89.08 + ,91.05 + ,90.43 + ,90.40 + ,90.43 + ,105.06 + ,89.69 + ,89.08 + ,91.05 + ,90.43 + ,91.05 + ,105.50 + ,87.92 + ,89.69 + ,89.08 + ,91.05 + ,89.08 + ,105.38 + ,85.88 + ,87.92 + ,89.69 + ,89.08 + ,89.69 + ,105.47 + ,83.21 + ,85.88 + ,87.92 + ,89.69 + ,87.92 + ,106.03 + ,83.86 + ,83.21 + ,85.88 + ,87.92 + ,85.88 + ,107.02 + ,83.01 + ,83.86 + ,83.21 + ,85.88 + ,83.21 + ,107.32 + ,82.85 + ,83.01 + ,83.86 + ,83.21 + ,83.86 + ,107.75 + ,78.69 + ,82.85 + ,83.01 + ,83.86 + ,83.01 + ,108.52 + ,77.57 + ,78.69 + ,82.85 + ,83.01 + ,82.85 + ,109.32 + ,78.54 + ,77.57 + ,78.69 + ,82.85 + ,78.69 + ,109.56 + ,78.56 + ,78.54 + ,77.57 + ,78.69 + ,77.57 + ,110.54 + ,77.48 + ,78.56 + ,78.54 + ,77.57 + ,78.54 + ,111.16 + ,81.59 + ,77.48 + ,78.56 + ,78.54 + ,78.56 + ,111.74 + ,85.02 + ,81.59 + ,77.48 + ,78.56 + ,77.48 + ,111.06 + ,91.71 + ,85.02 + ,81.59 + ,77.48 + ,81.59 + ,111.24 + ,95.96 + ,91.71 + ,85.02 + ,81.59 + ,85.02 + ,111.04 + ,90.85 + ,95.96 + ,91.71 + ,85.02 + ,91.71 + ,110.38 + ,92.29 + ,90.85 + ,95.96 + ,91.71 + ,95.96 + ,110.14 + ,95.57 + ,92.29 + ,90.85 + ,95.96 + ,90.85 + ,110.25 + ,93.62 + ,95.57 + ,92.29 + ,90.85 + ,92.29 + ,110.62 + ,92.63 + ,93.62 + ,95.57 + ,92.29 + ,95.57 + ,109.99 + ,89.51 + ,92.63 + ,93.62 + ,95.57 + ,93.62 + ,110.22 + ,87.17 + ,89.51 + ,92.63 + ,93.62 + ,92.63 + ,110.14 + ,86.73 + ,87.17 + ,89.51 + ,92.63 + ,89.51 + ,109.93 + ,85.63 + ,86.73 + ,87.17 + ,89.51) + ,dim=c(6 + ,57) + ,dimnames=list(c('wisselkoers' + ,'consumptieprijzen' + ,'Yt-1' + ,'Yt-2' + ,'Yt-3' + ,'Yt-4') + ,1:57)) > y <- array(NA,dim=c(6,57),dimnames=list(c('wisselkoers','consumptieprijzen','Yt-1','Yt-2','Yt-3','Yt-4'),1:57)) > 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 wisselkoers consumptieprijzen Yt-1 Yt-2 Yt-3 Yt-4 M1 M2 M3 M4 M5 M6 1 100.00 100.00 91.12 94.05 97.82 100.00 1 0 0 0 0 0 2 97.82 99.87 93.13 91.12 94.05 97.82 0 1 0 0 0 0 3 94.05 99.54 93.88 93.13 91.12 94.05 0 0 1 0 0 0 4 91.12 99.81 92.55 93.88 93.13 91.12 0 0 0 1 0 0 5 93.13 100.49 94.43 92.55 93.88 93.13 0 0 0 0 1 0 6 93.88 101.14 96.25 94.43 92.55 93.88 0 0 0 0 0 1 7 92.55 101.37 100.44 96.25 94.43 92.55 0 0 0 0 0 0 8 94.43 101.51 101.50 100.44 96.25 94.43 0 0 0 0 0 0 9 96.25 101.82 99.40 101.50 100.44 96.25 0 0 0 0 0 0 10 100.44 102.44 99.69 99.40 101.50 100.44 0 0 0 0 0 0 11 101.50 102.53 101.69 99.69 99.40 101.50 0 0 0 0 0 0 12 99.40 102.65 103.67 101.69 99.69 99.40 0 0 0 0 0 0 13 99.69 102.47 103.05 103.67 101.69 99.69 1 0 0 0 0 0 14 101.69 102.44 100.95 103.05 103.67 101.69 0 1 0 0 0 0 15 103.67 102.42 102.35 100.95 103.05 103.67 0 0 1 0 0 0 16 103.05 102.45 101.65 102.35 100.95 103.05 0 0 0 1 0 0 17 100.95 102.89 99.57 101.65 102.35 100.95 0 0 0 0 1 0 18 102.35 102.85 95.68 99.57 101.65 102.35 0 0 0 0 0 1 19 101.65 103.36 96.58 95.68 99.57 101.65 0 0 0 0 0 0 20 99.57 103.74 96.33 96.58 95.68 99.57 0 0 0 0 0 0 21 95.68 103.72 95.37 96.33 96.58 95.68 0 0 0 0 0 0 22 96.58 104.08 96.00 95.37 96.33 96.58 0 0 0 0 0 0 23 96.33 104.21 96.88 96.00 95.37 96.33 0 0 0 0 0 0 24 95.37 103.91 94.85 96.88 96.00 95.37 0 0 0 0 0 0 25 96.00 103.70 92.47 94.85 96.88 96.00 1 0 0 0 0 0 26 96.88 103.96 93.99 92.47 94.85 96.88 0 1 0 0 0 0 27 94.85 104.10 93.45 93.99 92.47 94.85 0 0 1 0 0 0 28 92.47 104.15 92.27 93.45 93.99 92.47 0 0 0 1 0 0 29 93.99 104.71 90.40 92.27 93.45 93.99 0 0 0 0 1 0 30 93.45 104.72 90.43 90.40 92.27 93.45 0 0 0 0 0 1 31 92.27 105.20 91.05 90.43 90.40 92.27 0 0 0 0 0 0 32 90.40 105.07 89.08 91.05 90.43 90.40 0 0 0 0 0 0 33 90.43 105.06 89.69 89.08 91.05 90.43 0 0 0 0 0 0 34 91.05 105.50 87.92 89.69 89.08 91.05 0 0 0 0 0 0 35 89.08 105.38 85.88 87.92 89.69 89.08 0 0 0 0 0 0 36 89.69 105.47 83.21 85.88 87.92 89.69 0 0 0 0 0 0 37 87.92 106.03 83.86 83.21 85.88 87.92 1 0 0 0 0 0 38 85.88 107.02 83.01 83.86 83.21 85.88 0 1 0 0 0 0 39 83.21 107.32 82.85 83.01 83.86 83.21 0 0 1 0 0 0 40 83.86 107.75 78.69 82.85 83.01 83.86 0 0 0 1 0 0 41 83.01 108.52 77.57 78.69 82.85 83.01 0 0 0 0 1 0 42 82.85 109.32 78.54 77.57 78.69 82.85 0 0 0 0 0 1 43 78.69 109.56 78.56 78.54 77.57 78.69 0 0 0 0 0 0 44 77.57 110.54 77.48 78.56 78.54 77.57 0 0 0 0 0 0 45 78.54 111.16 81.59 77.48 78.56 78.54 0 0 0 0 0 0 46 78.56 111.74 85.02 81.59 77.48 78.56 0 0 0 0 0 0 47 77.48 111.06 91.71 85.02 81.59 77.48 0 0 0 0 0 0 48 81.59 111.24 95.96 91.71 85.02 81.59 0 0 0 0 0 0 49 85.02 111.04 90.85 95.96 91.71 85.02 1 0 0 0 0 0 50 91.71 110.38 92.29 90.85 95.96 91.71 0 1 0 0 0 0 51 95.96 110.14 95.57 92.29 90.85 95.96 0 0 1 0 0 0 52 90.85 110.25 93.62 95.57 92.29 90.85 0 0 0 1 0 0 53 92.29 110.62 92.63 93.62 95.57 92.29 0 0 0 0 1 0 54 95.57 109.99 89.51 92.63 93.62 95.57 0 0 0 0 0 1 55 93.62 110.22 87.17 89.51 92.63 93.62 0 0 0 0 0 0 56 92.63 110.14 86.73 87.17 89.51 92.63 0 0 0 0 0 0 57 89.51 109.93 85.63 86.73 87.17 89.51 0 0 0 0 0 0 M7 M8 M9 M10 M11 t 1 0 0 0 0 0 1 2 0 0 0 0 0 2 3 0 0 0 0 0 3 4 0 0 0 0 0 4 5 0 0 0 0 0 5 6 0 0 0 0 0 6 7 1 0 0 0 0 7 8 0 1 0 0 0 8 9 0 0 1 0 0 9 10 0 0 0 1 0 10 11 0 0 0 0 1 11 12 0 0 0 0 0 12 13 0 0 0 0 0 13 14 0 0 0 0 0 14 15 0 0 0 0 0 15 16 0 0 0 0 0 16 17 0 0 0 0 0 17 18 0 0 0 0 0 18 19 1 0 0 0 0 19 20 0 1 0 0 0 20 21 0 0 1 0 0 21 22 0 0 0 1 0 22 23 0 0 0 0 1 23 24 0 0 0 0 0 24 25 0 0 0 0 0 25 26 0 0 0 0 0 26 27 0 0 0 0 0 27 28 0 0 0 0 0 28 29 0 0 0 0 0 29 30 0 0 0 0 0 30 31 1 0 0 0 0 31 32 0 1 0 0 0 32 33 0 0 1 0 0 33 34 0 0 0 1 0 34 35 0 0 0 0 1 35 36 0 0 0 0 0 36 37 0 0 0 0 0 37 38 0 0 0 0 0 38 39 0 0 0 0 0 39 40 0 0 0 0 0 40 41 0 0 0 0 0 41 42 0 0 0 0 0 42 43 1 0 0 0 0 43 44 0 1 0 0 0 44 45 0 0 1 0 0 45 46 0 0 0 1 0 46 47 0 0 0 0 1 47 48 0 0 0 0 0 48 49 0 0 0 0 0 49 50 0 0 0 0 0 50 51 0 0 0 0 0 51 52 0 0 0 0 0 52 53 0 0 0 0 0 53 54 0 0 0 0 0 54 55 1 0 0 0 0 55 56 0 1 0 0 0 56 57 0 0 1 0 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) consumptieprijzen `Yt-1` `Yt-2` 8.468e-15 -2.461e-17 -4.297e-17 4.157e-17 `Yt-3` `Yt-4` M1 M2 -2.257e-16 1.000e+00 -8.475e-17 -8.206e-17 M3 M4 M5 M6 -7.192e-17 -2.749e-16 -4.201e-16 -1.303e-15 M7 M8 M9 M10 -2.210e-16 -1.990e-16 -1.224e-16 -1.636e-16 M11 t -1.057e-16 -1.299e-17 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.817e-15 -1.239e-16 1.093e-18 1.528e-16 1.113e-15 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 8.468e-15 1.226e-14 6.910e-01 0.49373 consumptieprijzen -2.461e-17 1.175e-16 -2.100e-01 0.83514 `Yt-1` -4.297e-17 4.776e-17 -9.000e-01 0.37380 `Yt-2` 4.157e-17 6.953e-17 5.980e-01 0.55339 `Yt-3` -2.257e-16 6.861e-17 -3.289e+00 0.00214 ** `Yt-4` 1.000e+00 4.495e-17 2.225e+16 < 2e-16 *** M1 -8.475e-17 4.216e-16 -2.010e-01 0.84175 M2 -8.206e-17 4.294e-16 -1.910e-01 0.84945 M3 -7.192e-17 4.112e-16 -1.750e-01 0.86207 M4 -2.749e-16 4.076e-16 -6.740e-01 0.50403 M5 -4.201e-16 4.299e-16 -9.770e-01 0.33444 M6 -1.303e-15 4.207e-16 -3.097e+00 0.00362 ** M7 -2.209e-16 4.141e-16 -5.340e-01 0.59665 M8 -1.990e-16 4.052e-16 -4.910e-01 0.62616 M9 -1.224e-16 4.106e-16 -2.980e-01 0.76715 M10 -1.636e-16 4.322e-16 -3.790e-01 0.70705 M11 -1.057e-16 4.273e-16 -2.470e-01 0.80588 t -1.299e-17 2.460e-17 -5.280e-01 0.60040 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.9e-16 on 39 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 4.634e+32 on 17 and 39 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,] 8.733134e-02 1.746627e-01 0.912668656 [2,] 1.303675e-01 2.607350e-01 0.869632477 [3,] 8.197214e-08 1.639443e-07 0.999999918 [4,] 3.580822e-05 7.161644e-05 0.999964192 [5,] 1.051489e-02 2.102977e-02 0.989485113 [6,] 2.513594e-04 5.027187e-04 0.999748641 [7,] 1.276107e-04 2.552215e-04 0.999872389 [8,] 9.988208e-01 2.358453e-03 0.001179227 [9,] 4.662619e-03 9.325237e-03 0.995337381 [10,] 1.874876e-01 3.749752e-01 0.812512390 [11,] 3.433355e-01 6.866711e-01 0.656664455 [12,] 9.960839e-01 7.832104e-03 0.003916052 [13,] 5.952988e-01 8.094024e-01 0.404701223 [14,] 3.738974e-04 7.477948e-04 0.999626103 [15,] 6.778689e-01 6.442622e-01 0.322131110 [16,] 8.869589e-01 2.260822e-01 0.113041105 > postscript(file="/var/www/html/rcomp/tmp/19nvz1258737304.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/2gzyw1258737304.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/3j83i1258737304.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/41fbf1258737304.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/5xe5h1258737304.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 = 57 Frequency = 1 1 2 3 4 5 4.077638e-16 3.557458e-16 1.634655e-16 -4.188808e-16 -9.624887e-17 6 7 8 9 10 -2.816693e-15 4.685718e-16 7.338143e-16 1.291241e-17 -1.018296e-16 11 12 13 14 15 3.630475e-17 6.735534e-17 6.940912e-18 -1.351913e-16 -1.145539e-16 16 17 18 19 20 4.114285e-16 1.696734e-16 8.423835e-16 -1.208600e-16 -3.666196e-16 21 22 23 24 25 -2.681859e-17 2.051215e-17 1.092898e-18 -1.788636e-16 -1.657310e-16 26 27 28 29 30 -2.552044e-17 5.569415e-17 1.573915e-16 1.396880e-16 1.112529e-15 31 32 33 34 35 1.528287e-16 2.125541e-17 3.521270e-17 -9.377965e-17 -1.985132e-17 36 37 38 39 40 -3.486551e-16 -6.073065e-17 1.259945e-17 2.783517e-16 -1.238545e-16 41 42 43 44 45 -1.755576e-16 8.422122e-16 1.019170e-16 -2.076617e-16 -1.036108e-16 46 47 48 49 50 1.750971e-16 -1.754633e-17 4.601634e-16 -1.882431e-16 -2.076335e-16 51 52 53 54 55 -3.829574e-16 -2.608467e-17 -3.755500e-17 1.956893e-17 -6.024574e-16 56 57 -1.807884e-16 8.230429e-17 > postscript(file="/var/www/html/rcomp/tmp/68dzq1258737304.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 4.077638e-16 NA 1 3.557458e-16 4.077638e-16 2 1.634655e-16 3.557458e-16 3 -4.188808e-16 1.634655e-16 4 -9.624887e-17 -4.188808e-16 5 -2.816693e-15 -9.624887e-17 6 4.685718e-16 -2.816693e-15 7 7.338143e-16 4.685718e-16 8 1.291241e-17 7.338143e-16 9 -1.018296e-16 1.291241e-17 10 3.630475e-17 -1.018296e-16 11 6.735534e-17 3.630475e-17 12 6.940912e-18 6.735534e-17 13 -1.351913e-16 6.940912e-18 14 -1.145539e-16 -1.351913e-16 15 4.114285e-16 -1.145539e-16 16 1.696734e-16 4.114285e-16 17 8.423835e-16 1.696734e-16 18 -1.208600e-16 8.423835e-16 19 -3.666196e-16 -1.208600e-16 20 -2.681859e-17 -3.666196e-16 21 2.051215e-17 -2.681859e-17 22 1.092898e-18 2.051215e-17 23 -1.788636e-16 1.092898e-18 24 -1.657310e-16 -1.788636e-16 25 -2.552044e-17 -1.657310e-16 26 5.569415e-17 -2.552044e-17 27 1.573915e-16 5.569415e-17 28 1.396880e-16 1.573915e-16 29 1.112529e-15 1.396880e-16 30 1.528287e-16 1.112529e-15 31 2.125541e-17 1.528287e-16 32 3.521270e-17 2.125541e-17 33 -9.377965e-17 3.521270e-17 34 -1.985132e-17 -9.377965e-17 35 -3.486551e-16 -1.985132e-17 36 -6.073065e-17 -3.486551e-16 37 1.259945e-17 -6.073065e-17 38 2.783517e-16 1.259945e-17 39 -1.238545e-16 2.783517e-16 40 -1.755576e-16 -1.238545e-16 41 8.422122e-16 -1.755576e-16 42 1.019170e-16 8.422122e-16 43 -2.076617e-16 1.019170e-16 44 -1.036108e-16 -2.076617e-16 45 1.750971e-16 -1.036108e-16 46 -1.754633e-17 1.750971e-16 47 4.601634e-16 -1.754633e-17 48 -1.882431e-16 4.601634e-16 49 -2.076335e-16 -1.882431e-16 50 -3.829574e-16 -2.076335e-16 51 -2.608467e-17 -3.829574e-16 52 -3.755500e-17 -2.608467e-17 53 1.956893e-17 -3.755500e-17 54 -6.024574e-16 1.956893e-17 55 -1.807884e-16 -6.024574e-16 56 8.230429e-17 -1.807884e-16 57 NA 8.230429e-17 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.557458e-16 4.077638e-16 [2,] 1.634655e-16 3.557458e-16 [3,] -4.188808e-16 1.634655e-16 [4,] -9.624887e-17 -4.188808e-16 [5,] -2.816693e-15 -9.624887e-17 [6,] 4.685718e-16 -2.816693e-15 [7,] 7.338143e-16 4.685718e-16 [8,] 1.291241e-17 7.338143e-16 [9,] -1.018296e-16 1.291241e-17 [10,] 3.630475e-17 -1.018296e-16 [11,] 6.735534e-17 3.630475e-17 [12,] 6.940912e-18 6.735534e-17 [13,] -1.351913e-16 6.940912e-18 [14,] -1.145539e-16 -1.351913e-16 [15,] 4.114285e-16 -1.145539e-16 [16,] 1.696734e-16 4.114285e-16 [17,] 8.423835e-16 1.696734e-16 [18,] -1.208600e-16 8.423835e-16 [19,] -3.666196e-16 -1.208600e-16 [20,] -2.681859e-17 -3.666196e-16 [21,] 2.051215e-17 -2.681859e-17 [22,] 1.092898e-18 2.051215e-17 [23,] -1.788636e-16 1.092898e-18 [24,] -1.657310e-16 -1.788636e-16 [25,] -2.552044e-17 -1.657310e-16 [26,] 5.569415e-17 -2.552044e-17 [27,] 1.573915e-16 5.569415e-17 [28,] 1.396880e-16 1.573915e-16 [29,] 1.112529e-15 1.396880e-16 [30,] 1.528287e-16 1.112529e-15 [31,] 2.125541e-17 1.528287e-16 [32,] 3.521270e-17 2.125541e-17 [33,] -9.377965e-17 3.521270e-17 [34,] -1.985132e-17 -9.377965e-17 [35,] -3.486551e-16 -1.985132e-17 [36,] -6.073065e-17 -3.486551e-16 [37,] 1.259945e-17 -6.073065e-17 [38,] 2.783517e-16 1.259945e-17 [39,] -1.238545e-16 2.783517e-16 [40,] -1.755576e-16 -1.238545e-16 [41,] 8.422122e-16 -1.755576e-16 [42,] 1.019170e-16 8.422122e-16 [43,] -2.076617e-16 1.019170e-16 [44,] -1.036108e-16 -2.076617e-16 [45,] 1.750971e-16 -1.036108e-16 [46,] -1.754633e-17 1.750971e-16 [47,] 4.601634e-16 -1.754633e-17 [48,] -1.882431e-16 4.601634e-16 [49,] -2.076335e-16 -1.882431e-16 [50,] -3.829574e-16 -2.076335e-16 [51,] -2.608467e-17 -3.829574e-16 [52,] -3.755500e-17 -2.608467e-17 [53,] 1.956893e-17 -3.755500e-17 [54,] -6.024574e-16 1.956893e-17 [55,] -1.807884e-16 -6.024574e-16 [56,] 8.230429e-17 -1.807884e-16 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.557458e-16 4.077638e-16 2 1.634655e-16 3.557458e-16 3 -4.188808e-16 1.634655e-16 4 -9.624887e-17 -4.188808e-16 5 -2.816693e-15 -9.624887e-17 6 4.685718e-16 -2.816693e-15 7 7.338143e-16 4.685718e-16 8 1.291241e-17 7.338143e-16 9 -1.018296e-16 1.291241e-17 10 3.630475e-17 -1.018296e-16 11 6.735534e-17 3.630475e-17 12 6.940912e-18 6.735534e-17 13 -1.351913e-16 6.940912e-18 14 -1.145539e-16 -1.351913e-16 15 4.114285e-16 -1.145539e-16 16 1.696734e-16 4.114285e-16 17 8.423835e-16 1.696734e-16 18 -1.208600e-16 8.423835e-16 19 -3.666196e-16 -1.208600e-16 20 -2.681859e-17 -3.666196e-16 21 2.051215e-17 -2.681859e-17 22 1.092898e-18 2.051215e-17 23 -1.788636e-16 1.092898e-18 24 -1.657310e-16 -1.788636e-16 25 -2.552044e-17 -1.657310e-16 26 5.569415e-17 -2.552044e-17 27 1.573915e-16 5.569415e-17 28 1.396880e-16 1.573915e-16 29 1.112529e-15 1.396880e-16 30 1.528287e-16 1.112529e-15 31 2.125541e-17 1.528287e-16 32 3.521270e-17 2.125541e-17 33 -9.377965e-17 3.521270e-17 34 -1.985132e-17 -9.377965e-17 35 -3.486551e-16 -1.985132e-17 36 -6.073065e-17 -3.486551e-16 37 1.259945e-17 -6.073065e-17 38 2.783517e-16 1.259945e-17 39 -1.238545e-16 2.783517e-16 40 -1.755576e-16 -1.238545e-16 41 8.422122e-16 -1.755576e-16 42 1.019170e-16 8.422122e-16 43 -2.076617e-16 1.019170e-16 44 -1.036108e-16 -2.076617e-16 45 1.750971e-16 -1.036108e-16 46 -1.754633e-17 1.750971e-16 47 4.601634e-16 -1.754633e-17 48 -1.882431e-16 4.601634e-16 49 -2.076335e-16 -1.882431e-16 50 -3.829574e-16 -2.076335e-16 51 -2.608467e-17 -3.829574e-16 52 -3.755500e-17 -2.608467e-17 53 1.956893e-17 -3.755500e-17 54 -6.024574e-16 1.956893e-17 55 -1.807884e-16 -6.024574e-16 56 8.230429e-17 -1.807884e-16 > 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/7d3b31258737304.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/8dlps1258737304.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/9d1fc1258737304.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/10ikbm1258737304.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/11ihji1258737304.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/12kzis1258737304.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/13rtj51258737304.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/14s6zz1258737304.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/15ufzl1258737304.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/16rn9x1258737304.tab") + } > > system("convert tmp/19nvz1258737304.ps tmp/19nvz1258737304.png") > system("convert tmp/2gzyw1258737304.ps tmp/2gzyw1258737304.png") > system("convert tmp/3j83i1258737304.ps tmp/3j83i1258737304.png") > system("convert tmp/41fbf1258737304.ps tmp/41fbf1258737304.png") > system("convert tmp/5xe5h1258737304.ps tmp/5xe5h1258737304.png") > system("convert tmp/68dzq1258737304.ps tmp/68dzq1258737304.png") > system("convert tmp/7d3b31258737304.ps tmp/7d3b31258737304.png") > system("convert tmp/8dlps1258737304.ps tmp/8dlps1258737304.png") > system("convert tmp/9d1fc1258737304.ps tmp/9d1fc1258737304.png") > system("convert tmp/10ikbm1258737304.ps tmp/10ikbm1258737304.png") > > > proc.time() user system elapsed 2.421 1.576 5.341