R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(384 + ,257.9 + ,367.6 + ,275.8 + ,457.1 + ,319.4 + ,429.4 + ,299.8 + ,442.2 + ,331.1 + ,507.5 + ,339.3 + ,348.5 + ,209.6 + ,393.2 + ,280.9 + ,426.8 + ,285.5 + ,403 + ,247.6 + ,454.8 + ,275.1 + ,413 + ,262.3 + ,388.9 + ,267.8 + ,406.5 + ,448.2 + ,447.4 + ,563.4 + ,474.4 + ,346.6 + ,428.5 + ,455.1 + ,472.8 + ,424.4 + ,411 + ,381.2 + ,463.9 + ,382.9 + ,497.3 + ,466.6 + ,474 + ,400.2 + ,518.1 + ,493.6 + ,566 + ,367.5 + ,509.4 + ,307.1 + ,445.1 + ,316.7 + ,466.6 + ,314.2 + ,600.5 + ,403.7 + ,538.7 + ,370.6 + ,548 + ,343.7 + ,591.9 + ,383 + ,547.3 + ,365.4 + ,610.2 + ,417.2 + ,621.6 + ,411 + ,582.4 + ,420.8 + ,635.8 + ,493 + ,663.9 + ,471.8 + ,624.2 + ,452.4 + ,654.1 + ,464.8 + ,723.5 + ,541.5 + ,641.2 + ,484 + ,565.5 + ,449.4 + ,698.6 + ,436.8 + ,651 + ,490 + ,721.6 + ,475.4 + ,643.5 + ,393.6 + ,604 + ,486.8 + ,618.2 + ,536.7 + ,783.5 + ,467 + ,672.9 + ,475.5 + ,726.7 + ,532.8 + ,738.6 + ,554.1 + ,692.2 + ,507.3 + ,669.5 + ,455.2 + ,546.2 + ,465.3 + ,715 + ,563.2 + ,789.8 + ,680.1 + ,684 + ,518.2 + ,639 + ,426.6 + ,768.5 + ,612.4 + ,643.8 + ,518.1 + ,623 + ,540 + ,692.8 + ,541.7 + ,936.5 + ,627.6 + ,795.9 + ,637 + ,695.7 + ,564.2 + ,648.3 + ,665 + ,675.2 + ,703.2 + ,826.5 + ,824.4 + ,742.4 + ,700.3 + ,793.9 + ,1219.6 + ,685.3 + ,764.7 + ,756.1 + ,479.9 + ,704 + ,543.4 + ,860.6 + ,593.3 + ,795.9 + ,584.3 + ,816.7 + ,645.9 + ,777.9 + ,548.9 + ,746.4 + ,421.8 + ,694.7 + ,460.3 + ,909.2 + ,553.4 + ,783.6 + ,424.4 + ,730.4 + ,470.2 + ,847.7 + ,547.2 + ,758.7 + ,444.8 + ,839.2 + ,526.7 + ,784.8 + ,598.3 + ,906.1 + ,543.5 + ,838.2 + ,641.2 + ,729 + ,525 + ,768.1 + ,521.5 + ,710.5 + ,551.8 + ,863 + ,543.7 + ,778.3 + ,472.1 + ,827.7 + ,488 + ,853.1 + ,642.8 + ,859.3 + ,601.7 + ,779.2 + ,553.9 + ,724.6 + ,522.5 + ,829.2 + ,568.4 + ,862.9 + ,675.4 + ,601.6 + ,499.1 + ,964.9 + ,549.4 + ,766.3 + ,531.2 + ,847.8 + ,583.3 + ,992.7 + ,526.5 + ,865.3 + ,513.2 + ,1054.1 + ,729.1 + ,972.5 + ,753.7 + ,857.4 + ,571.7 + ,1043.3 + ,680.9 + ,1061 + ,757.6 + ,989.4 + ,805.4 + ,963.2 + ,687.7 + ,1181.9 + ,950.8 + ,1256.4 + ,1062 + ,1492.7 + ,1110.6 + ,1360.8 + ,1098.9 + ,1342.8 + ,1067 + ,1464 + ,1360.1) + ,dim=c(2 + ,120) + ,dimnames=list(c('yt' + ,'xt') + ,1:120)) > y <- array(NA,dim=c(2,120),dimnames=list(c('yt','xt'),1:120)) > 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 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x yt xt t 1 384.0 257.9 1 2 367.6 275.8 2 3 457.1 319.4 3 4 429.4 299.8 4 5 442.2 331.1 5 6 507.5 339.3 6 7 348.5 209.6 7 8 393.2 280.9 8 9 426.8 285.5 9 10 403.0 247.6 10 11 454.8 275.1 11 12 413.0 262.3 12 13 388.9 267.8 13 14 406.5 448.2 14 15 447.4 563.4 15 16 474.4 346.6 16 17 428.5 455.1 17 18 472.8 424.4 18 19 411.0 381.2 19 20 463.9 382.9 20 21 497.3 466.6 21 22 474.0 400.2 22 23 518.1 493.6 23 24 566.0 367.5 24 25 509.4 307.1 25 26 445.1 316.7 26 27 466.6 314.2 27 28 600.5 403.7 28 29 538.7 370.6 29 30 548.0 343.7 30 31 591.9 383.0 31 32 547.3 365.4 32 33 610.2 417.2 33 34 621.6 411.0 34 35 582.4 420.8 35 36 635.8 493.0 36 37 663.9 471.8 37 38 624.2 452.4 38 39 654.1 464.8 39 40 723.5 541.5 40 41 641.2 484.0 41 42 565.5 449.4 42 43 698.6 436.8 43 44 651.0 490.0 44 45 721.6 475.4 45 46 643.5 393.6 46 47 604.0 486.8 47 48 618.2 536.7 48 49 783.5 467.0 49 50 672.9 475.5 50 51 726.7 532.8 51 52 738.6 554.1 52 53 692.2 507.3 53 54 669.5 455.2 54 55 546.2 465.3 55 56 715.0 563.2 56 57 789.8 680.1 57 58 684.0 518.2 58 59 639.0 426.6 59 60 768.5 612.4 60 61 643.8 518.1 61 62 623.0 540.0 62 63 692.8 541.7 63 64 936.5 627.6 64 65 795.9 637.0 65 66 695.7 564.2 66 67 648.3 665.0 67 68 675.2 703.2 68 69 826.5 824.4 69 70 742.4 700.3 70 71 793.9 1219.6 71 72 685.3 764.7 72 73 756.1 479.9 73 74 704.0 543.4 74 75 860.6 593.3 75 76 795.9 584.3 76 77 816.7 645.9 77 78 777.9 548.9 78 79 746.4 421.8 79 80 694.7 460.3 80 81 909.2 553.4 81 82 783.6 424.4 82 83 730.4 470.2 83 84 847.7 547.2 84 85 758.7 444.8 85 86 839.2 526.7 86 87 784.8 598.3 87 88 906.1 543.5 88 89 838.2 641.2 89 90 729.0 525.0 90 91 768.1 521.5 91 92 710.5 551.8 92 93 863.0 543.7 93 94 778.3 472.1 94 95 827.7 488.0 95 96 853.1 642.8 96 97 859.3 601.7 97 98 779.2 553.9 98 99 724.6 522.5 99 100 829.2 568.4 100 101 862.9 675.4 101 102 601.6 499.1 102 103 964.9 549.4 103 104 766.3 531.2 104 105 847.8 583.3 105 106 992.7 526.5 106 107 865.3 513.2 107 108 1054.1 729.1 108 109 972.5 753.7 109 110 857.4 571.7 110 111 1043.3 680.9 111 112 1061.0 757.6 112 113 989.4 805.4 113 114 963.2 687.7 114 115 1181.9 950.8 115 116 1256.4 1062.0 116 117 1492.7 1110.6 117 118 1360.8 1098.9 118 119 1342.8 1067.0 119 120 1464.0 1360.1 120 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) xt t 219.1512 0.5321 3.4823 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -321.49 -43.41 10.84 49.25 275.12 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 219.15121 21.41977 10.231 <2e-16 *** xt 0.53214 0.05389 9.874 <2e-16 *** t 3.48234 0.30485 11.423 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 80.89 on 117 degrees of freedom Multiple R-squared: 0.8719, Adjusted R-squared: 0.8697 F-statistic: 398.1 on 2 and 117 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,] 4.829694e-02 9.659388e-02 0.9517031 [2,] 1.311128e-02 2.622256e-02 0.9868887 [3,] 6.941152e-03 1.388230e-02 0.9930588 [4,] 1.847029e-03 3.694058e-03 0.9981530 [5,] 5.491589e-04 1.098318e-03 0.9994508 [6,] 2.373413e-04 4.746827e-04 0.9997627 [7,] 6.522048e-05 1.304410e-04 0.9999348 [8,] 5.996411e-05 1.199282e-04 0.9999400 [9,] 4.241140e-03 8.482280e-03 0.9957589 [10,] 2.606525e-03 5.213049e-03 0.9973935 [11,] 2.287941e-03 4.575881e-03 0.9977121 [12,] 1.194382e-03 2.388765e-03 0.9988056 [13,] 6.608085e-04 1.321617e-03 0.9993392 [14,] 3.515218e-04 7.030435e-04 0.9996485 [15,] 1.868137e-04 3.736275e-04 0.9998132 [16,] 1.201731e-04 2.403462e-04 0.9998798 [17,] 5.805791e-05 1.161158e-04 0.9999419 [18,] 3.916427e-05 7.832853e-05 0.9999608 [19,] 2.016207e-04 4.032415e-04 0.9997984 [20,] 1.153650e-04 2.307301e-04 0.9998846 [21,] 7.398343e-05 1.479669e-04 0.9999260 [22,] 3.477164e-05 6.954329e-05 0.9999652 [23,] 1.274425e-04 2.548850e-04 0.9998726 [24,] 7.136137e-05 1.427227e-04 0.9999286 [25,] 4.223189e-05 8.446377e-05 0.9999578 [26,] 4.227610e-05 8.455221e-05 0.9999577 [27,] 2.042522e-05 4.085044e-05 0.9999796 [28,] 1.869625e-05 3.739250e-05 0.9999813 [29,] 1.750357e-05 3.500715e-05 0.9999825 [30,] 8.421586e-06 1.684317e-05 0.9999916 [31,] 5.788307e-06 1.157661e-05 0.9999942 [32,] 6.183196e-06 1.236639e-05 0.9999938 [33,] 3.131576e-06 6.263152e-06 0.9999969 [34,] 1.984953e-06 3.969906e-06 0.9999980 [35,] 3.509405e-06 7.018811e-06 0.9999965 [36,] 1.721727e-06 3.443455e-06 0.9999983 [37,] 2.205388e-06 4.410775e-06 0.9999978 [38,] 2.433124e-06 4.866248e-06 0.9999976 [39,] 1.238546e-06 2.477092e-06 0.9999988 [40,] 1.410005e-06 2.820010e-06 0.9999986 [41,] 8.747587e-07 1.749517e-06 0.9999991 [42,] 1.059657e-06 2.119315e-06 0.9999989 [43,] 1.096617e-06 2.193234e-06 0.9999989 [44,] 5.836721e-06 1.167344e-05 0.9999942 [45,] 3.688210e-06 7.376421e-06 0.9999963 [46,] 2.547211e-06 5.094422e-06 0.9999975 [47,] 1.787935e-06 3.575870e-06 0.9999982 [48,] 1.187496e-06 2.374993e-06 0.9999988 [49,] 9.710361e-07 1.942072e-06 0.9999990 [50,] 1.585303e-05 3.170607e-05 0.9999841 [51,] 9.876524e-06 1.975305e-05 0.9999901 [52,] 6.723001e-06 1.344600e-05 0.9999933 [53,] 5.007671e-06 1.001534e-05 0.9999950 [54,] 5.001402e-06 1.000280e-05 0.9999950 [55,] 3.390877e-06 6.781755e-06 0.9999966 [56,] 4.488774e-06 8.977548e-06 0.9999955 [57,] 9.567439e-06 1.913488e-05 0.9999904 [58,] 6.654107e-06 1.330821e-05 0.9999933 [59,] 1.984178e-04 3.968357e-04 0.9998016 [60,] 1.643848e-04 3.287696e-04 0.9998356 [61,] 1.468537e-04 2.937075e-04 0.9998531 [62,] 4.387205e-04 8.774410e-04 0.9995613 [63,] 7.906956e-04 1.581391e-03 0.9992093 [64,] 4.949315e-04 9.898630e-04 0.9995051 [65,] 3.742130e-04 7.484261e-04 0.9996258 [66,] 1.447161e-02 2.894323e-02 0.9855284 [67,] 9.220241e-02 1.844048e-01 0.9077976 [68,] 7.467113e-02 1.493423e-01 0.9253289 [69,] 7.842647e-02 1.568529e-01 0.9215735 [70,] 7.244111e-02 1.448822e-01 0.9275589 [71,] 5.612337e-02 1.122467e-01 0.9438766 [72,] 4.737909e-02 9.475819e-02 0.9526209 [73,] 3.654648e-02 7.309297e-02 0.9634535 [74,] 3.090621e-02 6.181243e-02 0.9690938 [75,] 3.071261e-02 6.142523e-02 0.9692874 [76,] 4.525492e-02 9.050984e-02 0.9547451 [77,] 4.716109e-02 9.432217e-02 0.9528389 [78,] 4.016314e-02 8.032629e-02 0.9598369 [79,] 3.565664e-02 7.131329e-02 0.9643434 [80,] 3.228899e-02 6.457798e-02 0.9677110 [81,] 3.179685e-02 6.359370e-02 0.9682031 [82,] 2.515880e-02 5.031759e-02 0.9748412 [83,] 5.063098e-02 1.012620e-01 0.9493690 [84,] 3.737387e-02 7.474774e-02 0.9626261 [85,] 3.617994e-02 7.235989e-02 0.9638201 [86,] 2.920154e-02 5.840308e-02 0.9707985 [87,] 3.870858e-02 7.741715e-02 0.9612914 [88,] 3.768864e-02 7.537728e-02 0.9623114 [89,] 3.280467e-02 6.560935e-02 0.9671953 [90,] 3.801873e-02 7.603746e-02 0.9619813 [91,] 2.717949e-02 5.435898e-02 0.9728205 [92,] 2.219247e-02 4.438494e-02 0.9778075 [93,] 1.707263e-02 3.414526e-02 0.9829274 [94,] 1.712454e-02 3.424908e-02 0.9828755 [95,] 1.169268e-02 2.338535e-02 0.9883073 [96,] 7.664378e-03 1.532876e-02 0.9923356 [97,] 1.394443e-01 2.788885e-01 0.8605557 [98,] 1.857074e-01 3.714147e-01 0.8142926 [99,] 2.051171e-01 4.102342e-01 0.7948829 [100,] 1.934906e-01 3.869812e-01 0.8065094 [101,] 3.508547e-01 7.017094e-01 0.6491453 [102,] 2.850609e-01 5.701217e-01 0.7149391 [103,] 2.979832e-01 5.959664e-01 0.7020168 [104,] 2.283286e-01 4.566572e-01 0.7716714 [105,] 1.679736e-01 3.359473e-01 0.8320264 [106,] 1.730689e-01 3.461378e-01 0.8269311 [107,] 1.456988e-01 2.913976e-01 0.8543012 [108,] 1.199607e-01 2.399213e-01 0.8800393 [109,] 9.899360e-02 1.979872e-01 0.9010064 > postscript(file="/var/www/html/rcomp/tmp/1azqg1259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2s2in1259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3tffq1259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4kl181259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5bde41259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 120 Frequency = 1 1 2 3 4 5 6 24.1279933 -5.2796245 57.5368045 36.7843713 29.4461008 86.9002241 7 8 9 10 11 12 -6.5637871 -3.2875878 24.3822332 17.2679301 50.9517850 12.4808117 13 14 15 16 17 18 -18.0282918 -99.9083762 -123.7930464 15.0921846 -92.0271593 -34.8728578 19 20 21 22 23 24 -77.1668282 -28.6538062 -43.2761213 -34.7244841 -43.8085403 67.7117508 25 26 27 28 29 30 39.7705585 -33.1203118 -13.7723092 69.0189738 21.3504071 41.4825832 31 32 33 34 35 36 60.9872067 22.2704969 54.1233922 65.3403064 17.4430085 28.9402833 37 38 39 40 41 42 64.8392714 31.9804105 51.7995531 76.9022058 21.7178125 -39.0525468 43 44 45 46 47 48 97.2700522 17.8779539 92.7648294 54.7113958 -37.8662327 -53.7022748 49 50 51 52 53 54 145.2054187 26.5999005 46.4260354 43.5091475 18.5308748 20.0729350 55 56 57 58 59 60 -112.0840044 1.1373172 10.2480121 -12.8811473 -12.6196260 14.5267429 61 62 63 64 65 66 -63.4749625 -99.4111334 -33.9981114 160.5088693 11.4244267 -53.5182513 67 68 69 70 71 72 -158.0401305 -154.9501549 -71.6276546 -93.1716401 -321.4933796 -191.5060298 73 74 75 76 77 78 27.3646026 -62.0085197 64.5554382 1.1623395 -14.2997201 -4.9646522 79 80 81 82 83 84 27.6877771 -47.9818888 113.4936965 53.0571886 -27.9970866 44.8459246 85 86 87 88 89 90 6.8545391 40.2900728 -55.6933693 91.2854641 -32.0867866 -82.9346642 91 92 93 94 95 96 -45.4545234 -122.6606555 30.6673213 -19.4139226 18.0427361 -42.4146090 97 98 99 100 101 102 -17.8260697 -75.9722040 -117.3454058 -40.6528948 -67.3740313 -238.3403997 103 104 105 106 107 108 94.7107030 -97.6867238 -47.3934699 124.2496400 0.4447358 70.8737432 109 110 111 112 113 114 -27.2992009 -49.0323813 75.2757781 48.6784308 -51.8401209 -18.8897911 115 116 117 118 119 120 56.3222906 68.1661735 275.1219112 145.9655858 141.4584531 103.2063872 > postscript(file="/var/www/html/rcomp/tmp/6mmqy1259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 120 Frequency = 1 lag(myerror, k = 1) myerror 0 24.1279933 NA 1 -5.2796245 24.1279933 2 57.5368045 -5.2796245 3 36.7843713 57.5368045 4 29.4461008 36.7843713 5 86.9002241 29.4461008 6 -6.5637871 86.9002241 7 -3.2875878 -6.5637871 8 24.3822332 -3.2875878 9 17.2679301 24.3822332 10 50.9517850 17.2679301 11 12.4808117 50.9517850 12 -18.0282918 12.4808117 13 -99.9083762 -18.0282918 14 -123.7930464 -99.9083762 15 15.0921846 -123.7930464 16 -92.0271593 15.0921846 17 -34.8728578 -92.0271593 18 -77.1668282 -34.8728578 19 -28.6538062 -77.1668282 20 -43.2761213 -28.6538062 21 -34.7244841 -43.2761213 22 -43.8085403 -34.7244841 23 67.7117508 -43.8085403 24 39.7705585 67.7117508 25 -33.1203118 39.7705585 26 -13.7723092 -33.1203118 27 69.0189738 -13.7723092 28 21.3504071 69.0189738 29 41.4825832 21.3504071 30 60.9872067 41.4825832 31 22.2704969 60.9872067 32 54.1233922 22.2704969 33 65.3403064 54.1233922 34 17.4430085 65.3403064 35 28.9402833 17.4430085 36 64.8392714 28.9402833 37 31.9804105 64.8392714 38 51.7995531 31.9804105 39 76.9022058 51.7995531 40 21.7178125 76.9022058 41 -39.0525468 21.7178125 42 97.2700522 -39.0525468 43 17.8779539 97.2700522 44 92.7648294 17.8779539 45 54.7113958 92.7648294 46 -37.8662327 54.7113958 47 -53.7022748 -37.8662327 48 145.2054187 -53.7022748 49 26.5999005 145.2054187 50 46.4260354 26.5999005 51 43.5091475 46.4260354 52 18.5308748 43.5091475 53 20.0729350 18.5308748 54 -112.0840044 20.0729350 55 1.1373172 -112.0840044 56 10.2480121 1.1373172 57 -12.8811473 10.2480121 58 -12.6196260 -12.8811473 59 14.5267429 -12.6196260 60 -63.4749625 14.5267429 61 -99.4111334 -63.4749625 62 -33.9981114 -99.4111334 63 160.5088693 -33.9981114 64 11.4244267 160.5088693 65 -53.5182513 11.4244267 66 -158.0401305 -53.5182513 67 -154.9501549 -158.0401305 68 -71.6276546 -154.9501549 69 -93.1716401 -71.6276546 70 -321.4933796 -93.1716401 71 -191.5060298 -321.4933796 72 27.3646026 -191.5060298 73 -62.0085197 27.3646026 74 64.5554382 -62.0085197 75 1.1623395 64.5554382 76 -14.2997201 1.1623395 77 -4.9646522 -14.2997201 78 27.6877771 -4.9646522 79 -47.9818888 27.6877771 80 113.4936965 -47.9818888 81 53.0571886 113.4936965 82 -27.9970866 53.0571886 83 44.8459246 -27.9970866 84 6.8545391 44.8459246 85 40.2900728 6.8545391 86 -55.6933693 40.2900728 87 91.2854641 -55.6933693 88 -32.0867866 91.2854641 89 -82.9346642 -32.0867866 90 -45.4545234 -82.9346642 91 -122.6606555 -45.4545234 92 30.6673213 -122.6606555 93 -19.4139226 30.6673213 94 18.0427361 -19.4139226 95 -42.4146090 18.0427361 96 -17.8260697 -42.4146090 97 -75.9722040 -17.8260697 98 -117.3454058 -75.9722040 99 -40.6528948 -117.3454058 100 -67.3740313 -40.6528948 101 -238.3403997 -67.3740313 102 94.7107030 -238.3403997 103 -97.6867238 94.7107030 104 -47.3934699 -97.6867238 105 124.2496400 -47.3934699 106 0.4447358 124.2496400 107 70.8737432 0.4447358 108 -27.2992009 70.8737432 109 -49.0323813 -27.2992009 110 75.2757781 -49.0323813 111 48.6784308 75.2757781 112 -51.8401209 48.6784308 113 -18.8897911 -51.8401209 114 56.3222906 -18.8897911 115 68.1661735 56.3222906 116 275.1219112 68.1661735 117 145.9655858 275.1219112 118 141.4584531 145.9655858 119 103.2063872 141.4584531 120 NA 103.2063872 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -5.2796245 24.1279933 [2,] 57.5368045 -5.2796245 [3,] 36.7843713 57.5368045 [4,] 29.4461008 36.7843713 [5,] 86.9002241 29.4461008 [6,] -6.5637871 86.9002241 [7,] -3.2875878 -6.5637871 [8,] 24.3822332 -3.2875878 [9,] 17.2679301 24.3822332 [10,] 50.9517850 17.2679301 [11,] 12.4808117 50.9517850 [12,] -18.0282918 12.4808117 [13,] -99.9083762 -18.0282918 [14,] -123.7930464 -99.9083762 [15,] 15.0921846 -123.7930464 [16,] -92.0271593 15.0921846 [17,] -34.8728578 -92.0271593 [18,] -77.1668282 -34.8728578 [19,] -28.6538062 -77.1668282 [20,] -43.2761213 -28.6538062 [21,] -34.7244841 -43.2761213 [22,] -43.8085403 -34.7244841 [23,] 67.7117508 -43.8085403 [24,] 39.7705585 67.7117508 [25,] -33.1203118 39.7705585 [26,] -13.7723092 -33.1203118 [27,] 69.0189738 -13.7723092 [28,] 21.3504071 69.0189738 [29,] 41.4825832 21.3504071 [30,] 60.9872067 41.4825832 [31,] 22.2704969 60.9872067 [32,] 54.1233922 22.2704969 [33,] 65.3403064 54.1233922 [34,] 17.4430085 65.3403064 [35,] 28.9402833 17.4430085 [36,] 64.8392714 28.9402833 [37,] 31.9804105 64.8392714 [38,] 51.7995531 31.9804105 [39,] 76.9022058 51.7995531 [40,] 21.7178125 76.9022058 [41,] -39.0525468 21.7178125 [42,] 97.2700522 -39.0525468 [43,] 17.8779539 97.2700522 [44,] 92.7648294 17.8779539 [45,] 54.7113958 92.7648294 [46,] -37.8662327 54.7113958 [47,] -53.7022748 -37.8662327 [48,] 145.2054187 -53.7022748 [49,] 26.5999005 145.2054187 [50,] 46.4260354 26.5999005 [51,] 43.5091475 46.4260354 [52,] 18.5308748 43.5091475 [53,] 20.0729350 18.5308748 [54,] -112.0840044 20.0729350 [55,] 1.1373172 -112.0840044 [56,] 10.2480121 1.1373172 [57,] -12.8811473 10.2480121 [58,] -12.6196260 -12.8811473 [59,] 14.5267429 -12.6196260 [60,] -63.4749625 14.5267429 [61,] -99.4111334 -63.4749625 [62,] -33.9981114 -99.4111334 [63,] 160.5088693 -33.9981114 [64,] 11.4244267 160.5088693 [65,] -53.5182513 11.4244267 [66,] -158.0401305 -53.5182513 [67,] -154.9501549 -158.0401305 [68,] -71.6276546 -154.9501549 [69,] -93.1716401 -71.6276546 [70,] -321.4933796 -93.1716401 [71,] -191.5060298 -321.4933796 [72,] 27.3646026 -191.5060298 [73,] -62.0085197 27.3646026 [74,] 64.5554382 -62.0085197 [75,] 1.1623395 64.5554382 [76,] -14.2997201 1.1623395 [77,] -4.9646522 -14.2997201 [78,] 27.6877771 -4.9646522 [79,] -47.9818888 27.6877771 [80,] 113.4936965 -47.9818888 [81,] 53.0571886 113.4936965 [82,] -27.9970866 53.0571886 [83,] 44.8459246 -27.9970866 [84,] 6.8545391 44.8459246 [85,] 40.2900728 6.8545391 [86,] -55.6933693 40.2900728 [87,] 91.2854641 -55.6933693 [88,] -32.0867866 91.2854641 [89,] -82.9346642 -32.0867866 [90,] -45.4545234 -82.9346642 [91,] -122.6606555 -45.4545234 [92,] 30.6673213 -122.6606555 [93,] -19.4139226 30.6673213 [94,] 18.0427361 -19.4139226 [95,] -42.4146090 18.0427361 [96,] -17.8260697 -42.4146090 [97,] -75.9722040 -17.8260697 [98,] -117.3454058 -75.9722040 [99,] -40.6528948 -117.3454058 [100,] -67.3740313 -40.6528948 [101,] -238.3403997 -67.3740313 [102,] 94.7107030 -238.3403997 [103,] -97.6867238 94.7107030 [104,] -47.3934699 -97.6867238 [105,] 124.2496400 -47.3934699 [106,] 0.4447358 124.2496400 [107,] 70.8737432 0.4447358 [108,] -27.2992009 70.8737432 [109,] -49.0323813 -27.2992009 [110,] 75.2757781 -49.0323813 [111,] 48.6784308 75.2757781 [112,] -51.8401209 48.6784308 [113,] -18.8897911 -51.8401209 [114,] 56.3222906 -18.8897911 [115,] 68.1661735 56.3222906 [116,] 275.1219112 68.1661735 [117,] 145.9655858 275.1219112 [118,] 141.4584531 145.9655858 [119,] 103.2063872 141.4584531 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -5.2796245 24.1279933 2 57.5368045 -5.2796245 3 36.7843713 57.5368045 4 29.4461008 36.7843713 5 86.9002241 29.4461008 6 -6.5637871 86.9002241 7 -3.2875878 -6.5637871 8 24.3822332 -3.2875878 9 17.2679301 24.3822332 10 50.9517850 17.2679301 11 12.4808117 50.9517850 12 -18.0282918 12.4808117 13 -99.9083762 -18.0282918 14 -123.7930464 -99.9083762 15 15.0921846 -123.7930464 16 -92.0271593 15.0921846 17 -34.8728578 -92.0271593 18 -77.1668282 -34.8728578 19 -28.6538062 -77.1668282 20 -43.2761213 -28.6538062 21 -34.7244841 -43.2761213 22 -43.8085403 -34.7244841 23 67.7117508 -43.8085403 24 39.7705585 67.7117508 25 -33.1203118 39.7705585 26 -13.7723092 -33.1203118 27 69.0189738 -13.7723092 28 21.3504071 69.0189738 29 41.4825832 21.3504071 30 60.9872067 41.4825832 31 22.2704969 60.9872067 32 54.1233922 22.2704969 33 65.3403064 54.1233922 34 17.4430085 65.3403064 35 28.9402833 17.4430085 36 64.8392714 28.9402833 37 31.9804105 64.8392714 38 51.7995531 31.9804105 39 76.9022058 51.7995531 40 21.7178125 76.9022058 41 -39.0525468 21.7178125 42 97.2700522 -39.0525468 43 17.8779539 97.2700522 44 92.7648294 17.8779539 45 54.7113958 92.7648294 46 -37.8662327 54.7113958 47 -53.7022748 -37.8662327 48 145.2054187 -53.7022748 49 26.5999005 145.2054187 50 46.4260354 26.5999005 51 43.5091475 46.4260354 52 18.5308748 43.5091475 53 20.0729350 18.5308748 54 -112.0840044 20.0729350 55 1.1373172 -112.0840044 56 10.2480121 1.1373172 57 -12.8811473 10.2480121 58 -12.6196260 -12.8811473 59 14.5267429 -12.6196260 60 -63.4749625 14.5267429 61 -99.4111334 -63.4749625 62 -33.9981114 -99.4111334 63 160.5088693 -33.9981114 64 11.4244267 160.5088693 65 -53.5182513 11.4244267 66 -158.0401305 -53.5182513 67 -154.9501549 -158.0401305 68 -71.6276546 -154.9501549 69 -93.1716401 -71.6276546 70 -321.4933796 -93.1716401 71 -191.5060298 -321.4933796 72 27.3646026 -191.5060298 73 -62.0085197 27.3646026 74 64.5554382 -62.0085197 75 1.1623395 64.5554382 76 -14.2997201 1.1623395 77 -4.9646522 -14.2997201 78 27.6877771 -4.9646522 79 -47.9818888 27.6877771 80 113.4936965 -47.9818888 81 53.0571886 113.4936965 82 -27.9970866 53.0571886 83 44.8459246 -27.9970866 84 6.8545391 44.8459246 85 40.2900728 6.8545391 86 -55.6933693 40.2900728 87 91.2854641 -55.6933693 88 -32.0867866 91.2854641 89 -82.9346642 -32.0867866 90 -45.4545234 -82.9346642 91 -122.6606555 -45.4545234 92 30.6673213 -122.6606555 93 -19.4139226 30.6673213 94 18.0427361 -19.4139226 95 -42.4146090 18.0427361 96 -17.8260697 -42.4146090 97 -75.9722040 -17.8260697 98 -117.3454058 -75.9722040 99 -40.6528948 -117.3454058 100 -67.3740313 -40.6528948 101 -238.3403997 -67.3740313 102 94.7107030 -238.3403997 103 -97.6867238 94.7107030 104 -47.3934699 -97.6867238 105 124.2496400 -47.3934699 106 0.4447358 124.2496400 107 70.8737432 0.4447358 108 -27.2992009 70.8737432 109 -49.0323813 -27.2992009 110 75.2757781 -49.0323813 111 48.6784308 75.2757781 112 -51.8401209 48.6784308 113 -18.8897911 -51.8401209 114 56.3222906 -18.8897911 115 68.1661735 56.3222906 116 275.1219112 68.1661735 117 145.9655858 275.1219112 118 141.4584531 145.9655858 119 103.2063872 141.4584531 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/77wxl1259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8m8ny1259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9hfho1259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10xal11259329055.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/11spu71259329055.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/12zs2i1259329055.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/139q451259329055.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/14ikc11259329055.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/15cc461259329055.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/16vu701259329055.tab") + } > system("convert tmp/1azqg1259329055.ps tmp/1azqg1259329055.png") > system("convert tmp/2s2in1259329055.ps tmp/2s2in1259329055.png") > system("convert tmp/3tffq1259329055.ps tmp/3tffq1259329055.png") > system("convert tmp/4kl181259329055.ps tmp/4kl181259329055.png") > system("convert tmp/5bde41259329055.ps tmp/5bde41259329055.png") > system("convert tmp/6mmqy1259329055.ps tmp/6mmqy1259329055.png") > system("convert tmp/77wxl1259329055.ps tmp/77wxl1259329055.png") > system("convert tmp/8m8ny1259329055.ps tmp/8m8ny1259329055.png") > system("convert tmp/9hfho1259329055.ps tmp/9hfho1259329055.png") > system("convert tmp/10xal11259329055.ps tmp/10xal11259329055.png") > > > proc.time() user system elapsed 3.298 1.657 3.739