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(98.71,153.4,98.54,145,98.2,137.7,96.92,148.3,99.06,152.2,99.65,169.4,99.82,168.6,99.99,161.1,100.33,174.1,99.31,179,101.1,190.6,101.1,190,100.93,181.6,100.85,174.8,100.93,180.5,99.6,196.8,101.88,193.8,101.81,197,102.38,216.3,102.74,221.4,102.82,217.9,101.72,229.7,103.47,227.4,102.98,204.2,102.68,196.6,102.9,198.8,103.03,207.5,101.29,190.7,103.69,201.6,103.68,210.5,104.2,223.5,104.08,223.8,104.16,231.2,103.05,244,104.66,234.7,104.46,250.2,104.95,265.7,105.85,287.6,106.23,283.3,104.86,295.4,107.44,312.3,108.23,333.8,108.45,347.7,109.39,383.2,110.15,407.1,109.13,413.6,110.28,362.7,110.17,321.9,109.99,239.4,109.26,191,109.11,159.7,107.06,163.4,109.53,157.6,108.92,166.2,109.24,176.7,109.12,198.3,109,226.2,107.23,216.2,109.49,235.9,109.04,226.9),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 = 'No 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 1 98.71 153.4 1 0 0 0 0 0 0 0 0 0 0 2 98.54 145.0 0 1 0 0 0 0 0 0 0 0 0 3 98.20 137.7 0 0 1 0 0 0 0 0 0 0 0 4 96.92 148.3 0 0 0 1 0 0 0 0 0 0 0 5 99.06 152.2 0 0 0 0 1 0 0 0 0 0 0 6 99.65 169.4 0 0 0 0 0 1 0 0 0 0 0 7 99.82 168.6 0 0 0 0 0 0 1 0 0 0 0 8 99.99 161.1 0 0 0 0 0 0 0 1 0 0 0 9 100.33 174.1 0 0 0 0 0 0 0 0 1 0 0 10 99.31 179.0 0 0 0 0 0 0 0 0 0 1 0 11 101.10 190.6 0 0 0 0 0 0 0 0 0 0 1 12 101.10 190.0 0 0 0 0 0 0 0 0 0 0 0 13 100.93 181.6 1 0 0 0 0 0 0 0 0 0 0 14 100.85 174.8 0 1 0 0 0 0 0 0 0 0 0 15 100.93 180.5 0 0 1 0 0 0 0 0 0 0 0 16 99.60 196.8 0 0 0 1 0 0 0 0 0 0 0 17 101.88 193.8 0 0 0 0 1 0 0 0 0 0 0 18 101.81 197.0 0 0 0 0 0 1 0 0 0 0 0 19 102.38 216.3 0 0 0 0 0 0 1 0 0 0 0 20 102.74 221.4 0 0 0 0 0 0 0 1 0 0 0 21 102.82 217.9 0 0 0 0 0 0 0 0 1 0 0 22 101.72 229.7 0 0 0 0 0 0 0 0 0 1 0 23 103.47 227.4 0 0 0 0 0 0 0 0 0 0 1 24 102.98 204.2 0 0 0 0 0 0 0 0 0 0 0 25 102.68 196.6 1 0 0 0 0 0 0 0 0 0 0 26 102.90 198.8 0 1 0 0 0 0 0 0 0 0 0 27 103.03 207.5 0 0 1 0 0 0 0 0 0 0 0 28 101.29 190.7 0 0 0 1 0 0 0 0 0 0 0 29 103.69 201.6 0 0 0 0 1 0 0 0 0 0 0 30 103.68 210.5 0 0 0 0 0 1 0 0 0 0 0 31 104.20 223.5 0 0 0 0 0 0 1 0 0 0 0 32 104.08 223.8 0 0 0 0 0 0 0 1 0 0 0 33 104.16 231.2 0 0 0 0 0 0 0 0 1 0 0 34 103.05 244.0 0 0 0 0 0 0 0 0 0 1 0 35 104.66 234.7 0 0 0 0 0 0 0 0 0 0 1 36 104.46 250.2 0 0 0 0 0 0 0 0 0 0 0 37 104.95 265.7 1 0 0 0 0 0 0 0 0 0 0 38 105.85 287.6 0 1 0 0 0 0 0 0 0 0 0 39 106.23 283.3 0 0 1 0 0 0 0 0 0 0 0 40 104.86 295.4 0 0 0 1 0 0 0 0 0 0 0 41 107.44 312.3 0 0 0 0 1 0 0 0 0 0 0 42 108.23 333.8 0 0 0 0 0 1 0 0 0 0 0 43 108.45 347.7 0 0 0 0 0 0 1 0 0 0 0 44 109.39 383.2 0 0 0 0 0 0 0 1 0 0 0 45 110.15 407.1 0 0 0 0 0 0 0 0 1 0 0 46 109.13 413.6 0 0 0 0 0 0 0 0 0 1 0 47 110.28 362.7 0 0 0 0 0 0 0 0 0 0 1 48 110.17 321.9 0 0 0 0 0 0 0 0 0 0 0 49 109.99 239.4 1 0 0 0 0 0 0 0 0 0 0 50 109.26 191.0 0 1 0 0 0 0 0 0 0 0 0 51 109.11 159.7 0 0 1 0 0 0 0 0 0 0 0 52 107.06 163.4 0 0 0 1 0 0 0 0 0 0 0 53 109.53 157.6 0 0 0 0 1 0 0 0 0 0 0 54 108.92 166.2 0 0 0 0 0 1 0 0 0 0 0 55 109.24 176.7 0 0 0 0 0 0 1 0 0 0 0 56 109.12 198.3 0 0 0 0 0 0 0 1 0 0 0 57 109.00 226.2 0 0 0 0 0 0 0 0 1 0 0 58 107.23 216.2 0 0 0 0 0 0 0 0 0 1 0 59 109.49 235.9 0 0 0 0 0 0 0 0 0 0 1 60 109.04 226.9 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 97.133637 0.035268 -0.994111 -0.687493 -0.466465 -2.203154 M5 M6 M7 M8 M9 M10 0.009319 -0.271666 -0.305962 -0.447911 -0.704493 -2.091887 M11 -0.159815 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.4507 -2.0526 -0.6386 -0.3864 6.8288 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 97.133637 2.264442 42.895 < 2e-16 *** X 0.035268 0.007098 4.969 9.34e-06 *** M1 -0.994111 2.137059 -0.465 0.644 M2 -0.687493 2.143613 -0.321 0.750 M3 -0.466465 2.149238 -0.217 0.829 M4 -2.203154 2.144095 -1.028 0.309 M5 0.009319 2.140064 0.004 0.997 M6 -0.271666 2.131882 -0.127 0.899 M7 -0.305962 2.127209 -0.144 0.886 M8 -0.447911 2.125494 -0.211 0.834 M9 -0.704493 2.127379 -0.331 0.742 M10 -2.091887 2.129257 -0.982 0.331 M11 -0.159815 2.127080 -0.075 0.940 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.361 on 47 degrees of freedom Multiple R-squared: 0.3941, Adjusted R-squared: 0.2394 F-statistic: 2.548 on 12 and 47 DF, p-value: 0.01110 > 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,] 1.069995e-03 2.139989e-03 0.9989300 [2,] 9.037226e-05 1.807445e-04 0.9999096 [3,] 1.133709e-05 2.267419e-05 0.9999887 [4,] 2.752002e-06 5.504003e-06 0.9999972 [5,] 2.527303e-06 5.054606e-06 0.9999975 [6,] 3.152596e-07 6.305193e-07 0.9999997 [7,] 7.178286e-08 1.435657e-07 0.9999999 [8,] 1.081938e-08 2.163876e-08 1.0000000 [9,] 1.372387e-08 2.744774e-08 1.0000000 [10,] 2.547953e-08 5.095907e-08 1.0000000 [11,] 1.455136e-08 2.910273e-08 1.0000000 [12,] 4.564973e-09 9.129945e-09 1.0000000 [13,] 6.428190e-08 1.285638e-07 0.9999999 [14,] 1.036801e-07 2.073603e-07 0.9999999 [15,] 1.176271e-07 2.352541e-07 0.9999999 [16,] 1.130724e-07 2.261449e-07 0.9999999 [17,] 9.790510e-08 1.958102e-07 0.9999999 [18,] 1.243470e-07 2.486941e-07 0.9999999 [19,] 2.466773e-07 4.933546e-07 0.9999998 [20,] 1.560850e-06 3.121701e-06 0.9999984 [21,] 6.953257e-05 1.390651e-04 0.9999305 [22,] 4.248437e-03 8.496875e-03 0.9957516 [23,] 3.663969e-02 7.327939e-02 0.9633603 [24,] 9.721957e-02 1.944391e-01 0.9027804 [25,] 1.978305e-01 3.956611e-01 0.8021695 [26,] 5.134307e-01 9.731386e-01 0.4865693 [27,] 5.816472e-01 8.367056e-01 0.4183528 [28,] 8.618143e-01 2.763714e-01 0.1381857 [29,] 9.616492e-01 7.670160e-02 0.0383508 > postscript(file="/var/www/html/rcomp/tmp/1tahm1258718394.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/2zlfj1258718394.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/3hvzf1258718394.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/42idt1258718394.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/55qim1258718394.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 7 -2.8396424 -3.0200084 -3.3235795 -3.2407323 -3.4507500 -3.1863759 -2.9538649 8 9 10 11 12 13 14 -2.3774063 -2.2393080 -2.0447276 -2.5959093 -2.7345630 -1.6142009 -1.7609957 15 16 17 18 19 20 21 -2.1030513 -2.2712318 -2.0979001 -1.9997736 -2.0761500 -1.7540686 -1.2940478 22 23 24 25 26 27 28 -1.4228168 -1.5237728 -1.3553690 -0.3932213 -0.5574285 -0.9552881 -0.3660968 29 30 31 32 33 34 35 -0.5629907 -0.6058920 -0.5100798 -0.4987119 -0.4231126 -0.5971496 -0.5912294 36 37 38 39 40 41 42 -1.4976984 -0.5602423 -0.7392296 -0.4286049 -0.4886597 -0.7171618 -0.4044403 43 44 45 46 47 48 49 -0.6403693 -0.8104361 -0.6367593 -0.4986077 0.5144626 1.6835837 5.4073069 50 51 52 53 54 55 56 6.0776622 6.8105238 6.3667205 6.8288026 6.1964818 6.1804640 5.4406229 57 58 59 60 4.5932276 4.5633017 4.1964489 3.9040467 > postscript(file="/var/www/html/rcomp/tmp/63hth1258718394.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 -2.8396424 NA 1 -3.0200084 -2.8396424 2 -3.3235795 -3.0200084 3 -3.2407323 -3.3235795 4 -3.4507500 -3.2407323 5 -3.1863759 -3.4507500 6 -2.9538649 -3.1863759 7 -2.3774063 -2.9538649 8 -2.2393080 -2.3774063 9 -2.0447276 -2.2393080 10 -2.5959093 -2.0447276 11 -2.7345630 -2.5959093 12 -1.6142009 -2.7345630 13 -1.7609957 -1.6142009 14 -2.1030513 -1.7609957 15 -2.2712318 -2.1030513 16 -2.0979001 -2.2712318 17 -1.9997736 -2.0979001 18 -2.0761500 -1.9997736 19 -1.7540686 -2.0761500 20 -1.2940478 -1.7540686 21 -1.4228168 -1.2940478 22 -1.5237728 -1.4228168 23 -1.3553690 -1.5237728 24 -0.3932213 -1.3553690 25 -0.5574285 -0.3932213 26 -0.9552881 -0.5574285 27 -0.3660968 -0.9552881 28 -0.5629907 -0.3660968 29 -0.6058920 -0.5629907 30 -0.5100798 -0.6058920 31 -0.4987119 -0.5100798 32 -0.4231126 -0.4987119 33 -0.5971496 -0.4231126 34 -0.5912294 -0.5971496 35 -1.4976984 -0.5912294 36 -0.5602423 -1.4976984 37 -0.7392296 -0.5602423 38 -0.4286049 -0.7392296 39 -0.4886597 -0.4286049 40 -0.7171618 -0.4886597 41 -0.4044403 -0.7171618 42 -0.6403693 -0.4044403 43 -0.8104361 -0.6403693 44 -0.6367593 -0.8104361 45 -0.4986077 -0.6367593 46 0.5144626 -0.4986077 47 1.6835837 0.5144626 48 5.4073069 1.6835837 49 6.0776622 5.4073069 50 6.8105238 6.0776622 51 6.3667205 6.8105238 52 6.8288026 6.3667205 53 6.1964818 6.8288026 54 6.1804640 6.1964818 55 5.4406229 6.1804640 56 4.5932276 5.4406229 57 4.5633017 4.5932276 58 4.1964489 4.5633017 59 3.9040467 4.1964489 60 NA 3.9040467 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.0200084 -2.8396424 [2,] -3.3235795 -3.0200084 [3,] -3.2407323 -3.3235795 [4,] -3.4507500 -3.2407323 [5,] -3.1863759 -3.4507500 [6,] -2.9538649 -3.1863759 [7,] -2.3774063 -2.9538649 [8,] -2.2393080 -2.3774063 [9,] -2.0447276 -2.2393080 [10,] -2.5959093 -2.0447276 [11,] -2.7345630 -2.5959093 [12,] -1.6142009 -2.7345630 [13,] -1.7609957 -1.6142009 [14,] -2.1030513 -1.7609957 [15,] -2.2712318 -2.1030513 [16,] -2.0979001 -2.2712318 [17,] -1.9997736 -2.0979001 [18,] -2.0761500 -1.9997736 [19,] -1.7540686 -2.0761500 [20,] -1.2940478 -1.7540686 [21,] -1.4228168 -1.2940478 [22,] -1.5237728 -1.4228168 [23,] -1.3553690 -1.5237728 [24,] -0.3932213 -1.3553690 [25,] -0.5574285 -0.3932213 [26,] -0.9552881 -0.5574285 [27,] -0.3660968 -0.9552881 [28,] -0.5629907 -0.3660968 [29,] -0.6058920 -0.5629907 [30,] -0.5100798 -0.6058920 [31,] -0.4987119 -0.5100798 [32,] -0.4231126 -0.4987119 [33,] -0.5971496 -0.4231126 [34,] -0.5912294 -0.5971496 [35,] -1.4976984 -0.5912294 [36,] -0.5602423 -1.4976984 [37,] -0.7392296 -0.5602423 [38,] -0.4286049 -0.7392296 [39,] -0.4886597 -0.4286049 [40,] -0.7171618 -0.4886597 [41,] -0.4044403 -0.7171618 [42,] -0.6403693 -0.4044403 [43,] -0.8104361 -0.6403693 [44,] -0.6367593 -0.8104361 [45,] -0.4986077 -0.6367593 [46,] 0.5144626 -0.4986077 [47,] 1.6835837 0.5144626 [48,] 5.4073069 1.6835837 [49,] 6.0776622 5.4073069 [50,] 6.8105238 6.0776622 [51,] 6.3667205 6.8105238 [52,] 6.8288026 6.3667205 [53,] 6.1964818 6.8288026 [54,] 6.1804640 6.1964818 [55,] 5.4406229 6.1804640 [56,] 4.5932276 5.4406229 [57,] 4.5633017 4.5932276 [58,] 4.1964489 4.5633017 [59,] 3.9040467 4.1964489 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.0200084 -2.8396424 2 -3.3235795 -3.0200084 3 -3.2407323 -3.3235795 4 -3.4507500 -3.2407323 5 -3.1863759 -3.4507500 6 -2.9538649 -3.1863759 7 -2.3774063 -2.9538649 8 -2.2393080 -2.3774063 9 -2.0447276 -2.2393080 10 -2.5959093 -2.0447276 11 -2.7345630 -2.5959093 12 -1.6142009 -2.7345630 13 -1.7609957 -1.6142009 14 -2.1030513 -1.7609957 15 -2.2712318 -2.1030513 16 -2.0979001 -2.2712318 17 -1.9997736 -2.0979001 18 -2.0761500 -1.9997736 19 -1.7540686 -2.0761500 20 -1.2940478 -1.7540686 21 -1.4228168 -1.2940478 22 -1.5237728 -1.4228168 23 -1.3553690 -1.5237728 24 -0.3932213 -1.3553690 25 -0.5574285 -0.3932213 26 -0.9552881 -0.5574285 27 -0.3660968 -0.9552881 28 -0.5629907 -0.3660968 29 -0.6058920 -0.5629907 30 -0.5100798 -0.6058920 31 -0.4987119 -0.5100798 32 -0.4231126 -0.4987119 33 -0.5971496 -0.4231126 34 -0.5912294 -0.5971496 35 -1.4976984 -0.5912294 36 -0.5602423 -1.4976984 37 -0.7392296 -0.5602423 38 -0.4286049 -0.7392296 39 -0.4886597 -0.4286049 40 -0.7171618 -0.4886597 41 -0.4044403 -0.7171618 42 -0.6403693 -0.4044403 43 -0.8104361 -0.6403693 44 -0.6367593 -0.8104361 45 -0.4986077 -0.6367593 46 0.5144626 -0.4986077 47 1.6835837 0.5144626 48 5.4073069 1.6835837 49 6.0776622 5.4073069 50 6.8105238 6.0776622 51 6.3667205 6.8105238 52 6.8288026 6.3667205 53 6.1964818 6.8288026 54 6.1804640 6.1964818 55 5.4406229 6.1804640 56 4.5932276 5.4406229 57 4.5633017 4.5932276 58 4.1964489 4.5633017 59 3.9040467 4.1964489 > 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/75gik1258718394.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/88hyx1258718394.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/967iv1258718394.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/10y0f31258718394.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/1189831258718394.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/12kim51258718395.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/1348pu1258718395.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/14blmq1258718395.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/150qkq1258718395.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/16uss61258718395.tab") + } > > system("convert tmp/1tahm1258718394.ps tmp/1tahm1258718394.png") > system("convert tmp/2zlfj1258718394.ps tmp/2zlfj1258718394.png") > system("convert tmp/3hvzf1258718394.ps tmp/3hvzf1258718394.png") > system("convert tmp/42idt1258718394.ps tmp/42idt1258718394.png") > system("convert tmp/55qim1258718394.ps tmp/55qim1258718394.png") > system("convert tmp/63hth1258718394.ps tmp/63hth1258718394.png") > system("convert tmp/75gik1258718394.ps tmp/75gik1258718394.png") > system("convert tmp/88hyx1258718394.ps tmp/88hyx1258718394.png") > system("convert tmp/967iv1258718394.ps tmp/967iv1258718394.png") > system("convert tmp/10y0f31258718394.ps tmp/10y0f31258718394.png") > > > proc.time() user system elapsed 2.372 1.547 2.779