R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(14 + ,501 + ,11 + ,20 + ,91.81 + ,77585 + ,1303.2 + ,2000 + ,14 + ,485 + ,11 + ,19 + ,91.98 + ,77585 + ,-58.7 + ,2000 + ,15 + ,464 + ,11 + ,18 + ,91.72 + ,77585 + ,-378.9 + ,2000 + ,13 + ,460 + ,11 + ,13 + ,90.27 + ,78302 + ,175.6 + ,2001 + ,8 + ,467 + ,11 + ,17 + ,91.89 + ,78302 + ,233.7 + ,2001 + ,7 + ,460 + ,9 + ,17 + ,92.07 + ,78302 + ,706.8 + ,2001 + ,3 + ,448 + ,8 + ,13 + ,92.92 + ,78224 + ,-23.6 + ,2001 + ,3 + ,443 + ,6 + ,14 + ,93.34 + ,78224 + ,420.9 + ,2001 + ,4 + ,436 + ,7 + ,13 + ,93.6 + ,78224 + ,722.1 + ,2001 + ,4 + ,431 + ,8 + ,17 + ,92.41 + ,78178 + ,1401.3 + ,2001 + ,0 + ,484 + ,6 + ,17 + ,93.6 + ,78178 + ,-94.9 + ,2001 + ,-4 + ,510 + ,5 + ,15 + ,93.77 + ,78178 + ,1043.6 + ,2001 + ,-14 + ,513 + ,2 + ,9 + ,93.6 + ,77988 + ,1300.1 + ,2001 + ,-18 + ,503 + ,3 + ,10 + ,93.6 + ,77988 + ,721.1 + ,2001 + ,-8 + ,471 + ,3 + ,9 + ,93.51 + ,77988 + ,-45.6 + ,2001 + ,-1 + ,471 + ,7 + ,14 + ,92.66 + ,77876 + ,787.5 + ,2002 + ,1 + ,476 + ,8 + ,18 + ,94.2 + ,77876 + ,694.3 + ,2002 + ,2 + ,475 + ,7 + ,18 + ,94.37 + ,77876 + ,1054.7 + ,2002 + ,0 + ,470 + ,7 + ,12 + ,94.45 + ,78432 + ,821.9 + ,2002 + ,1 + ,461 + ,6 + ,16 + ,94.62 + ,78432 + ,1100.7 + ,2002 + ,0 + ,455 + ,6 + ,12 + ,94.37 + ,78432 + ,862.4 + ,2002 + ,-1 + ,456 + ,7 + ,19 + ,93.43 + ,79025 + ,1656.1 + ,2002 + ,-3 + ,517 + ,5 + ,13 + ,94.79 + ,79025 + ,-174 + ,2002 + ,-3 + ,525 + ,5 + ,12 + ,94.88 + ,79025 + ,1337.6 + ,2002 + ,-3 + ,523 + ,5 + ,13 + ,94.79 + ,79407 + ,1394.9 + ,2002 + ,-4 + ,519 + ,4 + ,11 + ,94.62 + ,79407 + ,915.7 + ,2002 + ,-8 + ,509 + ,4 + ,10 + ,94.71 + ,79407 + ,-481.1 + ,2002 + ,-9 + ,512 + ,4 + ,16 + ,93.77 + ,79644 + ,167.9 + ,2003 + ,-13 + ,519 + ,1 + ,12 + ,95.73 + ,79644 + ,208.2 + ,2003 + ,-18 + ,517 + ,-1 + ,6 + ,95.99 + ,79644 + ,382.2 + ,2003 + ,-11 + ,510 + ,3 + ,8 + ,95.82 + ,79381 + ,1004 + ,2003 + ,-9 + ,509 + ,4 + ,6 + ,95.47 + ,79381 + ,864.7 + ,2003 + ,-10 + ,501 + ,3 + ,8 + ,95.82 + ,79381 + ,1052.9 + ,2003 + ,-13 + ,507 + ,2 + ,8 + ,94.71 + ,79536 + ,1417.6 + ,2003 + ,-11 + ,569 + ,1 + ,9 + ,96.33 + ,79536 + ,-197.7 + ,2003 + ,-5 + ,580 + ,4 + ,13 + ,96.5 + ,79536 + ,1262.1 + ,2003 + ,-15 + ,578 + ,3 + ,8 + ,96.16 + ,79813 + ,1147.2 + ,2003 + ,-6 + ,565 + ,5 + ,11 + ,96.33 + ,79813 + ,700.2 + ,2003 + ,-6 + ,547 + ,6 + ,8 + ,96.33 + ,79813 + ,45.3 + ,2003 + ,-3 + ,555 + ,6 + ,10 + ,95.05 + ,80332 + ,458.5 + ,2004 + ,-1 + ,562 + ,6 + ,15 + ,96.84 + ,80332 + ,610.2 + ,2004 + ,-3 + ,561 + ,6 + ,12 + ,96.92 + ,80332 + ,786.4 + ,2004 + ,-4 + ,555 + ,6 + ,13 + ,97.44 + ,81434 + ,787.2 + ,2004 + ,-6 + ,544 + ,5 + ,12 + ,97.78 + ,81434 + ,1040 + ,2004 + ,0 + ,537 + ,6 + ,15 + ,97.69 + ,81434 + ,324.1 + ,2004 + ,-4 + ,543 + ,5 + ,13 + ,96.67 + ,82167 + ,1343 + ,2004 + ,-2 + ,594 + ,6 + ,13 + ,98.29 + ,82167 + ,-501.2 + ,2004 + ,-2 + ,611 + ,5 + ,16 + ,98.2 + ,82167 + ,800.4 + ,2004 + ,-6 + ,613 + ,7 + ,14 + ,98.71 + ,82816 + ,916.7 + ,2004 + ,-7 + ,611 + ,4 + ,12 + ,98.54 + ,82816 + ,695.8 + ,2004 + ,-6 + ,594 + ,5 + ,15 + ,98.2 + ,82816 + ,28 + ,2004 + ,-6 + ,595 + ,6 + ,14 + ,96.92 + ,83000 + ,495.6 + ,2005 + ,-3 + ,591 + ,6 + ,19 + ,99.06 + ,83000 + ,366.2 + ,2005 + ,-2 + ,589 + ,5 + ,16 + ,99.65 + ,83000 + ,633 + ,2005 + ,-5 + ,584 + ,3 + ,16 + ,99.82 + ,83251 + ,848.3 + ,2005 + ,-11 + ,573 + ,2 + ,11 + ,99.99 + ,83251 + ,472.2 + ,2005 + ,-11 + ,567 + ,3 + ,13 + ,100.33 + ,83251 + ,357.8 + ,2005 + ,-11 + ,569 + ,3 + ,12 + ,99.31 + ,83591 + ,824.3 + ,2005 + ,-10 + ,621 + ,2 + ,11 + ,101.1 + ,83591 + ,-880.1 + ,2005 + ,-14 + ,629 + ,0 + ,6 + ,101.1 + ,83591 + ,1066.8 + ,2005 + ,-8 + ,628 + ,4 + ,9 + ,100.93 + ,83910 + ,1052.8 + ,2005 + ,-9 + ,612 + ,4 + ,6 + ,100.85 + ,83910 + ,-32.1 + ,2005 + ,-5 + ,595 + ,5 + ,15 + ,100.93 + ,83910 + ,-1331.4 + ,2005 + ,-1 + ,597 + ,6 + ,17 + ,99.6 + ,84599 + ,-767.1 + ,2006 + ,-2 + ,593 + ,6 + ,13 + ,101.88 + ,84599 + ,-236.7 + ,2006 + ,-5 + ,590 + ,5 + ,12 + ,101.81 + ,84599 + ,-184.9 + ,2006 + ,-4 + ,580 + ,5 + ,13 + ,102.38 + ,85275 + ,-143.4 + ,2006 + ,-6 + ,574 + ,3 + ,10 + ,102.74 + ,85275 + ,493.9 + ,2006 + ,-2 + ,573 + ,5 + ,14 + ,102.82 + ,85275 + ,549.7 + ,2006 + ,-2 + ,573 + ,5 + ,13 + ,101.72 + ,85608 + ,982.7 + ,2006 + ,-2 + ,620 + ,5 + ,10 + ,103.47 + ,85608 + ,-856.3 + ,2006 + ,-2 + ,626 + ,3 + ,11 + ,102.98 + ,85608 + ,967 + ,2006 + ,2 + ,620 + ,6 + ,12 + ,102.68 + ,86303 + ,659.4 + ,2006 + ,1 + ,588 + ,6 + ,7 + ,102.9 + ,86303 + ,577.2 + ,2006 + ,-8 + ,566 + ,4 + ,11 + ,103.03 + ,86303 + ,-213.1 + ,2006 + ,-1 + ,557 + ,6 + ,9 + ,101.29 + ,87115 + ,17.7 + ,2007 + ,1 + ,561 + ,5 + ,13 + ,103.69 + ,87115 + ,390.1 + ,2007 + ,-1 + ,549 + ,4 + ,12 + ,103.68 + ,87115 + ,509.3 + ,2007 + ,2 + ,532 + ,5 + ,5 + ,104.2 + ,87931 + ,410 + ,2007 + ,2 + ,526 + ,5 + ,13 + ,104.08 + ,87931 + ,212.5 + ,2007 + ,1 + ,511 + ,4 + ,11 + ,104.16 + ,87931 + ,818 + ,2007 + ,-1 + ,499 + ,3 + ,8 + ,103.05 + ,88164 + ,422.7 + ,2007 + ,-2 + ,555 + ,2 + ,8 + ,104.66 + ,88164 + ,-158 + ,2007 + ,-2 + ,565 + ,3 + ,8 + ,104.46 + ,88164 + ,427.2 + ,2007 + ,-1 + ,542 + ,2 + ,8 + ,104.95 + ,88792 + ,243.4 + ,2007 + ,-8 + ,527 + ,-1 + ,0 + ,105.85 + ,88792 + ,-419.3 + ,2007 + ,-4 + ,510 + ,0 + ,3 + ,106.23 + ,88792 + ,-1459.8 + ,2007 + ,-6 + ,514 + ,-2 + ,0 + ,104.86 + ,89263 + ,-1389.8 + ,2008 + ,-3 + ,517 + ,1 + ,-1 + ,107.44 + ,89263 + ,-2.1 + ,2008 + ,-3 + ,508 + ,-2 + ,-1 + ,108.23 + ,89263 + ,-938.6 + ,2008 + ,-7 + ,493 + ,-2 + ,-4 + ,108.45 + ,89881 + ,-839.9 + ,2008 + ,-9 + ,490 + ,-2 + ,1 + ,109.39 + ,89881 + ,-297.6 + ,2008 + ,-11 + ,469 + ,-6 + ,-1 + ,110.15 + ,89881 + ,-376.3 + ,2008 + ,-13 + ,478 + ,-4 + ,0 + ,109.13 + ,90120 + ,-79.4 + ,2008 + ,-11 + ,528 + ,-2 + ,-1 + ,110.28 + ,90120 + ,-2091.3 + ,2008 + ,-9 + ,534 + ,0 + ,6 + ,110.17 + ,90120 + ,-1023 + ,2008 + ,-17 + ,518 + ,-5 + ,0 + ,109.99 + ,89703 + ,-765.6 + ,2008 + ,-22 + ,506 + ,-4 + ,-3 + ,109.26 + ,89703 + ,-1592.3 + ,2008 + ,-25 + ,502 + ,-5 + ,-3 + ,109.11 + ,89703 + ,-1588.8 + ,2008 + ,-20 + ,516 + ,-1 + ,4 + ,107.06 + ,87818 + ,-1318 + ,2009 + ,-24 + ,528 + ,-2 + ,1 + ,109.53 + ,87818 + ,-402.4 + ,2009 + ,-24 + ,533 + ,-4 + ,0 + ,108.92 + ,87818 + ,-814.5 + ,2009 + ,-22 + ,536 + ,-1 + ,-4 + ,109.24 + ,86273 + ,-98.4 + ,2009 + ,-19 + ,537 + ,1 + ,-2 + ,109.12 + ,86273 + ,-305.9 + ,2009 + ,-18 + ,524 + ,1 + ,3 + ,109 + ,86273 + ,-18.4 + ,2009 + ,-17 + ,536 + ,-2 + ,2 + ,107.23 + ,86316 + ,610.3 + ,2009 + ,-11 + ,587 + ,1 + ,5 + ,109.49 + ,86316 + ,-917.3 + ,2009 + ,-11 + ,597 + ,1 + ,6 + ,109.04 + ,86316 + ,88.4 + ,2009 + ,-12 + ,581 + ,3 + ,6 + ,109.02 + ,87234 + ,-740.2 + ,2009 + ,-10 + ,564 + ,3 + ,3 + ,109.23 + ,87234 + ,29.3 + ,2009 + ,-15 + ,558 + ,1 + ,4 + ,109.46 + ,87234 + ,-893.2 + ,2009 + ,-15 + ,575 + ,1 + ,7 + ,107.9 + ,87885 + ,-1030.2 + ,2010 + ,-15 + ,580 + ,0 + ,5 + ,110.42 + ,87885 + ,-403.4 + ,2010 + ,-13 + ,575 + ,2 + ,6 + ,110.98 + ,87885 + ,-46.9 + ,2010 + ,-8 + ,563 + ,2 + ,1 + ,111.48 + ,88003 + ,-321.2 + ,2010 + ,-13 + ,552 + ,-1 + ,3 + ,111.88 + ,88003 + ,-239.9 + ,2010 + ,-9 + ,537 + ,1 + ,6 + ,111.89 + ,88003 + ,640.9 + ,2010 + ,-7 + ,545 + ,0 + ,0 + ,109.85 + ,88910 + ,511.6 + ,2010 + ,-4 + ,601 + ,1 + ,3 + ,112.1 + ,88910 + ,-665.1 + ,2010 + ,-4 + ,604 + ,1 + ,4 + ,112.24 + ,88910 + ,657.7 + ,2010 + ,-2 + ,586 + ,3 + ,7 + ,112.39 + ,89397 + ,-207.7 + ,2010 + ,0 + ,564 + ,2 + ,6 + ,112.52 + ,89397 + ,-885.2 + ,2010 + ,-2 + ,549 + ,0 + ,6 + ,113.16 + ,89397 + ,-1595.8 + ,2010 + ,-3 + ,551 + ,0 + ,6 + ,111.84 + ,89813 + ,-1374.9 + ,2011 + ,1 + ,556 + ,3 + ,6 + ,114.33 + ,89813 + ,-316.6 + ,2011 + ,-2 + ,548 + ,-2 + ,2 + ,114.82 + ,89813 + ,-283.4 + ,2011 + ,-1 + ,540 + ,0 + ,2 + ,115.2 + ,90539 + ,-175.8 + ,2011 + ,1 + ,531 + ,1 + ,2 + ,115.4 + ,90539 + ,-694.2 + ,2011 + ,-3 + ,521 + ,-1 + ,3 + ,115.74 + ,90539 + ,-249.9 + ,2011 + ,-4 + ,519 + ,-2 + ,-1 + ,114.19 + ,90688 + ,268.2 + ,2011 + ,-9 + ,572 + ,-1 + ,-4 + ,115.94 + ,90688 + ,-2105.1 + ,2011 + ,-9 + ,581 + ,-1 + ,4 + ,116.03 + ,90688 + ,-762.8 + ,2011 + ,-7 + ,563 + ,1 + ,5 + ,116.24 + ,90691 + ,-117.1 + ,2011 + ,-14 + ,548 + ,-2 + ,3 + ,116.66 + ,90691 + ,-1094.4 + ,2011 + ,-12 + ,539 + ,-5 + ,-1 + ,116.79 + ,90691 + ,-2095.2 + ,2011 + ,-16 + ,541 + ,-5 + ,-4 + ,115.48 + ,90645 + ,-1587.6 + ,2012 + ,-20 + ,562 + ,-6 + ,0 + ,118.16 + ,90645 + ,-528 + ,2012 + ,-12 + ,559 + ,-4 + ,-1 + ,118.38 + ,90645 + ,-324.2 + ,2012 + ,-12 + ,546 + ,-3 + ,-1 + ,118.51 + ,90861 + ,-276.1 + ,2012 + ,-10 + ,536 + ,-3 + ,3 + ,118.42 + ,90861 + ,-139.1 + ,2012 + ,-10 + ,528 + ,-1 + ,2 + ,118.24 + ,90861 + ,268 + ,2012 + ,-13 + ,530 + ,-2 + ,-4 + ,116.47 + ,90401 + ,570.5 + ,2012 + ,-16 + ,582 + ,-3 + ,-3 + ,118.96 + ,90401 + ,-316.5 + ,2012) + ,dim=c(8 + ,143) + ,dimnames=list(c('i' + ,'w' + ,'f' + ,'s' + ,'c' + ,'b' + ,'h' + ,'t') + ,1:143)) > y <- array(NA,dim=c(8,143),dimnames=list(c('i','w','f','s','c','b','h','t'),1:143)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 i w f s c b h t 1 14 501 11 20 91.81 77585 1303.2 2000 2 14 485 11 19 91.98 77585 -58.7 2000 3 15 464 11 18 91.72 77585 -378.9 2000 4 13 460 11 13 90.27 78302 175.6 2001 5 8 467 11 17 91.89 78302 233.7 2001 6 7 460 9 17 92.07 78302 706.8 2001 7 3 448 8 13 92.92 78224 -23.6 2001 8 3 443 6 14 93.34 78224 420.9 2001 9 4 436 7 13 93.60 78224 722.1 2001 10 4 431 8 17 92.41 78178 1401.3 2001 11 0 484 6 17 93.60 78178 -94.9 2001 12 -4 510 5 15 93.77 78178 1043.6 2001 13 -14 513 2 9 93.60 77988 1300.1 2001 14 -18 503 3 10 93.60 77988 721.1 2001 15 -8 471 3 9 93.51 77988 -45.6 2001 16 -1 471 7 14 92.66 77876 787.5 2002 17 1 476 8 18 94.20 77876 694.3 2002 18 2 475 7 18 94.37 77876 1054.7 2002 19 0 470 7 12 94.45 78432 821.9 2002 20 1 461 6 16 94.62 78432 1100.7 2002 21 0 455 6 12 94.37 78432 862.4 2002 22 -1 456 7 19 93.43 79025 1656.1 2002 23 -3 517 5 13 94.79 79025 -174.0 2002 24 -3 525 5 12 94.88 79025 1337.6 2002 25 -3 523 5 13 94.79 79407 1394.9 2002 26 -4 519 4 11 94.62 79407 915.7 2002 27 -8 509 4 10 94.71 79407 -481.1 2002 28 -9 512 4 16 93.77 79644 167.9 2003 29 -13 519 1 12 95.73 79644 208.2 2003 30 -18 517 -1 6 95.99 79644 382.2 2003 31 -11 510 3 8 95.82 79381 1004.0 2003 32 -9 509 4 6 95.47 79381 864.7 2003 33 -10 501 3 8 95.82 79381 1052.9 2003 34 -13 507 2 8 94.71 79536 1417.6 2003 35 -11 569 1 9 96.33 79536 -197.7 2003 36 -5 580 4 13 96.50 79536 1262.1 2003 37 -15 578 3 8 96.16 79813 1147.2 2003 38 -6 565 5 11 96.33 79813 700.2 2003 39 -6 547 6 8 96.33 79813 45.3 2003 40 -3 555 6 10 95.05 80332 458.5 2004 41 -1 562 6 15 96.84 80332 610.2 2004 42 -3 561 6 12 96.92 80332 786.4 2004 43 -4 555 6 13 97.44 81434 787.2 2004 44 -6 544 5 12 97.78 81434 1040.0 2004 45 0 537 6 15 97.69 81434 324.1 2004 46 -4 543 5 13 96.67 82167 1343.0 2004 47 -2 594 6 13 98.29 82167 -501.2 2004 48 -2 611 5 16 98.20 82167 800.4 2004 49 -6 613 7 14 98.71 82816 916.7 2004 50 -7 611 4 12 98.54 82816 695.8 2004 51 -6 594 5 15 98.20 82816 28.0 2004 52 -6 595 6 14 96.92 83000 495.6 2005 53 -3 591 6 19 99.06 83000 366.2 2005 54 -2 589 5 16 99.65 83000 633.0 2005 55 -5 584 3 16 99.82 83251 848.3 2005 56 -11 573 2 11 99.99 83251 472.2 2005 57 -11 567 3 13 100.33 83251 357.8 2005 58 -11 569 3 12 99.31 83591 824.3 2005 59 -10 621 2 11 101.10 83591 -880.1 2005 60 -14 629 0 6 101.10 83591 1066.8 2005 61 -8 628 4 9 100.93 83910 1052.8 2005 62 -9 612 4 6 100.85 83910 -32.1 2005 63 -5 595 5 15 100.93 83910 -1331.4 2005 64 -1 597 6 17 99.60 84599 -767.1 2006 65 -2 593 6 13 101.88 84599 -236.7 2006 66 -5 590 5 12 101.81 84599 -184.9 2006 67 -4 580 5 13 102.38 85275 -143.4 2006 68 -6 574 3 10 102.74 85275 493.9 2006 69 -2 573 5 14 102.82 85275 549.7 2006 70 -2 573 5 13 101.72 85608 982.7 2006 71 -2 620 5 10 103.47 85608 -856.3 2006 72 -2 626 3 11 102.98 85608 967.0 2006 73 2 620 6 12 102.68 86303 659.4 2006 74 1 588 6 7 102.90 86303 577.2 2006 75 -8 566 4 11 103.03 86303 -213.1 2006 76 -1 557 6 9 101.29 87115 17.7 2007 77 1 561 5 13 103.69 87115 390.1 2007 78 -1 549 4 12 103.68 87115 509.3 2007 79 2 532 5 5 104.20 87931 410.0 2007 80 2 526 5 13 104.08 87931 212.5 2007 81 1 511 4 11 104.16 87931 818.0 2007 82 -1 499 3 8 103.05 88164 422.7 2007 83 -2 555 2 8 104.66 88164 -158.0 2007 84 -2 565 3 8 104.46 88164 427.2 2007 85 -1 542 2 8 104.95 88792 243.4 2007 86 -8 527 -1 0 105.85 88792 -419.3 2007 87 -4 510 0 3 106.23 88792 -1459.8 2007 88 -6 514 -2 0 104.86 89263 -1389.8 2008 89 -3 517 1 -1 107.44 89263 -2.1 2008 90 -3 508 -2 -1 108.23 89263 -938.6 2008 91 -7 493 -2 -4 108.45 89881 -839.9 2008 92 -9 490 -2 1 109.39 89881 -297.6 2008 93 -11 469 -6 -1 110.15 89881 -376.3 2008 94 -13 478 -4 0 109.13 90120 -79.4 2008 95 -11 528 -2 -1 110.28 90120 -2091.3 2008 96 -9 534 0 6 110.17 90120 -1023.0 2008 97 -17 518 -5 0 109.99 89703 -765.6 2008 98 -22 506 -4 -3 109.26 89703 -1592.3 2008 99 -25 502 -5 -3 109.11 89703 -1588.8 2008 100 -20 516 -1 4 107.06 87818 -1318.0 2009 101 -24 528 -2 1 109.53 87818 -402.4 2009 102 -24 533 -4 0 108.92 87818 -814.5 2009 103 -22 536 -1 -4 109.24 86273 -98.4 2009 104 -19 537 1 -2 109.12 86273 -305.9 2009 105 -18 524 1 3 109.00 86273 -18.4 2009 106 -17 536 -2 2 107.23 86316 610.3 2009 107 -11 587 1 5 109.49 86316 -917.3 2009 108 -11 597 1 6 109.04 86316 88.4 2009 109 -12 581 3 6 109.02 87234 -740.2 2009 110 -10 564 3 3 109.23 87234 29.3 2009 111 -15 558 1 4 109.46 87234 -893.2 2009 112 -15 575 1 7 107.90 87885 -1030.2 2010 113 -15 580 0 5 110.42 87885 -403.4 2010 114 -13 575 2 6 110.98 87885 -46.9 2010 115 -8 563 2 1 111.48 88003 -321.2 2010 116 -13 552 -1 3 111.88 88003 -239.9 2010 117 -9 537 1 6 111.89 88003 640.9 2010 118 -7 545 0 0 109.85 88910 511.6 2010 119 -4 601 1 3 112.10 88910 -665.1 2010 120 -4 604 1 4 112.24 88910 657.7 2010 121 -2 586 3 7 112.39 89397 -207.7 2010 122 0 564 2 6 112.52 89397 -885.2 2010 123 -2 549 0 6 113.16 89397 -1595.8 2010 124 -3 551 0 6 111.84 89813 -1374.9 2011 125 1 556 3 6 114.33 89813 -316.6 2011 126 -2 548 -2 2 114.82 89813 -283.4 2011 127 -1 540 0 2 115.20 90539 -175.8 2011 128 1 531 1 2 115.40 90539 -694.2 2011 129 -3 521 -1 3 115.74 90539 -249.9 2011 130 -4 519 -2 -1 114.19 90688 268.2 2011 131 -9 572 -1 -4 115.94 90688 -2105.1 2011 132 -9 581 -1 4 116.03 90688 -762.8 2011 133 -7 563 1 5 116.24 90691 -117.1 2011 134 -14 548 -2 3 116.66 90691 -1094.4 2011 135 -12 539 -5 -1 116.79 90691 -2095.2 2011 136 -16 541 -5 -4 115.48 90645 -1587.6 2012 137 -20 562 -6 0 118.16 90645 -528.0 2012 138 -12 559 -4 -1 118.38 90645 -324.2 2012 139 -12 546 -3 -1 118.51 90861 -276.1 2012 140 -10 536 -3 3 118.42 90861 -139.1 2012 141 -10 528 -1 2 118.24 90861 268.0 2012 142 -13 530 -2 -4 116.47 90401 570.5 2012 143 -16 582 -3 -3 118.96 90401 -316.5 2012 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) w f s c b 4.403e+03 -4.349e-02 2.129e+00 2.826e-01 8.835e-01 1.410e-03 h t 3.437e-04 -2.295e+00 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.6622 -1.6906 -0.0062 2.0253 9.9879 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.403e+03 1.080e+03 4.078 7.71e-05 *** w -4.349e-02 8.056e-03 -5.398 2.94e-07 *** f 2.129e+00 1.791e-01 11.890 < 2e-16 *** s 2.826e-01 1.160e-01 2.436 0.016145 * c 8.835e-01 2.347e-01 3.764 0.000249 *** b 1.410e-03 2.313e-04 6.095 1.08e-08 *** h 3.437e-04 4.854e-04 0.708 0.480111 t -2.295e+00 5.522e-01 -4.156 5.71e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.632 on 135 degrees of freedom Multiple R-squared: 0.7769, Adjusted R-squared: 0.7653 F-statistic: 67.14 on 7 and 135 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,] 2.692015e-02 5.384029e-02 0.9730799 [2,] 2.490341e-02 4.980682e-02 0.9750966 [3,] 1.841393e-02 3.682787e-02 0.9815861 [4,] 7.114683e-02 1.422937e-01 0.9288532 [5,] 1.147504e-01 2.295008e-01 0.8852496 [6,] 3.835415e-01 7.670830e-01 0.6164585 [7,] 2.855458e-01 5.710915e-01 0.7144542 [8,] 2.467588e-01 4.935175e-01 0.7532412 [9,] 1.984699e-01 3.969399e-01 0.8015301 [10,] 1.724399e-01 3.448799e-01 0.8275601 [11,] 1.384509e-01 2.769019e-01 0.8615491 [12,] 1.101201e-01 2.202402e-01 0.8898799 [13,] 1.065984e-01 2.131968e-01 0.8934016 [14,] 9.227595e-02 1.845519e-01 0.9077240 [15,] 6.556393e-02 1.311279e-01 0.9344361 [16,] 5.638054e-02 1.127611e-01 0.9436195 [17,] 4.627827e-02 9.255654e-02 0.9537217 [18,] 3.106155e-02 6.212309e-02 0.9689385 [19,] 2.625375e-02 5.250750e-02 0.9737463 [20,] 2.309107e-02 4.618214e-02 0.9769089 [21,] 1.578347e-02 3.156694e-02 0.9842165 [22,] 1.062154e-02 2.124307e-02 0.9893785 [23,] 6.641805e-03 1.328361e-02 0.9933582 [24,] 4.281396e-03 8.562792e-03 0.9957186 [25,] 6.784667e-03 1.356933e-02 0.9932153 [26,] 5.274357e-03 1.054871e-02 0.9947256 [27,] 9.518807e-03 1.903761e-02 0.9904812 [28,] 7.546206e-03 1.509241e-02 0.9924538 [29,] 9.272145e-03 1.854429e-02 0.9907279 [30,] 8.719271e-03 1.743854e-02 0.9912807 [31,] 7.764672e-03 1.552934e-02 0.9922353 [32,] 6.792912e-03 1.358582e-02 0.9932071 [33,] 6.999820e-03 1.399964e-02 0.9930002 [34,] 5.462231e-03 1.092446e-02 0.9945378 [35,] 5.649750e-03 1.129950e-02 0.9943502 [36,] 4.271786e-03 8.543571e-03 0.9957282 [37,] 4.024836e-03 8.049672e-03 0.9959752 [38,] 3.619052e-03 7.238104e-03 0.9963809 [39,] 1.085207e-02 2.170414e-02 0.9891479 [40,] 7.728554e-03 1.545711e-02 0.9922714 [41,] 6.063352e-03 1.212670e-02 0.9939366 [42,] 4.718469e-03 9.436938e-03 0.9952815 [43,] 3.372120e-03 6.744240e-03 0.9966279 [44,] 3.596657e-03 7.193314e-03 0.9964033 [45,] 4.714145e-03 9.428289e-03 0.9952859 [46,] 3.527960e-03 7.055920e-03 0.9964720 [47,] 3.037540e-03 6.075081e-03 0.9969625 [48,] 2.088147e-03 4.176293e-03 0.9979119 [49,] 1.701647e-03 3.403294e-03 0.9982984 [50,] 2.489404e-03 4.978808e-03 0.9975106 [51,] 1.639965e-03 3.279930e-03 0.9983600 [52,] 1.132530e-03 2.265060e-03 0.9988675 [53,] 1.042651e-03 2.085302e-03 0.9989573 [54,] 7.830871e-04 1.566174e-03 0.9992169 [55,] 5.699267e-04 1.139853e-03 0.9994301 [56,] 3.968281e-04 7.936563e-04 0.9996032 [57,] 2.524025e-04 5.048050e-04 0.9997476 [58,] 2.415299e-04 4.830598e-04 0.9997585 [59,] 1.712272e-04 3.424543e-04 0.9998288 [60,] 1.174546e-04 2.349092e-04 0.9998825 [61,] 1.001034e-04 2.002068e-04 0.9998999 [62,] 4.877816e-04 9.755633e-04 0.9995122 [63,] 4.120660e-04 8.241320e-04 0.9995879 [64,] 3.124966e-04 6.249932e-04 0.9996875 [65,] 3.772519e-04 7.545039e-04 0.9996227 [66,] 2.828506e-04 5.657012e-04 0.9997171 [67,] 2.177719e-04 4.355437e-04 0.9997822 [68,] 1.650368e-04 3.300735e-04 0.9998350 [69,] 1.286550e-04 2.573100e-04 0.9998713 [70,] 8.058574e-05 1.611715e-04 0.9999194 [71,] 5.286963e-05 1.057393e-04 0.9999471 [72,] 3.926956e-05 7.853912e-05 0.9999607 [73,] 4.215524e-05 8.431047e-05 0.9999578 [74,] 2.846665e-05 5.693330e-05 0.9999715 [75,] 2.265809e-05 4.531617e-05 0.9999773 [76,] 1.688392e-05 3.376784e-05 0.9999831 [77,] 1.674135e-05 3.348269e-05 0.9999833 [78,] 5.764476e-05 1.152895e-04 0.9999424 [79,] 3.870047e-05 7.740095e-05 0.9999613 [80,] 3.790103e-04 7.580206e-04 0.9996210 [81,] 3.846345e-04 7.692690e-04 0.9996154 [82,] 2.951325e-04 5.902649e-04 0.9997049 [83,] 1.036969e-03 2.073939e-03 0.9989630 [84,] 9.561382e-04 1.912276e-03 0.9990439 [85,] 1.034967e-03 2.069933e-03 0.9989650 [86,] 1.367709e-03 2.735417e-03 0.9986323 [87,] 1.225621e-03 2.451241e-03 0.9987744 [88,] 3.334917e-03 6.669835e-03 0.9966651 [89,] 1.107110e-02 2.214220e-02 0.9889289 [90,] 2.233560e-02 4.467121e-02 0.9776644 [91,] 7.770671e-02 1.554134e-01 0.9222933 [92,] 1.237915e-01 2.475830e-01 0.8762085 [93,] 1.023444e-01 2.046887e-01 0.8976556 [94,] 8.908305e-02 1.781661e-01 0.9109169 [95,] 9.123883e-02 1.824777e-01 0.9087612 [96,] 8.528516e-02 1.705703e-01 0.9147148 [97,] 1.321982e-01 2.643964e-01 0.8678018 [98,] 2.048386e-01 4.096772e-01 0.7951614 [99,] 1.937417e-01 3.874834e-01 0.8062583 [100,] 1.694934e-01 3.389868e-01 0.8305066 [101,] 1.946455e-01 3.892910e-01 0.8053545 [102,] 2.527041e-01 5.054082e-01 0.7472959 [103,] 2.585771e-01 5.171542e-01 0.7414229 [104,] 3.644799e-01 7.289597e-01 0.6355201 [105,] 3.326531e-01 6.653063e-01 0.6673469 [106,] 3.339945e-01 6.679890e-01 0.6660055 [107,] 5.196545e-01 9.606910e-01 0.4803455 [108,] 7.260560e-01 5.478880e-01 0.2739440 [109,] 7.125259e-01 5.749482e-01 0.2874741 [110,] 6.771880e-01 6.456240e-01 0.3228120 [111,] 6.592167e-01 6.815666e-01 0.3407833 [112,] 6.396251e-01 7.207498e-01 0.3603749 [113,] 6.880738e-01 6.238523e-01 0.3119262 [114,] 6.502526e-01 6.994949e-01 0.3497474 [115,] 5.889855e-01 8.220290e-01 0.4110145 [116,] 6.217699e-01 7.564603e-01 0.3782301 [117,] 6.206603e-01 7.586793e-01 0.3793397 [118,] 7.090018e-01 5.819964e-01 0.2909982 [119,] 8.336129e-01 3.327743e-01 0.1663871 [120,] 7.720518e-01 4.558964e-01 0.2279482 [121,] 6.466484e-01 7.067032e-01 0.3533516 [122,] 5.120713e-01 9.758574e-01 0.4879287 > postscript(file="/var/wessaorg/rcomp/tmp/13noz1355497170.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/wessaorg/rcomp/tmp/2v0fr1355497170.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/wessaorg/rcomp/tmp/3wbsg1355497170.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/wessaorg/rcomp/tmp/4ttdo1355497170.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/wessaorg/rcomp/tmp/5ivuh1355497170.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 = 143 Frequency = 1 1 2 3 4 5 6 2.955230897 2.859918310 3.569037523 5.183048216 -2.094352140 0.537871167 7 8 9 10 11 12 -1.114239840 2.120104681 0.635953435 -1.958448387 0.067668496 -0.648640863 13 14 15 16 17 18 -2.104932375 -8.752624861 0.481368272 0.469257770 -1.901583519 0.910007056 19 20 21 22 23 24 -0.386133612 0.974987732 1.147418946 -4.195154342 1.839338053 1.870868606 25 26 27 28 29 30 1.022472501 2.857842704 -0.893855607 -0.890853111 1.186088561 1.763771937 31 32 33 34 35 36 -0.315223925 0.434542670 0.276560144 0.303442402 5.970208189 4.278664438 37 38 39 40 41 42 -2.316598607 1.015238541 -0.823692459 4.511189173 3.768776002 2.441994085 43 44 45 46 47 48 -1.115018255 -1.568891881 1.475154083 -0.051956348 1.239457046 2.892148140 49 50 51 52 53 54 -6.119449353 -0.027592000 -2.214102474 -1.011219650 -1.444634969 1.832512149 55 56 57 58 59 60 2.295264251 -0.661672768 -3.878122208 -3.247029716 1.430562311 2.780876570 61 62 63 64 65 66 -0.921882353 -1.326225348 -2.362656582 1.334701219 -0.905332462 -1.579970595 67 68 69 70 71 72 -2.768480547 -0.460284782 -1.982509954 -1.346334440 0.631564724 4.674400939 73 74 75 76 77 78 1.134264036 -0.010288595 -6.682615525 -1.158758442 -0.234637690 -0.376859906 79 80 81 82 83 84 0.157426995 -2.190803731 -1.427498649 -0.184257846 2.157469600 0.438799487 85 86 87 88 89 90 1.312499765 1.741380004 2.046844555 8.144438154 2.413768603 8.033686010 91 92 93 94 95 96 3.129661670 -1.430923256 4.093240657 -1.594125589 -1.719813753 -5.965677741 97 98 99 100 101 102 -1.661418380 -7.535410201 -8.448906898 -6.664215519 -9.662171862 -4.223222195 103 104 105 106 107 108 -5.700093638 -7.302848146 -8.274252283 1.204786055 0.715719567 0.919894562 109 110 111 112 113 114 -6.026080096 -4.367467469 -5.538923089 -2.844911912 -2.374863570 -5.750529137 115 116 117 118 119 120 -0.373009788 -0.410613910 -2.480749493 4.260182568 5.135082268 4.404579595 121 122 123 124 125 126 -0.006193083 3.566813982 4.851535419 6.737428091 2.003816231 9.987873534 127 128 129 130 131 132 4.985360326 4.466279259 3.553922654 6.707956713 2.001288166 -0.409342978 133 134 135 136 137 138 -4.144778595 -4.879586576 4.476133646 4.753983688 -0.066130259 3.563352354 139 140 141 142 143 0.432913217 0.899848131 -3.404592107 -0.384191267 -1.171278003 > postscript(file="/var/wessaorg/rcomp/tmp/6dbp21355497170.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 = 143 Frequency = 1 lag(myerror, k = 1) myerror 0 2.955230897 NA 1 2.859918310 2.955230897 2 3.569037523 2.859918310 3 5.183048216 3.569037523 4 -2.094352140 5.183048216 5 0.537871167 -2.094352140 6 -1.114239840 0.537871167 7 2.120104681 -1.114239840 8 0.635953435 2.120104681 9 -1.958448387 0.635953435 10 0.067668496 -1.958448387 11 -0.648640863 0.067668496 12 -2.104932375 -0.648640863 13 -8.752624861 -2.104932375 14 0.481368272 -8.752624861 15 0.469257770 0.481368272 16 -1.901583519 0.469257770 17 0.910007056 -1.901583519 18 -0.386133612 0.910007056 19 0.974987732 -0.386133612 20 1.147418946 0.974987732 21 -4.195154342 1.147418946 22 1.839338053 -4.195154342 23 1.870868606 1.839338053 24 1.022472501 1.870868606 25 2.857842704 1.022472501 26 -0.893855607 2.857842704 27 -0.890853111 -0.893855607 28 1.186088561 -0.890853111 29 1.763771937 1.186088561 30 -0.315223925 1.763771937 31 0.434542670 -0.315223925 32 0.276560144 0.434542670 33 0.303442402 0.276560144 34 5.970208189 0.303442402 35 4.278664438 5.970208189 36 -2.316598607 4.278664438 37 1.015238541 -2.316598607 38 -0.823692459 1.015238541 39 4.511189173 -0.823692459 40 3.768776002 4.511189173 41 2.441994085 3.768776002 42 -1.115018255 2.441994085 43 -1.568891881 -1.115018255 44 1.475154083 -1.568891881 45 -0.051956348 1.475154083 46 1.239457046 -0.051956348 47 2.892148140 1.239457046 48 -6.119449353 2.892148140 49 -0.027592000 -6.119449353 50 -2.214102474 -0.027592000 51 -1.011219650 -2.214102474 52 -1.444634969 -1.011219650 53 1.832512149 -1.444634969 54 2.295264251 1.832512149 55 -0.661672768 2.295264251 56 -3.878122208 -0.661672768 57 -3.247029716 -3.878122208 58 1.430562311 -3.247029716 59 2.780876570 1.430562311 60 -0.921882353 2.780876570 61 -1.326225348 -0.921882353 62 -2.362656582 -1.326225348 63 1.334701219 -2.362656582 64 -0.905332462 1.334701219 65 -1.579970595 -0.905332462 66 -2.768480547 -1.579970595 67 -0.460284782 -2.768480547 68 -1.982509954 -0.460284782 69 -1.346334440 -1.982509954 70 0.631564724 -1.346334440 71 4.674400939 0.631564724 72 1.134264036 4.674400939 73 -0.010288595 1.134264036 74 -6.682615525 -0.010288595 75 -1.158758442 -6.682615525 76 -0.234637690 -1.158758442 77 -0.376859906 -0.234637690 78 0.157426995 -0.376859906 79 -2.190803731 0.157426995 80 -1.427498649 -2.190803731 81 -0.184257846 -1.427498649 82 2.157469600 -0.184257846 83 0.438799487 2.157469600 84 1.312499765 0.438799487 85 1.741380004 1.312499765 86 2.046844555 1.741380004 87 8.144438154 2.046844555 88 2.413768603 8.144438154 89 8.033686010 2.413768603 90 3.129661670 8.033686010 91 -1.430923256 3.129661670 92 4.093240657 -1.430923256 93 -1.594125589 4.093240657 94 -1.719813753 -1.594125589 95 -5.965677741 -1.719813753 96 -1.661418380 -5.965677741 97 -7.535410201 -1.661418380 98 -8.448906898 -7.535410201 99 -6.664215519 -8.448906898 100 -9.662171862 -6.664215519 101 -4.223222195 -9.662171862 102 -5.700093638 -4.223222195 103 -7.302848146 -5.700093638 104 -8.274252283 -7.302848146 105 1.204786055 -8.274252283 106 0.715719567 1.204786055 107 0.919894562 0.715719567 108 -6.026080096 0.919894562 109 -4.367467469 -6.026080096 110 -5.538923089 -4.367467469 111 -2.844911912 -5.538923089 112 -2.374863570 -2.844911912 113 -5.750529137 -2.374863570 114 -0.373009788 -5.750529137 115 -0.410613910 -0.373009788 116 -2.480749493 -0.410613910 117 4.260182568 -2.480749493 118 5.135082268 4.260182568 119 4.404579595 5.135082268 120 -0.006193083 4.404579595 121 3.566813982 -0.006193083 122 4.851535419 3.566813982 123 6.737428091 4.851535419 124 2.003816231 6.737428091 125 9.987873534 2.003816231 126 4.985360326 9.987873534 127 4.466279259 4.985360326 128 3.553922654 4.466279259 129 6.707956713 3.553922654 130 2.001288166 6.707956713 131 -0.409342978 2.001288166 132 -4.144778595 -0.409342978 133 -4.879586576 -4.144778595 134 4.476133646 -4.879586576 135 4.753983688 4.476133646 136 -0.066130259 4.753983688 137 3.563352354 -0.066130259 138 0.432913217 3.563352354 139 0.899848131 0.432913217 140 -3.404592107 0.899848131 141 -0.384191267 -3.404592107 142 -1.171278003 -0.384191267 143 NA -1.171278003 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.859918310 2.955230897 [2,] 3.569037523 2.859918310 [3,] 5.183048216 3.569037523 [4,] -2.094352140 5.183048216 [5,] 0.537871167 -2.094352140 [6,] -1.114239840 0.537871167 [7,] 2.120104681 -1.114239840 [8,] 0.635953435 2.120104681 [9,] -1.958448387 0.635953435 [10,] 0.067668496 -1.958448387 [11,] -0.648640863 0.067668496 [12,] -2.104932375 -0.648640863 [13,] -8.752624861 -2.104932375 [14,] 0.481368272 -8.752624861 [15,] 0.469257770 0.481368272 [16,] -1.901583519 0.469257770 [17,] 0.910007056 -1.901583519 [18,] -0.386133612 0.910007056 [19,] 0.974987732 -0.386133612 [20,] 1.147418946 0.974987732 [21,] -4.195154342 1.147418946 [22,] 1.839338053 -4.195154342 [23,] 1.870868606 1.839338053 [24,] 1.022472501 1.870868606 [25,] 2.857842704 1.022472501 [26,] -0.893855607 2.857842704 [27,] -0.890853111 -0.893855607 [28,] 1.186088561 -0.890853111 [29,] 1.763771937 1.186088561 [30,] -0.315223925 1.763771937 [31,] 0.434542670 -0.315223925 [32,] 0.276560144 0.434542670 [33,] 0.303442402 0.276560144 [34,] 5.970208189 0.303442402 [35,] 4.278664438 5.970208189 [36,] -2.316598607 4.278664438 [37,] 1.015238541 -2.316598607 [38,] -0.823692459 1.015238541 [39,] 4.511189173 -0.823692459 [40,] 3.768776002 4.511189173 [41,] 2.441994085 3.768776002 [42,] -1.115018255 2.441994085 [43,] -1.568891881 -1.115018255 [44,] 1.475154083 -1.568891881 [45,] -0.051956348 1.475154083 [46,] 1.239457046 -0.051956348 [47,] 2.892148140 1.239457046 [48,] -6.119449353 2.892148140 [49,] -0.027592000 -6.119449353 [50,] -2.214102474 -0.027592000 [51,] -1.011219650 -2.214102474 [52,] -1.444634969 -1.011219650 [53,] 1.832512149 -1.444634969 [54,] 2.295264251 1.832512149 [55,] -0.661672768 2.295264251 [56,] -3.878122208 -0.661672768 [57,] -3.247029716 -3.878122208 [58,] 1.430562311 -3.247029716 [59,] 2.780876570 1.430562311 [60,] -0.921882353 2.780876570 [61,] -1.326225348 -0.921882353 [62,] -2.362656582 -1.326225348 [63,] 1.334701219 -2.362656582 [64,] -0.905332462 1.334701219 [65,] -1.579970595 -0.905332462 [66,] -2.768480547 -1.579970595 [67,] -0.460284782 -2.768480547 [68,] -1.982509954 -0.460284782 [69,] -1.346334440 -1.982509954 [70,] 0.631564724 -1.346334440 [71,] 4.674400939 0.631564724 [72,] 1.134264036 4.674400939 [73,] -0.010288595 1.134264036 [74,] -6.682615525 -0.010288595 [75,] -1.158758442 -6.682615525 [76,] -0.234637690 -1.158758442 [77,] -0.376859906 -0.234637690 [78,] 0.157426995 -0.376859906 [79,] -2.190803731 0.157426995 [80,] -1.427498649 -2.190803731 [81,] -0.184257846 -1.427498649 [82,] 2.157469600 -0.184257846 [83,] 0.438799487 2.157469600 [84,] 1.312499765 0.438799487 [85,] 1.741380004 1.312499765 [86,] 2.046844555 1.741380004 [87,] 8.144438154 2.046844555 [88,] 2.413768603 8.144438154 [89,] 8.033686010 2.413768603 [90,] 3.129661670 8.033686010 [91,] -1.430923256 3.129661670 [92,] 4.093240657 -1.430923256 [93,] -1.594125589 4.093240657 [94,] -1.719813753 -1.594125589 [95,] -5.965677741 -1.719813753 [96,] -1.661418380 -5.965677741 [97,] -7.535410201 -1.661418380 [98,] -8.448906898 -7.535410201 [99,] -6.664215519 -8.448906898 [100,] -9.662171862 -6.664215519 [101,] -4.223222195 -9.662171862 [102,] -5.700093638 -4.223222195 [103,] -7.302848146 -5.700093638 [104,] -8.274252283 -7.302848146 [105,] 1.204786055 -8.274252283 [106,] 0.715719567 1.204786055 [107,] 0.919894562 0.715719567 [108,] -6.026080096 0.919894562 [109,] -4.367467469 -6.026080096 [110,] -5.538923089 -4.367467469 [111,] -2.844911912 -5.538923089 [112,] -2.374863570 -2.844911912 [113,] -5.750529137 -2.374863570 [114,] -0.373009788 -5.750529137 [115,] -0.410613910 -0.373009788 [116,] -2.480749493 -0.410613910 [117,] 4.260182568 -2.480749493 [118,] 5.135082268 4.260182568 [119,] 4.404579595 5.135082268 [120,] -0.006193083 4.404579595 [121,] 3.566813982 -0.006193083 [122,] 4.851535419 3.566813982 [123,] 6.737428091 4.851535419 [124,] 2.003816231 6.737428091 [125,] 9.987873534 2.003816231 [126,] 4.985360326 9.987873534 [127,] 4.466279259 4.985360326 [128,] 3.553922654 4.466279259 [129,] 6.707956713 3.553922654 [130,] 2.001288166 6.707956713 [131,] -0.409342978 2.001288166 [132,] -4.144778595 -0.409342978 [133,] -4.879586576 -4.144778595 [134,] 4.476133646 -4.879586576 [135,] 4.753983688 4.476133646 [136,] -0.066130259 4.753983688 [137,] 3.563352354 -0.066130259 [138,] 0.432913217 3.563352354 [139,] 0.899848131 0.432913217 [140,] -3.404592107 0.899848131 [141,] -0.384191267 -3.404592107 [142,] -1.171278003 -0.384191267 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.859918310 2.955230897 2 3.569037523 2.859918310 3 5.183048216 3.569037523 4 -2.094352140 5.183048216 5 0.537871167 -2.094352140 6 -1.114239840 0.537871167 7 2.120104681 -1.114239840 8 0.635953435 2.120104681 9 -1.958448387 0.635953435 10 0.067668496 -1.958448387 11 -0.648640863 0.067668496 12 -2.104932375 -0.648640863 13 -8.752624861 -2.104932375 14 0.481368272 -8.752624861 15 0.469257770 0.481368272 16 -1.901583519 0.469257770 17 0.910007056 -1.901583519 18 -0.386133612 0.910007056 19 0.974987732 -0.386133612 20 1.147418946 0.974987732 21 -4.195154342 1.147418946 22 1.839338053 -4.195154342 23 1.870868606 1.839338053 24 1.022472501 1.870868606 25 2.857842704 1.022472501 26 -0.893855607 2.857842704 27 -0.890853111 -0.893855607 28 1.186088561 -0.890853111 29 1.763771937 1.186088561 30 -0.315223925 1.763771937 31 0.434542670 -0.315223925 32 0.276560144 0.434542670 33 0.303442402 0.276560144 34 5.970208189 0.303442402 35 4.278664438 5.970208189 36 -2.316598607 4.278664438 37 1.015238541 -2.316598607 38 -0.823692459 1.015238541 39 4.511189173 -0.823692459 40 3.768776002 4.511189173 41 2.441994085 3.768776002 42 -1.115018255 2.441994085 43 -1.568891881 -1.115018255 44 1.475154083 -1.568891881 45 -0.051956348 1.475154083 46 1.239457046 -0.051956348 47 2.892148140 1.239457046 48 -6.119449353 2.892148140 49 -0.027592000 -6.119449353 50 -2.214102474 -0.027592000 51 -1.011219650 -2.214102474 52 -1.444634969 -1.011219650 53 1.832512149 -1.444634969 54 2.295264251 1.832512149 55 -0.661672768 2.295264251 56 -3.878122208 -0.661672768 57 -3.247029716 -3.878122208 58 1.430562311 -3.247029716 59 2.780876570 1.430562311 60 -0.921882353 2.780876570 61 -1.326225348 -0.921882353 62 -2.362656582 -1.326225348 63 1.334701219 -2.362656582 64 -0.905332462 1.334701219 65 -1.579970595 -0.905332462 66 -2.768480547 -1.579970595 67 -0.460284782 -2.768480547 68 -1.982509954 -0.460284782 69 -1.346334440 -1.982509954 70 0.631564724 -1.346334440 71 4.674400939 0.631564724 72 1.134264036 4.674400939 73 -0.010288595 1.134264036 74 -6.682615525 -0.010288595 75 -1.158758442 -6.682615525 76 -0.234637690 -1.158758442 77 -0.376859906 -0.234637690 78 0.157426995 -0.376859906 79 -2.190803731 0.157426995 80 -1.427498649 -2.190803731 81 -0.184257846 -1.427498649 82 2.157469600 -0.184257846 83 0.438799487 2.157469600 84 1.312499765 0.438799487 85 1.741380004 1.312499765 86 2.046844555 1.741380004 87 8.144438154 2.046844555 88 2.413768603 8.144438154 89 8.033686010 2.413768603 90 3.129661670 8.033686010 91 -1.430923256 3.129661670 92 4.093240657 -1.430923256 93 -1.594125589 4.093240657 94 -1.719813753 -1.594125589 95 -5.965677741 -1.719813753 96 -1.661418380 -5.965677741 97 -7.535410201 -1.661418380 98 -8.448906898 -7.535410201 99 -6.664215519 -8.448906898 100 -9.662171862 -6.664215519 101 -4.223222195 -9.662171862 102 -5.700093638 -4.223222195 103 -7.302848146 -5.700093638 104 -8.274252283 -7.302848146 105 1.204786055 -8.274252283 106 0.715719567 1.204786055 107 0.919894562 0.715719567 108 -6.026080096 0.919894562 109 -4.367467469 -6.026080096 110 -5.538923089 -4.367467469 111 -2.844911912 -5.538923089 112 -2.374863570 -2.844911912 113 -5.750529137 -2.374863570 114 -0.373009788 -5.750529137 115 -0.410613910 -0.373009788 116 -2.480749493 -0.410613910 117 4.260182568 -2.480749493 118 5.135082268 4.260182568 119 4.404579595 5.135082268 120 -0.006193083 4.404579595 121 3.566813982 -0.006193083 122 4.851535419 3.566813982 123 6.737428091 4.851535419 124 2.003816231 6.737428091 125 9.987873534 2.003816231 126 4.985360326 9.987873534 127 4.466279259 4.985360326 128 3.553922654 4.466279259 129 6.707956713 3.553922654 130 2.001288166 6.707956713 131 -0.409342978 2.001288166 132 -4.144778595 -0.409342978 133 -4.879586576 -4.144778595 134 4.476133646 -4.879586576 135 4.753983688 4.476133646 136 -0.066130259 4.753983688 137 3.563352354 -0.066130259 138 0.432913217 3.563352354 139 0.899848131 0.432913217 140 -3.404592107 0.899848131 141 -0.384191267 -3.404592107 142 -1.171278003 -0.384191267 > 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/wessaorg/rcomp/tmp/757fe1355497170.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/wessaorg/rcomp/tmp/82sa91355497170.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/wessaorg/rcomp/tmp/994mz1355497170.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/wessaorg/rcomp/tmp/10mb341355497170.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/119sxg1355497170.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/wessaorg/rcomp/tmp/12xb1l1355497170.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/wessaorg/rcomp/tmp/13ooh21355497170.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/wessaorg/rcomp/tmp/146lzh1355497170.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/wessaorg/rcomp/tmp/15pv0l1355497170.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/wessaorg/rcomp/tmp/168rtb1355497170.tab") + } > > try(system("convert tmp/13noz1355497170.ps tmp/13noz1355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/2v0fr1355497170.ps tmp/2v0fr1355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/3wbsg1355497170.ps tmp/3wbsg1355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/4ttdo1355497170.ps tmp/4ttdo1355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/5ivuh1355497170.ps tmp/5ivuh1355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/6dbp21355497170.ps tmp/6dbp21355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/757fe1355497170.ps tmp/757fe1355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/82sa91355497170.ps tmp/82sa91355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/994mz1355497170.ps tmp/994mz1355497170.png",intern=TRUE)) character(0) > try(system("convert tmp/10mb341355497170.ps tmp/10mb341355497170.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 10.699 1.822 12.593