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(1 + ,110.115 + ,110.661 + ,100.294 + ,107.711 + ,1 + ,114.151 + ,115.626 + ,109.764 + ,113.241 + ,1 + ,122.563 + ,121.828 + ,120.711 + ,121.998 + ,1 + ,136.114 + ,137.409 + ,131.551 + ,135.136 + ,1 + ,159.863 + ,171.274 + ,145.023 + ,157.641 + ,1 + ,210.638 + ,238.258 + ,177.164 + ,205.875 + ,1 + ,219.929 + ,251.688 + ,190.269 + ,216.347 + ,1 + ,255.015 + ,296.637 + ,219.996 + ,251.435 + ,1 + ,242.351 + ,296.679 + ,218.186 + ,243.588 + ,1 + ,220.855 + ,256.573 + ,191.582 + ,217.678 + ,1 + ,215.9 + ,244.361 + ,204.484 + ,216.346 + ,1 + ,239.951 + ,274.37 + ,219.318 + ,239.488 + ,2 + ,110.439 + ,113.149 + ,100.578 + ,108.313 + ,2 + ,114.069 + ,116.697 + ,108.502 + ,113.015 + ,2 + ,124.143 + ,122.603 + ,121.37 + ,123.239 + ,2 + ,136.177 + ,138.866 + ,131.422 + ,135.336 + ,2 + ,164.488 + ,177.848 + ,148.287 + ,162.182 + ,2 + ,212.831 + ,241.42 + ,174.947 + ,207.085 + ,2 + ,222.144 + ,255.734 + ,196.606 + ,219.825 + ,2 + ,253.493 + ,299.882 + ,223.847 + ,252.091 + ,2 + ,238.172 + ,285.712 + ,206.917 + ,236.447 + ,2 + ,220.127 + ,257.917 + ,195.727 + ,218.478 + ,2 + ,217.141 + ,255.116 + ,208.73 + ,220.221 + ,2 + ,240.436 + ,275.671 + ,213.558 + ,238.741 + ,3 + ,100 + ,100 + ,100 + ,100 + ,3 + ,111.054 + ,113.853 + ,97.9592 + ,108.124 + ,3 + ,114.798 + ,119.368 + ,109.211 + ,113.998 + ,3 + ,126.574 + ,123.803 + ,120.473 + ,124.666 + ,3 + ,136.883 + ,135.802 + ,131.112 + ,135.284 + ,3 + ,172.288 + ,185.538 + ,147.732 + ,167.86 + ,3 + ,214.227 + ,242.44 + ,179.407 + ,209.204 + ,3 + ,224.73 + ,257.646 + ,197.796 + ,221.956 + ,3 + ,255.976 + ,292.588 + ,227.227 + ,252.946 + ,3 + ,226.723 + ,270.085 + ,197.833 + ,224.906 + ,3 + ,215.471 + ,253.316 + ,194.766 + ,214.815 + ,3 + ,219.459 + ,256.46 + ,210.264 + ,222.182 + ,3 + ,241.588 + ,270.831 + ,214.026 + ,238.5 + ,4 + ,102.815 + ,101.542 + ,100.254 + ,102 + ,4 + ,112.319 + ,115.143 + ,100.107 + ,109.615 + ,4 + ,114.537 + ,120.264 + ,113.097 + ,114.936 + ,4 + ,128.069 + ,127.692 + ,122.204 + ,126.54 + ,4 + ,139.095 + ,139.408 + ,131.193 + ,137.144 + ,4 + ,181.098 + ,193.704 + ,151.23 + ,175.245 + ,4 + ,216.573 + ,248.809 + ,181.625 + ,212.246 + ,4 + ,228.912 + ,263.016 + ,205.874 + ,227.184 + ,4 + ,255.878 + ,292.523 + ,226.757 + ,252.773 + ,4 + ,225.84 + ,261.006 + ,194.438 + ,221.934 + ,4 + ,214.691 + ,257.496 + ,194.576 + ,215.143 + ,4 + ,222.898 + ,258.249 + ,214.211 + ,225.455 + ,4 + ,241.512 + ,275.141 + ,225.59 + ,242.116 + ,5 + ,104.301 + ,102.179 + ,102.839 + ,103.65 + ,5 + ,113.607 + ,116.923 + ,102.865 + ,111.34 + ,5 + ,114.118 + ,118.74 + ,112.18 + ,114.245 + ,5 + ,128.101 + ,128.336 + ,124.943 + ,127.336 + ,5 + ,141.551 + ,142.191 + ,136.448 + ,140.349 + ,5 + ,186.026 + ,203.366 + ,150.278 + ,179.32 + ,5 + ,217.504 + ,254.991 + ,188.871 + ,215.466 + ,5 + ,231.613 + ,265.367 + ,206.229 + ,229.247 + ,5 + ,254.149 + ,290.063 + ,223.928 + ,250.677 + ,5 + ,225.751 + ,266.44 + ,202.508 + ,224.903 + ,5 + ,216.2 + ,264.861 + ,198.563 + ,218.381 + ,5 + ,225.478 + ,256.327 + ,214.169 + ,226.42 + ,5 + ,243.05 + ,277.59 + ,227.637 + ,243.923 + ,6 + ,104.964 + ,105.494 + ,104.726 + ,104.974 + ,6 + ,112.716 + ,116.638 + ,102.719 + ,110.717 + ,6 + ,113.814 + ,116.522 + ,114.855 + ,114.437 + ,6 + ,128.752 + ,128.718 + ,125.276 + ,127.871 + ,6 + ,144.647 + ,146.027 + ,138.433 + ,143.264 + ,6 + ,191.144 + ,213.692 + ,154.789 + ,184.979 + ,6 + ,219.151 + ,255.458 + ,189.866 + ,216.693 + ,6 + ,235.936 + ,271.406 + ,208.473 + ,233.33 + ,6 + ,252.408 + ,296.831 + ,220.682 + ,250.105 + ,6 + ,226.192 + ,267.075 + ,196.651 + ,223.798 + ,6 + ,219.85 + ,257.795 + ,201.679 + ,219.962 + ,6 + ,228.098 + ,259.192 + ,213.656 + ,228.287 + ,6 + ,246.469 + ,276.357 + ,229 + ,245.813 + ,7 + ,104.83 + ,106.14 + ,103.387 + ,104.641 + ,7 + ,113.126 + ,116.227 + ,103.921 + ,111.217 + ,7 + ,115.232 + ,116.967 + ,114.53 + ,115.286 + ,7 + ,129.991 + ,130.539 + ,130.192 + ,130.115 + ,7 + ,147.403 + ,145.695 + ,136.323 + ,144.381 + ,7 + ,196.021 + ,220.819 + ,153.029 + ,188.482 + ,7 + ,220.494 + ,261.125 + ,192.114 + ,219.019 + ,7 + ,239.005 + ,278.478 + ,211.102 + ,236.987 + ,7 + ,252.503 + ,296.742 + ,227.654 + ,251.788 + ,7 + ,220.037 + ,263.672 + ,191.446 + ,218.529 + ,7 + ,220.182 + ,251.318 + ,201.506 + ,218.933 + ,7 + ,230.729 + ,260.776 + ,219.028 + ,231.349 + ,7 + ,248.64 + ,279.389 + ,226.841 + ,247.143 + ,8 + ,105.878 + ,106.371 + ,101.746 + ,104.902 + ,8 + ,112.818 + ,115.942 + ,105.751 + ,111.452 + ,8 + ,115.945 + ,118.061 + ,115.328 + ,116.071 + ,8 + ,133.236 + ,132.864 + ,131.595 + ,132.773 + ,8 + ,148.778 + ,148.469 + ,137.453 + ,145.881 + ,8 + ,200.338 + ,225.005 + ,157.658 + ,192.86 + ,8 + ,220.484 + ,258.58 + ,189.665 + ,217.924 + ,8 + ,242.293 + ,284.415 + ,211.503 + ,240.027 + ,8 + ,253.733 + ,296.479 + ,218.398 + ,250.212 + ,8 + ,220.406 + ,259.121 + ,190.056 + ,217.521 + ,8 + ,220.283 + ,243.526 + ,204.453 + ,218.36 + ,8 + ,230.535 + ,261.166 + ,217.602 + ,231.015 + ,8 + ,251.147 + ,274.787 + ,221.488 + ,246.381 + ,9 + ,107.542 + ,107.249 + ,100.371 + ,105.695 + ,9 + ,112.565 + ,116.42 + ,106.746 + ,111.611 + ,9 + ,117.543 + ,118.711 + ,117.973 + ,117.807 + ,9 + ,134.689 + ,134.529 + ,133.091 + ,134.265 + ,9 + ,149.123 + ,152.221 + ,137.072 + ,146.497 + ,9 + ,202.319 + ,229.096 + ,161.039 + ,195.475 + ,9 + ,220.269 + ,257.981 + ,191.006 + ,217.978 + ,9 + ,248.077 + ,287.685 + ,218.055 + ,245.433 + ,9 + ,252.299 + ,295.557 + ,213.639 + ,248.073 + ,9 + ,223.551 + ,262.711 + ,190.322 + ,219.971 + ,9 + ,216.675 + ,247.503 + ,206.552 + ,217.72 + ,9 + ,229.735 + ,265.351 + ,220.635 + ,232.241 + ,10 + ,107.954 + ,109.481 + ,101.337 + ,106.489 + ,10 + ,112.698 + ,113.365 + ,108.454 + ,111.717 + ,10 + ,118.205 + ,119.223 + ,117.863 + ,118.255 + ,10 + ,135.058 + ,135.166 + ,133.167 + ,134.596 + ,10 + ,150.925 + ,157.061 + ,139.485 + ,148.857 + ,10 + ,204.148 + ,233.982 + ,165.599 + ,198.4 + ,10 + ,222.524 + ,257.756 + ,186.398 + ,218.186 + ,10 + ,248.956 + ,287.97 + ,221.076 + ,246.641 + ,10 + ,248.838 + ,288.037 + ,212.71 + ,244.468 + ,10 + ,223.373 + ,265.838 + ,203.701 + ,223.841 + ,10 + ,217.808 + ,256.9 + ,205.642 + ,219.934 + ,10 + ,233.148 + ,261.627 + ,222.011 + ,233.688 + ,11 + ,108.09 + ,111.951 + ,102.307 + ,107.146 + ,11 + ,113.701 + ,112.709 + ,107.724 + ,112.062 + ,11 + ,119.899 + ,119.196 + ,116.582 + ,118.969 + ,11 + ,135.615 + ,133.458 + ,131.858 + ,134.38 + ,11 + ,152.195 + ,160.782 + ,142.049 + ,150.78 + ,11 + ,205.288 + ,234.529 + ,171.248 + ,200.598 + ,11 + ,221.905 + ,257.984 + ,189.577 + ,218.54 + ,11 + ,252.358 + ,290.44 + ,226.743 + ,250.328 + ,11 + ,247.559 + ,287.377 + ,217.355 + ,244.727 + ,11 + ,224.678 + ,265.766 + ,200.524 + ,223.764 + ,11 + ,217.66 + ,261.806 + ,205.679 + ,220.842 + ,11 + ,235.221 + ,266.932 + ,224.948 + ,236.667 + ,12 + ,109.19 + ,111.972 + ,101.794 + ,107.695 + ,12 + ,113.844 + ,115.609 + ,108.936 + ,112.842 + ,12 + ,121.35 + ,120.729 + ,117.645 + ,120.333 + ,12 + ,136.088 + ,135.621 + ,132.5 + ,135.121 + ,12 + ,155.762 + ,164.581 + ,141.315 + ,153.293 + ,12 + ,206.439 + ,238.753 + ,172.249 + ,202.121 + ,12 + ,222.286 + ,252.604 + ,190.244 + ,217.886 + ,12 + ,254.122 + ,292.298 + ,223.179 + ,250.849 + ,12 + ,245.331 + ,290.101 + ,217.786 + ,244.034 + ,12 + ,223.629 + ,269.162 + ,200.524 + ,223.664 + ,12 + ,217.951 + ,260.758 + ,204.583 + ,220.584 + ,12 + ,237.46 + ,268.695 + ,225.566 + ,238.439) + ,dim=c(5 + ,150) + ,dimnames=list(c('month' + ,'MSF' + ,'SSF' + ,'NS' + ,'TOT') + ,1:150)) > y <- array(NA,dim=c(5,150),dimnames=list(c('month','MSF','SSF','NS','TOT'),1:150)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '4' > 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 NS month MSF SSF TOT t 1 100.2940 1 110.115 110.661 107.711 1 2 109.7640 1 114.151 115.626 113.241 2 3 120.7110 1 122.563 121.828 121.998 3 4 131.5510 1 136.114 137.409 135.136 4 5 145.0230 1 159.863 171.274 157.641 5 6 177.1640 1 210.638 238.258 205.875 6 7 190.2690 1 219.929 251.688 216.347 7 8 219.9960 1 255.015 296.637 251.435 8 9 218.1860 1 242.351 296.679 243.588 9 10 191.5820 1 220.855 256.573 217.678 10 11 204.4840 1 215.900 244.361 216.346 11 12 219.3180 1 239.951 274.370 239.488 12 13 100.5780 2 110.439 113.149 108.313 13 14 108.5020 2 114.069 116.697 113.015 14 15 121.3700 2 124.143 122.603 123.239 15 16 131.4220 2 136.177 138.866 135.336 16 17 148.2870 2 164.488 177.848 162.182 17 18 174.9470 2 212.831 241.420 207.085 18 19 196.6060 2 222.144 255.734 219.825 19 20 223.8470 2 253.493 299.882 252.091 20 21 206.9170 2 238.172 285.712 236.447 21 22 195.7270 2 220.127 257.917 218.478 22 23 208.7300 2 217.141 255.116 220.221 23 24 213.5580 2 240.436 275.671 238.741 24 25 100.0000 3 100.000 100.000 100.000 25 26 97.9592 3 111.054 113.853 108.124 26 27 109.2110 3 114.798 119.368 113.998 27 28 120.4730 3 126.574 123.803 124.666 28 29 131.1120 3 136.883 135.802 135.284 29 30 147.7320 3 172.288 185.538 167.860 30 31 179.4070 3 214.227 242.440 209.204 31 32 197.7960 3 224.730 257.646 221.956 32 33 227.2270 3 255.976 292.588 252.946 33 34 197.8330 3 226.723 270.085 224.906 34 35 194.7660 3 215.471 253.316 214.815 35 36 210.2640 3 219.459 256.460 222.182 36 37 214.0260 3 241.588 270.831 238.500 37 38 100.2540 4 102.815 101.542 102.000 38 39 100.1070 4 112.319 115.143 109.615 39 40 113.0970 4 114.537 120.264 114.936 40 41 122.2040 4 128.069 127.692 126.540 41 42 131.1930 4 139.095 139.408 137.144 42 43 151.2300 4 181.098 193.704 175.245 43 44 181.6250 4 216.573 248.809 212.246 44 45 205.8740 4 228.912 263.016 227.184 45 46 226.7570 4 255.878 292.523 252.773 46 47 194.4380 4 225.840 261.006 221.934 47 48 194.5760 4 214.691 257.496 215.143 48 49 214.2110 4 222.898 258.249 225.455 49 50 225.5900 4 241.512 275.141 242.116 50 51 102.8390 5 104.301 102.179 103.650 51 52 102.8650 5 113.607 116.923 111.340 52 53 112.1800 5 114.118 118.740 114.245 53 54 124.9430 5 128.101 128.336 127.336 54 55 136.4480 5 141.551 142.191 140.349 55 56 150.2780 5 186.026 203.366 179.320 56 57 188.8710 5 217.504 254.991 215.466 57 58 206.2290 5 231.613 265.367 229.247 58 59 223.9280 5 254.149 290.063 250.677 59 60 202.5080 5 225.751 266.440 224.903 60 61 198.5630 5 216.200 264.861 218.381 61 62 214.1690 5 225.478 256.327 226.420 62 63 227.6370 5 243.050 277.590 243.923 63 64 104.7260 6 104.964 105.494 104.974 64 65 102.7190 6 112.716 116.638 110.717 65 66 114.8550 6 113.814 116.522 114.437 66 67 125.2760 6 128.752 128.718 127.871 67 68 138.4330 6 144.647 146.027 143.264 68 69 154.7890 6 191.144 213.692 184.979 69 70 189.8660 6 219.151 255.458 216.693 70 71 208.4730 6 235.936 271.406 233.330 71 72 220.6820 6 252.408 296.831 250.105 72 73 196.6510 6 226.192 267.075 223.798 73 74 201.6790 6 219.850 257.795 219.962 74 75 213.6560 6 228.098 259.192 228.287 75 76 229.0000 6 246.469 276.357 245.813 76 77 103.3870 7 104.830 106.140 104.641 77 78 103.9210 7 113.126 116.227 111.217 78 79 114.5300 7 115.232 116.967 115.286 79 80 130.1920 7 129.991 130.539 130.115 80 81 136.3230 7 147.403 145.695 144.381 81 82 153.0290 7 196.021 220.819 188.482 82 83 192.1140 7 220.494 261.125 219.019 83 84 211.1020 7 239.005 278.478 236.987 84 85 227.6540 7 252.503 296.742 251.788 85 86 191.4460 7 220.037 263.672 218.529 86 87 201.5060 7 220.182 251.318 218.933 87 88 219.0280 7 230.729 260.776 231.349 88 89 226.8410 7 248.640 279.389 247.143 89 90 101.7460 8 105.878 106.371 104.902 90 91 105.7510 8 112.818 115.942 111.452 91 92 115.3280 8 115.945 118.061 116.071 92 93 131.5950 8 133.236 132.864 132.773 93 94 137.4530 8 148.778 148.469 145.881 94 95 157.6580 8 200.338 225.005 192.860 95 96 189.6650 8 220.484 258.580 217.924 96 97 211.5030 8 242.293 284.415 240.027 97 98 218.3980 8 253.733 296.479 250.212 98 99 190.0560 8 220.406 259.121 217.521 99 100 204.4530 8 220.283 243.526 218.360 100 101 217.6020 8 230.535 261.166 231.015 101 102 221.4880 8 251.147 274.787 246.381 102 103 100.3710 9 107.542 107.249 105.695 103 104 106.7460 9 112.565 116.420 111.611 104 105 117.9730 9 117.543 118.711 117.807 105 106 133.0910 9 134.689 134.529 134.265 106 107 137.0720 9 149.123 152.221 146.497 107 108 161.0390 9 202.319 229.096 195.475 108 109 191.0060 9 220.269 257.981 217.978 109 110 218.0550 9 248.077 287.685 245.433 110 111 213.6390 9 252.299 295.557 248.073 111 112 190.3220 9 223.551 262.711 219.971 112 113 206.5520 9 216.675 247.503 217.720 113 114 220.6350 9 229.735 265.351 232.241 114 115 101.3370 10 107.954 109.481 106.489 115 116 108.4540 10 112.698 113.365 111.717 116 117 117.8630 10 118.205 119.223 118.255 117 118 133.1670 10 135.058 135.166 134.596 118 119 139.4850 10 150.925 157.061 148.857 119 120 165.5990 10 204.148 233.982 198.400 120 121 186.3980 10 222.524 257.756 218.186 121 122 221.0760 10 248.956 287.970 246.641 122 123 212.7100 10 248.838 288.037 244.468 123 124 203.7010 10 223.373 265.838 223.841 124 125 205.6420 10 217.808 256.900 219.934 125 126 222.0110 10 233.148 261.627 233.688 126 127 102.3070 11 108.090 111.951 107.146 127 128 107.7240 11 113.701 112.709 112.062 128 129 116.5820 11 119.899 119.196 118.969 129 130 131.8580 11 135.615 133.458 134.380 130 131 142.0490 11 152.195 160.782 150.780 131 132 171.2480 11 205.288 234.529 200.598 132 133 189.5770 11 221.905 257.984 218.540 133 134 226.7430 11 252.358 290.440 250.328 134 135 217.3550 11 247.559 287.377 244.727 135 136 200.5240 11 224.678 265.766 223.764 136 137 205.6790 11 217.660 261.806 220.842 137 138 224.9480 11 235.221 266.932 236.667 138 139 101.7940 12 109.190 111.972 107.695 139 140 108.9360 12 113.844 115.609 112.842 140 141 117.6450 12 121.350 120.729 120.333 141 142 132.5000 12 136.088 135.621 135.121 142 143 141.3150 12 155.762 164.581 153.293 143 144 172.2490 12 206.439 238.753 202.121 144 145 190.2440 12 222.286 252.604 217.886 145 146 223.1790 12 254.122 292.298 250.849 146 147 217.7860 12 245.331 290.101 244.034 147 148 200.5240 12 223.629 269.162 223.664 148 149 204.5830 12 217.951 260.758 220.584 149 150 225.5660 12 237.460 268.695 238.439 150 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) month MSF SSF TOT t -2.44716 0.19359 -2.37440 -0.55780 3.95052 -0.01461 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.52194 -0.49615 0.06524 0.35976 3.05581 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -2.44716 1.14582 -2.136 0.0344 * month 0.19359 0.65092 0.297 0.7666 MSF -2.37440 0.03831 -61.976 <2e-16 *** SSF -0.55780 0.01270 -43.914 <2e-16 *** TOT 3.95052 0.04384 90.116 <2e-16 *** t -0.01461 0.05142 -0.284 0.7767 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.8165 on 144 degrees of freedom Multiple R-squared: 0.9997, Adjusted R-squared: 0.9997 F-statistic: 9.042e+04 on 5 and 144 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.3313223 0.66264462 0.66867769 [2,] 0.4182199 0.83643975 0.58178012 [3,] 0.3006539 0.60130786 0.69934607 [4,] 0.8097671 0.38046577 0.19023289 [5,] 0.7243530 0.55129408 0.27564704 [6,] 0.6296931 0.74061376 0.37030688 [7,] 0.5321433 0.93571338 0.46785669 [8,] 0.4337542 0.86750844 0.56624578 [9,] 0.3640568 0.72811359 0.63594321 [10,] 0.3593408 0.71868156 0.64065922 [11,] 0.4530115 0.90602305 0.54698847 [12,] 0.3767791 0.75355826 0.62322087 [13,] 0.3021054 0.60421080 0.69789460 [14,] 0.3393050 0.67860992 0.66069504 [15,] 0.3759825 0.75196492 0.62401754 [16,] 0.8323344 0.33533121 0.16766561 [17,] 0.7955924 0.40881527 0.20440763 [18,] 0.7492080 0.50158402 0.25079201 [19,] 0.6942933 0.61141331 0.30570665 [20,] 0.6394786 0.72104278 0.36052139 [21,] 0.5830529 0.83389417 0.41694708 [22,] 0.5357919 0.92841616 0.46420808 [23,] 0.5014643 0.99707133 0.49853567 [24,] 0.5553548 0.88929045 0.44464522 [25,] 0.7579360 0.48412798 0.24206399 [26,] 0.7314898 0.53702031 0.26851016 [27,] 0.7846169 0.43076623 0.21538312 [28,] 0.7868266 0.42634678 0.21317339 [29,] 0.7836852 0.43262967 0.21631483 [30,] 0.7414054 0.51718925 0.25859463 [31,] 0.6987480 0.60250394 0.30125197 [32,] 0.6516966 0.69660684 0.34830342 [33,] 0.5992704 0.80145929 0.40072964 [34,] 0.5477558 0.90448832 0.45224416 [35,] 0.5309069 0.93818612 0.46909306 [36,] 0.6592456 0.68150888 0.34075444 [37,] 0.6994987 0.60100252 0.30050126 [38,] 0.7757495 0.44850092 0.22425046 [39,] 0.8905016 0.21899682 0.10949841 [40,] 0.8686399 0.26272012 0.13136006 [41,] 0.8598897 0.28022056 0.14011028 [42,] 0.9028406 0.19431875 0.09715937 [43,] 0.8801722 0.23965569 0.11982784 [44,] 0.8558063 0.28838741 0.14419371 [45,] 0.8281075 0.34378497 0.17189249 [46,] 0.7943867 0.41122655 0.20561327 [47,] 0.7610624 0.47787518 0.23893759 [48,] 0.7577445 0.48451105 0.24225553 [49,] 0.8361134 0.32777322 0.16388661 [50,] 0.8422281 0.31554385 0.15777192 [51,] 0.8769813 0.24603745 0.12301872 [52,] 0.8858058 0.22838847 0.11419424 [53,] 0.8846560 0.23068803 0.11534402 [54,] 0.8727637 0.25447270 0.12723635 [55,] 0.9294127 0.14117459 0.07058730 [56,] 0.9136429 0.17271424 0.08635712 [57,] 0.8953712 0.20925764 0.10462882 [58,] 0.8739433 0.25211347 0.12605674 [59,] 0.8475449 0.30491014 0.15245507 [60,] 0.8233611 0.35327789 0.17663895 [61,] 0.8139751 0.37204977 0.18602489 [62,] 0.8412111 0.31757782 0.15878891 [63,] 0.8252378 0.34952436 0.17476218 [64,] 0.7947206 0.41055884 0.20527942 [65,] 0.8030823 0.39383543 0.19691771 [66,] 0.8097453 0.38050934 0.19025467 [67,] 0.7866259 0.42674814 0.21337407 [68,] 0.7668762 0.46624767 0.23312383 [69,] 0.7357604 0.52847913 0.26423957 [70,] 0.7005899 0.59882011 0.29941005 [71,] 0.6604415 0.67911691 0.33955845 [72,] 0.6159592 0.76808152 0.38404076 [73,] 0.5956154 0.80876914 0.40438457 [74,] 0.5855133 0.82897340 0.41448670 [75,] 0.7347300 0.53053996 0.26526998 [76,] 0.6956248 0.60875045 0.30437522 [77,] 0.6553207 0.68935863 0.34467931 [78,] 0.6091077 0.78178462 0.39089231 [79,] 0.7942482 0.41150359 0.20575179 [80,] 0.7826907 0.43461852 0.21730926 [81,] 0.8157933 0.36841334 0.18420667 [82,] 0.7859423 0.42811539 0.21405769 [83,] 0.7542177 0.49156456 0.24578228 [84,] 0.7170332 0.56593359 0.28296679 [85,] 0.6792348 0.64153038 0.32076519 [86,] 0.6701028 0.65979450 0.32989725 [87,] 0.6749467 0.65010661 0.32505331 [88,] 0.7438036 0.51239276 0.25619638 [89,] 0.7442986 0.51140284 0.25570142 [90,] 0.7169258 0.56614838 0.28307419 [91,] 0.7283693 0.54326143 0.27163071 [92,] 0.9868146 0.02637088 0.01318544 [93,] 0.9820999 0.03580016 0.01790008 [94,] 0.9752465 0.04950709 0.02475354 [95,] 0.9669276 0.06614488 0.03307244 [96,] 0.9588461 0.08230777 0.04115388 [97,] 0.9462521 0.10749571 0.05374786 [98,] 0.9320458 0.13590844 0.06795422 [99,] 0.9184277 0.16314453 0.08157226 [100,] 0.9166720 0.16665608 0.08332804 [101,] 0.9370293 0.12594145 0.06297073 [102,] 0.9223125 0.15537503 0.07768751 [103,] 0.9118845 0.17623099 0.08811549 [104,] 0.9498832 0.10023359 0.05011679 [105,] 0.9852410 0.02951809 0.01475904 [106,] 0.9878513 0.02429750 0.01214875 [107,] 0.9825181 0.03496381 0.01748191 [108,] 0.9751748 0.04965031 0.02482516 [109,] 0.9647059 0.07058829 0.03529414 [110,] 0.9542003 0.09159938 0.04579969 [111,] 0.9379817 0.12403658 0.06201829 [112,] 0.9242247 0.15155067 0.07577534 [113,] 0.9724966 0.05500689 0.02750344 [114,] 0.9647642 0.07047155 0.03523578 [115,] 0.9512511 0.09749772 0.04874886 [116,] 0.9423945 0.11521103 0.05760552 [117,] 0.9190478 0.16190444 0.08095222 [118,] 0.9317385 0.13652300 0.06826150 [119,] 0.9081819 0.18363629 0.09181815 [120,] 0.8756545 0.24869091 0.12434546 [121,] 0.8371131 0.32577379 0.16288690 [122,] 0.7848496 0.43030081 0.21515041 [123,] 0.7175297 0.56494064 0.28247032 [124,] 0.7359097 0.52818066 0.26409033 [125,] 0.8647735 0.27045305 0.13522653 [126,] 0.8170782 0.36584359 0.18292180 [127,] 0.7545760 0.49084808 0.24542404 [128,] 0.8347023 0.33059537 0.16529768 [129,] 0.8436455 0.31270892 0.15635446 [130,] 0.7534499 0.49310010 0.24655005 [131,] 0.6377966 0.72440673 0.36220337 [132,] 0.5178976 0.96420487 0.48210244 [133,] 0.3951685 0.79033705 0.60483147 > postscript(file="/var/fisher/rcomp/tmp/1hupg1353428236.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/fisher/rcomp/tmp/2ri9r1353428236.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/fisher/rcomp/tmp/33boo1353428236.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/fisher/rcomp/tmp/4pdi71353428236.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/fisher/rcomp/tmp/54k9o1353428236.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 = 150 Frequency = 1 1 2 3 4 5 6 0.23151543 0.22230165 0.02214346 -0.15860170 -0.29893540 -0.76889080 7 8 9 10 11 12 0.53266918 0.03917012 -0.80250458 1.55489869 1.15660360 -1.57201079 13 14 15 16 17 18 0.27615845 0.23756943 -0.05585243 -0.13365783 -0.34392327 -0.81344708 19 20 21 22 23 24 0.62765824 -0.52341347 0.08091950 1.54234376 -0.97816984 -2.52193982 25 26 27 28 29 30 0.39970584 0.25331658 0.28038566 -0.15235164 -0.27463241 -0.52380617 31 32 33 34 35 36 -0.84462038 0.60217602 1.30232097 0.68499274 1.42681170 -0.94123288 37 38 39 40 41 42 -1.06992994 0.29309559 0.23042970 0.33722358 -0.10925909 -0.28164105 43 44 45 46 47 48 -0.73057020 -1.52478103 0.94834071 1.24317362 1.86646074 0.41696004 49 50 51 52 53 54 -0.76445348 -1.57100454 0.23977718 0.22125281 0.30143594 -0.08331141 55 56 57 58 59 60 -0.30781510 -0.69407918 -1.34422568 0.87442379 1.21330091 1.02347156 61 62 63 64 65 66 -0.70031326 0.43153036 -1.64835636 0.31597631 0.25822199 0.25528192 67 68 69 70 71 72 -0.10866381 -0.35135752 -0.63070100 -1.02901956 0.61789441 -0.13530302 73 74 75 76 77 78 0.92947371 0.89145024 0.35829708 -0.32515743 0.33102817 0.22557269 79 80 81 82 83 84 0.18777526 -0.10363796 -0.51905939 -0.67762315 -1.62370824 0.02798900 85 86 87 88 89 90 0.36025304 0.02348951 1.95534487 0.76076906 -0.89591572 0.27253017 91 92 93 94 95 96 0.23327167 0.18415737 -0.20294222 -0.50634456 -0.76240232 -1.19386478 97 98 99 100 101 102 -0.46554989 0.10045426 0.94959464 3.05580971 0.40751093 0.14339074 103 104 105 106 107 108 0.20188277 0.26240231 0.12427875 -0.22601735 -0.41247868 -0.73001097 109 110 111 112 113 114 -0.91445009 0.28384305 -0.13120360 1.00317272 1.33101393 -0.97160895 115 116 117 118 119 120 0.23617689 0.14512012 0.08364267 -0.24441820 -0.36254335 -0.67535317 121 122 123 124 125 126 -1.13363085 0.76043570 0.75072485 0.39699010 -0.41186690 0.69633945 127 128 129 130 131 132 0.29311272 0.04955210 -0.02909958 -0.34853095 -0.32258881 -0.71591501 133 134 135 136 137 138 -0.71394498 1.29909484 0.94927875 0.56436669 -1.59504781 -0.27225892 139 140 141 142 143 144 0.21658449 0.11904754 -0.07249724 -0.32250849 -0.41392635 -0.66073341 145 146 147 148 149 150 0.42214244 0.88346053 0.32900743 0.34469897 -1.58368378 -0.37314523 > postscript(file="/var/fisher/rcomp/tmp/6cqs91353428236.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 = 150 Frequency = 1 lag(myerror, k = 1) myerror 0 0.23151543 NA 1 0.22230165 0.23151543 2 0.02214346 0.22230165 3 -0.15860170 0.02214346 4 -0.29893540 -0.15860170 5 -0.76889080 -0.29893540 6 0.53266918 -0.76889080 7 0.03917012 0.53266918 8 -0.80250458 0.03917012 9 1.55489869 -0.80250458 10 1.15660360 1.55489869 11 -1.57201079 1.15660360 12 0.27615845 -1.57201079 13 0.23756943 0.27615845 14 -0.05585243 0.23756943 15 -0.13365783 -0.05585243 16 -0.34392327 -0.13365783 17 -0.81344708 -0.34392327 18 0.62765824 -0.81344708 19 -0.52341347 0.62765824 20 0.08091950 -0.52341347 21 1.54234376 0.08091950 22 -0.97816984 1.54234376 23 -2.52193982 -0.97816984 24 0.39970584 -2.52193982 25 0.25331658 0.39970584 26 0.28038566 0.25331658 27 -0.15235164 0.28038566 28 -0.27463241 -0.15235164 29 -0.52380617 -0.27463241 30 -0.84462038 -0.52380617 31 0.60217602 -0.84462038 32 1.30232097 0.60217602 33 0.68499274 1.30232097 34 1.42681170 0.68499274 35 -0.94123288 1.42681170 36 -1.06992994 -0.94123288 37 0.29309559 -1.06992994 38 0.23042970 0.29309559 39 0.33722358 0.23042970 40 -0.10925909 0.33722358 41 -0.28164105 -0.10925909 42 -0.73057020 -0.28164105 43 -1.52478103 -0.73057020 44 0.94834071 -1.52478103 45 1.24317362 0.94834071 46 1.86646074 1.24317362 47 0.41696004 1.86646074 48 -0.76445348 0.41696004 49 -1.57100454 -0.76445348 50 0.23977718 -1.57100454 51 0.22125281 0.23977718 52 0.30143594 0.22125281 53 -0.08331141 0.30143594 54 -0.30781510 -0.08331141 55 -0.69407918 -0.30781510 56 -1.34422568 -0.69407918 57 0.87442379 -1.34422568 58 1.21330091 0.87442379 59 1.02347156 1.21330091 60 -0.70031326 1.02347156 61 0.43153036 -0.70031326 62 -1.64835636 0.43153036 63 0.31597631 -1.64835636 64 0.25822199 0.31597631 65 0.25528192 0.25822199 66 -0.10866381 0.25528192 67 -0.35135752 -0.10866381 68 -0.63070100 -0.35135752 69 -1.02901956 -0.63070100 70 0.61789441 -1.02901956 71 -0.13530302 0.61789441 72 0.92947371 -0.13530302 73 0.89145024 0.92947371 74 0.35829708 0.89145024 75 -0.32515743 0.35829708 76 0.33102817 -0.32515743 77 0.22557269 0.33102817 78 0.18777526 0.22557269 79 -0.10363796 0.18777526 80 -0.51905939 -0.10363796 81 -0.67762315 -0.51905939 82 -1.62370824 -0.67762315 83 0.02798900 -1.62370824 84 0.36025304 0.02798900 85 0.02348951 0.36025304 86 1.95534487 0.02348951 87 0.76076906 1.95534487 88 -0.89591572 0.76076906 89 0.27253017 -0.89591572 90 0.23327167 0.27253017 91 0.18415737 0.23327167 92 -0.20294222 0.18415737 93 -0.50634456 -0.20294222 94 -0.76240232 -0.50634456 95 -1.19386478 -0.76240232 96 -0.46554989 -1.19386478 97 0.10045426 -0.46554989 98 0.94959464 0.10045426 99 3.05580971 0.94959464 100 0.40751093 3.05580971 101 0.14339074 0.40751093 102 0.20188277 0.14339074 103 0.26240231 0.20188277 104 0.12427875 0.26240231 105 -0.22601735 0.12427875 106 -0.41247868 -0.22601735 107 -0.73001097 -0.41247868 108 -0.91445009 -0.73001097 109 0.28384305 -0.91445009 110 -0.13120360 0.28384305 111 1.00317272 -0.13120360 112 1.33101393 1.00317272 113 -0.97160895 1.33101393 114 0.23617689 -0.97160895 115 0.14512012 0.23617689 116 0.08364267 0.14512012 117 -0.24441820 0.08364267 118 -0.36254335 -0.24441820 119 -0.67535317 -0.36254335 120 -1.13363085 -0.67535317 121 0.76043570 -1.13363085 122 0.75072485 0.76043570 123 0.39699010 0.75072485 124 -0.41186690 0.39699010 125 0.69633945 -0.41186690 126 0.29311272 0.69633945 127 0.04955210 0.29311272 128 -0.02909958 0.04955210 129 -0.34853095 -0.02909958 130 -0.32258881 -0.34853095 131 -0.71591501 -0.32258881 132 -0.71394498 -0.71591501 133 1.29909484 -0.71394498 134 0.94927875 1.29909484 135 0.56436669 0.94927875 136 -1.59504781 0.56436669 137 -0.27225892 -1.59504781 138 0.21658449 -0.27225892 139 0.11904754 0.21658449 140 -0.07249724 0.11904754 141 -0.32250849 -0.07249724 142 -0.41392635 -0.32250849 143 -0.66073341 -0.41392635 144 0.42214244 -0.66073341 145 0.88346053 0.42214244 146 0.32900743 0.88346053 147 0.34469897 0.32900743 148 -1.58368378 0.34469897 149 -0.37314523 -1.58368378 150 NA -0.37314523 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.22230165 0.23151543 [2,] 0.02214346 0.22230165 [3,] -0.15860170 0.02214346 [4,] -0.29893540 -0.15860170 [5,] -0.76889080 -0.29893540 [6,] 0.53266918 -0.76889080 [7,] 0.03917012 0.53266918 [8,] -0.80250458 0.03917012 [9,] 1.55489869 -0.80250458 [10,] 1.15660360 1.55489869 [11,] -1.57201079 1.15660360 [12,] 0.27615845 -1.57201079 [13,] 0.23756943 0.27615845 [14,] -0.05585243 0.23756943 [15,] -0.13365783 -0.05585243 [16,] -0.34392327 -0.13365783 [17,] -0.81344708 -0.34392327 [18,] 0.62765824 -0.81344708 [19,] -0.52341347 0.62765824 [20,] 0.08091950 -0.52341347 [21,] 1.54234376 0.08091950 [22,] -0.97816984 1.54234376 [23,] -2.52193982 -0.97816984 [24,] 0.39970584 -2.52193982 [25,] 0.25331658 0.39970584 [26,] 0.28038566 0.25331658 [27,] -0.15235164 0.28038566 [28,] -0.27463241 -0.15235164 [29,] -0.52380617 -0.27463241 [30,] -0.84462038 -0.52380617 [31,] 0.60217602 -0.84462038 [32,] 1.30232097 0.60217602 [33,] 0.68499274 1.30232097 [34,] 1.42681170 0.68499274 [35,] -0.94123288 1.42681170 [36,] -1.06992994 -0.94123288 [37,] 0.29309559 -1.06992994 [38,] 0.23042970 0.29309559 [39,] 0.33722358 0.23042970 [40,] -0.10925909 0.33722358 [41,] -0.28164105 -0.10925909 [42,] -0.73057020 -0.28164105 [43,] -1.52478103 -0.73057020 [44,] 0.94834071 -1.52478103 [45,] 1.24317362 0.94834071 [46,] 1.86646074 1.24317362 [47,] 0.41696004 1.86646074 [48,] -0.76445348 0.41696004 [49,] -1.57100454 -0.76445348 [50,] 0.23977718 -1.57100454 [51,] 0.22125281 0.23977718 [52,] 0.30143594 0.22125281 [53,] -0.08331141 0.30143594 [54,] -0.30781510 -0.08331141 [55,] -0.69407918 -0.30781510 [56,] -1.34422568 -0.69407918 [57,] 0.87442379 -1.34422568 [58,] 1.21330091 0.87442379 [59,] 1.02347156 1.21330091 [60,] -0.70031326 1.02347156 [61,] 0.43153036 -0.70031326 [62,] -1.64835636 0.43153036 [63,] 0.31597631 -1.64835636 [64,] 0.25822199 0.31597631 [65,] 0.25528192 0.25822199 [66,] -0.10866381 0.25528192 [67,] -0.35135752 -0.10866381 [68,] -0.63070100 -0.35135752 [69,] -1.02901956 -0.63070100 [70,] 0.61789441 -1.02901956 [71,] -0.13530302 0.61789441 [72,] 0.92947371 -0.13530302 [73,] 0.89145024 0.92947371 [74,] 0.35829708 0.89145024 [75,] -0.32515743 0.35829708 [76,] 0.33102817 -0.32515743 [77,] 0.22557269 0.33102817 [78,] 0.18777526 0.22557269 [79,] -0.10363796 0.18777526 [80,] -0.51905939 -0.10363796 [81,] -0.67762315 -0.51905939 [82,] -1.62370824 -0.67762315 [83,] 0.02798900 -1.62370824 [84,] 0.36025304 0.02798900 [85,] 0.02348951 0.36025304 [86,] 1.95534487 0.02348951 [87,] 0.76076906 1.95534487 [88,] -0.89591572 0.76076906 [89,] 0.27253017 -0.89591572 [90,] 0.23327167 0.27253017 [91,] 0.18415737 0.23327167 [92,] -0.20294222 0.18415737 [93,] -0.50634456 -0.20294222 [94,] -0.76240232 -0.50634456 [95,] -1.19386478 -0.76240232 [96,] -0.46554989 -1.19386478 [97,] 0.10045426 -0.46554989 [98,] 0.94959464 0.10045426 [99,] 3.05580971 0.94959464 [100,] 0.40751093 3.05580971 [101,] 0.14339074 0.40751093 [102,] 0.20188277 0.14339074 [103,] 0.26240231 0.20188277 [104,] 0.12427875 0.26240231 [105,] -0.22601735 0.12427875 [106,] -0.41247868 -0.22601735 [107,] -0.73001097 -0.41247868 [108,] -0.91445009 -0.73001097 [109,] 0.28384305 -0.91445009 [110,] -0.13120360 0.28384305 [111,] 1.00317272 -0.13120360 [112,] 1.33101393 1.00317272 [113,] -0.97160895 1.33101393 [114,] 0.23617689 -0.97160895 [115,] 0.14512012 0.23617689 [116,] 0.08364267 0.14512012 [117,] -0.24441820 0.08364267 [118,] -0.36254335 -0.24441820 [119,] -0.67535317 -0.36254335 [120,] -1.13363085 -0.67535317 [121,] 0.76043570 -1.13363085 [122,] 0.75072485 0.76043570 [123,] 0.39699010 0.75072485 [124,] -0.41186690 0.39699010 [125,] 0.69633945 -0.41186690 [126,] 0.29311272 0.69633945 [127,] 0.04955210 0.29311272 [128,] -0.02909958 0.04955210 [129,] -0.34853095 -0.02909958 [130,] -0.32258881 -0.34853095 [131,] -0.71591501 -0.32258881 [132,] -0.71394498 -0.71591501 [133,] 1.29909484 -0.71394498 [134,] 0.94927875 1.29909484 [135,] 0.56436669 0.94927875 [136,] -1.59504781 0.56436669 [137,] -0.27225892 -1.59504781 [138,] 0.21658449 -0.27225892 [139,] 0.11904754 0.21658449 [140,] -0.07249724 0.11904754 [141,] -0.32250849 -0.07249724 [142,] -0.41392635 -0.32250849 [143,] -0.66073341 -0.41392635 [144,] 0.42214244 -0.66073341 [145,] 0.88346053 0.42214244 [146,] 0.32900743 0.88346053 [147,] 0.34469897 0.32900743 [148,] -1.58368378 0.34469897 [149,] -0.37314523 -1.58368378 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.22230165 0.23151543 2 0.02214346 0.22230165 3 -0.15860170 0.02214346 4 -0.29893540 -0.15860170 5 -0.76889080 -0.29893540 6 0.53266918 -0.76889080 7 0.03917012 0.53266918 8 -0.80250458 0.03917012 9 1.55489869 -0.80250458 10 1.15660360 1.55489869 11 -1.57201079 1.15660360 12 0.27615845 -1.57201079 13 0.23756943 0.27615845 14 -0.05585243 0.23756943 15 -0.13365783 -0.05585243 16 -0.34392327 -0.13365783 17 -0.81344708 -0.34392327 18 0.62765824 -0.81344708 19 -0.52341347 0.62765824 20 0.08091950 -0.52341347 21 1.54234376 0.08091950 22 -0.97816984 1.54234376 23 -2.52193982 -0.97816984 24 0.39970584 -2.52193982 25 0.25331658 0.39970584 26 0.28038566 0.25331658 27 -0.15235164 0.28038566 28 -0.27463241 -0.15235164 29 -0.52380617 -0.27463241 30 -0.84462038 -0.52380617 31 0.60217602 -0.84462038 32 1.30232097 0.60217602 33 0.68499274 1.30232097 34 1.42681170 0.68499274 35 -0.94123288 1.42681170 36 -1.06992994 -0.94123288 37 0.29309559 -1.06992994 38 0.23042970 0.29309559 39 0.33722358 0.23042970 40 -0.10925909 0.33722358 41 -0.28164105 -0.10925909 42 -0.73057020 -0.28164105 43 -1.52478103 -0.73057020 44 0.94834071 -1.52478103 45 1.24317362 0.94834071 46 1.86646074 1.24317362 47 0.41696004 1.86646074 48 -0.76445348 0.41696004 49 -1.57100454 -0.76445348 50 0.23977718 -1.57100454 51 0.22125281 0.23977718 52 0.30143594 0.22125281 53 -0.08331141 0.30143594 54 -0.30781510 -0.08331141 55 -0.69407918 -0.30781510 56 -1.34422568 -0.69407918 57 0.87442379 -1.34422568 58 1.21330091 0.87442379 59 1.02347156 1.21330091 60 -0.70031326 1.02347156 61 0.43153036 -0.70031326 62 -1.64835636 0.43153036 63 0.31597631 -1.64835636 64 0.25822199 0.31597631 65 0.25528192 0.25822199 66 -0.10866381 0.25528192 67 -0.35135752 -0.10866381 68 -0.63070100 -0.35135752 69 -1.02901956 -0.63070100 70 0.61789441 -1.02901956 71 -0.13530302 0.61789441 72 0.92947371 -0.13530302 73 0.89145024 0.92947371 74 0.35829708 0.89145024 75 -0.32515743 0.35829708 76 0.33102817 -0.32515743 77 0.22557269 0.33102817 78 0.18777526 0.22557269 79 -0.10363796 0.18777526 80 -0.51905939 -0.10363796 81 -0.67762315 -0.51905939 82 -1.62370824 -0.67762315 83 0.02798900 -1.62370824 84 0.36025304 0.02798900 85 0.02348951 0.36025304 86 1.95534487 0.02348951 87 0.76076906 1.95534487 88 -0.89591572 0.76076906 89 0.27253017 -0.89591572 90 0.23327167 0.27253017 91 0.18415737 0.23327167 92 -0.20294222 0.18415737 93 -0.50634456 -0.20294222 94 -0.76240232 -0.50634456 95 -1.19386478 -0.76240232 96 -0.46554989 -1.19386478 97 0.10045426 -0.46554989 98 0.94959464 0.10045426 99 3.05580971 0.94959464 100 0.40751093 3.05580971 101 0.14339074 0.40751093 102 0.20188277 0.14339074 103 0.26240231 0.20188277 104 0.12427875 0.26240231 105 -0.22601735 0.12427875 106 -0.41247868 -0.22601735 107 -0.73001097 -0.41247868 108 -0.91445009 -0.73001097 109 0.28384305 -0.91445009 110 -0.13120360 0.28384305 111 1.00317272 -0.13120360 112 1.33101393 1.00317272 113 -0.97160895 1.33101393 114 0.23617689 -0.97160895 115 0.14512012 0.23617689 116 0.08364267 0.14512012 117 -0.24441820 0.08364267 118 -0.36254335 -0.24441820 119 -0.67535317 -0.36254335 120 -1.13363085 -0.67535317 121 0.76043570 -1.13363085 122 0.75072485 0.76043570 123 0.39699010 0.75072485 124 -0.41186690 0.39699010 125 0.69633945 -0.41186690 126 0.29311272 0.69633945 127 0.04955210 0.29311272 128 -0.02909958 0.04955210 129 -0.34853095 -0.02909958 130 -0.32258881 -0.34853095 131 -0.71591501 -0.32258881 132 -0.71394498 -0.71591501 133 1.29909484 -0.71394498 134 0.94927875 1.29909484 135 0.56436669 0.94927875 136 -1.59504781 0.56436669 137 -0.27225892 -1.59504781 138 0.21658449 -0.27225892 139 0.11904754 0.21658449 140 -0.07249724 0.11904754 141 -0.32250849 -0.07249724 142 -0.41392635 -0.32250849 143 -0.66073341 -0.41392635 144 0.42214244 -0.66073341 145 0.88346053 0.42214244 146 0.32900743 0.88346053 147 0.34469897 0.32900743 148 -1.58368378 0.34469897 149 -0.37314523 -1.58368378 > 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/fisher/rcomp/tmp/7nc261353428236.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/fisher/rcomp/tmp/89als1353428236.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/fisher/rcomp/tmp/9qsvu1353428236.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/fisher/rcomp/tmp/106rx01353428236.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11abv91353428236.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/fisher/rcomp/tmp/12lszt1353428236.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/fisher/rcomp/tmp/13nees1353428236.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/fisher/rcomp/tmp/14o0981353428236.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/fisher/rcomp/tmp/15bvtj1353428236.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/fisher/rcomp/tmp/16saur1353428236.tab") + } > > try(system("convert tmp/1hupg1353428236.ps tmp/1hupg1353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/2ri9r1353428236.ps tmp/2ri9r1353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/33boo1353428236.ps tmp/33boo1353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/4pdi71353428236.ps tmp/4pdi71353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/54k9o1353428236.ps tmp/54k9o1353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/6cqs91353428236.ps tmp/6cqs91353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/7nc261353428236.ps tmp/7nc261353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/89als1353428236.ps tmp/89als1353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/9qsvu1353428236.ps tmp/9qsvu1353428236.png",intern=TRUE)) character(0) > try(system("convert tmp/106rx01353428236.ps tmp/106rx01353428236.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.607 1.348 8.972