R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(9700,0,9081,0,9084,0,9743,0,8587,0,9731,0,9563,0,9998,0,9437,0,10038,0,9918,0,9252,0,9737,0,9035,0,9133,0,9487,0,8700,0,9627,0,8947,0,9283,0,8829,0,9947,0,9628,0,9318,0,9605,0,8640,0,9214,0,9567,0,8547,0,9185,0,9470,0,9123,0,9278,0,10170,0,9434,0,9655,0,9429,0,8739,0,9552,0,9687,1,9019,1,9672,1,9206,1,9069,1,9788,1,10312,1,10105,1,9863,1,9656,1,9295,1,9946,1,9701,1,9049,1,10190,1,9706,1,9765,1,9893,1,9994,1,10433,1,10073,1,10112,1,9266,1,9820,1,10097,1,9115,1,10411,1,9678,1,10408,1,10153,1,10368,1,10581,1,10597,1,10680,1,9738,1,9556,1),dim=c(2,75),dimnames=list(c('births','difference'),1:75)) > y <- array(NA,dim=c(2,75),dimnames=list(c('births','difference'),1:75)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No 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 > 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 births difference 1 9700 0 2 9081 0 3 9084 0 4 9743 0 5 8587 0 6 9731 0 7 9563 0 8 9998 0 9 9437 0 10 10038 0 11 9918 0 12 9252 0 13 9737 0 14 9035 0 15 9133 0 16 9487 0 17 8700 0 18 9627 0 19 8947 0 20 9283 0 21 8829 0 22 9947 0 23 9628 0 24 9318 0 25 9605 0 26 8640 0 27 9214 0 28 9567 0 29 8547 0 30 9185 0 31 9470 0 32 9123 0 33 9278 0 34 10170 0 35 9434 0 36 9655 0 37 9429 0 38 8739 0 39 9552 0 40 9687 1 41 9019 1 42 9672 1 43 9206 1 44 9069 1 45 9788 1 46 10312 1 47 10105 1 48 9863 1 49 9656 1 50 9295 1 51 9946 1 52 9701 1 53 9049 1 54 10190 1 55 9706 1 56 9765 1 57 9893 1 58 9994 1 59 10433 1 60 10073 1 61 10112 1 62 9266 1 63 9820 1 64 10097 1 65 9115 1 66 10411 1 67 9678 1 68 10408 1 69 10153 1 70 10368 1 71 10581 1 72 10597 1 73 10680 1 74 9738 1 75 9556 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) difference 9369.5 491.7 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -842.17 -241.51 31.83 288.66 818.83 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9369.51 70.63 132.656 < 2e-16 *** difference 491.65 101.95 4.823 7.52e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 441.1 on 73 degrees of freedom Multiple R-squared: 0.2416, Adjusted R-squared: 0.2312 F-statistic: 23.26 on 1 and 73 DF, p-value: 7.523e-06 > 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.80709932 0.3858014 0.1929007 [2,] 0.77793321 0.4441336 0.2220668 [3,] 0.68577410 0.6284518 0.3142259 [4,] 0.74558769 0.5088246 0.2544123 [5,] 0.64280680 0.7143864 0.3571932 [6,] 0.69929704 0.6014059 0.3007030 [7,] 0.68720111 0.6255978 0.3127989 [8,] 0.62232588 0.7553482 0.3776741 [9,] 0.56042390 0.8791522 0.4395761 [10,] 0.55923485 0.8815303 0.4407651 [11,] 0.51609203 0.9678159 0.4839080 [12,] 0.43143061 0.8628612 0.5685694 [13,] 0.56664927 0.8667015 0.4333507 [14,] 0.50494055 0.9901189 0.4950595 [15,] 0.50666803 0.9866639 0.4933320 [16,] 0.43244288 0.8648858 0.5675571 [17,] 0.47185112 0.9437022 0.5281489 [18,] 0.51753294 0.9649341 0.4824671 [19,] 0.46550826 0.9310165 0.5344917 [20,] 0.39464667 0.7892933 0.6053533 [21,] 0.34404584 0.6880917 0.6559542 [22,] 0.46384897 0.9276979 0.5361510 [23,] 0.40186170 0.8037234 0.5981383 [24,] 0.34790640 0.6958128 0.6520936 [25,] 0.50954950 0.9809010 0.4904505 [26,] 0.45305970 0.9061194 0.5469403 [27,] 0.38823701 0.7764740 0.6117630 [28,] 0.34641848 0.6928370 0.6535815 [29,] 0.29079961 0.5815992 0.7092004 [30,] 0.42047168 0.8409434 0.5795283 [31,] 0.35674312 0.7134862 0.6432569 [32,] 0.32524076 0.6504815 0.6747592 [33,] 0.27353676 0.5470735 0.7264632 [34,] 0.32247057 0.6449411 0.6775294 [35,] 0.26911940 0.5382388 0.7308806 [36,] 0.21972251 0.4394450 0.7802775 [37,] 0.29478232 0.5895646 0.7052177 [38,] 0.25484948 0.5096990 0.7451505 [39,] 0.27933812 0.5586762 0.7206619 [40,] 0.36478246 0.7295649 0.6352175 [41,] 0.33231660 0.6646332 0.6676834 [42,] 0.39467546 0.7893509 0.6053245 [43,] 0.37212422 0.7442484 0.6278758 [44,] 0.31579815 0.6315963 0.6842019 [45,] 0.27020669 0.5404134 0.7297933 [46,] 0.30749290 0.6149858 0.6925071 [47,] 0.25836408 0.5167282 0.7416359 [48,] 0.21668522 0.4333704 0.7833148 [49,] 0.39428034 0.7885607 0.6057197 [50,] 0.36643319 0.7328664 0.6335668 [51,] 0.32366794 0.6473359 0.6763321 [52,] 0.27699603 0.5539921 0.7230040 [53,] 0.22519931 0.4503986 0.7748007 [54,] 0.17775150 0.3555030 0.8222485 [55,] 0.18899890 0.3779978 0.8110011 [56,] 0.14427598 0.2885520 0.8557240 [57,] 0.10766479 0.2153296 0.8923352 [58,] 0.18060690 0.3612138 0.8193931 [59,] 0.14122779 0.2824556 0.8587722 [60,] 0.09913677 0.1982735 0.9008632 [61,] 0.36284927 0.7256985 0.6371507 [62,] 0.30833438 0.6166688 0.6916656 [63,] 0.34386745 0.6877349 0.6561326 [64,] 0.26513004 0.5302601 0.7348700 [65,] 0.17270262 0.3454052 0.8272974 [66,] 0.10325832 0.2065166 0.8967417 > postscript(file="/var/www/rcomp/tmp/1qutm1291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/213a71291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/313a71291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/413a71291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/5uu9s1291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 75 Frequency = 1 1 2 3 4 5 6 330.487179 -288.512821 -285.512821 373.487179 -782.512821 361.487179 7 8 9 10 11 12 193.487179 628.487179 67.487179 668.487179 548.487179 -117.512821 13 14 15 16 17 18 367.487179 -334.512821 -236.512821 117.487179 -669.512821 257.487179 19 20 21 22 23 24 -422.512821 -86.512821 -540.512821 577.487179 258.487179 -51.512821 25 26 27 28 29 30 235.487179 -729.512821 -155.512821 197.487179 -822.512821 -184.512821 31 32 33 34 35 36 100.487179 -246.512821 -91.512821 800.487179 64.487179 285.487179 37 38 39 40 41 42 59.487179 -630.512821 182.487179 -174.166667 -842.166667 -189.166667 43 44 45 46 47 48 -655.166667 -792.166667 -73.166667 450.833333 243.833333 1.833333 49 50 51 52 53 54 -205.166667 -566.166667 84.833333 -160.166667 -812.166667 328.833333 55 56 57 58 59 60 -155.166667 -96.166667 31.833333 132.833333 571.833333 211.833333 61 62 63 64 65 66 250.833333 -595.166667 -41.166667 235.833333 -746.166667 549.833333 67 68 69 70 71 72 -183.166667 546.833333 291.833333 506.833333 719.833333 735.833333 73 74 75 818.833333 -123.166667 -305.166667 > postscript(file="/var/www/rcomp/tmp/6uu9s1291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 75 Frequency = 1 lag(myerror, k = 1) myerror 0 330.487179 NA 1 -288.512821 330.487179 2 -285.512821 -288.512821 3 373.487179 -285.512821 4 -782.512821 373.487179 5 361.487179 -782.512821 6 193.487179 361.487179 7 628.487179 193.487179 8 67.487179 628.487179 9 668.487179 67.487179 10 548.487179 668.487179 11 -117.512821 548.487179 12 367.487179 -117.512821 13 -334.512821 367.487179 14 -236.512821 -334.512821 15 117.487179 -236.512821 16 -669.512821 117.487179 17 257.487179 -669.512821 18 -422.512821 257.487179 19 -86.512821 -422.512821 20 -540.512821 -86.512821 21 577.487179 -540.512821 22 258.487179 577.487179 23 -51.512821 258.487179 24 235.487179 -51.512821 25 -729.512821 235.487179 26 -155.512821 -729.512821 27 197.487179 -155.512821 28 -822.512821 197.487179 29 -184.512821 -822.512821 30 100.487179 -184.512821 31 -246.512821 100.487179 32 -91.512821 -246.512821 33 800.487179 -91.512821 34 64.487179 800.487179 35 285.487179 64.487179 36 59.487179 285.487179 37 -630.512821 59.487179 38 182.487179 -630.512821 39 -174.166667 182.487179 40 -842.166667 -174.166667 41 -189.166667 -842.166667 42 -655.166667 -189.166667 43 -792.166667 -655.166667 44 -73.166667 -792.166667 45 450.833333 -73.166667 46 243.833333 450.833333 47 1.833333 243.833333 48 -205.166667 1.833333 49 -566.166667 -205.166667 50 84.833333 -566.166667 51 -160.166667 84.833333 52 -812.166667 -160.166667 53 328.833333 -812.166667 54 -155.166667 328.833333 55 -96.166667 -155.166667 56 31.833333 -96.166667 57 132.833333 31.833333 58 571.833333 132.833333 59 211.833333 571.833333 60 250.833333 211.833333 61 -595.166667 250.833333 62 -41.166667 -595.166667 63 235.833333 -41.166667 64 -746.166667 235.833333 65 549.833333 -746.166667 66 -183.166667 549.833333 67 546.833333 -183.166667 68 291.833333 546.833333 69 506.833333 291.833333 70 719.833333 506.833333 71 735.833333 719.833333 72 818.833333 735.833333 73 -123.166667 818.833333 74 -305.166667 -123.166667 75 NA -305.166667 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -288.512821 330.487179 [2,] -285.512821 -288.512821 [3,] 373.487179 -285.512821 [4,] -782.512821 373.487179 [5,] 361.487179 -782.512821 [6,] 193.487179 361.487179 [7,] 628.487179 193.487179 [8,] 67.487179 628.487179 [9,] 668.487179 67.487179 [10,] 548.487179 668.487179 [11,] -117.512821 548.487179 [12,] 367.487179 -117.512821 [13,] -334.512821 367.487179 [14,] -236.512821 -334.512821 [15,] 117.487179 -236.512821 [16,] -669.512821 117.487179 [17,] 257.487179 -669.512821 [18,] -422.512821 257.487179 [19,] -86.512821 -422.512821 [20,] -540.512821 -86.512821 [21,] 577.487179 -540.512821 [22,] 258.487179 577.487179 [23,] -51.512821 258.487179 [24,] 235.487179 -51.512821 [25,] -729.512821 235.487179 [26,] -155.512821 -729.512821 [27,] 197.487179 -155.512821 [28,] -822.512821 197.487179 [29,] -184.512821 -822.512821 [30,] 100.487179 -184.512821 [31,] -246.512821 100.487179 [32,] -91.512821 -246.512821 [33,] 800.487179 -91.512821 [34,] 64.487179 800.487179 [35,] 285.487179 64.487179 [36,] 59.487179 285.487179 [37,] -630.512821 59.487179 [38,] 182.487179 -630.512821 [39,] -174.166667 182.487179 [40,] -842.166667 -174.166667 [41,] -189.166667 -842.166667 [42,] -655.166667 -189.166667 [43,] -792.166667 -655.166667 [44,] -73.166667 -792.166667 [45,] 450.833333 -73.166667 [46,] 243.833333 450.833333 [47,] 1.833333 243.833333 [48,] -205.166667 1.833333 [49,] -566.166667 -205.166667 [50,] 84.833333 -566.166667 [51,] -160.166667 84.833333 [52,] -812.166667 -160.166667 [53,] 328.833333 -812.166667 [54,] -155.166667 328.833333 [55,] -96.166667 -155.166667 [56,] 31.833333 -96.166667 [57,] 132.833333 31.833333 [58,] 571.833333 132.833333 [59,] 211.833333 571.833333 [60,] 250.833333 211.833333 [61,] -595.166667 250.833333 [62,] -41.166667 -595.166667 [63,] 235.833333 -41.166667 [64,] -746.166667 235.833333 [65,] 549.833333 -746.166667 [66,] -183.166667 549.833333 [67,] 546.833333 -183.166667 [68,] 291.833333 546.833333 [69,] 506.833333 291.833333 [70,] 719.833333 506.833333 [71,] 735.833333 719.833333 [72,] 818.833333 735.833333 [73,] -123.166667 818.833333 [74,] -305.166667 -123.166667 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -288.512821 330.487179 2 -285.512821 -288.512821 3 373.487179 -285.512821 4 -782.512821 373.487179 5 361.487179 -782.512821 6 193.487179 361.487179 7 628.487179 193.487179 8 67.487179 628.487179 9 668.487179 67.487179 10 548.487179 668.487179 11 -117.512821 548.487179 12 367.487179 -117.512821 13 -334.512821 367.487179 14 -236.512821 -334.512821 15 117.487179 -236.512821 16 -669.512821 117.487179 17 257.487179 -669.512821 18 -422.512821 257.487179 19 -86.512821 -422.512821 20 -540.512821 -86.512821 21 577.487179 -540.512821 22 258.487179 577.487179 23 -51.512821 258.487179 24 235.487179 -51.512821 25 -729.512821 235.487179 26 -155.512821 -729.512821 27 197.487179 -155.512821 28 -822.512821 197.487179 29 -184.512821 -822.512821 30 100.487179 -184.512821 31 -246.512821 100.487179 32 -91.512821 -246.512821 33 800.487179 -91.512821 34 64.487179 800.487179 35 285.487179 64.487179 36 59.487179 285.487179 37 -630.512821 59.487179 38 182.487179 -630.512821 39 -174.166667 182.487179 40 -842.166667 -174.166667 41 -189.166667 -842.166667 42 -655.166667 -189.166667 43 -792.166667 -655.166667 44 -73.166667 -792.166667 45 450.833333 -73.166667 46 243.833333 450.833333 47 1.833333 243.833333 48 -205.166667 1.833333 49 -566.166667 -205.166667 50 84.833333 -566.166667 51 -160.166667 84.833333 52 -812.166667 -160.166667 53 328.833333 -812.166667 54 -155.166667 328.833333 55 -96.166667 -155.166667 56 31.833333 -96.166667 57 132.833333 31.833333 58 571.833333 132.833333 59 211.833333 571.833333 60 250.833333 211.833333 61 -595.166667 250.833333 62 -41.166667 -595.166667 63 235.833333 -41.166667 64 -746.166667 235.833333 65 549.833333 -746.166667 66 -183.166667 549.833333 67 546.833333 -183.166667 68 291.833333 546.833333 69 506.833333 291.833333 70 719.833333 506.833333 71 735.833333 719.833333 72 818.833333 735.833333 73 -123.166667 818.833333 74 -305.166667 -123.166667 > 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/rcomp/tmp/74lqv1291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/84lqv1291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/9xuqg1291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/rcomp/tmp/10xuqg1291914016.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11jvom1291914016.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/rcomp/tmp/12mvnr1291914016.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/rcomp/tmp/13bx2l1291914016.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/rcomp/tmp/1436jo1291914016.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/rcomp/tmp/15hyhx1291914016.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/rcomp/tmp/163gf31291914016.tab") + } > > try(system("convert tmp/1qutm1291914016.ps tmp/1qutm1291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/213a71291914016.ps tmp/213a71291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/313a71291914016.ps tmp/313a71291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/413a71291914016.ps tmp/413a71291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/5uu9s1291914016.ps tmp/5uu9s1291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/6uu9s1291914016.ps tmp/6uu9s1291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/74lqv1291914016.ps tmp/74lqv1291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/84lqv1291914016.ps tmp/84lqv1291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/9xuqg1291914016.ps tmp/9xuqg1291914016.png",intern=TRUE)) character(0) > try(system("convert tmp/10xuqg1291914016.ps tmp/10xuqg1291914016.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.110 1.740 4.915