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(3,101.2,3.21,101.1,3.37,100.7,3.51,100.1,3.75,99.9,4.11,99.7,4.25,99.5,4.25,99.2,4.5,99,4.7,99,4.75,99.3,4.75,99.5,4.75,99.7,4.75,100,4.75,100.4,4.75,100.6,4.58,100.7,4.5,100.7,4.5,100.6,4.49,100.5,4.03,100.6,3.75,100.5,3.39,100.4,3.25,100.3,3.25,100.4,3.25,100.4,3.25,100.4,3.25,100.4,3.25,100.4,3.25,100.5,3.25,100.6,3.25,100.6,3.25,100.5,3.25,100.5,3.25,100.7,2.85,101.1,2.75,101.5,2.75,101.9,2.55,102.1,2.5,102.1,2.5,102.1,2.1,102.4,2,102.8,2,103.1,2,103.1,2,102.9,2,102.4,2,101.9,2,101.3,2,100.7,2,100.6,2,101,2,101.5,2,101.9,2,102.1,2,102.3,2,102.5,2,102.9,2,103.6,2,104.3),dim=c(2,60),dimnames=list(c('Rente','Tprod'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Rente','Tprod'),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 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '2' > #'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 Tprod Rente M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 101.2 3.00 1 0 0 0 0 0 0 0 0 0 0 2 101.1 3.21 0 1 0 0 0 0 0 0 0 0 0 3 100.7 3.37 0 0 1 0 0 0 0 0 0 0 0 4 100.1 3.51 0 0 0 1 0 0 0 0 0 0 0 5 99.9 3.75 0 0 0 0 1 0 0 0 0 0 0 6 99.7 4.11 0 0 0 0 0 1 0 0 0 0 0 7 99.5 4.25 0 0 0 0 0 0 1 0 0 0 0 8 99.2 4.25 0 0 0 0 0 0 0 1 0 0 0 9 99.0 4.50 0 0 0 0 0 0 0 0 1 0 0 10 99.0 4.70 0 0 0 0 0 0 0 0 0 1 0 11 99.3 4.75 0 0 0 0 0 0 0 0 0 0 1 12 99.5 4.75 0 0 0 0 0 0 0 0 0 0 0 13 99.7 4.75 1 0 0 0 0 0 0 0 0 0 0 14 100.0 4.75 0 1 0 0 0 0 0 0 0 0 0 15 100.4 4.75 0 0 1 0 0 0 0 0 0 0 0 16 100.6 4.75 0 0 0 1 0 0 0 0 0 0 0 17 100.7 4.58 0 0 0 0 1 0 0 0 0 0 0 18 100.7 4.50 0 0 0 0 0 1 0 0 0 0 0 19 100.6 4.50 0 0 0 0 0 0 1 0 0 0 0 20 100.5 4.49 0 0 0 0 0 0 0 1 0 0 0 21 100.6 4.03 0 0 0 0 0 0 0 0 1 0 0 22 100.5 3.75 0 0 0 0 0 0 0 0 0 1 0 23 100.4 3.39 0 0 0 0 0 0 0 0 0 0 1 24 100.3 3.25 0 0 0 0 0 0 0 0 0 0 0 25 100.4 3.25 1 0 0 0 0 0 0 0 0 0 0 26 100.4 3.25 0 1 0 0 0 0 0 0 0 0 0 27 100.4 3.25 0 0 1 0 0 0 0 0 0 0 0 28 100.4 3.25 0 0 0 1 0 0 0 0 0 0 0 29 100.4 3.25 0 0 0 0 1 0 0 0 0 0 0 30 100.5 3.25 0 0 0 0 0 1 0 0 0 0 0 31 100.6 3.25 0 0 0 0 0 0 1 0 0 0 0 32 100.6 3.25 0 0 0 0 0 0 0 1 0 0 0 33 100.5 3.25 0 0 0 0 0 0 0 0 1 0 0 34 100.5 3.25 0 0 0 0 0 0 0 0 0 1 0 35 100.7 3.25 0 0 0 0 0 0 0 0 0 0 1 36 101.1 2.85 0 0 0 0 0 0 0 0 0 0 0 37 101.5 2.75 1 0 0 0 0 0 0 0 0 0 0 38 101.9 2.75 0 1 0 0 0 0 0 0 0 0 0 39 102.1 2.55 0 0 1 0 0 0 0 0 0 0 0 40 102.1 2.50 0 0 0 1 0 0 0 0 0 0 0 41 102.1 2.50 0 0 0 0 1 0 0 0 0 0 0 42 102.4 2.10 0 0 0 0 0 1 0 0 0 0 0 43 102.8 2.00 0 0 0 0 0 0 1 0 0 0 0 44 103.1 2.00 0 0 0 0 0 0 0 1 0 0 0 45 103.1 2.00 0 0 0 0 0 0 0 0 1 0 0 46 102.9 2.00 0 0 0 0 0 0 0 0 0 1 0 47 102.4 2.00 0 0 0 0 0 0 0 0 0 0 1 48 101.9 2.00 0 0 0 0 0 0 0 0 0 0 0 49 101.3 2.00 1 0 0 0 0 0 0 0 0 0 0 50 100.7 2.00 0 1 0 0 0 0 0 0 0 0 0 51 100.6 2.00 0 0 1 0 0 0 0 0 0 0 0 52 101.0 2.00 0 0 0 1 0 0 0 0 0 0 0 53 101.5 2.00 0 0 0 0 1 0 0 0 0 0 0 54 101.9 2.00 0 0 0 0 0 1 0 0 0 0 0 55 102.1 2.00 0 0 0 0 0 0 1 0 0 0 0 56 102.3 2.00 0 0 0 0 0 0 0 1 0 0 0 57 102.5 2.00 0 0 0 0 0 0 0 0 1 0 0 58 102.9 2.00 0 0 0 0 0 0 0 0 0 1 0 59 103.6 2.00 0 0 0 0 0 0 0 0 0 0 1 60 104.3 2.00 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Rente M1 M2 M3 M4 104.23901 -0.94916 -0.42915 -0.38929 -0.37688 -0.35979 M5 M6 M7 M8 M9 M10 -0.26651 -0.16929 -0.08169 -0.06359 -0.10346 -0.09864 M11 -0.03749 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.3638 -0.4885 -0.1947 0.5882 1.9593 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 104.23901 0.46018 226.520 < 2e-16 *** Rente -0.94916 0.10156 -9.345 2.72e-12 *** M1 -0.42915 0.49181 -0.873 0.387 M2 -0.38929 0.49199 -0.791 0.433 M3 -0.37688 0.49195 -0.766 0.447 M4 -0.35979 0.49203 -0.731 0.468 M5 -0.26651 0.49210 -0.542 0.591 M6 -0.16929 0.49199 -0.344 0.732 M7 -0.08169 0.49202 -0.166 0.869 M8 -0.06359 0.49202 -0.129 0.898 M9 -0.10346 0.49183 -0.210 0.834 M10 -0.09864 0.49177 -0.201 0.842 M11 -0.03749 0.49159 -0.076 0.940 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7771 on 47 degrees of freedom Multiple R-squared: 0.6592, Adjusted R-squared: 0.5722 F-statistic: 7.577 on 12 and 47 DF, p-value: 1.544e-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.31053517 0.62107035 0.6894648 [2,] 0.36707072 0.73414144 0.6329293 [3,] 0.40803610 0.81607220 0.5919639 [4,] 0.45020552 0.90041103 0.5497945 [5,] 0.52540325 0.94919351 0.4745968 [6,] 0.58477690 0.83044620 0.4152231 [7,] 0.55963336 0.88073328 0.4403666 [8,] 0.47284827 0.94569654 0.5271517 [9,] 0.39398509 0.78797018 0.6060149 [10,] 0.30551848 0.61103697 0.6944815 [11,] 0.23671717 0.47343433 0.7632828 [12,] 0.18015403 0.36030806 0.8198460 [13,] 0.12525602 0.25051205 0.8747440 [14,] 0.08224957 0.16449915 0.9177504 [15,] 0.05042439 0.10084877 0.9495756 [16,] 0.02973465 0.05946929 0.9702654 [17,] 0.01835769 0.03671538 0.9816423 [18,] 0.01233617 0.02467235 0.9876638 [19,] 0.01090664 0.02181328 0.9890934 [20,] 0.02050226 0.04100452 0.9794977 [21,] 0.17752662 0.35505324 0.8224734 [22,] 0.18587392 0.37174785 0.8141261 [23,] 0.15958922 0.31917844 0.8404108 [24,] 0.13566312 0.27132625 0.8643369 [25,] 0.10736596 0.21473192 0.8926340 [26,] 0.07966888 0.15933776 0.9203311 [27,] 0.04994172 0.09988344 0.9500583 [28,] 0.03920183 0.07840366 0.9607982 [29,] 0.03424094 0.06848188 0.9657591 > postscript(file="/var/www/html/rcomp/tmp/1l7fy1258663129.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/2vrr71258663129.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/3r00m1258663129.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/4hsfl1258663129.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/5fy9f1258663129.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 6 0.23762554 0.29708494 0.03654434 -0.44765777 -0.51314691 -0.46866828 7 8 9 10 11 12 -0.62337875 -0.94148043 -0.86432480 -0.67930557 -0.39299931 -0.23048969 13 14 15 16 17 18 0.39866095 0.65879610 1.04638940 1.22930447 1.07465846 0.90150533 19 20 21 22 23 24 0.71391202 0.58631872 0.28956854 -0.08101051 -0.58386111 -0.85423433 25 26 27 28 29 30 -0.32508369 -0.36494854 -0.37735524 -0.39444017 -0.48772845 -0.48494854 31 32 33 34 35 36 -0.47254185 -0.49064352 -0.55077867 -0.55559206 -0.41674395 -0.43389957 37 38 39 40 41 42 0.30033476 0.66046991 0.65823060 0.59368751 0.50039923 0.32351390 43 44 45 46 47 48 0.54100429 0.82290261 0.86276746 0.65795407 0.09680219 -0.44068820 49 50 51 52 53 54 -0.61153756 -1.25140241 -1.36380910 -0.98089404 -0.57418232 -0.27140241 55 56 57 58 59 60 -0.15899571 0.02290261 0.26276746 0.65795407 1.29680219 1.95931180 > postscript(file="/var/www/html/rcomp/tmp/68e4l1258663129.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 0.23762554 NA 1 0.29708494 0.23762554 2 0.03654434 0.29708494 3 -0.44765777 0.03654434 4 -0.51314691 -0.44765777 5 -0.46866828 -0.51314691 6 -0.62337875 -0.46866828 7 -0.94148043 -0.62337875 8 -0.86432480 -0.94148043 9 -0.67930557 -0.86432480 10 -0.39299931 -0.67930557 11 -0.23048969 -0.39299931 12 0.39866095 -0.23048969 13 0.65879610 0.39866095 14 1.04638940 0.65879610 15 1.22930447 1.04638940 16 1.07465846 1.22930447 17 0.90150533 1.07465846 18 0.71391202 0.90150533 19 0.58631872 0.71391202 20 0.28956854 0.58631872 21 -0.08101051 0.28956854 22 -0.58386111 -0.08101051 23 -0.85423433 -0.58386111 24 -0.32508369 -0.85423433 25 -0.36494854 -0.32508369 26 -0.37735524 -0.36494854 27 -0.39444017 -0.37735524 28 -0.48772845 -0.39444017 29 -0.48494854 -0.48772845 30 -0.47254185 -0.48494854 31 -0.49064352 -0.47254185 32 -0.55077867 -0.49064352 33 -0.55559206 -0.55077867 34 -0.41674395 -0.55559206 35 -0.43389957 -0.41674395 36 0.30033476 -0.43389957 37 0.66046991 0.30033476 38 0.65823060 0.66046991 39 0.59368751 0.65823060 40 0.50039923 0.59368751 41 0.32351390 0.50039923 42 0.54100429 0.32351390 43 0.82290261 0.54100429 44 0.86276746 0.82290261 45 0.65795407 0.86276746 46 0.09680219 0.65795407 47 -0.44068820 0.09680219 48 -0.61153756 -0.44068820 49 -1.25140241 -0.61153756 50 -1.36380910 -1.25140241 51 -0.98089404 -1.36380910 52 -0.57418232 -0.98089404 53 -0.27140241 -0.57418232 54 -0.15899571 -0.27140241 55 0.02290261 -0.15899571 56 0.26276746 0.02290261 57 0.65795407 0.26276746 58 1.29680219 0.65795407 59 1.95931180 1.29680219 60 NA 1.95931180 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.29708494 0.23762554 [2,] 0.03654434 0.29708494 [3,] -0.44765777 0.03654434 [4,] -0.51314691 -0.44765777 [5,] -0.46866828 -0.51314691 [6,] -0.62337875 -0.46866828 [7,] -0.94148043 -0.62337875 [8,] -0.86432480 -0.94148043 [9,] -0.67930557 -0.86432480 [10,] -0.39299931 -0.67930557 [11,] -0.23048969 -0.39299931 [12,] 0.39866095 -0.23048969 [13,] 0.65879610 0.39866095 [14,] 1.04638940 0.65879610 [15,] 1.22930447 1.04638940 [16,] 1.07465846 1.22930447 [17,] 0.90150533 1.07465846 [18,] 0.71391202 0.90150533 [19,] 0.58631872 0.71391202 [20,] 0.28956854 0.58631872 [21,] -0.08101051 0.28956854 [22,] -0.58386111 -0.08101051 [23,] -0.85423433 -0.58386111 [24,] -0.32508369 -0.85423433 [25,] -0.36494854 -0.32508369 [26,] -0.37735524 -0.36494854 [27,] -0.39444017 -0.37735524 [28,] -0.48772845 -0.39444017 [29,] -0.48494854 -0.48772845 [30,] -0.47254185 -0.48494854 [31,] -0.49064352 -0.47254185 [32,] -0.55077867 -0.49064352 [33,] -0.55559206 -0.55077867 [34,] -0.41674395 -0.55559206 [35,] -0.43389957 -0.41674395 [36,] 0.30033476 -0.43389957 [37,] 0.66046991 0.30033476 [38,] 0.65823060 0.66046991 [39,] 0.59368751 0.65823060 [40,] 0.50039923 0.59368751 [41,] 0.32351390 0.50039923 [42,] 0.54100429 0.32351390 [43,] 0.82290261 0.54100429 [44,] 0.86276746 0.82290261 [45,] 0.65795407 0.86276746 [46,] 0.09680219 0.65795407 [47,] -0.44068820 0.09680219 [48,] -0.61153756 -0.44068820 [49,] -1.25140241 -0.61153756 [50,] -1.36380910 -1.25140241 [51,] -0.98089404 -1.36380910 [52,] -0.57418232 -0.98089404 [53,] -0.27140241 -0.57418232 [54,] -0.15899571 -0.27140241 [55,] 0.02290261 -0.15899571 [56,] 0.26276746 0.02290261 [57,] 0.65795407 0.26276746 [58,] 1.29680219 0.65795407 [59,] 1.95931180 1.29680219 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.29708494 0.23762554 2 0.03654434 0.29708494 3 -0.44765777 0.03654434 4 -0.51314691 -0.44765777 5 -0.46866828 -0.51314691 6 -0.62337875 -0.46866828 7 -0.94148043 -0.62337875 8 -0.86432480 -0.94148043 9 -0.67930557 -0.86432480 10 -0.39299931 -0.67930557 11 -0.23048969 -0.39299931 12 0.39866095 -0.23048969 13 0.65879610 0.39866095 14 1.04638940 0.65879610 15 1.22930447 1.04638940 16 1.07465846 1.22930447 17 0.90150533 1.07465846 18 0.71391202 0.90150533 19 0.58631872 0.71391202 20 0.28956854 0.58631872 21 -0.08101051 0.28956854 22 -0.58386111 -0.08101051 23 -0.85423433 -0.58386111 24 -0.32508369 -0.85423433 25 -0.36494854 -0.32508369 26 -0.37735524 -0.36494854 27 -0.39444017 -0.37735524 28 -0.48772845 -0.39444017 29 -0.48494854 -0.48772845 30 -0.47254185 -0.48494854 31 -0.49064352 -0.47254185 32 -0.55077867 -0.49064352 33 -0.55559206 -0.55077867 34 -0.41674395 -0.55559206 35 -0.43389957 -0.41674395 36 0.30033476 -0.43389957 37 0.66046991 0.30033476 38 0.65823060 0.66046991 39 0.59368751 0.65823060 40 0.50039923 0.59368751 41 0.32351390 0.50039923 42 0.54100429 0.32351390 43 0.82290261 0.54100429 44 0.86276746 0.82290261 45 0.65795407 0.86276746 46 0.09680219 0.65795407 47 -0.44068820 0.09680219 48 -0.61153756 -0.44068820 49 -1.25140241 -0.61153756 50 -1.36380910 -1.25140241 51 -0.98089404 -1.36380910 52 -0.57418232 -0.98089404 53 -0.27140241 -0.57418232 54 -0.15899571 -0.27140241 55 0.02290261 -0.15899571 56 0.26276746 0.02290261 57 0.65795407 0.26276746 58 1.29680219 0.65795407 59 1.95931180 1.29680219 > 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/7ap7j1258663129.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/89qx61258663129.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/912fw1258663129.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/10hwzw1258663129.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/11vvi41258663129.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/12f3br1258663129.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/13vnex1258663129.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/143gsh1258663129.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/15ccha1258663129.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/16zqhz1258663129.tab") + } > system("convert tmp/1l7fy1258663129.ps tmp/1l7fy1258663129.png") > system("convert tmp/2vrr71258663129.ps tmp/2vrr71258663129.png") > system("convert tmp/3r00m1258663129.ps tmp/3r00m1258663129.png") > system("convert tmp/4hsfl1258663129.ps tmp/4hsfl1258663129.png") > system("convert tmp/5fy9f1258663129.ps tmp/5fy9f1258663129.png") > system("convert tmp/68e4l1258663129.ps tmp/68e4l1258663129.png") > system("convert tmp/7ap7j1258663129.ps tmp/7ap7j1258663129.png") > system("convert tmp/89qx61258663129.ps tmp/89qx61258663129.png") > system("convert tmp/912fw1258663129.ps tmp/912fw1258663129.png") > system("convert tmp/10hwzw1258663129.ps tmp/10hwzw1258663129.png") > > > proc.time() user system elapsed 2.440 1.588 3.908