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(3759 + ,36.71 + ,3922 + ,5560 + ,4138 + ,36.72 + ,3759 + ,3922 + ,4634 + ,36.73 + ,4138 + ,3759 + ,3996 + ,36.73 + ,4634 + ,4138 + ,4308 + ,36.87 + ,3996 + ,4634 + ,4429 + ,37.31 + ,4308 + ,3996 + ,5219 + ,37.39 + ,4429 + ,4308 + ,4929 + ,37.42 + ,5219 + ,4429 + ,5755 + ,37.51 + ,4929 + ,5219 + ,5592 + ,37.67 + ,5755 + ,4929 + ,4163 + ,37.67 + ,5592 + ,5755 + ,4962 + ,37.71 + ,4163 + ,5592 + ,5208 + ,37.78 + ,4962 + ,4163 + ,4755 + ,37.79 + ,5208 + ,4962 + ,4491 + ,37.84 + ,4755 + ,5208 + ,5732 + ,37.88 + ,4491 + ,4755 + ,5731 + ,38.34 + ,5732 + ,4491 + ,5040 + ,38.58 + ,5731 + ,5732 + ,6102 + ,38.72 + ,5040 + ,5731 + ,4904 + ,38.83 + ,6102 + ,5040 + ,5369 + ,38.9 + ,4904 + ,6102 + ,5578 + ,38.92 + ,5369 + ,4904 + ,4619 + ,38.94 + ,5578 + ,5369 + ,4731 + ,39.1 + ,4619 + ,5578 + ,5011 + ,39.14 + ,4731 + ,4619 + ,5299 + ,39.16 + ,5011 + ,4731 + ,4146 + ,39.32 + ,5299 + ,5011 + ,4625 + ,39.34 + ,4146 + ,5299 + ,4736 + ,39.44 + ,4625 + ,4146 + ,4219 + ,39.92 + ,4736 + ,4625 + ,5116 + ,40.19 + ,4219 + ,4736 + ,4205 + ,40.2 + ,5116 + ,4219 + ,4121 + ,40.27 + ,4205 + ,5116 + ,5103 + ,40.28 + ,4121 + ,4205 + ,4300 + ,40.3 + ,5103 + ,4121 + ,4578 + ,40.34 + ,4300 + ,5103 + ,3809 + ,40.4 + ,4578 + ,4300 + ,5526 + ,40.43 + ,3809 + ,4578 + ,4247 + ,40.48 + ,5526 + ,3809 + ,3830 + ,40.48 + ,4247 + ,5526 + ,4394 + ,40.63 + ,3830 + ,4247 + ,4826 + ,40.74 + ,4394 + ,3830 + ,4409 + ,40.77 + ,4826 + ,4394 + ,4569 + ,40.91 + ,4409 + ,4826 + ,4106 + ,40.92 + ,4569 + ,4409 + ,4794 + ,41.03 + ,4106 + ,4569 + ,3914 + ,41 + ,4794 + ,4106 + ,3793 + ,41.04 + ,3914 + ,4794 + ,4405 + ,41.33 + ,3793 + ,3914 + ,4022 + ,41.44 + ,4405 + ,3793 + ,4100 + ,41.46 + ,4022 + ,4405 + ,4788 + ,41.55 + ,4100 + ,4022 + ,3163 + ,41.55 + ,4788 + ,4100 + ,3585 + ,41.81 + ,3163 + ,4788 + ,3903 + ,41.78 + ,3585 + ,3163 + ,4178 + ,41.84 + ,3903 + ,3585 + ,3863 + ,41.84 + ,4178 + ,3903 + ,4187 + ,41.86 + ,3863 + ,4178) + ,dim=c(4 + ,58) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2') + ,1:58)) > y <- array(NA,dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58)) > 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 = '3' > #'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 Y1 Y X Y2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 3922 3759 36.71 5560 1 0 0 0 0 0 0 0 0 0 0 1 2 3759 4138 36.72 3922 0 1 0 0 0 0 0 0 0 0 0 2 3 4138 4634 36.73 3759 0 0 1 0 0 0 0 0 0 0 0 3 4 4634 3996 36.73 4138 0 0 0 1 0 0 0 0 0 0 0 4 5 3996 4308 36.87 4634 0 0 0 0 1 0 0 0 0 0 0 5 6 4308 4429 37.31 3996 0 0 0 0 0 1 0 0 0 0 0 6 7 4429 5219 37.39 4308 0 0 0 0 0 0 1 0 0 0 0 7 8 5219 4929 37.42 4429 0 0 0 0 0 0 0 1 0 0 0 8 9 4929 5755 37.51 5219 0 0 0 0 0 0 0 0 1 0 0 9 10 5755 5592 37.67 4929 0 0 0 0 0 0 0 0 0 1 0 10 11 5592 4163 37.67 5755 0 0 0 0 0 0 0 0 0 0 1 11 12 4163 4962 37.71 5592 0 0 0 0 0 0 0 0 0 0 0 12 13 4962 5208 37.78 4163 1 0 0 0 0 0 0 0 0 0 0 13 14 5208 4755 37.79 4962 0 1 0 0 0 0 0 0 0 0 0 14 15 4755 4491 37.84 5208 0 0 1 0 0 0 0 0 0 0 0 15 16 4491 5732 37.88 4755 0 0 0 1 0 0 0 0 0 0 0 16 17 5732 5731 38.34 4491 0 0 0 0 1 0 0 0 0 0 0 17 18 5731 5040 38.58 5732 0 0 0 0 0 1 0 0 0 0 0 18 19 5040 6102 38.72 5731 0 0 0 0 0 0 1 0 0 0 0 19 20 6102 4904 38.83 5040 0 0 0 0 0 0 0 1 0 0 0 20 21 4904 5369 38.90 6102 0 0 0 0 0 0 0 0 1 0 0 21 22 5369 5578 38.92 4904 0 0 0 0 0 0 0 0 0 1 0 22 23 5578 4619 38.94 5369 0 0 0 0 0 0 0 0 0 0 1 23 24 4619 4731 39.10 5578 0 0 0 0 0 0 0 0 0 0 0 24 25 4731 5011 39.14 4619 1 0 0 0 0 0 0 0 0 0 0 25 26 5011 5299 39.16 4731 0 1 0 0 0 0 0 0 0 0 0 26 27 5299 4146 39.32 5011 0 0 1 0 0 0 0 0 0 0 0 27 28 4146 4625 39.34 5299 0 0 0 1 0 0 0 0 0 0 0 28 29 4625 4736 39.44 4146 0 0 0 0 1 0 0 0 0 0 0 29 30 4736 4219 39.92 4625 0 0 0 0 0 1 0 0 0 0 0 30 31 4219 5116 40.19 4736 0 0 0 0 0 0 1 0 0 0 0 31 32 5116 4205 40.20 4219 0 0 0 0 0 0 0 1 0 0 0 32 33 4205 4121 40.27 5116 0 0 0 0 0 0 0 0 1 0 0 33 34 4121 5103 40.28 4205 0 0 0 0 0 0 0 0 0 1 0 34 35 5103 4300 40.30 4121 0 0 0 0 0 0 0 0 0 0 1 35 36 4300 4578 40.34 5103 0 0 0 0 0 0 0 0 0 0 0 36 37 4578 3809 40.40 4300 1 0 0 0 0 0 0 0 0 0 0 37 38 3809 5526 40.43 4578 0 1 0 0 0 0 0 0 0 0 0 38 39 5526 4247 40.48 3809 0 0 1 0 0 0 0 0 0 0 0 39 40 4247 3830 40.48 5526 0 0 0 1 0 0 0 0 0 0 0 40 41 3830 4394 40.63 4247 0 0 0 0 1 0 0 0 0 0 0 41 42 4394 4826 40.74 3830 0 0 0 0 0 1 0 0 0 0 0 42 43 4826 4409 40.77 4394 0 0 0 0 0 0 1 0 0 0 0 43 44 4409 4569 40.91 4826 0 0 0 0 0 0 0 1 0 0 0 44 45 4569 4106 40.92 4409 0 0 0 0 0 0 0 0 1 0 0 45 46 4106 4794 41.03 4569 0 0 0 0 0 0 0 0 0 1 0 46 47 4794 3914 41.00 4106 0 0 0 0 0 0 0 0 0 0 1 47 48 3914 3793 41.04 4794 0 0 0 0 0 0 0 0 0 0 0 48 49 3793 4405 41.33 3914 1 0 0 0 0 0 0 0 0 0 0 49 50 4405 4022 41.44 3793 0 1 0 0 0 0 0 0 0 0 0 50 51 4022 4100 41.46 4405 0 0 1 0 0 0 0 0 0 0 0 51 52 4100 4788 41.55 4022 0 0 0 1 0 0 0 0 0 0 0 52 53 4788 3163 41.55 4100 0 0 0 0 1 0 0 0 0 0 0 53 54 3163 3585 41.81 4788 0 0 0 0 0 1 0 0 0 0 0 54 55 3585 3903 41.78 3163 0 0 0 0 0 0 1 0 0 0 0 55 56 3903 4178 41.84 3585 0 0 0 0 0 0 0 1 0 0 0 56 57 4178 3863 41.84 3903 0 0 0 0 0 0 0 0 1 0 0 57 58 3863 4187 41.86 4178 0 0 0 0 0 0 0 0 0 1 0 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Y X Y2 M1 M2 -1.457e+04 2.861e-01 4.591e+02 1.730e-01 2.635e+02 2.705e+02 M3 M4 M5 M6 M7 M8 7.189e+02 2.010e+02 5.547e+02 3.041e+02 1.342e+02 8.037e+02 M9 M10 M11 t 3.238e+02 3.826e+02 1.149e+03 -5.118e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -875.922 -347.223 -4.976 370.553 919.757 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.457e+04 1.496e+04 -0.974 0.33550 Y 2.861e-01 1.482e-01 1.931 0.06029 . X 4.591e+02 4.169e+02 1.101 0.27712 Y2 1.730e-01 1.447e-01 1.195 0.23863 M1 2.635e+02 3.791e+02 0.695 0.49091 M2 2.705e+02 3.847e+02 0.703 0.48587 M3 7.189e+02 3.788e+02 1.898 0.06462 . M4 2.010e+02 3.707e+02 0.542 0.59057 M5 5.547e+02 3.826e+02 1.450 0.15459 M6 3.041e+02 3.792e+02 0.802 0.42713 M7 1.342e+02 3.909e+02 0.343 0.73313 M8 8.037e+02 3.842e+02 2.092 0.04254 * M9 3.238e+02 3.637e+02 0.890 0.37843 M10 3.826e+02 3.854e+02 0.993 0.32646 M11 1.149e+03 3.860e+02 2.977 0.00481 ** t -5.118e+01 4.109e+01 -1.246 0.21981 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 535.1 on 42 degrees of freedom Multiple R-squared: 0.4717, Adjusted R-squared: 0.283 F-statistic: 2.5 on 15 and 42 DF, p-value: 0.009925 > 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.7749488 0.4501024 0.22505120 [2,] 0.8300501 0.3398999 0.16994994 [3,] 0.8924716 0.2150569 0.10752843 [4,] 0.9233146 0.1533707 0.07668537 [5,] 0.8916043 0.2167914 0.10839569 [6,] 0.8255558 0.3488884 0.17444422 [7,] 0.7553782 0.4892436 0.24462181 [8,] 0.6809397 0.6381205 0.31906025 [9,] 0.6018491 0.7963018 0.39815090 [10,] 0.7376086 0.5247828 0.26239140 [11,] 0.7251734 0.5496532 0.27482659 [12,] 0.6291110 0.7417779 0.37088897 [13,] 0.5621982 0.8756036 0.43780181 [14,] 0.4591502 0.9183003 0.54084983 [15,] 0.3582041 0.7164082 0.64179591 [16,] 0.4300824 0.8601649 0.56991757 [17,] 0.3139779 0.6279557 0.68602215 [18,] 0.2328509 0.4657019 0.76714905 [19,] 0.1659012 0.3318023 0.83409884 [20,] 0.2123001 0.4246002 0.78769991 [21,] 0.2202661 0.4405322 0.77973391 > postscript(file="/var/www/html/rcomp/tmp/1e8d31258494695.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/2kpch1258494695.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/3pdni1258494695.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/4aiz41258494695.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/56n8o1258494695.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 = 58 Frequency = 1 1 2 3 4 5 6 -606.328260 -554.849250 -691.389111 490.698697 -689.135910 -201.642562 7 8 9 10 11 12 -176.225409 43.741541 -129.455852 712.235451 99.669923 -347.600367 13 14 15 16 17 18 383.788754 660.762924 -179.472224 -169.359225 603.891767 777.488024 19 20 21 22 23 24 -60.311832 795.122486 -220.669695 374.926745 53.168591 152.993635 25 26 27 28 29 30 120.136159 333.370736 432.068497 -347.820769 -49.576761 207.863357 31 32 33 34 35 36 -487.787703 136.358011 -406.845279 -626.427134 -124.854706 4.872258 37 38 39 40 41 42 401.933675 -875.922024 919.756970 32.199529 -696.304670 67.493159 43 44 45 46 47 48 728.558543 -491.494115 399.539754 -346.090234 -27.983809 189.734474 49 50 51 52 53 54 -299.530328 436.637614 -480.964132 -5.718231 831.125574 -851.201979 55 56 57 58 -4.233600 -483.727923 357.431072 -114.644827 > postscript(file="/var/www/html/rcomp/tmp/6nrku1258494695.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -606.328260 NA 1 -554.849250 -606.328260 2 -691.389111 -554.849250 3 490.698697 -691.389111 4 -689.135910 490.698697 5 -201.642562 -689.135910 6 -176.225409 -201.642562 7 43.741541 -176.225409 8 -129.455852 43.741541 9 712.235451 -129.455852 10 99.669923 712.235451 11 -347.600367 99.669923 12 383.788754 -347.600367 13 660.762924 383.788754 14 -179.472224 660.762924 15 -169.359225 -179.472224 16 603.891767 -169.359225 17 777.488024 603.891767 18 -60.311832 777.488024 19 795.122486 -60.311832 20 -220.669695 795.122486 21 374.926745 -220.669695 22 53.168591 374.926745 23 152.993635 53.168591 24 120.136159 152.993635 25 333.370736 120.136159 26 432.068497 333.370736 27 -347.820769 432.068497 28 -49.576761 -347.820769 29 207.863357 -49.576761 30 -487.787703 207.863357 31 136.358011 -487.787703 32 -406.845279 136.358011 33 -626.427134 -406.845279 34 -124.854706 -626.427134 35 4.872258 -124.854706 36 401.933675 4.872258 37 -875.922024 401.933675 38 919.756970 -875.922024 39 32.199529 919.756970 40 -696.304670 32.199529 41 67.493159 -696.304670 42 728.558543 67.493159 43 -491.494115 728.558543 44 399.539754 -491.494115 45 -346.090234 399.539754 46 -27.983809 -346.090234 47 189.734474 -27.983809 48 -299.530328 189.734474 49 436.637614 -299.530328 50 -480.964132 436.637614 51 -5.718231 -480.964132 52 831.125574 -5.718231 53 -851.201979 831.125574 54 -4.233600 -851.201979 55 -483.727923 -4.233600 56 357.431072 -483.727923 57 -114.644827 357.431072 58 NA -114.644827 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -554.849250 -606.328260 [2,] -691.389111 -554.849250 [3,] 490.698697 -691.389111 [4,] -689.135910 490.698697 [5,] -201.642562 -689.135910 [6,] -176.225409 -201.642562 [7,] 43.741541 -176.225409 [8,] -129.455852 43.741541 [9,] 712.235451 -129.455852 [10,] 99.669923 712.235451 [11,] -347.600367 99.669923 [12,] 383.788754 -347.600367 [13,] 660.762924 383.788754 [14,] -179.472224 660.762924 [15,] -169.359225 -179.472224 [16,] 603.891767 -169.359225 [17,] 777.488024 603.891767 [18,] -60.311832 777.488024 [19,] 795.122486 -60.311832 [20,] -220.669695 795.122486 [21,] 374.926745 -220.669695 [22,] 53.168591 374.926745 [23,] 152.993635 53.168591 [24,] 120.136159 152.993635 [25,] 333.370736 120.136159 [26,] 432.068497 333.370736 [27,] -347.820769 432.068497 [28,] -49.576761 -347.820769 [29,] 207.863357 -49.576761 [30,] -487.787703 207.863357 [31,] 136.358011 -487.787703 [32,] -406.845279 136.358011 [33,] -626.427134 -406.845279 [34,] -124.854706 -626.427134 [35,] 4.872258 -124.854706 [36,] 401.933675 4.872258 [37,] -875.922024 401.933675 [38,] 919.756970 -875.922024 [39,] 32.199529 919.756970 [40,] -696.304670 32.199529 [41,] 67.493159 -696.304670 [42,] 728.558543 67.493159 [43,] -491.494115 728.558543 [44,] 399.539754 -491.494115 [45,] -346.090234 399.539754 [46,] -27.983809 -346.090234 [47,] 189.734474 -27.983809 [48,] -299.530328 189.734474 [49,] 436.637614 -299.530328 [50,] -480.964132 436.637614 [51,] -5.718231 -480.964132 [52,] 831.125574 -5.718231 [53,] -851.201979 831.125574 [54,] -4.233600 -851.201979 [55,] -483.727923 -4.233600 [56,] 357.431072 -483.727923 [57,] -114.644827 357.431072 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -554.849250 -606.328260 2 -691.389111 -554.849250 3 490.698697 -691.389111 4 -689.135910 490.698697 5 -201.642562 -689.135910 6 -176.225409 -201.642562 7 43.741541 -176.225409 8 -129.455852 43.741541 9 712.235451 -129.455852 10 99.669923 712.235451 11 -347.600367 99.669923 12 383.788754 -347.600367 13 660.762924 383.788754 14 -179.472224 660.762924 15 -169.359225 -179.472224 16 603.891767 -169.359225 17 777.488024 603.891767 18 -60.311832 777.488024 19 795.122486 -60.311832 20 -220.669695 795.122486 21 374.926745 -220.669695 22 53.168591 374.926745 23 152.993635 53.168591 24 120.136159 152.993635 25 333.370736 120.136159 26 432.068497 333.370736 27 -347.820769 432.068497 28 -49.576761 -347.820769 29 207.863357 -49.576761 30 -487.787703 207.863357 31 136.358011 -487.787703 32 -406.845279 136.358011 33 -626.427134 -406.845279 34 -124.854706 -626.427134 35 4.872258 -124.854706 36 401.933675 4.872258 37 -875.922024 401.933675 38 919.756970 -875.922024 39 32.199529 919.756970 40 -696.304670 32.199529 41 67.493159 -696.304670 42 728.558543 67.493159 43 -491.494115 728.558543 44 399.539754 -491.494115 45 -346.090234 399.539754 46 -27.983809 -346.090234 47 189.734474 -27.983809 48 -299.530328 189.734474 49 436.637614 -299.530328 50 -480.964132 436.637614 51 -5.718231 -480.964132 52 831.125574 -5.718231 53 -851.201979 831.125574 54 -4.233600 -851.201979 55 -483.727923 -4.233600 56 357.431072 -483.727923 57 -114.644827 357.431072 > 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/70tnj1258494695.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/8k0k81258494695.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/99tqe1258494695.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/10prry1258494695.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/11u83s1258494695.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/12f1j61258494695.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/13avtp1258494695.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/14n8sb1258494695.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/158uhi1258494695.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/16ossu1258494695.tab") + } > > system("convert tmp/1e8d31258494695.ps tmp/1e8d31258494695.png") > system("convert tmp/2kpch1258494695.ps tmp/2kpch1258494695.png") > system("convert tmp/3pdni1258494695.ps tmp/3pdni1258494695.png") > system("convert tmp/4aiz41258494695.ps tmp/4aiz41258494695.png") > system("convert tmp/56n8o1258494695.ps tmp/56n8o1258494695.png") > system("convert tmp/6nrku1258494695.ps tmp/6nrku1258494695.png") > system("convert tmp/70tnj1258494695.ps tmp/70tnj1258494695.png") > system("convert tmp/8k0k81258494695.ps tmp/8k0k81258494695.png") > system("convert tmp/99tqe1258494695.ps tmp/99tqe1258494695.png") > system("convert tmp/10prry1258494695.ps tmp/10prry1258494695.png") > > > proc.time() user system elapsed 2.359 1.546 2.769