R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(493,0,481,0,462,0,457,0,442,0,439,0,488,0,521,0,501,0,485,0,464,0,460,0,467,0,460,0,448,0,443,0,436,0,431,0,484,0,510,0,513,0,503,0,471,0,471,0,476,0,475,0,470,0,461,0,455,0,456,0,517,0,525,0,523,0,519,0,509,0,512,0,519,0,517,0,510,0,509,0,501,0,507,0,569,0,580,0,578,0,565,0,547,0,555,0,562,0,561,0,555,0,544,0,537,0,543,0,594,0,611,0,613,0,611,0,594,0,595,0,591,0,589,0,584,0,573,0,567,0,569,0,621,0,629,0,628,0,612,0,595,0,597,0,593,0,590,0,580,0,574,0,573,0,573,0,620,0,626,0,620,0,588,0,566,0,557,0,561,0,549,0,532,0,526,0,511,0,499,0,555,1,565,1,542,1,527,1,510,1,514,1,517,1,508,1,493,1,490,1,469,1,478,1,528,1,534,1,518,1,506,1,502,1),dim=c(2,107),dimnames=list(c('Werkloosheid','Wel(1)_geen(0)_financiële_crisis'),1:107)) > y <- array(NA,dim=c(2,107),dimnames=list(c('Werkloosheid','Wel(1)_geen(0)_financiële_crisis'),1:107)) > 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) > 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 Werkloosheid Wel(1)_geen(0)_financi\353le_crisis M1 M2 M3 M4 M5 M6 M7 M8 M9 1 493 0 1 0 0 0 0 0 0 0 0 2 481 0 0 1 0 0 0 0 0 0 0 3 462 0 0 0 1 0 0 0 0 0 0 4 457 0 0 0 0 1 0 0 0 0 0 5 442 0 0 0 0 0 1 0 0 0 0 6 439 0 0 0 0 0 0 1 0 0 0 7 488 0 0 0 0 0 0 0 1 0 0 8 521 0 0 0 0 0 0 0 0 1 0 9 501 0 0 0 0 0 0 0 0 0 1 10 485 0 0 0 0 0 0 0 0 0 0 11 464 0 0 0 0 0 0 0 0 0 0 12 460 0 0 0 0 0 0 0 0 0 0 13 467 0 1 0 0 0 0 0 0 0 0 14 460 0 0 1 0 0 0 0 0 0 0 15 448 0 0 0 1 0 0 0 0 0 0 16 443 0 0 0 0 1 0 0 0 0 0 17 436 0 0 0 0 0 1 0 0 0 0 18 431 0 0 0 0 0 0 1 0 0 0 19 484 0 0 0 0 0 0 0 1 0 0 20 510 0 0 0 0 0 0 0 0 1 0 21 513 0 0 0 0 0 0 0 0 0 1 22 503 0 0 0 0 0 0 0 0 0 0 23 471 0 0 0 0 0 0 0 0 0 0 24 471 0 0 0 0 0 0 0 0 0 0 25 476 0 1 0 0 0 0 0 0 0 0 26 475 0 0 1 0 0 0 0 0 0 0 27 470 0 0 0 1 0 0 0 0 0 0 28 461 0 0 0 0 1 0 0 0 0 0 29 455 0 0 0 0 0 1 0 0 0 0 30 456 0 0 0 0 0 0 1 0 0 0 31 517 0 0 0 0 0 0 0 1 0 0 32 525 0 0 0 0 0 0 0 0 1 0 33 523 0 0 0 0 0 0 0 0 0 1 34 519 0 0 0 0 0 0 0 0 0 0 35 509 0 0 0 0 0 0 0 0 0 0 36 512 0 0 0 0 0 0 0 0 0 0 37 519 0 1 0 0 0 0 0 0 0 0 38 517 0 0 1 0 0 0 0 0 0 0 39 510 0 0 0 1 0 0 0 0 0 0 40 509 0 0 0 0 1 0 0 0 0 0 41 501 0 0 0 0 0 1 0 0 0 0 42 507 0 0 0 0 0 0 1 0 0 0 43 569 0 0 0 0 0 0 0 1 0 0 44 580 0 0 0 0 0 0 0 0 1 0 45 578 0 0 0 0 0 0 0 0 0 1 46 565 0 0 0 0 0 0 0 0 0 0 47 547 0 0 0 0 0 0 0 0 0 0 48 555 0 0 0 0 0 0 0 0 0 0 49 562 0 1 0 0 0 0 0 0 0 0 50 561 0 0 1 0 0 0 0 0 0 0 51 555 0 0 0 1 0 0 0 0 0 0 52 544 0 0 0 0 1 0 0 0 0 0 53 537 0 0 0 0 0 1 0 0 0 0 54 543 0 0 0 0 0 0 1 0 0 0 55 594 0 0 0 0 0 0 0 1 0 0 56 611 0 0 0 0 0 0 0 0 1 0 57 613 0 0 0 0 0 0 0 0 0 1 58 611 0 0 0 0 0 0 0 0 0 0 59 594 0 0 0 0 0 0 0 0 0 0 60 595 0 0 0 0 0 0 0 0 0 0 61 591 0 1 0 0 0 0 0 0 0 0 62 589 0 0 1 0 0 0 0 0 0 0 63 584 0 0 0 1 0 0 0 0 0 0 64 573 0 0 0 0 1 0 0 0 0 0 65 567 0 0 0 0 0 1 0 0 0 0 66 569 0 0 0 0 0 0 1 0 0 0 67 621 0 0 0 0 0 0 0 1 0 0 68 629 0 0 0 0 0 0 0 0 1 0 69 628 0 0 0 0 0 0 0 0 0 1 70 612 0 0 0 0 0 0 0 0 0 0 71 595 0 0 0 0 0 0 0 0 0 0 72 597 0 0 0 0 0 0 0 0 0 0 73 593 0 1 0 0 0 0 0 0 0 0 74 590 0 0 1 0 0 0 0 0 0 0 75 580 0 0 0 1 0 0 0 0 0 0 76 574 0 0 0 0 1 0 0 0 0 0 77 573 0 0 0 0 0 1 0 0 0 0 78 573 0 0 0 0 0 0 1 0 0 0 79 620 0 0 0 0 0 0 0 1 0 0 80 626 0 0 0 0 0 0 0 0 1 0 81 620 0 0 0 0 0 0 0 0 0 1 82 588 0 0 0 0 0 0 0 0 0 0 83 566 0 0 0 0 0 0 0 0 0 0 84 557 0 0 0 0 0 0 0 0 0 0 85 561 0 1 0 0 0 0 0 0 0 0 86 549 0 0 1 0 0 0 0 0 0 0 87 532 0 0 0 1 0 0 0 0 0 0 88 526 0 0 0 0 1 0 0 0 0 0 89 511 0 0 0 0 0 1 0 0 0 0 90 499 0 0 0 0 0 0 1 0 0 0 91 555 1 0 0 0 0 0 0 1 0 0 92 565 1 0 0 0 0 0 0 0 1 0 93 542 1 0 0 0 0 0 0 0 0 1 94 527 1 0 0 0 0 0 0 0 0 0 95 510 1 0 0 0 0 0 0 0 0 0 96 514 1 0 0 0 0 0 0 0 0 0 97 517 1 1 0 0 0 0 0 0 0 0 98 508 1 0 1 0 0 0 0 0 0 0 99 493 1 0 0 1 0 0 0 0 0 0 100 490 1 0 0 0 1 0 0 0 0 0 101 469 1 0 0 0 0 1 0 0 0 0 102 478 1 0 0 0 0 0 1 0 0 0 103 528 1 0 0 0 0 0 0 1 0 0 104 534 1 0 0 0 0 0 0 0 1 0 105 518 1 0 0 0 0 0 0 0 0 1 106 506 1 0 0 0 0 0 0 0 0 0 107 502 1 0 0 0 0 0 0 0 0 0 M10 M11 t 1 0 0 1 2 0 0 2 3 0 0 3 4 0 0 4 5 0 0 5 6 0 0 6 7 0 0 7 8 0 0 8 9 0 0 9 10 1 0 10 11 0 1 11 12 0 0 12 13 0 0 13 14 0 0 14 15 0 0 15 16 0 0 16 17 0 0 17 18 0 0 18 19 0 0 19 20 0 0 20 21 0 0 21 22 1 0 22 23 0 1 23 24 0 0 24 25 0 0 25 26 0 0 26 27 0 0 27 28 0 0 28 29 0 0 29 30 0 0 30 31 0 0 31 32 0 0 32 33 0 0 33 34 1 0 34 35 0 1 35 36 0 0 36 37 0 0 37 38 0 0 38 39 0 0 39 40 0 0 40 41 0 0 41 42 0 0 42 43 0 0 43 44 0 0 44 45 0 0 45 46 1 0 46 47 0 1 47 48 0 0 48 49 0 0 49 50 0 0 50 51 0 0 51 52 0 0 52 53 0 0 53 54 0 0 54 55 0 0 55 56 0 0 56 57 0 0 57 58 1 0 58 59 0 1 59 60 0 0 60 61 0 0 61 62 0 0 62 63 0 0 63 64 0 0 64 65 0 0 65 66 0 0 66 67 0 0 67 68 0 0 68 69 0 0 69 70 1 0 70 71 0 1 71 72 0 0 72 73 0 0 73 74 0 0 74 75 0 0 75 76 0 0 76 77 0 0 77 78 0 0 78 79 0 0 79 80 0 0 80 81 0 0 81 82 1 0 82 83 0 1 83 84 0 0 84 85 0 0 85 86 0 0 86 87 0 0 87 88 0 0 88 89 0 0 89 90 0 0 90 91 0 0 91 92 0 0 92 93 0 0 93 94 1 0 94 95 0 1 95 96 0 0 96 97 0 0 97 98 0 0 98 99 0 0 99 100 0 0 100 101 0 0 101 102 0 0 102 103 0 0 103 104 0 0 104 105 0 0 105 106 1 0 106 107 0 1 107 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Wel(1)_geen(0)_financi\353le_crisis` 457.194 -115.179 M1 M2 5.093 -2.015 M3 M4 -14.345 -22.342 M5 M6 -33.561 -34.780 M7 M8 29.798 42.024 M9 M10 33.138 18.141 M11 t -1.078 1.663 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -73.127 -17.460 4.978 18.415 39.738 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 457.1943 10.4072 43.931 < 2e-16 *** `Wel(1)_geen(0)_financi\353le_crisis` -115.1788 8.8862 -12.961 < 2e-16 *** M1 5.0927 12.5389 0.406 0.68556 M2 -2.0152 12.5357 -0.161 0.87263 M3 -14.3454 12.5333 -1.145 0.25532 M4 -22.3422 12.5317 -1.783 0.07787 . M5 -33.5612 12.5311 -2.678 0.00875 ** M6 -34.7803 12.5313 -2.775 0.00666 ** M7 29.7983 12.5563 2.373 0.01969 * M8 42.0238 12.5531 3.348 0.00118 ** M9 33.1380 12.5507 2.640 0.00971 ** M10 18.1412 12.5492 1.446 0.15165 M11 -1.0778 12.5486 -0.086 0.93174 t 1.6635 0.1045 15.915 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 25.79 on 93 degrees of freedom Multiple R-squared: 0.787, Adjusted R-squared: 0.7572 F-statistic: 26.43 on 13 and 93 DF, p-value: < 2.2e-16 > postscript(file="/var/www/html/rcomp/tmp/123uh1228653833.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/2chhh1228653833.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/39qaa1228653833.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/4d5ui1228653833.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/52dib1228653833.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 107 Frequency = 1 1 2 3 4 5 6 29.0495038 22.4939483 14.1606149 15.4939483 10.0495038 6.6050594 7 8 9 10 11 12 -10.6370283 8.4740828 -4.3036949 -6.9703616 -10.4148060 -17.1560949 13 14 15 16 17 18 -16.9122829 -18.4678385 -19.8011718 -18.4678385 -15.9122829 -21.3567274 19 20 21 22 23 24 -34.5988150 -22.4877039 -12.2654817 -8.9321484 -23.3765928 -26.1178817 25 26 27 28 29 30 -27.8740697 -23.4296252 -17.7629586 -20.4296252 -16.8740697 -16.3185141 31 32 33 34 35 36 -21.5606018 -27.4494907 -22.2272685 -12.8939351 -5.3383796 -5.0796685 37 38 39 40 41 42 -4.8358565 -1.3914120 2.2752547 7.6085880 9.1641435 14.7196991 43 44 45 46 47 48 10.4776114 7.5887226 12.8109448 13.1442781 12.6998337 17.9585448 49 50 51 52 53 54 18.2023568 22.6468012 27.3134679 22.6468012 25.2023568 30.7579123 55 56 57 58 59 60 15.5158247 18.6269358 27.8491580 39.1824914 39.7380469 37.9967580 61 62 63 64 65 66 27.2405700 30.6850145 36.3516811 31.6850145 35.2405700 36.7961256 67 68 69 70 71 72 22.5540379 16.6651490 22.8873713 20.2207046 20.7762601 20.0349712 73 74 75 76 77 78 9.2787833 11.7232277 12.3898944 12.7232277 21.2787833 20.8343388 79 80 81 82 83 84 1.5922512 -6.2966377 -5.0744155 -23.7410822 -28.1855266 -39.9268155 85 86 87 88 89 90 -42.6830035 -49.2385591 -55.5718924 -55.2385591 -60.6830035 -73.1274479 91 92 93 94 95 96 31.8092533 27.9203644 12.1425866 10.4759200 11.0314755 12.2901866 97 98 99 100 101 102 8.5339986 4.9784431 0.6451098 3.9784431 -7.4660014 1.0895542 103 104 105 106 107 -15.1525335 -23.0414223 -31.8192001 -30.4858668 -16.9303112 > postscript(file="/var/www/html/rcomp/tmp/6ac3q1228653833.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 = 107 Frequency = 1 lag(myerror, k = 1) myerror 0 29.0495038 NA 1 22.4939483 29.0495038 2 14.1606149 22.4939483 3 15.4939483 14.1606149 4 10.0495038 15.4939483 5 6.6050594 10.0495038 6 -10.6370283 6.6050594 7 8.4740828 -10.6370283 8 -4.3036949 8.4740828 9 -6.9703616 -4.3036949 10 -10.4148060 -6.9703616 11 -17.1560949 -10.4148060 12 -16.9122829 -17.1560949 13 -18.4678385 -16.9122829 14 -19.8011718 -18.4678385 15 -18.4678385 -19.8011718 16 -15.9122829 -18.4678385 17 -21.3567274 -15.9122829 18 -34.5988150 -21.3567274 19 -22.4877039 -34.5988150 20 -12.2654817 -22.4877039 21 -8.9321484 -12.2654817 22 -23.3765928 -8.9321484 23 -26.1178817 -23.3765928 24 -27.8740697 -26.1178817 25 -23.4296252 -27.8740697 26 -17.7629586 -23.4296252 27 -20.4296252 -17.7629586 28 -16.8740697 -20.4296252 29 -16.3185141 -16.8740697 30 -21.5606018 -16.3185141 31 -27.4494907 -21.5606018 32 -22.2272685 -27.4494907 33 -12.8939351 -22.2272685 34 -5.3383796 -12.8939351 35 -5.0796685 -5.3383796 36 -4.8358565 -5.0796685 37 -1.3914120 -4.8358565 38 2.2752547 -1.3914120 39 7.6085880 2.2752547 40 9.1641435 7.6085880 41 14.7196991 9.1641435 42 10.4776114 14.7196991 43 7.5887226 10.4776114 44 12.8109448 7.5887226 45 13.1442781 12.8109448 46 12.6998337 13.1442781 47 17.9585448 12.6998337 48 18.2023568 17.9585448 49 22.6468012 18.2023568 50 27.3134679 22.6468012 51 22.6468012 27.3134679 52 25.2023568 22.6468012 53 30.7579123 25.2023568 54 15.5158247 30.7579123 55 18.6269358 15.5158247 56 27.8491580 18.6269358 57 39.1824914 27.8491580 58 39.7380469 39.1824914 59 37.9967580 39.7380469 60 27.2405700 37.9967580 61 30.6850145 27.2405700 62 36.3516811 30.6850145 63 31.6850145 36.3516811 64 35.2405700 31.6850145 65 36.7961256 35.2405700 66 22.5540379 36.7961256 67 16.6651490 22.5540379 68 22.8873713 16.6651490 69 20.2207046 22.8873713 70 20.7762601 20.2207046 71 20.0349712 20.7762601 72 9.2787833 20.0349712 73 11.7232277 9.2787833 74 12.3898944 11.7232277 75 12.7232277 12.3898944 76 21.2787833 12.7232277 77 20.8343388 21.2787833 78 1.5922512 20.8343388 79 -6.2966377 1.5922512 80 -5.0744155 -6.2966377 81 -23.7410822 -5.0744155 82 -28.1855266 -23.7410822 83 -39.9268155 -28.1855266 84 -42.6830035 -39.9268155 85 -49.2385591 -42.6830035 86 -55.5718924 -49.2385591 87 -55.2385591 -55.5718924 88 -60.6830035 -55.2385591 89 -73.1274479 -60.6830035 90 31.8092533 -73.1274479 91 27.9203644 31.8092533 92 12.1425866 27.9203644 93 10.4759200 12.1425866 94 11.0314755 10.4759200 95 12.2901866 11.0314755 96 8.5339986 12.2901866 97 4.9784431 8.5339986 98 0.6451098 4.9784431 99 3.9784431 0.6451098 100 -7.4660014 3.9784431 101 1.0895542 -7.4660014 102 -15.1525335 1.0895542 103 -23.0414223 -15.1525335 104 -31.8192001 -23.0414223 105 -30.4858668 -31.8192001 106 -16.9303112 -30.4858668 107 NA -16.9303112 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 22.4939483 29.0495038 [2,] 14.1606149 22.4939483 [3,] 15.4939483 14.1606149 [4,] 10.0495038 15.4939483 [5,] 6.6050594 10.0495038 [6,] -10.6370283 6.6050594 [7,] 8.4740828 -10.6370283 [8,] -4.3036949 8.4740828 [9,] -6.9703616 -4.3036949 [10,] -10.4148060 -6.9703616 [11,] -17.1560949 -10.4148060 [12,] -16.9122829 -17.1560949 [13,] -18.4678385 -16.9122829 [14,] -19.8011718 -18.4678385 [15,] -18.4678385 -19.8011718 [16,] -15.9122829 -18.4678385 [17,] -21.3567274 -15.9122829 [18,] -34.5988150 -21.3567274 [19,] -22.4877039 -34.5988150 [20,] -12.2654817 -22.4877039 [21,] -8.9321484 -12.2654817 [22,] -23.3765928 -8.9321484 [23,] -26.1178817 -23.3765928 [24,] -27.8740697 -26.1178817 [25,] -23.4296252 -27.8740697 [26,] -17.7629586 -23.4296252 [27,] -20.4296252 -17.7629586 [28,] -16.8740697 -20.4296252 [29,] -16.3185141 -16.8740697 [30,] -21.5606018 -16.3185141 [31,] -27.4494907 -21.5606018 [32,] -22.2272685 -27.4494907 [33,] -12.8939351 -22.2272685 [34,] -5.3383796 -12.8939351 [35,] -5.0796685 -5.3383796 [36,] -4.8358565 -5.0796685 [37,] -1.3914120 -4.8358565 [38,] 2.2752547 -1.3914120 [39,] 7.6085880 2.2752547 [40,] 9.1641435 7.6085880 [41,] 14.7196991 9.1641435 [42,] 10.4776114 14.7196991 [43,] 7.5887226 10.4776114 [44,] 12.8109448 7.5887226 [45,] 13.1442781 12.8109448 [46,] 12.6998337 13.1442781 [47,] 17.9585448 12.6998337 [48,] 18.2023568 17.9585448 [49,] 22.6468012 18.2023568 [50,] 27.3134679 22.6468012 [51,] 22.6468012 27.3134679 [52,] 25.2023568 22.6468012 [53,] 30.7579123 25.2023568 [54,] 15.5158247 30.7579123 [55,] 18.6269358 15.5158247 [56,] 27.8491580 18.6269358 [57,] 39.1824914 27.8491580 [58,] 39.7380469 39.1824914 [59,] 37.9967580 39.7380469 [60,] 27.2405700 37.9967580 [61,] 30.6850145 27.2405700 [62,] 36.3516811 30.6850145 [63,] 31.6850145 36.3516811 [64,] 35.2405700 31.6850145 [65,] 36.7961256 35.2405700 [66,] 22.5540379 36.7961256 [67,] 16.6651490 22.5540379 [68,] 22.8873713 16.6651490 [69,] 20.2207046 22.8873713 [70,] 20.7762601 20.2207046 [71,] 20.0349712 20.7762601 [72,] 9.2787833 20.0349712 [73,] 11.7232277 9.2787833 [74,] 12.3898944 11.7232277 [75,] 12.7232277 12.3898944 [76,] 21.2787833 12.7232277 [77,] 20.8343388 21.2787833 [78,] 1.5922512 20.8343388 [79,] -6.2966377 1.5922512 [80,] -5.0744155 -6.2966377 [81,] -23.7410822 -5.0744155 [82,] -28.1855266 -23.7410822 [83,] -39.9268155 -28.1855266 [84,] -42.6830035 -39.9268155 [85,] -49.2385591 -42.6830035 [86,] -55.5718924 -49.2385591 [87,] -55.2385591 -55.5718924 [88,] -60.6830035 -55.2385591 [89,] -73.1274479 -60.6830035 [90,] 31.8092533 -73.1274479 [91,] 27.9203644 31.8092533 [92,] 12.1425866 27.9203644 [93,] 10.4759200 12.1425866 [94,] 11.0314755 10.4759200 [95,] 12.2901866 11.0314755 [96,] 8.5339986 12.2901866 [97,] 4.9784431 8.5339986 [98,] 0.6451098 4.9784431 [99,] 3.9784431 0.6451098 [100,] -7.4660014 3.9784431 [101,] 1.0895542 -7.4660014 [102,] -15.1525335 1.0895542 [103,] -23.0414223 -15.1525335 [104,] -31.8192001 -23.0414223 [105,] -30.4858668 -31.8192001 [106,] -16.9303112 -30.4858668 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 22.4939483 29.0495038 2 14.1606149 22.4939483 3 15.4939483 14.1606149 4 10.0495038 15.4939483 5 6.6050594 10.0495038 6 -10.6370283 6.6050594 7 8.4740828 -10.6370283 8 -4.3036949 8.4740828 9 -6.9703616 -4.3036949 10 -10.4148060 -6.9703616 11 -17.1560949 -10.4148060 12 -16.9122829 -17.1560949 13 -18.4678385 -16.9122829 14 -19.8011718 -18.4678385 15 -18.4678385 -19.8011718 16 -15.9122829 -18.4678385 17 -21.3567274 -15.9122829 18 -34.5988150 -21.3567274 19 -22.4877039 -34.5988150 20 -12.2654817 -22.4877039 21 -8.9321484 -12.2654817 22 -23.3765928 -8.9321484 23 -26.1178817 -23.3765928 24 -27.8740697 -26.1178817 25 -23.4296252 -27.8740697 26 -17.7629586 -23.4296252 27 -20.4296252 -17.7629586 28 -16.8740697 -20.4296252 29 -16.3185141 -16.8740697 30 -21.5606018 -16.3185141 31 -27.4494907 -21.5606018 32 -22.2272685 -27.4494907 33 -12.8939351 -22.2272685 34 -5.3383796 -12.8939351 35 -5.0796685 -5.3383796 36 -4.8358565 -5.0796685 37 -1.3914120 -4.8358565 38 2.2752547 -1.3914120 39 7.6085880 2.2752547 40 9.1641435 7.6085880 41 14.7196991 9.1641435 42 10.4776114 14.7196991 43 7.5887226 10.4776114 44 12.8109448 7.5887226 45 13.1442781 12.8109448 46 12.6998337 13.1442781 47 17.9585448 12.6998337 48 18.2023568 17.9585448 49 22.6468012 18.2023568 50 27.3134679 22.6468012 51 22.6468012 27.3134679 52 25.2023568 22.6468012 53 30.7579123 25.2023568 54 15.5158247 30.7579123 55 18.6269358 15.5158247 56 27.8491580 18.6269358 57 39.1824914 27.8491580 58 39.7380469 39.1824914 59 37.9967580 39.7380469 60 27.2405700 37.9967580 61 30.6850145 27.2405700 62 36.3516811 30.6850145 63 31.6850145 36.3516811 64 35.2405700 31.6850145 65 36.7961256 35.2405700 66 22.5540379 36.7961256 67 16.6651490 22.5540379 68 22.8873713 16.6651490 69 20.2207046 22.8873713 70 20.7762601 20.2207046 71 20.0349712 20.7762601 72 9.2787833 20.0349712 73 11.7232277 9.2787833 74 12.3898944 11.7232277 75 12.7232277 12.3898944 76 21.2787833 12.7232277 77 20.8343388 21.2787833 78 1.5922512 20.8343388 79 -6.2966377 1.5922512 80 -5.0744155 -6.2966377 81 -23.7410822 -5.0744155 82 -28.1855266 -23.7410822 83 -39.9268155 -28.1855266 84 -42.6830035 -39.9268155 85 -49.2385591 -42.6830035 86 -55.5718924 -49.2385591 87 -55.2385591 -55.5718924 88 -60.6830035 -55.2385591 89 -73.1274479 -60.6830035 90 31.8092533 -73.1274479 91 27.9203644 31.8092533 92 12.1425866 27.9203644 93 10.4759200 12.1425866 94 11.0314755 10.4759200 95 12.2901866 11.0314755 96 8.5339986 12.2901866 97 4.9784431 8.5339986 98 0.6451098 4.9784431 99 3.9784431 0.6451098 100 -7.4660014 3.9784431 101 1.0895542 -7.4660014 102 -15.1525335 1.0895542 103 -23.0414223 -15.1525335 104 -31.8192001 -23.0414223 105 -30.4858668 -31.8192001 106 -16.9303112 -30.4858668 > 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/7ud4j1228653833.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/840ip1228653833.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/9g08r1228653833.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 > > #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/10kqht1228653833.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/11dme11228653833.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/12q2h81228653833.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/13q6oz1228653833.tab") > > system("convert tmp/123uh1228653833.ps tmp/123uh1228653833.png") > system("convert tmp/2chhh1228653833.ps tmp/2chhh1228653833.png") > system("convert tmp/39qaa1228653833.ps tmp/39qaa1228653833.png") > system("convert tmp/4d5ui1228653833.ps tmp/4d5ui1228653833.png") > system("convert tmp/52dib1228653833.ps tmp/52dib1228653833.png") > system("convert tmp/6ac3q1228653833.ps tmp/6ac3q1228653833.png") > system("convert tmp/7ud4j1228653833.ps tmp/7ud4j1228653833.png") > system("convert tmp/840ip1228653833.ps tmp/840ip1228653833.png") > system("convert tmp/9g08r1228653833.ps tmp/9g08r1228653833.png") > > > proc.time() user system elapsed 2.097 1.487 2.508