R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(98.1 + ,102.8 + ,104.7 + ,95.9 + ,94.6 + ,15607.4 + ,-7.5 + ,15172.6 + ,113.9 + ,98.1 + ,102.8 + ,104.7 + ,95.9 + ,17160.9 + ,-7.8 + ,16858.9 + ,80.9 + ,113.9 + ,98.1 + ,102.8 + ,104.7 + ,14915.8 + ,-7.7 + ,14143.5 + ,95.7 + ,80.9 + ,113.9 + ,98.1 + ,102.8 + ,13768 + ,-6.6 + ,14731.8 + ,113.2 + ,95.7 + ,80.9 + ,113.9 + ,98.1 + ,17487.5 + ,-4.2 + ,16471.6 + ,105.9 + ,113.2 + ,95.7 + ,80.9 + ,113.9 + ,16198.1 + ,-2.0 + ,15214 + ,108.8 + ,105.9 + ,113.2 + ,95.7 + ,80.9 + ,17535.2 + ,-0.7 + ,17637.4 + ,102.3 + ,108.8 + ,105.9 + ,113.2 + ,95.7 + ,16571.8 + ,0.1 + ,17972.4 + ,99 + ,102.3 + ,108.8 + ,105.9 + ,113.2 + ,16198.9 + ,0.9 + ,16896.2 + ,100.7 + ,99 + ,102.3 + ,108.8 + ,105.9 + ,16554.2 + ,2.1 + ,16698 + ,115.5 + ,100.7 + ,99 + ,102.3 + ,108.8 + ,19554.2 + ,3.5 + ,19691.6 + ,100.7 + ,115.5 + ,100.7 + ,99 + ,102.3 + ,15903.8 + ,4.9 + ,15930.7 + ,109.9 + ,100.7 + ,115.5 + ,100.7 + ,99 + ,18003.8 + ,5.7 + ,17444.6 + ,114.6 + ,109.9 + ,100.7 + ,115.5 + ,100.7 + ,18329.6 + ,6.2 + ,17699.4 + ,85.4 + ,114.6 + ,109.9 + ,100.7 + ,115.5 + ,16260.7 + ,6.5 + ,15189.8 + ,100.5 + ,85.4 + ,114.6 + ,109.9 + ,100.7 + ,14851.9 + ,6.5 + ,15672.7 + ,114.8 + ,100.5 + ,85.4 + ,114.6 + ,109.9 + ,18174.1 + ,6.3 + ,17180.8 + ,116.5 + ,114.8 + ,100.5 + ,85.4 + ,114.6 + ,18406.6 + ,6.2 + ,17664.9 + ,112.9 + ,116.5 + ,114.8 + ,100.5 + ,85.4 + ,18466.5 + ,6.4 + ,17862.9 + ,102 + ,112.9 + ,116.5 + ,114.8 + ,100.5 + ,16016.5 + ,6.3 + ,16162.3 + ,106 + ,102 + ,112.9 + ,116.5 + ,114.8 + ,17428.5 + ,5.8 + ,17463.6 + ,105.3 + ,106 + ,102 + ,112.9 + ,116.5 + ,17167.2 + ,5.1 + ,16772.1 + ,118.8 + ,105.3 + ,106 + ,102 + ,112.9 + ,19630 + ,5.1 + ,19106.9 + ,106.1 + ,118.8 + ,105.3 + ,106 + ,102 + ,17183.6 + ,5.8 + ,16721.3 + ,109.3 + ,106.1 + ,118.8 + ,105.3 + ,106 + ,18344.7 + ,6.7 + ,18161.3 + ,117.2 + ,109.3 + ,106.1 + ,118.8 + ,105.3 + ,19301.4 + ,7.1 + ,18509.9 + ,92.5 + ,117.2 + ,109.3 + ,106.1 + ,118.8 + ,18147.5 + ,6.7 + ,17802.7 + ,104.2 + ,92.5 + ,117.2 + ,109.3 + ,106.1 + ,16192.9 + ,5.5 + ,16409.9 + ,112.5 + ,104.2 + ,92.5 + ,117.2 + ,109.3 + ,18374.4 + ,4.2 + ,17967.7 + ,122.4 + ,112.5 + ,104.2 + ,92.5 + ,117.2 + ,20515.2 + ,3.0 + ,20286.6 + ,113.3 + ,122.4 + ,112.5 + ,104.2 + ,92.5 + ,18957.2 + ,2.2 + ,19537.3 + ,100 + ,113.3 + ,122.4 + ,112.5 + ,104.2 + ,16471.5 + ,2.0 + ,18021.9 + ,110.7 + ,100 + ,113.3 + ,122.4 + ,112.5 + ,18746.8 + ,1.8 + ,20194.3 + ,112.8 + ,110.7 + ,100 + ,113.3 + ,122.4 + ,19009.5 + ,1.8 + ,19049.6 + ,109.8 + ,112.8 + ,110.7 + ,100 + ,113.3 + ,19211.2 + ,1.5 + ,20244.7 + ,117.3 + ,109.8 + ,112.8 + ,110.7 + ,100 + ,20547.7 + ,0.4 + ,21473.3 + ,109.1 + ,117.3 + ,109.8 + ,112.8 + ,110.7 + ,19325.8 + ,-0.9 + ,19673.6 + ,115.9 + ,109.1 + ,117.3 + ,109.8 + ,112.8 + ,20605.5 + ,-1.7 + ,21053.2 + ,96 + ,115.9 + ,109.1 + ,117.3 + ,109.8 + ,20056.9 + ,-2.6 + ,20159.5 + ,99.8 + ,96 + ,115.9 + ,109.1 + ,117.3 + ,16141.4 + ,-4.4 + ,18203.6 + ,116.8 + ,99.8 + ,96 + ,115.9 + ,109.1 + ,20359.8 + ,-8.3 + ,21289.5 + ,115.7 + ,116.8 + ,99.8 + ,96 + ,115.9 + ,19711.6 + ,-14.4 + ,20432.3 + ,99.4 + ,115.7 + ,116.8 + ,99.8 + ,96 + ,15638.6 + ,-21.3 + ,17180.4 + ,94.3 + ,99.4 + ,115.7 + ,116.8 + ,99.8 + ,14384.5 + ,-26.5 + ,15816.8 + ,91 + ,94.3 + ,99.4 + ,115.7 + ,116.8 + ,13855.6 + ,-29.2 + ,15071.8 + ,93.2 + ,91 + ,94.3 + ,99.4 + ,115.7 + ,14308.3 + ,-30.8 + ,14521.1 + ,103.1 + ,93.2 + ,91 + ,94.3 + ,99.4 + ,15290.6 + ,-30.9 + ,15668.8 + ,94.1 + ,103.1 + ,93.2 + ,91 + ,94.3 + ,14423.8 + ,-29.5 + ,14346.9 + ,91.8 + ,94.1 + ,103.1 + ,93.2 + ,91 + ,13779.7 + ,-27.1 + ,13881 + ,102.7 + ,91.8 + ,94.1 + ,103.1 + ,93.2 + ,15686.3 + ,-24.4 + ,15465.9 + ,82.6 + ,102.7 + ,91.8 + ,94.1 + ,103.1 + ,14733.8 + ,-21.9 + ,14238.2 + ,89.1 + ,82.6 + ,102.7 + ,91.8 + ,94.1 + ,12522.5 + ,-19.3 + ,13557.7 + ,104.5 + ,89.1 + ,82.6 + ,102.7 + ,91.8 + ,16189.4 + ,-17.0 + ,16127.6 + ,105.1 + ,104.5 + ,89.1 + ,82.6 + ,102.7 + ,16059.1 + ,-13.8 + ,16793.9 + ,95.1 + ,105.1 + ,104.5 + ,89.1 + ,82.6 + ,16007.1 + ,-9.9 + ,16014 + ,88.7 + ,95.1 + ,105.1 + ,104.5 + ,89.1 + ,15806.8 + ,-7.9 + ,16867.9 + ,86.3 + ,88.7 + ,95.1 + ,105.1 + ,104.5 + ,15160 + ,-7.2 + ,16014.6 + ,91.8 + ,86.3 + ,88.7 + ,95.1 + ,105.1 + ,15692.1 + ,-6.2 + ,15878.6 + ,111.5 + ,91.8 + ,86.3 + ,88.7 + ,95.1 + ,18908.9 + ,-4.5 + ,18664.9 + ,99.7 + ,111.5 + ,91.8 + ,86.3 + ,88.7 + ,16969.9 + ,-3.9 + ,17962.5 + ,97.5 + ,99.7 + ,111.5 + ,91.8 + ,86.3 + ,16997.5 + ,-5.0 + ,17332.7 + ,111.7 + ,97.5 + ,99.7 + ,111.5 + ,91.8 + ,19858.9 + ,-6.2 + ,19542.1 + ,86.2 + ,111.7 + ,97.5 + ,99.7 + ,111.5 + ,17681.2 + ,-6.1 + ,17203.6 + ,95.4 + ,86.2 + ,111.7 + ,97.5 + ,99.7 + ,16006.9 + ,-5.0 + ,16579) + ,dim=c(8 + ,64) + ,dimnames=list(c('y' + ,'y1' + ,'y2' + ,'y3' + ,'y4' + ,'uitvoer' + ,'ondernemersvertrouwen' + ,'invoer') + ,1:64)) > y <- array(NA,dim=c(8,64),dimnames=list(c('y','y1','y2','y3','y4','uitvoer','ondernemersvertrouwen','invoer'),1:64)) > 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 = '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 > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x y y1 y2 y3 y4 uitvoer ondernemersvertrouwen invoer M1 M2 M3 1 98.1 102.8 104.7 95.9 94.6 15607.4 -7.5 15172.6 1 0 0 2 113.9 98.1 102.8 104.7 95.9 17160.9 -7.8 16858.9 0 1 0 3 80.9 113.9 98.1 102.8 104.7 14915.8 -7.7 14143.5 0 0 1 4 95.7 80.9 113.9 98.1 102.8 13768.0 -6.6 14731.8 0 0 0 5 113.2 95.7 80.9 113.9 98.1 17487.5 -4.2 16471.6 0 0 0 6 105.9 113.2 95.7 80.9 113.9 16198.1 -2.0 15214.0 0 0 0 7 108.8 105.9 113.2 95.7 80.9 17535.2 -0.7 17637.4 0 0 0 8 102.3 108.8 105.9 113.2 95.7 16571.8 0.1 17972.4 0 0 0 9 99.0 102.3 108.8 105.9 113.2 16198.9 0.9 16896.2 0 0 0 10 100.7 99.0 102.3 108.8 105.9 16554.2 2.1 16698.0 0 0 0 11 115.5 100.7 99.0 102.3 108.8 19554.2 3.5 19691.6 0 0 0 12 100.7 115.5 100.7 99.0 102.3 15903.8 4.9 15930.7 0 0 0 13 109.9 100.7 115.5 100.7 99.0 18003.8 5.7 17444.6 1 0 0 14 114.6 109.9 100.7 115.5 100.7 18329.6 6.2 17699.4 0 1 0 15 85.4 114.6 109.9 100.7 115.5 16260.7 6.5 15189.8 0 0 1 16 100.5 85.4 114.6 109.9 100.7 14851.9 6.5 15672.7 0 0 0 17 114.8 100.5 85.4 114.6 109.9 18174.1 6.3 17180.8 0 0 0 18 116.5 114.8 100.5 85.4 114.6 18406.6 6.2 17664.9 0 0 0 19 112.9 116.5 114.8 100.5 85.4 18466.5 6.4 17862.9 0 0 0 20 102.0 112.9 116.5 114.8 100.5 16016.5 6.3 16162.3 0 0 0 21 106.0 102.0 112.9 116.5 114.8 17428.5 5.8 17463.6 0 0 0 22 105.3 106.0 102.0 112.9 116.5 17167.2 5.1 16772.1 0 0 0 23 118.8 105.3 106.0 102.0 112.9 19630.0 5.1 19106.9 0 0 0 24 106.1 118.8 105.3 106.0 102.0 17183.6 5.8 16721.3 0 0 0 25 109.3 106.1 118.8 105.3 106.0 18344.7 6.7 18161.3 1 0 0 26 117.2 109.3 106.1 118.8 105.3 19301.4 7.1 18509.9 0 1 0 27 92.5 117.2 109.3 106.1 118.8 18147.5 6.7 17802.7 0 0 1 28 104.2 92.5 117.2 109.3 106.1 16192.9 5.5 16409.9 0 0 0 29 112.5 104.2 92.5 117.2 109.3 18374.4 4.2 17967.7 0 0 0 30 122.4 112.5 104.2 92.5 117.2 20515.2 3.0 20286.6 0 0 0 31 113.3 122.4 112.5 104.2 92.5 18957.2 2.2 19537.3 0 0 0 32 100.0 113.3 122.4 112.5 104.2 16471.5 2.0 18021.9 0 0 0 33 110.7 100.0 113.3 122.4 112.5 18746.8 1.8 20194.3 0 0 0 34 112.8 110.7 100.0 113.3 122.4 19009.5 1.8 19049.6 0 0 0 35 109.8 112.8 110.7 100.0 113.3 19211.2 1.5 20244.7 0 0 0 36 117.3 109.8 112.8 110.7 100.0 20547.7 0.4 21473.3 0 0 0 37 109.1 117.3 109.8 112.8 110.7 19325.8 -0.9 19673.6 1 0 0 38 115.9 109.1 117.3 109.8 112.8 20605.5 -1.7 21053.2 0 1 0 39 96.0 115.9 109.1 117.3 109.8 20056.9 -2.6 20159.5 0 0 1 40 99.8 96.0 115.9 109.1 117.3 16141.4 -4.4 18203.6 0 0 0 41 116.8 99.8 96.0 115.9 109.1 20359.8 -8.3 21289.5 0 0 0 42 115.7 116.8 99.8 96.0 115.9 19711.6 -14.4 20432.3 0 0 0 43 99.4 115.7 116.8 99.8 96.0 15638.6 -21.3 17180.4 0 0 0 44 94.3 99.4 115.7 116.8 99.8 14384.5 -26.5 15816.8 0 0 0 45 91.0 94.3 99.4 115.7 116.8 13855.6 -29.2 15071.8 0 0 0 46 93.2 91.0 94.3 99.4 115.7 14308.3 -30.8 14521.1 0 0 0 47 103.1 93.2 91.0 94.3 99.4 15290.6 -30.9 15668.8 0 0 0 48 94.1 103.1 93.2 91.0 94.3 14423.8 -29.5 14346.9 0 0 0 49 91.8 94.1 103.1 93.2 91.0 13779.7 -27.1 13881.0 1 0 0 50 102.7 91.8 94.1 103.1 93.2 15686.3 -24.4 15465.9 0 1 0 51 82.6 102.7 91.8 94.1 103.1 14733.8 -21.9 14238.2 0 0 1 52 89.1 82.6 102.7 91.8 94.1 12522.5 -19.3 13557.7 0 0 0 53 104.5 89.1 82.6 102.7 91.8 16189.4 -17.0 16127.6 0 0 0 54 105.1 104.5 89.1 82.6 102.7 16059.1 -13.8 16793.9 0 0 0 55 95.1 105.1 104.5 89.1 82.6 16007.1 -9.9 16014.0 0 0 0 56 88.7 95.1 105.1 104.5 89.1 15806.8 -7.9 16867.9 0 0 0 57 86.3 88.7 95.1 105.1 104.5 15160.0 -7.2 16014.6 0 0 0 58 91.8 86.3 88.7 95.1 105.1 15692.1 -6.2 15878.6 0 0 0 59 111.5 91.8 86.3 88.7 95.1 18908.9 -4.5 18664.9 0 0 0 60 99.7 111.5 91.8 86.3 88.7 16969.9 -3.9 17962.5 0 0 0 61 97.5 99.7 111.5 91.8 86.3 16997.5 -5.0 17332.7 1 0 0 62 111.7 97.5 99.7 111.5 91.8 19858.9 -6.2 19542.1 0 1 0 63 86.2 111.7 97.5 99.7 111.5 17681.2 -6.1 17203.6 0 0 1 64 95.4 86.2 111.7 97.5 99.7 16006.9 -5.0 16579.0 0 0 0 M4 M5 M6 M7 M8 M9 M10 M11 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 4 1 0 0 0 0 0 0 0 5 0 1 0 0 0 0 0 0 6 0 0 1 0 0 0 0 0 7 0 0 0 1 0 0 0 0 8 0 0 0 0 1 0 0 0 9 0 0 0 0 0 1 0 0 10 0 0 0 0 0 0 1 0 11 0 0 0 0 0 0 0 1 12 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 0 0 14 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 16 1 0 0 0 0 0 0 0 17 0 1 0 0 0 0 0 0 18 0 0 1 0 0 0 0 0 19 0 0 0 1 0 0 0 0 20 0 0 0 0 1 0 0 0 21 0 0 0 0 0 1 0 0 22 0 0 0 0 0 0 1 0 23 0 0 0 0 0 0 0 1 24 0 0 0 0 0 0 0 0 25 0 0 0 0 0 0 0 0 26 0 0 0 0 0 0 0 0 27 0 0 0 0 0 0 0 0 28 1 0 0 0 0 0 0 0 29 0 1 0 0 0 0 0 0 30 0 0 1 0 0 0 0 0 31 0 0 0 1 0 0 0 0 32 0 0 0 0 1 0 0 0 33 0 0 0 0 0 1 0 0 34 0 0 0 0 0 0 1 0 35 0 0 0 0 0 0 0 1 36 0 0 0 0 0 0 0 0 37 0 0 0 0 0 0 0 0 38 0 0 0 0 0 0 0 0 39 0 0 0 0 0 0 0 0 40 1 0 0 0 0 0 0 0 41 0 1 0 0 0 0 0 0 42 0 0 1 0 0 0 0 0 43 0 0 0 1 0 0 0 0 44 0 0 0 0 1 0 0 0 45 0 0 0 0 0 1 0 0 46 0 0 0 0 0 0 1 0 47 0 0 0 0 0 0 0 1 48 0 0 0 0 0 0 0 0 49 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 51 0 0 0 0 0 0 0 0 52 1 0 0 0 0 0 0 0 53 0 1 0 0 0 0 0 0 54 0 0 1 0 0 0 0 0 55 0 0 0 1 0 0 0 0 56 0 0 0 0 1 0 0 0 57 0 0 0 0 0 1 0 0 58 0 0 0 0 0 0 1 0 59 0 0 0 0 0 0 0 1 60 0 0 0 0 0 0 0 0 61 0 0 0 0 0 0 0 0 62 0 0 0 0 0 0 0 0 63 0 0 0 0 0 0 0 0 64 1 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) y1 y2 22.672926 0.017469 0.131438 y3 y4 uitvoer 0.300292 -0.031989 0.004513 ondernemersvertrouwen invoer M1 0.008792 -0.002168 -3.257003 M2 M3 M4 0.633034 -19.234837 -1.943181 M5 M6 M7 2.791387 10.165372 0.033113 M8 M9 M10 -7.231640 -6.339951 -3.288692 M11 5.435076 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.9256 -1.5219 0.2736 1.3305 6.1766 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.267e+01 1.089e+01 2.082 0.043030 * y1 1.747e-02 1.163e-01 0.150 0.881294 y2 1.314e-01 9.390e-02 1.400 0.168462 y3 3.003e-01 9.281e-02 3.236 0.002279 ** y4 -3.199e-02 1.045e-01 -0.306 0.760849 uitvoer 4.513e-03 1.168e-03 3.864 0.000355 *** ondernemersvertrouwen 8.792e-03 6.927e-02 0.127 0.899569 invoer -2.168e-03 9.112e-04 -2.380 0.021629 * M1 -3.257e+00 2.152e+00 -1.514 0.137141 M2 6.330e-01 2.429e+00 0.261 0.795550 M3 -1.923e+01 2.185e+00 -8.805 2.40e-11 *** M4 -1.943e+00 4.195e+00 -0.463 0.645465 M5 2.791e+00 3.585e+00 0.779 0.440230 M6 1.017e+01 2.919e+00 3.483 0.001116 ** M7 3.311e-02 2.595e+00 0.013 0.989875 M8 -7.232e+00 2.897e+00 -2.496 0.016298 * M9 -6.340e+00 3.823e+00 -1.658 0.104212 M10 -3.289e+00 3.524e+00 -0.933 0.355692 M11 5.435e+00 2.719e+00 1.999 0.051652 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.827 on 45 degrees of freedom Multiple R-squared: 0.9447, Adjusted R-squared: 0.9225 F-statistic: 42.68 on 18 and 45 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.073211397 0.146422794 0.9267886 [2,] 0.022556593 0.045113185 0.9774434 [3,] 0.043531183 0.087062367 0.9564688 [4,] 0.019683231 0.039366462 0.9803168 [5,] 0.034714978 0.069429956 0.9652850 [6,] 0.015086897 0.030173793 0.9849131 [7,] 0.008917007 0.017834014 0.9910830 [8,] 0.005135392 0.010270783 0.9948646 [9,] 0.002990417 0.005980834 0.9970096 [10,] 0.003707646 0.007415291 0.9962924 [11,] 0.002216540 0.004433079 0.9977835 [12,] 0.009319906 0.018639812 0.9906801 [13,] 0.066483824 0.132967647 0.9335162 [14,] 0.053041864 0.106083727 0.9469581 [15,] 0.145631554 0.291263108 0.8543684 [16,] 0.125610752 0.251221504 0.8743892 [17,] 0.228472459 0.456944918 0.7715275 [18,] 0.175710305 0.351420611 0.8242897 [19,] 0.102237990 0.204475980 0.8977620 [20,] 0.057865679 0.115731358 0.9421343 [21,] 0.031411001 0.062822002 0.9685890 > postscript(file="/var/www/rcomp/tmp/18rq21293197823.ps",horizontal=F,onefile=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/rcomp/tmp/28rq21293197823.ps",horizontal=F,onefile=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/rcomp/tmp/38rq21293197823.ps",horizontal=F,onefile=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/rcomp/tmp/4i07n1293197823.ps",horizontal=F,onefile=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/rcomp/tmp/5i07n1293197823.ps",horizontal=F,onefile=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 = 64 Frequency = 1 1 2 3 4 5 6 -0.11268585 6.17659595 -1.51878252 2.28547618 1.20108752 -2.23626668 7 8 9 10 11 12 2.33254632 4.29132547 1.92624807 -1.66104304 -0.19565376 -0.95321844 13 14 15 16 17 18 2.99978681 0.28221438 -1.53121790 0.33785274 0.64002139 1.65171729 19 20 21 22 23 24 0.96347340 0.72621033 0.89905393 -0.66799268 0.70127349 -2.39616673 25 26 27 28 29 30 0.72110165 -1.29687193 1.23529332 -0.51930126 -2.63701492 1.25381206 31 32 33 34 35 36 2.13180313 0.76935604 3.74300836 3.73483758 -4.04553082 1.66970521 37 38 39 40 41 42 -1.67500722 -1.41609154 -2.29155229 -0.18262341 0.01664364 -1.94029233 43 44 45 46 47 48 -0.71097500 -0.35182416 -0.64268728 0.87072091 1.50887500 -0.65723173 49 50 51 52 53 54 0.26489441 0.40426052 4.91776524 1.92790197 0.77926238 1.27102966 55 56 57 58 59 60 -4.71684785 -5.43506768 -5.92562309 -2.27652277 2.03103608 2.33691168 61 62 63 64 -2.19808981 -4.15010738 -0.81150586 -3.84930621 > postscript(file="/var/www/rcomp/tmp/6i07n1293197823.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 64 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.11268585 NA 1 6.17659595 -0.11268585 2 -1.51878252 6.17659595 3 2.28547618 -1.51878252 4 1.20108752 2.28547618 5 -2.23626668 1.20108752 6 2.33254632 -2.23626668 7 4.29132547 2.33254632 8 1.92624807 4.29132547 9 -1.66104304 1.92624807 10 -0.19565376 -1.66104304 11 -0.95321844 -0.19565376 12 2.99978681 -0.95321844 13 0.28221438 2.99978681 14 -1.53121790 0.28221438 15 0.33785274 -1.53121790 16 0.64002139 0.33785274 17 1.65171729 0.64002139 18 0.96347340 1.65171729 19 0.72621033 0.96347340 20 0.89905393 0.72621033 21 -0.66799268 0.89905393 22 0.70127349 -0.66799268 23 -2.39616673 0.70127349 24 0.72110165 -2.39616673 25 -1.29687193 0.72110165 26 1.23529332 -1.29687193 27 -0.51930126 1.23529332 28 -2.63701492 -0.51930126 29 1.25381206 -2.63701492 30 2.13180313 1.25381206 31 0.76935604 2.13180313 32 3.74300836 0.76935604 33 3.73483758 3.74300836 34 -4.04553082 3.73483758 35 1.66970521 -4.04553082 36 -1.67500722 1.66970521 37 -1.41609154 -1.67500722 38 -2.29155229 -1.41609154 39 -0.18262341 -2.29155229 40 0.01664364 -0.18262341 41 -1.94029233 0.01664364 42 -0.71097500 -1.94029233 43 -0.35182416 -0.71097500 44 -0.64268728 -0.35182416 45 0.87072091 -0.64268728 46 1.50887500 0.87072091 47 -0.65723173 1.50887500 48 0.26489441 -0.65723173 49 0.40426052 0.26489441 50 4.91776524 0.40426052 51 1.92790197 4.91776524 52 0.77926238 1.92790197 53 1.27102966 0.77926238 54 -4.71684785 1.27102966 55 -5.43506768 -4.71684785 56 -5.92562309 -5.43506768 57 -2.27652277 -5.92562309 58 2.03103608 -2.27652277 59 2.33691168 2.03103608 60 -2.19808981 2.33691168 61 -4.15010738 -2.19808981 62 -0.81150586 -4.15010738 63 -3.84930621 -0.81150586 64 NA -3.84930621 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 6.17659595 -0.11268585 [2,] -1.51878252 6.17659595 [3,] 2.28547618 -1.51878252 [4,] 1.20108752 2.28547618 [5,] -2.23626668 1.20108752 [6,] 2.33254632 -2.23626668 [7,] 4.29132547 2.33254632 [8,] 1.92624807 4.29132547 [9,] -1.66104304 1.92624807 [10,] -0.19565376 -1.66104304 [11,] -0.95321844 -0.19565376 [12,] 2.99978681 -0.95321844 [13,] 0.28221438 2.99978681 [14,] -1.53121790 0.28221438 [15,] 0.33785274 -1.53121790 [16,] 0.64002139 0.33785274 [17,] 1.65171729 0.64002139 [18,] 0.96347340 1.65171729 [19,] 0.72621033 0.96347340 [20,] 0.89905393 0.72621033 [21,] -0.66799268 0.89905393 [22,] 0.70127349 -0.66799268 [23,] -2.39616673 0.70127349 [24,] 0.72110165 -2.39616673 [25,] -1.29687193 0.72110165 [26,] 1.23529332 -1.29687193 [27,] -0.51930126 1.23529332 [28,] -2.63701492 -0.51930126 [29,] 1.25381206 -2.63701492 [30,] 2.13180313 1.25381206 [31,] 0.76935604 2.13180313 [32,] 3.74300836 0.76935604 [33,] 3.73483758 3.74300836 [34,] -4.04553082 3.73483758 [35,] 1.66970521 -4.04553082 [36,] -1.67500722 1.66970521 [37,] -1.41609154 -1.67500722 [38,] -2.29155229 -1.41609154 [39,] -0.18262341 -2.29155229 [40,] 0.01664364 -0.18262341 [41,] -1.94029233 0.01664364 [42,] -0.71097500 -1.94029233 [43,] -0.35182416 -0.71097500 [44,] -0.64268728 -0.35182416 [45,] 0.87072091 -0.64268728 [46,] 1.50887500 0.87072091 [47,] -0.65723173 1.50887500 [48,] 0.26489441 -0.65723173 [49,] 0.40426052 0.26489441 [50,] 4.91776524 0.40426052 [51,] 1.92790197 4.91776524 [52,] 0.77926238 1.92790197 [53,] 1.27102966 0.77926238 [54,] -4.71684785 1.27102966 [55,] -5.43506768 -4.71684785 [56,] -5.92562309 -5.43506768 [57,] -2.27652277 -5.92562309 [58,] 2.03103608 -2.27652277 [59,] 2.33691168 2.03103608 [60,] -2.19808981 2.33691168 [61,] -4.15010738 -2.19808981 [62,] -0.81150586 -4.15010738 [63,] -3.84930621 -0.81150586 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 6.17659595 -0.11268585 2 -1.51878252 6.17659595 3 2.28547618 -1.51878252 4 1.20108752 2.28547618 5 -2.23626668 1.20108752 6 2.33254632 -2.23626668 7 4.29132547 2.33254632 8 1.92624807 4.29132547 9 -1.66104304 1.92624807 10 -0.19565376 -1.66104304 11 -0.95321844 -0.19565376 12 2.99978681 -0.95321844 13 0.28221438 2.99978681 14 -1.53121790 0.28221438 15 0.33785274 -1.53121790 16 0.64002139 0.33785274 17 1.65171729 0.64002139 18 0.96347340 1.65171729 19 0.72621033 0.96347340 20 0.89905393 0.72621033 21 -0.66799268 0.89905393 22 0.70127349 -0.66799268 23 -2.39616673 0.70127349 24 0.72110165 -2.39616673 25 -1.29687193 0.72110165 26 1.23529332 -1.29687193 27 -0.51930126 1.23529332 28 -2.63701492 -0.51930126 29 1.25381206 -2.63701492 30 2.13180313 1.25381206 31 0.76935604 2.13180313 32 3.74300836 0.76935604 33 3.73483758 3.74300836 34 -4.04553082 3.73483758 35 1.66970521 -4.04553082 36 -1.67500722 1.66970521 37 -1.41609154 -1.67500722 38 -2.29155229 -1.41609154 39 -0.18262341 -2.29155229 40 0.01664364 -0.18262341 41 -1.94029233 0.01664364 42 -0.71097500 -1.94029233 43 -0.35182416 -0.71097500 44 -0.64268728 -0.35182416 45 0.87072091 -0.64268728 46 1.50887500 0.87072091 47 -0.65723173 1.50887500 48 0.26489441 -0.65723173 49 0.40426052 0.26489441 50 4.91776524 0.40426052 51 1.92790197 4.91776524 52 0.77926238 1.92790197 53 1.27102966 0.77926238 54 -4.71684785 1.27102966 55 -5.43506768 -4.71684785 56 -5.92562309 -5.43506768 57 -2.27652277 -5.92562309 58 2.03103608 -2.27652277 59 2.33691168 2.03103608 60 -2.19808981 2.33691168 61 -4.15010738 -2.19808981 62 -0.81150586 -4.15010738 63 -3.84930621 -0.81150586 > 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/rcomp/tmp/7ta781293197823.ps",horizontal=F,onefile=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/rcomp/tmp/84joa1293197823.ps",horizontal=F,onefile=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/rcomp/tmp/94joa1293197823.ps",horizontal=F,onefile=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/rcomp/tmp/104joa1293197823.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11pjny1293197823.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/rcomp/tmp/12b2341293197823.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/rcomp/tmp/13iliy1293197823.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/rcomp/tmp/14sczj1293197823.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/rcomp/tmp/15edyp1293197823.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/rcomp/tmp/162xyt1293197824.tab") + } > > try(system("convert tmp/18rq21293197823.ps tmp/18rq21293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/28rq21293197823.ps tmp/28rq21293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/38rq21293197823.ps tmp/38rq21293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/4i07n1293197823.ps tmp/4i07n1293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/5i07n1293197823.ps tmp/5i07n1293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/6i07n1293197823.ps tmp/6i07n1293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/7ta781293197823.ps tmp/7ta781293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/84joa1293197823.ps tmp/84joa1293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/94joa1293197823.ps tmp/94joa1293197823.png",intern=TRUE)) character(0) > try(system("convert tmp/104joa1293197823.ps tmp/104joa1293197823.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.150 1.670 4.817