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(593530.00,0,610943.00,0,612613.00,0,611324.00,0,594167.00,0,595454.00,0,590865.00,0,589379.00,0,584428.00,0,573100.00,0,567456.00,0,569028.00,0,620735.00,0,628884.00,0,628232.00,0,612117.00,0,595404.00,0,597141.00,0,593408.00,0,590072.00,0,579799.00,0,574205.00,0,572775.00,0,572942.00,0,619567.00,0,625809.00,0,619916.00,0,587625.00,0,565742.00,0,557274.00,0,560576.00,0,548854.00,0,531673.00,0,525919.00,0,511038.00,0,498662.00,0,555362.00,0,564591.00,0,541657.00,0,527070.00,0,509846.00,0,514258.00,0,516922.00,0,507561.00,0,492622.00,0,490243.00,0,469357.00,0,477580.00,0,528379.00,1,533590.00,1,517945.00,1,506174.00,1,501866.00,1,516141.00,1,528222.00,1,532638.00,1,536322.00,1,536535.00,1,523597.00,1,536214.00,1,586570.00,1,596594.00,1,580523.00,1),dim=c(2,63),dimnames=list(c('werklozen','crisis '),1:63)) > y <- array(NA,dim=c(2,63),dimnames=list(c('werklozen','crisis '),1:63)) > 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 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo 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 werklozen crisis\r M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 593530 0 1 0 0 0 0 0 0 0 0 0 0 1 2 610943 0 0 1 0 0 0 0 0 0 0 0 0 2 3 612613 0 0 0 1 0 0 0 0 0 0 0 0 3 4 611324 0 0 0 0 1 0 0 0 0 0 0 0 4 5 594167 0 0 0 0 0 1 0 0 0 0 0 0 5 6 595454 0 0 0 0 0 0 1 0 0 0 0 0 6 7 590865 0 0 0 0 0 0 0 1 0 0 0 0 7 8 589379 0 0 0 0 0 0 0 0 1 0 0 0 8 9 584428 0 0 0 0 0 0 0 0 0 1 0 0 9 10 573100 0 0 0 0 0 0 0 0 0 0 1 0 10 11 567456 0 0 0 0 0 0 0 0 0 0 0 1 11 12 569028 0 0 0 0 0 0 0 0 0 0 0 0 12 13 620735 0 1 0 0 0 0 0 0 0 0 0 0 13 14 628884 0 0 1 0 0 0 0 0 0 0 0 0 14 15 628232 0 0 0 1 0 0 0 0 0 0 0 0 15 16 612117 0 0 0 0 1 0 0 0 0 0 0 0 16 17 595404 0 0 0 0 0 1 0 0 0 0 0 0 17 18 597141 0 0 0 0 0 0 1 0 0 0 0 0 18 19 593408 0 0 0 0 0 0 0 1 0 0 0 0 19 20 590072 0 0 0 0 0 0 0 0 1 0 0 0 20 21 579799 0 0 0 0 0 0 0 0 0 1 0 0 21 22 574205 0 0 0 0 0 0 0 0 0 0 1 0 22 23 572775 0 0 0 0 0 0 0 0 0 0 0 1 23 24 572942 0 0 0 0 0 0 0 0 0 0 0 0 24 25 619567 0 1 0 0 0 0 0 0 0 0 0 0 25 26 625809 0 0 1 0 0 0 0 0 0 0 0 0 26 27 619916 0 0 0 1 0 0 0 0 0 0 0 0 27 28 587625 0 0 0 0 1 0 0 0 0 0 0 0 28 29 565742 0 0 0 0 0 1 0 0 0 0 0 0 29 30 557274 0 0 0 0 0 0 1 0 0 0 0 0 30 31 560576 0 0 0 0 0 0 0 1 0 0 0 0 31 32 548854 0 0 0 0 0 0 0 0 1 0 0 0 32 33 531673 0 0 0 0 0 0 0 0 0 1 0 0 33 34 525919 0 0 0 0 0 0 0 0 0 0 1 0 34 35 511038 0 0 0 0 0 0 0 0 0 0 0 1 35 36 498662 0 0 0 0 0 0 0 0 0 0 0 0 36 37 555362 0 1 0 0 0 0 0 0 0 0 0 0 37 38 564591 0 0 1 0 0 0 0 0 0 0 0 0 38 39 541657 0 0 0 1 0 0 0 0 0 0 0 0 39 40 527070 0 0 0 0 1 0 0 0 0 0 0 0 40 41 509846 0 0 0 0 0 1 0 0 0 0 0 0 41 42 514258 0 0 0 0 0 0 1 0 0 0 0 0 42 43 516922 0 0 0 0 0 0 0 1 0 0 0 0 43 44 507561 0 0 0 0 0 0 0 0 1 0 0 0 44 45 492622 0 0 0 0 0 0 0 0 0 1 0 0 45 46 490243 0 0 0 0 0 0 0 0 0 0 1 0 46 47 469357 0 0 0 0 0 0 0 0 0 0 0 1 47 48 477580 0 0 0 0 0 0 0 0 0 0 0 0 48 49 528379 1 1 0 0 0 0 0 0 0 0 0 0 49 50 533590 1 0 1 0 0 0 0 0 0 0 0 0 50 51 517945 1 0 0 1 0 0 0 0 0 0 0 0 51 52 506174 1 0 0 0 1 0 0 0 0 0 0 0 52 53 501866 1 0 0 0 0 1 0 0 0 0 0 0 53 54 516141 1 0 0 0 0 0 1 0 0 0 0 0 54 55 528222 1 0 0 0 0 0 0 1 0 0 0 0 55 56 532638 1 0 0 0 0 0 0 0 1 0 0 0 56 57 536322 1 0 0 0 0 0 0 0 0 1 0 0 57 58 536535 1 0 0 0 0 0 0 0 0 0 1 0 58 59 523597 1 0 0 0 0 0 0 0 0 0 0 1 59 60 536214 1 0 0 0 0 0 0 0 0 0 0 0 60 61 586570 1 1 0 0 0 0 0 0 0 0 0 0 61 62 596594 1 0 1 0 0 0 0 0 0 0 0 0 62 63 580523 1 0 0 1 0 0 0 0 0 0 0 0 63 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `crisis\r` M1 M2 M3 M4 598258 30273 38904 50322 42440 21660 M5 M6 M7 M8 M9 M10 8242 12930 16915 14657 7965 5036 M11 t -4080 -2040 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -49004 -14104 -3497 18260 44200 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 598258.3 14112.3 42.393 < 2e-16 *** `crisis\r` 30272.7 11633.4 2.602 0.01222 * M1 38904.0 15804.7 2.462 0.01740 * M2 50321.7 15763.6 3.192 0.00247 ** M3 42440.5 15727.0 2.699 0.00953 ** M4 21659.6 16405.2 1.320 0.19287 M5 8242.2 16371.4 0.503 0.61690 M6 12930.5 16342.0 0.791 0.43262 M7 16915.1 16317.2 1.037 0.30499 M8 14657.0 16296.8 0.899 0.37285 M9 7964.6 16280.9 0.489 0.62688 M10 5035.9 16269.6 0.310 0.75823 M11 -4080.3 16262.7 -0.251 0.80294 t -2039.7 271.8 -7.505 1.1e-09 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 25710 on 49 degrees of freedom Multiple R-squared: 0.7059, Adjusted R-squared: 0.6279 F-statistic: 9.047 on 13 and 49 DF, p-value: 4.584e-09 > 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,] 5.079638e-02 1.015928e-01 0.9492036163 [2,] 1.905479e-02 3.810957e-02 0.9809452150 [3,] 6.160481e-03 1.232096e-02 0.9938395189 [4,] 2.020040e-03 4.040080e-03 0.9979799599 [5,] 8.919403e-04 1.783881e-03 0.9991080597 [6,] 2.463340e-04 4.926680e-04 0.9997536660 [7,] 6.014135e-05 1.202827e-04 0.9999398586 [8,] 1.431005e-05 2.862010e-05 0.9999856899 [9,] 3.757603e-06 7.515205e-06 0.9999962424 [10,] 1.046913e-06 2.093826e-06 0.9999989531 [11,] 7.487340e-07 1.497468e-06 0.9999992513 [12,] 4.343825e-05 8.687649e-05 0.9999565618 [13,] 4.947963e-04 9.895926e-04 0.9995052037 [14,] 3.741144e-03 7.482287e-03 0.9962588563 [15,] 7.554133e-03 1.510827e-02 0.9924458666 [16,] 1.876253e-02 3.752505e-02 0.9812374737 [17,] 4.592697e-02 9.185395e-02 0.9540730258 [18,] 7.579423e-02 1.515885e-01 0.9242057660 [19,] 1.850012e-01 3.700023e-01 0.8149988454 [20,] 3.360415e-01 6.720830e-01 0.6639584902 [21,] 3.708987e-01 7.417975e-01 0.6291012684 [22,] 4.683191e-01 9.366381e-01 0.5316809350 [23,] 6.689695e-01 6.620611e-01 0.3310305269 [24,] 8.370165e-01 3.259669e-01 0.1629834708 [25,] 9.226925e-01 1.546151e-01 0.0773075472 [26,] 9.683354e-01 6.332925e-02 0.0316646230 [27,] 9.929195e-01 1.416093e-02 0.0070804649 [28,] 9.993344e-01 1.331142e-03 0.0006655709 [29,] 9.987256e-01 2.548833e-03 0.0012744164 [30,] 9.988595e-01 2.280922e-03 0.0011404612 > postscript(file="/var/www/html/rcomp/tmp/1eoa21258646990.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/2yamw1258646990.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/3ukdt1258646990.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/414jw1258646990.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/5ay9h1258646990.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 = 63 Frequency = 1 1 2 3 4 5 6 -41592.6291 -33557.6291 -21966.7957 -435.2145 -2135.2145 -3496.8145 7 8 9 10 11 12 -10030.8145 -7219.0145 -3438.0145 -9797.6145 -4285.8145 -4754.4145 13 14 15 16 17 18 10088.2451 8859.2451 18128.0784 24833.6596 23577.6596 22666.0596 19 20 21 22 23 24 16988.0596 17949.8596 16408.8596 15783.2596 25509.0596 23635.4596 25 26 27 28 29 30 33396.1192 30260.1192 34287.9525 24817.5338 18391.5338 7274.9338 31 32 33 34 35 36 8631.9338 1207.7338 -7241.2662 -8026.8662 -11752.0662 -26168.6662 37 38 39 40 41 42 -6333.0067 -6482.0067 -19495.1733 -11261.5921 -13028.5921 -11265.1921 43 44 45 46 47 48 -10546.1921 -15609.3921 -21816.3921 -19226.9921 -28957.1921 -22774.7921 49 50 51 52 53 54 -39112.8013 -43279.8013 -49003.9680 -37954.3868 -26805.3868 -15178.9868 55 56 57 58 59 60 -5042.9868 3670.8132 16086.8132 21268.2132 19486.0132 30062.4132 61 62 63 43554.0728 44200.0728 38049.9061 > postscript(file="/var/www/html/rcomp/tmp/6qtdb1258646990.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 = 63 Frequency = 1 lag(myerror, k = 1) myerror 0 -41592.6291 NA 1 -33557.6291 -41592.6291 2 -21966.7957 -33557.6291 3 -435.2145 -21966.7957 4 -2135.2145 -435.2145 5 -3496.8145 -2135.2145 6 -10030.8145 -3496.8145 7 -7219.0145 -10030.8145 8 -3438.0145 -7219.0145 9 -9797.6145 -3438.0145 10 -4285.8145 -9797.6145 11 -4754.4145 -4285.8145 12 10088.2451 -4754.4145 13 8859.2451 10088.2451 14 18128.0784 8859.2451 15 24833.6596 18128.0784 16 23577.6596 24833.6596 17 22666.0596 23577.6596 18 16988.0596 22666.0596 19 17949.8596 16988.0596 20 16408.8596 17949.8596 21 15783.2596 16408.8596 22 25509.0596 15783.2596 23 23635.4596 25509.0596 24 33396.1192 23635.4596 25 30260.1192 33396.1192 26 34287.9525 30260.1192 27 24817.5338 34287.9525 28 18391.5338 24817.5338 29 7274.9338 18391.5338 30 8631.9338 7274.9338 31 1207.7338 8631.9338 32 -7241.2662 1207.7338 33 -8026.8662 -7241.2662 34 -11752.0662 -8026.8662 35 -26168.6662 -11752.0662 36 -6333.0067 -26168.6662 37 -6482.0067 -6333.0067 38 -19495.1733 -6482.0067 39 -11261.5921 -19495.1733 40 -13028.5921 -11261.5921 41 -11265.1921 -13028.5921 42 -10546.1921 -11265.1921 43 -15609.3921 -10546.1921 44 -21816.3921 -15609.3921 45 -19226.9921 -21816.3921 46 -28957.1921 -19226.9921 47 -22774.7921 -28957.1921 48 -39112.8013 -22774.7921 49 -43279.8013 -39112.8013 50 -49003.9680 -43279.8013 51 -37954.3868 -49003.9680 52 -26805.3868 -37954.3868 53 -15178.9868 -26805.3868 54 -5042.9868 -15178.9868 55 3670.8132 -5042.9868 56 16086.8132 3670.8132 57 21268.2132 16086.8132 58 19486.0132 21268.2132 59 30062.4132 19486.0132 60 43554.0728 30062.4132 61 44200.0728 43554.0728 62 38049.9061 44200.0728 63 NA 38049.9061 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -33557.6291 -41592.6291 [2,] -21966.7957 -33557.6291 [3,] -435.2145 -21966.7957 [4,] -2135.2145 -435.2145 [5,] -3496.8145 -2135.2145 [6,] -10030.8145 -3496.8145 [7,] -7219.0145 -10030.8145 [8,] -3438.0145 -7219.0145 [9,] -9797.6145 -3438.0145 [10,] -4285.8145 -9797.6145 [11,] -4754.4145 -4285.8145 [12,] 10088.2451 -4754.4145 [13,] 8859.2451 10088.2451 [14,] 18128.0784 8859.2451 [15,] 24833.6596 18128.0784 [16,] 23577.6596 24833.6596 [17,] 22666.0596 23577.6596 [18,] 16988.0596 22666.0596 [19,] 17949.8596 16988.0596 [20,] 16408.8596 17949.8596 [21,] 15783.2596 16408.8596 [22,] 25509.0596 15783.2596 [23,] 23635.4596 25509.0596 [24,] 33396.1192 23635.4596 [25,] 30260.1192 33396.1192 [26,] 34287.9525 30260.1192 [27,] 24817.5338 34287.9525 [28,] 18391.5338 24817.5338 [29,] 7274.9338 18391.5338 [30,] 8631.9338 7274.9338 [31,] 1207.7338 8631.9338 [32,] -7241.2662 1207.7338 [33,] -8026.8662 -7241.2662 [34,] -11752.0662 -8026.8662 [35,] -26168.6662 -11752.0662 [36,] -6333.0067 -26168.6662 [37,] -6482.0067 -6333.0067 [38,] -19495.1733 -6482.0067 [39,] -11261.5921 -19495.1733 [40,] -13028.5921 -11261.5921 [41,] -11265.1921 -13028.5921 [42,] -10546.1921 -11265.1921 [43,] -15609.3921 -10546.1921 [44,] -21816.3921 -15609.3921 [45,] -19226.9921 -21816.3921 [46,] -28957.1921 -19226.9921 [47,] -22774.7921 -28957.1921 [48,] -39112.8013 -22774.7921 [49,] -43279.8013 -39112.8013 [50,] -49003.9680 -43279.8013 [51,] -37954.3868 -49003.9680 [52,] -26805.3868 -37954.3868 [53,] -15178.9868 -26805.3868 [54,] -5042.9868 -15178.9868 [55,] 3670.8132 -5042.9868 [56,] 16086.8132 3670.8132 [57,] 21268.2132 16086.8132 [58,] 19486.0132 21268.2132 [59,] 30062.4132 19486.0132 [60,] 43554.0728 30062.4132 [61,] 44200.0728 43554.0728 [62,] 38049.9061 44200.0728 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -33557.6291 -41592.6291 2 -21966.7957 -33557.6291 3 -435.2145 -21966.7957 4 -2135.2145 -435.2145 5 -3496.8145 -2135.2145 6 -10030.8145 -3496.8145 7 -7219.0145 -10030.8145 8 -3438.0145 -7219.0145 9 -9797.6145 -3438.0145 10 -4285.8145 -9797.6145 11 -4754.4145 -4285.8145 12 10088.2451 -4754.4145 13 8859.2451 10088.2451 14 18128.0784 8859.2451 15 24833.6596 18128.0784 16 23577.6596 24833.6596 17 22666.0596 23577.6596 18 16988.0596 22666.0596 19 17949.8596 16988.0596 20 16408.8596 17949.8596 21 15783.2596 16408.8596 22 25509.0596 15783.2596 23 23635.4596 25509.0596 24 33396.1192 23635.4596 25 30260.1192 33396.1192 26 34287.9525 30260.1192 27 24817.5338 34287.9525 28 18391.5338 24817.5338 29 7274.9338 18391.5338 30 8631.9338 7274.9338 31 1207.7338 8631.9338 32 -7241.2662 1207.7338 33 -8026.8662 -7241.2662 34 -11752.0662 -8026.8662 35 -26168.6662 -11752.0662 36 -6333.0067 -26168.6662 37 -6482.0067 -6333.0067 38 -19495.1733 -6482.0067 39 -11261.5921 -19495.1733 40 -13028.5921 -11261.5921 41 -11265.1921 -13028.5921 42 -10546.1921 -11265.1921 43 -15609.3921 -10546.1921 44 -21816.3921 -15609.3921 45 -19226.9921 -21816.3921 46 -28957.1921 -19226.9921 47 -22774.7921 -28957.1921 48 -39112.8013 -22774.7921 49 -43279.8013 -39112.8013 50 -49003.9680 -43279.8013 51 -37954.3868 -49003.9680 52 -26805.3868 -37954.3868 53 -15178.9868 -26805.3868 54 -5042.9868 -15178.9868 55 3670.8132 -5042.9868 56 16086.8132 3670.8132 57 21268.2132 16086.8132 58 19486.0132 21268.2132 59 30062.4132 19486.0132 60 43554.0728 30062.4132 61 44200.0728 43554.0728 62 38049.9061 44200.0728 > 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/77qdn1258646990.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/8nczj1258646990.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/90n701258646990.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/10gh801258646990.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/11p6e81258646990.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/12ik3b1258646990.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/13n21z1258646990.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/14mgcy1258646990.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/153xpi1258646990.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/16adm71258646990.tab") + } > > system("convert tmp/1eoa21258646990.ps tmp/1eoa21258646990.png") > system("convert tmp/2yamw1258646990.ps tmp/2yamw1258646990.png") > system("convert tmp/3ukdt1258646990.ps tmp/3ukdt1258646990.png") > system("convert tmp/414jw1258646990.ps tmp/414jw1258646990.png") > system("convert tmp/5ay9h1258646990.ps tmp/5ay9h1258646990.png") > system("convert tmp/6qtdb1258646990.ps tmp/6qtdb1258646990.png") > system("convert tmp/77qdn1258646990.ps tmp/77qdn1258646990.png") > system("convert tmp/8nczj1258646990.ps tmp/8nczj1258646990.png") > system("convert tmp/90n701258646990.ps tmp/90n701258646990.png") > system("convert tmp/10gh801258646990.ps tmp/10gh801258646990.png") > > > proc.time() user system elapsed 2.468 1.608 5.897