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(2529,314,2196,318,3202,320,2718,323,2728,325,2354,327,2697,330,2651,331,2067,332,2641,334,2539,334,2294,334,2712,339,2314,345,3092,346,2677,352,2813,355,2668,358,2939,361,2617,363,2231,364,2481,365,2421,366,2408,370,2560,371,2100,371,3315,372,2801,373,2403,373,3024,374,2507,375,2980,375,2211,376,2471,376,2594,377,2452,377,2232,378,2373,379,3127,380,2802,384,2641,389,2787,390,2619,391,2806,392,2193,393,2323,394,2529,394,2412,395,2262,396,2154,397,3230,398,2295,399,2715,400,2733,400,2317,401,2730,401,1913,406,2390,407,2484,423,1960,427),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 2529 314 1 0 0 0 0 0 0 0 0 0 0 1 2 2196 318 0 1 0 0 0 0 0 0 0 0 0 2 3 3202 320 0 0 1 0 0 0 0 0 0 0 0 3 4 2718 323 0 0 0 1 0 0 0 0 0 0 0 4 5 2728 325 0 0 0 0 1 0 0 0 0 0 0 5 6 2354 327 0 0 0 0 0 1 0 0 0 0 0 6 7 2697 330 0 0 0 0 0 0 1 0 0 0 0 7 8 2651 331 0 0 0 0 0 0 0 1 0 0 0 8 9 2067 332 0 0 0 0 0 0 0 0 1 0 0 9 10 2641 334 0 0 0 0 0 0 0 0 0 1 0 10 11 2539 334 0 0 0 0 0 0 0 0 0 0 1 11 12 2294 334 0 0 0 0 0 0 0 0 0 0 0 12 13 2712 339 1 0 0 0 0 0 0 0 0 0 0 13 14 2314 345 0 1 0 0 0 0 0 0 0 0 0 14 15 3092 346 0 0 1 0 0 0 0 0 0 0 0 15 16 2677 352 0 0 0 1 0 0 0 0 0 0 0 16 17 2813 355 0 0 0 0 1 0 0 0 0 0 0 17 18 2668 358 0 0 0 0 0 1 0 0 0 0 0 18 19 2939 361 0 0 0 0 0 0 1 0 0 0 0 19 20 2617 363 0 0 0 0 0 0 0 1 0 0 0 20 21 2231 364 0 0 0 0 0 0 0 0 1 0 0 21 22 2481 365 0 0 0 0 0 0 0 0 0 1 0 22 23 2421 366 0 0 0 0 0 0 0 0 0 0 1 23 24 2408 370 0 0 0 0 0 0 0 0 0 0 0 24 25 2560 371 1 0 0 0 0 0 0 0 0 0 0 25 26 2100 371 0 1 0 0 0 0 0 0 0 0 0 26 27 3315 372 0 0 1 0 0 0 0 0 0 0 0 27 28 2801 373 0 0 0 1 0 0 0 0 0 0 0 28 29 2403 373 0 0 0 0 1 0 0 0 0 0 0 29 30 3024 374 0 0 0 0 0 1 0 0 0 0 0 30 31 2507 375 0 0 0 0 0 0 1 0 0 0 0 31 32 2980 375 0 0 0 0 0 0 0 1 0 0 0 32 33 2211 376 0 0 0 0 0 0 0 0 1 0 0 33 34 2471 376 0 0 0 0 0 0 0 0 0 1 0 34 35 2594 377 0 0 0 0 0 0 0 0 0 0 1 35 36 2452 377 0 0 0 0 0 0 0 0 0 0 0 36 37 2232 378 1 0 0 0 0 0 0 0 0 0 0 37 38 2373 379 0 1 0 0 0 0 0 0 0 0 0 38 39 3127 380 0 0 1 0 0 0 0 0 0 0 0 39 40 2802 384 0 0 0 1 0 0 0 0 0 0 0 40 41 2641 389 0 0 0 0 1 0 0 0 0 0 0 41 42 2787 390 0 0 0 0 0 1 0 0 0 0 0 42 43 2619 391 0 0 0 0 0 0 1 0 0 0 0 43 44 2806 392 0 0 0 0 0 0 0 1 0 0 0 44 45 2193 393 0 0 0 0 0 0 0 0 1 0 0 45 46 2323 394 0 0 0 0 0 0 0 0 0 1 0 46 47 2529 394 0 0 0 0 0 0 0 0 0 0 1 47 48 2412 395 0 0 0 0 0 0 0 0 0 0 0 48 49 2262 396 1 0 0 0 0 0 0 0 0 0 0 49 50 2154 397 0 1 0 0 0 0 0 0 0 0 0 50 51 3230 398 0 0 1 0 0 0 0 0 0 0 0 51 52 2295 399 0 0 0 1 0 0 0 0 0 0 0 52 53 2715 400 0 0 0 0 1 0 0 0 0 0 0 53 54 2733 400 0 0 0 0 0 1 0 0 0 0 0 54 55 2317 401 0 0 0 0 0 0 1 0 0 0 0 55 56 2730 401 0 0 0 0 0 0 0 1 0 0 0 56 57 1913 406 0 0 0 0 0 0 0 0 1 0 0 57 58 2390 407 0 0 0 0 0 0 0 0 0 1 0 58 59 2484 423 0 0 0 0 0 0 0 0 0 0 1 59 60 1960 427 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 1219.032 3.608 141.869 -90.417 879.026 341.574 M5 M6 M7 M8 M9 M10 343.009 399.131 303.209 449.295 -183.027 159.538 M11 t 206.722 -7.972 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -396.1 -101.3 26.4 96.9 295.6 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1219.032 1238.875 0.984 0.330271 X 3.608 3.808 0.948 0.348313 M1 141.869 105.916 1.339 0.187007 M2 -90.417 105.360 -0.858 0.395247 M3 879.026 105.377 8.342 9.32e-11 *** M4 341.574 104.718 3.262 0.002089 ** M5 343.009 104.461 3.284 0.001963 ** M6 399.131 104.393 3.823 0.000394 *** M7 303.209 104.265 2.908 0.005582 ** M8 449.295 104.366 4.305 8.66e-05 *** M9 -183.027 104.251 -1.756 0.085807 . M10 159.538 104.368 1.529 0.133211 M11 206.722 103.986 1.988 0.052785 . t -7.972 6.056 -1.316 0.194557 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 164.4 on 46 degrees of freedom Multiple R-squared: 0.7833, Adjusted R-squared: 0.722 F-statistic: 12.79 on 13 and 46 DF, p-value: 3.255e-11 > 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.2071570 0.4143140 0.7928430 [2,] 0.2716578 0.5433156 0.7283422 [3,] 0.2050387 0.4100773 0.7949613 [4,] 0.2721013 0.5442027 0.7278987 [5,] 0.1722539 0.3445077 0.8277461 [6,] 0.2433788 0.4867576 0.7566212 [7,] 0.2892629 0.5785258 0.7107371 [8,] 0.2049077 0.4098154 0.7950923 [9,] 0.2075546 0.4151093 0.7924454 [10,] 0.2425059 0.4850118 0.7574941 [11,] 0.2266667 0.4533335 0.7733333 [12,] 0.1829881 0.3659762 0.8170119 [13,] 0.5626671 0.8746657 0.4373329 [14,] 0.8567526 0.2864949 0.1432474 [15,] 0.8766011 0.2467979 0.1233989 [16,] 0.8790614 0.2418772 0.1209386 [17,] 0.8173205 0.3653591 0.1826795 [18,] 0.7560670 0.4878659 0.2439330 [19,] 0.7070564 0.5858872 0.2929436 [20,] 0.6069214 0.7861572 0.3930786 [21,] 0.6649269 0.6701462 0.3350731 [22,] 0.5761963 0.8476073 0.4238037 [23,] 0.5884050 0.8231901 0.4115950 [24,] 0.7242148 0.5515704 0.2757852 [25,] 0.6753171 0.6493658 0.3246829 [26,] 0.5406772 0.9186456 0.4593228 [27,] 0.4838893 0.9677786 0.5161107 > postscript(file="/var/www/html/rcomp/tmp/1mz9d1258719864.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/2fr071258719864.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/3ue351258719864.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/4s5nn1258719864.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/5hwzo1258719864.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 = 60 Frequency = 1 1 2 3 4 5 6 43.182056 -63.990626 -26.676966 23.923034 33.244619 -396.120137 7 8 9 10 11 12 39.950352 -147.771233 -95.084892 137.107182 -4.104285 -34.410018 13 14 15 16 17 18 231.653591 52.265057 -134.813357 -26.037135 105.676524 -98.296158 19 20 21 22 23 24 265.774331 -201.555180 49.131161 -39.068839 -141.888232 45.374331 25 26 27 28 29 30 59.869644 -159.871334 90.050251 117.866103 -273.596459 295.646711 31 32 33 34 35 36 -121.066948 213.819392 81.505733 6.913659 87.094267 159.788533 37 38 39 40 41 42 -197.716154 179.934943 -31.143472 174.848602 2.346409 96.589580 43 44 45 46 47 48 28.875920 74.154335 97.840676 -110.359324 56.429209 150.515550 49 50 51 52 53 54 -136.989137 -8.338041 102.583545 -290.600604 132.328908 102.180004 55 56 57 58 59 60 -213.533655 61.352686 -133.392678 5.407322 2.469040 -321.268397 > postscript(file="/var/www/html/rcomp/tmp/6qniq1258719864.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 43.182056 NA 1 -63.990626 43.182056 2 -26.676966 -63.990626 3 23.923034 -26.676966 4 33.244619 23.923034 5 -396.120137 33.244619 6 39.950352 -396.120137 7 -147.771233 39.950352 8 -95.084892 -147.771233 9 137.107182 -95.084892 10 -4.104285 137.107182 11 -34.410018 -4.104285 12 231.653591 -34.410018 13 52.265057 231.653591 14 -134.813357 52.265057 15 -26.037135 -134.813357 16 105.676524 -26.037135 17 -98.296158 105.676524 18 265.774331 -98.296158 19 -201.555180 265.774331 20 49.131161 -201.555180 21 -39.068839 49.131161 22 -141.888232 -39.068839 23 45.374331 -141.888232 24 59.869644 45.374331 25 -159.871334 59.869644 26 90.050251 -159.871334 27 117.866103 90.050251 28 -273.596459 117.866103 29 295.646711 -273.596459 30 -121.066948 295.646711 31 213.819392 -121.066948 32 81.505733 213.819392 33 6.913659 81.505733 34 87.094267 6.913659 35 159.788533 87.094267 36 -197.716154 159.788533 37 179.934943 -197.716154 38 -31.143472 179.934943 39 174.848602 -31.143472 40 2.346409 174.848602 41 96.589580 2.346409 42 28.875920 96.589580 43 74.154335 28.875920 44 97.840676 74.154335 45 -110.359324 97.840676 46 56.429209 -110.359324 47 150.515550 56.429209 48 -136.989137 150.515550 49 -8.338041 -136.989137 50 102.583545 -8.338041 51 -290.600604 102.583545 52 132.328908 -290.600604 53 102.180004 132.328908 54 -213.533655 102.180004 55 61.352686 -213.533655 56 -133.392678 61.352686 57 5.407322 -133.392678 58 2.469040 5.407322 59 -321.268397 2.469040 60 NA -321.268397 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -63.990626 43.182056 [2,] -26.676966 -63.990626 [3,] 23.923034 -26.676966 [4,] 33.244619 23.923034 [5,] -396.120137 33.244619 [6,] 39.950352 -396.120137 [7,] -147.771233 39.950352 [8,] -95.084892 -147.771233 [9,] 137.107182 -95.084892 [10,] -4.104285 137.107182 [11,] -34.410018 -4.104285 [12,] 231.653591 -34.410018 [13,] 52.265057 231.653591 [14,] -134.813357 52.265057 [15,] -26.037135 -134.813357 [16,] 105.676524 -26.037135 [17,] -98.296158 105.676524 [18,] 265.774331 -98.296158 [19,] -201.555180 265.774331 [20,] 49.131161 -201.555180 [21,] -39.068839 49.131161 [22,] -141.888232 -39.068839 [23,] 45.374331 -141.888232 [24,] 59.869644 45.374331 [25,] -159.871334 59.869644 [26,] 90.050251 -159.871334 [27,] 117.866103 90.050251 [28,] -273.596459 117.866103 [29,] 295.646711 -273.596459 [30,] -121.066948 295.646711 [31,] 213.819392 -121.066948 [32,] 81.505733 213.819392 [33,] 6.913659 81.505733 [34,] 87.094267 6.913659 [35,] 159.788533 87.094267 [36,] -197.716154 159.788533 [37,] 179.934943 -197.716154 [38,] -31.143472 179.934943 [39,] 174.848602 -31.143472 [40,] 2.346409 174.848602 [41,] 96.589580 2.346409 [42,] 28.875920 96.589580 [43,] 74.154335 28.875920 [44,] 97.840676 74.154335 [45,] -110.359324 97.840676 [46,] 56.429209 -110.359324 [47,] 150.515550 56.429209 [48,] -136.989137 150.515550 [49,] -8.338041 -136.989137 [50,] 102.583545 -8.338041 [51,] -290.600604 102.583545 [52,] 132.328908 -290.600604 [53,] 102.180004 132.328908 [54,] -213.533655 102.180004 [55,] 61.352686 -213.533655 [56,] -133.392678 61.352686 [57,] 5.407322 -133.392678 [58,] 2.469040 5.407322 [59,] -321.268397 2.469040 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -63.990626 43.182056 2 -26.676966 -63.990626 3 23.923034 -26.676966 4 33.244619 23.923034 5 -396.120137 33.244619 6 39.950352 -396.120137 7 -147.771233 39.950352 8 -95.084892 -147.771233 9 137.107182 -95.084892 10 -4.104285 137.107182 11 -34.410018 -4.104285 12 231.653591 -34.410018 13 52.265057 231.653591 14 -134.813357 52.265057 15 -26.037135 -134.813357 16 105.676524 -26.037135 17 -98.296158 105.676524 18 265.774331 -98.296158 19 -201.555180 265.774331 20 49.131161 -201.555180 21 -39.068839 49.131161 22 -141.888232 -39.068839 23 45.374331 -141.888232 24 59.869644 45.374331 25 -159.871334 59.869644 26 90.050251 -159.871334 27 117.866103 90.050251 28 -273.596459 117.866103 29 295.646711 -273.596459 30 -121.066948 295.646711 31 213.819392 -121.066948 32 81.505733 213.819392 33 6.913659 81.505733 34 87.094267 6.913659 35 159.788533 87.094267 36 -197.716154 159.788533 37 179.934943 -197.716154 38 -31.143472 179.934943 39 174.848602 -31.143472 40 2.346409 174.848602 41 96.589580 2.346409 42 28.875920 96.589580 43 74.154335 28.875920 44 97.840676 74.154335 45 -110.359324 97.840676 46 56.429209 -110.359324 47 150.515550 56.429209 48 -136.989137 150.515550 49 -8.338041 -136.989137 50 102.583545 -8.338041 51 -290.600604 102.583545 52 132.328908 -290.600604 53 102.180004 132.328908 54 -213.533655 102.180004 55 61.352686 -213.533655 56 -133.392678 61.352686 57 5.407322 -133.392678 58 2.469040 5.407322 59 -321.268397 2.469040 > 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/7p1e01258719864.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/86hsq1258719864.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/9ypep1258719864.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/10hjwu1258719864.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/11mftj1258719864.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/12b99j1258719864.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/130d2h1258719864.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/14d0l11258719864.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/15r0n81258719864.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/16xjmc1258719864.tab") + } > system("convert tmp/1mz9d1258719864.ps tmp/1mz9d1258719864.png") > system("convert tmp/2fr071258719864.ps tmp/2fr071258719864.png") > system("convert tmp/3ue351258719864.ps tmp/3ue351258719864.png") > system("convert tmp/4s5nn1258719864.ps tmp/4s5nn1258719864.png") > system("convert tmp/5hwzo1258719864.ps tmp/5hwzo1258719864.png") > system("convert tmp/6qniq1258719864.ps tmp/6qniq1258719864.png") > system("convert tmp/7p1e01258719864.ps tmp/7p1e01258719864.png") > system("convert tmp/86hsq1258719864.ps tmp/86hsq1258719864.png") > system("convert tmp/9ypep1258719864.ps tmp/9ypep1258719864.png") > system("convert tmp/10hjwu1258719864.ps tmp/10hjwu1258719864.png") > > > proc.time() user system elapsed 2.371 1.574 3.325