R version 2.7.0 (2008-04-22) Copyright (C) 2008 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(4.25,101.8,0,4.5,108.3,0,4.7,106.7,0,4.75,108.2,0,4.75,94.2,0,4.75,95.1,0,4.75,98.1,0,4.75,93.2,0,4.75,94,0,4.58,97.2,0,4.5,95,0,4.5,90.5,0,4.49,91.6,0,4.03,90.5,0,3.75,79.9,0,3.39,74.9,0,3.25,74.3,0,3.25,75.9,1,3.25,77.7,1,3.25,86.9,1,3.25,90.7,1,3.25,91,1,3.25,89.5,1,3.25,92.5,1,3.25,94.1,1,3.25,98.5,1,3.25,96.8,1,3.25,91.2,1,2.85,97.1,1,2.75,104.9,1,2.75,110.9,1,2.55,104.8,1,2.5,94.1,1,2.5,95.8,1,2.1,99.3,1,2,101.1,1,2,104,1,2,99,1,2,105.4,1,2,107.1,1,2,110.7,1,2,117.1,1,2,118.7,1,2,126.5,1,2,127.5,1,2,134.6,1,2,131.8,1,2,135.9,1,2,142.7,1,2,141.7,1,2,153.4,1,2,145,1,2,137.7,1,2,148.3,1,2,152.2,1,2,169.4,1,2,168.6,1,2,161.1,1,2,174.1,1,2,179,1,2,190.6,1),dim=c(3,61),dimnames=list(c('rentetarief','grondstofprijs','dummy'),1:61)) > y <- array(NA,dim=c(3,61),dimnames=list(c('rentetarief','grondstofprijs','dummy'),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 rentetarief grondstofprijs dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 4.25 101.8 0 1 0 0 0 0 0 0 0 0 0 0 1 2 4.50 108.3 0 0 1 0 0 0 0 0 0 0 0 0 2 3 4.70 106.7 0 0 0 1 0 0 0 0 0 0 0 0 3 4 4.75 108.2 0 0 0 0 1 0 0 0 0 0 0 0 4 5 4.75 94.2 0 0 0 0 0 1 0 0 0 0 0 0 5 6 4.75 95.1 0 0 0 0 0 0 1 0 0 0 0 0 6 7 4.75 98.1 0 0 0 0 0 0 0 1 0 0 0 0 7 8 4.75 93.2 0 0 0 0 0 0 0 0 1 0 0 0 8 9 4.75 94.0 0 0 0 0 0 0 0 0 0 1 0 0 9 10 4.58 97.2 0 0 0 0 0 0 0 0 0 0 1 0 10 11 4.50 95.0 0 0 0 0 0 0 0 0 0 0 0 1 11 12 4.50 90.5 0 0 0 0 0 0 0 0 0 0 0 0 12 13 4.49 91.6 0 1 0 0 0 0 0 0 0 0 0 0 13 14 4.03 90.5 0 0 1 0 0 0 0 0 0 0 0 0 14 15 3.75 79.9 0 0 0 1 0 0 0 0 0 0 0 0 15 16 3.39 74.9 0 0 0 0 1 0 0 0 0 0 0 0 16 17 3.25 74.3 0 0 0 0 0 1 0 0 0 0 0 0 17 18 3.25 75.9 1 0 0 0 0 0 1 0 0 0 0 0 18 19 3.25 77.7 1 0 0 0 0 0 0 1 0 0 0 0 19 20 3.25 86.9 1 0 0 0 0 0 0 0 1 0 0 0 20 21 3.25 90.7 1 0 0 0 0 0 0 0 0 1 0 0 21 22 3.25 91.0 1 0 0 0 0 0 0 0 0 0 1 0 22 23 3.25 89.5 1 0 0 0 0 0 0 0 0 0 0 1 23 24 3.25 92.5 1 0 0 0 0 0 0 0 0 0 0 0 24 25 3.25 94.1 1 1 0 0 0 0 0 0 0 0 0 0 25 26 3.25 98.5 1 0 1 0 0 0 0 0 0 0 0 0 26 27 3.25 96.8 1 0 0 1 0 0 0 0 0 0 0 0 27 28 3.25 91.2 1 0 0 0 1 0 0 0 0 0 0 0 28 29 2.85 97.1 1 0 0 0 0 1 0 0 0 0 0 0 29 30 2.75 104.9 1 0 0 0 0 0 1 0 0 0 0 0 30 31 2.75 110.9 1 0 0 0 0 0 0 1 0 0 0 0 31 32 2.55 104.8 1 0 0 0 0 0 0 0 1 0 0 0 32 33 2.50 94.1 1 0 0 0 0 0 0 0 0 1 0 0 33 34 2.50 95.8 1 0 0 0 0 0 0 0 0 0 1 0 34 35 2.10 99.3 1 0 0 0 0 0 0 0 0 0 0 1 35 36 2.00 101.1 1 0 0 0 0 0 0 0 0 0 0 0 36 37 2.00 104.0 1 1 0 0 0 0 0 0 0 0 0 0 37 38 2.00 99.0 1 0 1 0 0 0 0 0 0 0 0 0 38 39 2.00 105.4 1 0 0 1 0 0 0 0 0 0 0 0 39 40 2.00 107.1 1 0 0 0 1 0 0 0 0 0 0 0 40 41 2.00 110.7 1 0 0 0 0 1 0 0 0 0 0 0 41 42 2.00 117.1 1 0 0 0 0 0 1 0 0 0 0 0 42 43 2.00 118.7 1 0 0 0 0 0 0 1 0 0 0 0 43 44 2.00 126.5 1 0 0 0 0 0 0 0 1 0 0 0 44 45 2.00 127.5 1 0 0 0 0 0 0 0 0 1 0 0 45 46 2.00 134.6 1 0 0 0 0 0 0 0 0 0 1 0 46 47 2.00 131.8 1 0 0 0 0 0 0 0 0 0 0 1 47 48 2.00 135.9 1 0 0 0 0 0 0 0 0 0 0 0 48 49 2.00 142.7 1 1 0 0 0 0 0 0 0 0 0 0 49 50 2.00 141.7 1 0 1 0 0 0 0 0 0 0 0 0 50 51 2.00 153.4 1 0 0 1 0 0 0 0 0 0 0 0 51 52 2.00 145.0 1 0 0 0 1 0 0 0 0 0 0 0 52 53 2.00 137.7 1 0 0 0 0 1 0 0 0 0 0 0 53 54 2.00 148.3 1 0 0 0 0 0 1 0 0 0 0 0 54 55 2.00 152.2 1 0 0 0 0 0 0 1 0 0 0 0 55 56 2.00 169.4 1 0 0 0 0 0 0 0 1 0 0 0 56 57 2.00 168.6 1 0 0 0 0 0 0 0 0 1 0 0 57 58 2.00 161.1 1 0 0 0 0 0 0 0 0 0 1 0 58 59 2.00 174.1 1 0 0 0 0 0 0 0 0 0 0 1 59 60 2.00 179.0 1 0 0 0 0 0 0 0 0 0 0 0 60 61 2.00 190.6 1 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) grondstofprijs dummy M1 M2 3.69690 0.01446 -0.32712 -0.14546 -0.15449 M3 M4 M5 M6 M7 -0.11549 -0.06466 -0.06966 -0.03603 -0.01602 M8 M9 M10 M11 t -0.05595 0.01825 0.03752 -0.02025 -0.06714 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.706051 -0.159472 0.004256 0.120861 0.506405 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.696905 0.250192 14.776 < 2e-16 *** grondstofprijs 0.014457 0.002741 5.274 3.48e-06 *** dummy -0.327115 0.156742 -2.087 0.0425 * M1 -0.145461 0.160720 -0.905 0.3702 M2 -0.154487 0.167684 -0.921 0.3617 M3 -0.115487 0.167488 -0.690 0.4940 M4 -0.064658 0.168063 -0.385 0.7022 M5 -0.069659 0.169563 -0.411 0.6831 M6 -0.036029 0.167570 -0.215 0.8307 M7 -0.016015 0.167322 -0.096 0.9242 M8 -0.055953 0.167431 -0.334 0.7398 M9 0.018251 0.166831 0.109 0.9134 M10 0.037516 0.166657 0.225 0.8229 M11 -0.020254 0.166571 -0.122 0.9038 t -0.067144 0.006309 -10.642 5.42e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2633 on 46 degrees of freedom Multiple R-squared: 0.9504, Adjusted R-squared: 0.9353 F-statistic: 63 on 14 and 46 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.9843274 3.134513e-02 1.567256e-02 [2,] 0.9629848 7.403035e-02 3.701518e-02 [3,] 0.9783990 4.320192e-02 2.160096e-02 [4,] 0.9768926 4.621473e-02 2.310737e-02 [5,] 0.9601159 7.976821e-02 3.988410e-02 [6,] 0.9304438 1.391124e-01 6.955619e-02 [7,] 0.9040646 1.918709e-01 9.593544e-02 [8,] 0.8995912 2.008176e-01 1.004088e-01 [9,] 0.8614135 2.771730e-01 1.385865e-01 [10,] 0.9058360 1.883279e-01 9.416396e-02 [11,] 0.9904108 1.917833e-02 9.589163e-03 [12,] 0.9943301 1.133979e-02 5.669896e-03 [13,] 0.9989923 2.015469e-03 1.007734e-03 [14,] 0.9990255 1.948974e-03 9.744868e-04 [15,] 0.9994657 1.068608e-03 5.343038e-04 [16,] 0.9999380 1.240628e-04 6.203140e-05 [17,] 1.0000000 4.393811e-12 2.196906e-12 [18,] 1.0000000 1.767760e-183 8.838802e-184 [19,] 1.0000000 6.249100e-153 3.124550e-153 [20,] 1.0000000 2.585799e-132 1.292900e-132 [21,] 1.0000000 9.720987e-120 4.860493e-120 [22,] 1.0000000 1.253765e-102 6.268824e-103 [23,] 1.0000000 3.577920e-102 1.788960e-102 [24,] 1.0000000 1.211227e-78 6.056133e-79 [25,] 1.0000000 4.072004e-59 2.036002e-59 [26,] 1.0000000 3.945861e-44 1.972930e-44 > postscript(file="/var/www/html/rcomp/tmp/1jspj1227781806.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/2gpnh1227781806.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/3capr1227781806.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/4pbn81227781806.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/59fcr1227781806.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 -0.706051480 -0.473853057 -0.222577278 -0.177948234 0.096599710 0.117101898 7 8 9 10 11 12 0.120860793 0.298783309 0.280157881 0.111773558 0.188494163 0.300442507 13 14 15 16 17 18 0.487144764 0.119218567 0.020609928 -0.250788665 -0.309968364 0.027528921 19 20 21 22 23 24 0.048636560 0.022711332 -0.039285956 0.004255853 0.150856357 0.154375050 25 26 27 28 29 30 0.343848664 0.356407389 0.409128897 0.506404677 0.093252614 -0.086000477 31 32 33 34 35 36 -0.125613443 -0.130342182 -0.032708812 -0.009407204 -0.335093135 -0.414225697 37 38 39 40 41 42 -0.243546556 -0.095089335 -0.159471850 -0.167734264 -0.147634568 -0.206647457 43 44 45 46 47 48 -0.182648361 -0.188333387 -0.209850272 -0.264618013 -0.099223036 -0.111607359 49 50 51 52 53 54 0.002688364 0.093316437 -0.047689697 0.090066485 0.267750608 0.148017114 55 56 57 58 59 60 0.138764451 -0.002819072 0.001687159 0.157995806 0.094965651 0.071015499 61 0.115916245 > postscript(file="/var/www/html/rcomp/tmp/6mnn21227781806.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 -0.706051480 NA 1 -0.473853057 -0.706051480 2 -0.222577278 -0.473853057 3 -0.177948234 -0.222577278 4 0.096599710 -0.177948234 5 0.117101898 0.096599710 6 0.120860793 0.117101898 7 0.298783309 0.120860793 8 0.280157881 0.298783309 9 0.111773558 0.280157881 10 0.188494163 0.111773558 11 0.300442507 0.188494163 12 0.487144764 0.300442507 13 0.119218567 0.487144764 14 0.020609928 0.119218567 15 -0.250788665 0.020609928 16 -0.309968364 -0.250788665 17 0.027528921 -0.309968364 18 0.048636560 0.027528921 19 0.022711332 0.048636560 20 -0.039285956 0.022711332 21 0.004255853 -0.039285956 22 0.150856357 0.004255853 23 0.154375050 0.150856357 24 0.343848664 0.154375050 25 0.356407389 0.343848664 26 0.409128897 0.356407389 27 0.506404677 0.409128897 28 0.093252614 0.506404677 29 -0.086000477 0.093252614 30 -0.125613443 -0.086000477 31 -0.130342182 -0.125613443 32 -0.032708812 -0.130342182 33 -0.009407204 -0.032708812 34 -0.335093135 -0.009407204 35 -0.414225697 -0.335093135 36 -0.243546556 -0.414225697 37 -0.095089335 -0.243546556 38 -0.159471850 -0.095089335 39 -0.167734264 -0.159471850 40 -0.147634568 -0.167734264 41 -0.206647457 -0.147634568 42 -0.182648361 -0.206647457 43 -0.188333387 -0.182648361 44 -0.209850272 -0.188333387 45 -0.264618013 -0.209850272 46 -0.099223036 -0.264618013 47 -0.111607359 -0.099223036 48 0.002688364 -0.111607359 49 0.093316437 0.002688364 50 -0.047689697 0.093316437 51 0.090066485 -0.047689697 52 0.267750608 0.090066485 53 0.148017114 0.267750608 54 0.138764451 0.148017114 55 -0.002819072 0.138764451 56 0.001687159 -0.002819072 57 0.157995806 0.001687159 58 0.094965651 0.157995806 59 0.071015499 0.094965651 60 0.115916245 0.071015499 61 NA 0.115916245 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.473853057 -0.706051480 [2,] -0.222577278 -0.473853057 [3,] -0.177948234 -0.222577278 [4,] 0.096599710 -0.177948234 [5,] 0.117101898 0.096599710 [6,] 0.120860793 0.117101898 [7,] 0.298783309 0.120860793 [8,] 0.280157881 0.298783309 [9,] 0.111773558 0.280157881 [10,] 0.188494163 0.111773558 [11,] 0.300442507 0.188494163 [12,] 0.487144764 0.300442507 [13,] 0.119218567 0.487144764 [14,] 0.020609928 0.119218567 [15,] -0.250788665 0.020609928 [16,] -0.309968364 -0.250788665 [17,] 0.027528921 -0.309968364 [18,] 0.048636560 0.027528921 [19,] 0.022711332 0.048636560 [20,] -0.039285956 0.022711332 [21,] 0.004255853 -0.039285956 [22,] 0.150856357 0.004255853 [23,] 0.154375050 0.150856357 [24,] 0.343848664 0.154375050 [25,] 0.356407389 0.343848664 [26,] 0.409128897 0.356407389 [27,] 0.506404677 0.409128897 [28,] 0.093252614 0.506404677 [29,] -0.086000477 0.093252614 [30,] -0.125613443 -0.086000477 [31,] -0.130342182 -0.125613443 [32,] -0.032708812 -0.130342182 [33,] -0.009407204 -0.032708812 [34,] -0.335093135 -0.009407204 [35,] -0.414225697 -0.335093135 [36,] -0.243546556 -0.414225697 [37,] -0.095089335 -0.243546556 [38,] -0.159471850 -0.095089335 [39,] -0.167734264 -0.159471850 [40,] -0.147634568 -0.167734264 [41,] -0.206647457 -0.147634568 [42,] -0.182648361 -0.206647457 [43,] -0.188333387 -0.182648361 [44,] -0.209850272 -0.188333387 [45,] -0.264618013 -0.209850272 [46,] -0.099223036 -0.264618013 [47,] -0.111607359 -0.099223036 [48,] 0.002688364 -0.111607359 [49,] 0.093316437 0.002688364 [50,] -0.047689697 0.093316437 [51,] 0.090066485 -0.047689697 [52,] 0.267750608 0.090066485 [53,] 0.148017114 0.267750608 [54,] 0.138764451 0.148017114 [55,] -0.002819072 0.138764451 [56,] 0.001687159 -0.002819072 [57,] 0.157995806 0.001687159 [58,] 0.094965651 0.157995806 [59,] 0.071015499 0.094965651 [60,] 0.115916245 0.071015499 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.473853057 -0.706051480 2 -0.222577278 -0.473853057 3 -0.177948234 -0.222577278 4 0.096599710 -0.177948234 5 0.117101898 0.096599710 6 0.120860793 0.117101898 7 0.298783309 0.120860793 8 0.280157881 0.298783309 9 0.111773558 0.280157881 10 0.188494163 0.111773558 11 0.300442507 0.188494163 12 0.487144764 0.300442507 13 0.119218567 0.487144764 14 0.020609928 0.119218567 15 -0.250788665 0.020609928 16 -0.309968364 -0.250788665 17 0.027528921 -0.309968364 18 0.048636560 0.027528921 19 0.022711332 0.048636560 20 -0.039285956 0.022711332 21 0.004255853 -0.039285956 22 0.150856357 0.004255853 23 0.154375050 0.150856357 24 0.343848664 0.154375050 25 0.356407389 0.343848664 26 0.409128897 0.356407389 27 0.506404677 0.409128897 28 0.093252614 0.506404677 29 -0.086000477 0.093252614 30 -0.125613443 -0.086000477 31 -0.130342182 -0.125613443 32 -0.032708812 -0.130342182 33 -0.009407204 -0.032708812 34 -0.335093135 -0.009407204 35 -0.414225697 -0.335093135 36 -0.243546556 -0.414225697 37 -0.095089335 -0.243546556 38 -0.159471850 -0.095089335 39 -0.167734264 -0.159471850 40 -0.147634568 -0.167734264 41 -0.206647457 -0.147634568 42 -0.182648361 -0.206647457 43 -0.188333387 -0.182648361 44 -0.209850272 -0.188333387 45 -0.264618013 -0.209850272 46 -0.099223036 -0.264618013 47 -0.111607359 -0.099223036 48 0.002688364 -0.111607359 49 0.093316437 0.002688364 50 -0.047689697 0.093316437 51 0.090066485 -0.047689697 52 0.267750608 0.090066485 53 0.148017114 0.267750608 54 0.138764451 0.148017114 55 -0.002819072 0.138764451 56 0.001687159 -0.002819072 57 0.157995806 0.001687159 58 0.094965651 0.157995806 59 0.071015499 0.094965651 60 0.115916245 0.071015499 > 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/7y5481227781806.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/8f1rg1227781806.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/99wfg1227781806.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/10i0je1227781806.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/11xclk1227781806.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/12lrn21227781806.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/131jw81227781806.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/14ftkf1227781806.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/15z90i1227781806.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/16lmq11227781806.tab") + } > > system("convert tmp/1jspj1227781806.ps tmp/1jspj1227781806.png") > system("convert tmp/2gpnh1227781806.ps tmp/2gpnh1227781806.png") > system("convert tmp/3capr1227781806.ps tmp/3capr1227781806.png") > system("convert tmp/4pbn81227781806.ps tmp/4pbn81227781806.png") > system("convert tmp/59fcr1227781806.ps tmp/59fcr1227781806.png") > system("convert tmp/6mnn21227781806.ps tmp/6mnn21227781806.png") > system("convert tmp/7y5481227781806.ps tmp/7y5481227781806.png") > system("convert tmp/8f1rg1227781806.ps tmp/8f1rg1227781806.png") > system("convert tmp/99wfg1227781806.ps tmp/99wfg1227781806.png") > system("convert tmp/10i0je1227781806.ps tmp/10i0je1227781806.png") > > > proc.time() user system elapsed 4.959 2.741 5.324