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(12300.00,0.00,12092.80,0.00,12380.80,0.00,12196.90,0.00,9455.00,0.00,13168.00,0.00,13427.90,0.00,11980.50,0.00,11884.80,0.00,11691.70,0.00,12233.80,0.00,14341.40,0.00,13130.70,0.00,12421.10,0.00,14285.80,0.00,12864.60,0.00,11160.20,0.00,14316.20,0.00,14388.70,0.00,14013.90,0.00,13419.00,0.00,12769.60,0.00,13315.50,0.00,15332.90,0.00,14243.00,0.00,13824.40,0.00,14962.90,0.00,13202.90,0.00,12199.00,0.00,15508.90,0.00,14199.80,0.00,15169.60,0.00,14058.00,0.00,13786.20,0.00,14147.90,0.00,16541.70,0.00,13587.50,0.00,15582.40,0.00,15802.80,0.00,14130.50,0.00,12923.20,0.00,15612.20,1.00,16033.70,1.00,16036.60,1.00,14037.80,1.00,15330.60,1.00,15038.30,1.00,17401.80,1.00,14992.50,1.00,16043.70,1.00,16929.60,1.00,15921.30,1.00,14417.20,1.00,15961.00,1.00,17851.90,1.00,16483.90,1.00,14215.50,1.00,17429.70,1.00,17839.50,1.00,17629.20,1.00),dim=c(2,60),dimnames=list(c('x','y'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('x','y'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x x y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 12300.0 0 1 0 0 0 0 0 0 0 0 0 0 1 2 12092.8 0 0 1 0 0 0 0 0 0 0 0 0 2 3 12380.8 0 0 0 1 0 0 0 0 0 0 0 0 3 4 12196.9 0 0 0 0 1 0 0 0 0 0 0 0 4 5 9455.0 0 0 0 0 0 1 0 0 0 0 0 0 5 6 13168.0 0 0 0 0 0 0 1 0 0 0 0 0 6 7 13427.9 0 0 0 0 0 0 0 1 0 0 0 0 7 8 11980.5 0 0 0 0 0 0 0 0 1 0 0 0 8 9 11884.8 0 0 0 0 0 0 0 0 0 1 0 0 9 10 11691.7 0 0 0 0 0 0 0 0 0 0 1 0 10 11 12233.8 0 0 0 0 0 0 0 0 0 0 0 1 11 12 14341.4 0 0 0 0 0 0 0 0 0 0 0 0 12 13 13130.7 0 1 0 0 0 0 0 0 0 0 0 0 13 14 12421.1 0 0 1 0 0 0 0 0 0 0 0 0 14 15 14285.8 0 0 0 1 0 0 0 0 0 0 0 0 15 16 12864.6 0 0 0 0 1 0 0 0 0 0 0 0 16 17 11160.2 0 0 0 0 0 1 0 0 0 0 0 0 17 18 14316.2 0 0 0 0 0 0 1 0 0 0 0 0 18 19 14388.7 0 0 0 0 0 0 0 1 0 0 0 0 19 20 14013.9 0 0 0 0 0 0 0 0 1 0 0 0 20 21 13419.0 0 0 0 0 0 0 0 0 0 1 0 0 21 22 12769.6 0 0 0 0 0 0 0 0 0 0 1 0 22 23 13315.5 0 0 0 0 0 0 0 0 0 0 0 1 23 24 15332.9 0 0 0 0 0 0 0 0 0 0 0 0 24 25 14243.0 0 1 0 0 0 0 0 0 0 0 0 0 25 26 13824.4 0 0 1 0 0 0 0 0 0 0 0 0 26 27 14962.9 0 0 0 1 0 0 0 0 0 0 0 0 27 28 13202.9 0 0 0 0 1 0 0 0 0 0 0 0 28 29 12199.0 0 0 0 0 0 1 0 0 0 0 0 0 29 30 15508.9 0 0 0 0 0 0 1 0 0 0 0 0 30 31 14199.8 0 0 0 0 0 0 0 1 0 0 0 0 31 32 15169.6 0 0 0 0 0 0 0 0 1 0 0 0 32 33 14058.0 0 0 0 0 0 0 0 0 0 1 0 0 33 34 13786.2 0 0 0 0 0 0 0 0 0 0 1 0 34 35 14147.9 0 0 0 0 0 0 0 0 0 0 0 1 35 36 16541.7 0 0 0 0 0 0 0 0 0 0 0 0 36 37 13587.5 0 1 0 0 0 0 0 0 0 0 0 0 37 38 15582.4 0 0 1 0 0 0 0 0 0 0 0 0 38 39 15802.8 0 0 0 1 0 0 0 0 0 0 0 0 39 40 14130.5 0 0 0 0 1 0 0 0 0 0 0 0 40 41 12923.2 0 0 0 0 0 1 0 0 0 0 0 0 41 42 15612.2 1 0 0 0 0 0 1 0 0 0 0 0 42 43 16033.7 1 0 0 0 0 0 0 1 0 0 0 0 43 44 16036.6 1 0 0 0 0 0 0 0 1 0 0 0 44 45 14037.8 1 0 0 0 0 0 0 0 0 1 0 0 45 46 15330.6 1 0 0 0 0 0 0 0 0 0 1 0 46 47 15038.3 1 0 0 0 0 0 0 0 0 0 0 1 47 48 17401.8 1 0 0 0 0 0 0 0 0 0 0 0 48 49 14992.5 1 1 0 0 0 0 0 0 0 0 0 0 49 50 16043.7 1 0 1 0 0 0 0 0 0 0 0 0 50 51 16929.6 1 0 0 1 0 0 0 0 0 0 0 0 51 52 15921.3 1 0 0 0 1 0 0 0 0 0 0 0 52 53 14417.2 1 0 0 0 0 1 0 0 0 0 0 0 53 54 15961.0 1 0 0 0 0 0 1 0 0 0 0 0 54 55 17851.9 1 0 0 0 0 0 0 1 0 0 0 0 55 56 16483.9 1 0 0 0 0 0 0 0 1 0 0 0 56 57 14215.5 1 0 0 0 0 0 0 0 0 1 0 0 57 58 17429.7 1 0 0 0 0 0 0 0 0 0 1 0 58 59 17839.5 1 0 0 0 0 0 0 0 0 0 0 1 59 60 17629.2 1 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) y M1 M2 M3 M4 13325.20 16.94 -1703.84 -1442.74 -644.28 -1934.46 M5 M6 M7 M8 M9 M10 -3647.82 -849.90 -663.80 -1188.34 -2483.26 -1885.76 M11 t -1653.36 81.04 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1262.63 -453.77 93.11 333.34 1369.39 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 13325.204 339.128 39.293 < 2e-16 *** y 16.943 292.055 0.058 0.953988 M1 -1703.838 390.609 -4.362 7.20e-05 *** M2 -1442.737 389.903 -3.700 0.000574 *** M3 -644.277 389.353 -1.655 0.104787 M4 -1934.456 388.960 -4.973 9.61e-06 *** M5 -3647.815 388.724 -9.384 2.95e-12 *** M6 -849.904 389.923 -2.180 0.034438 * M7 -663.803 389.059 -1.706 0.094719 . M8 -1188.342 388.350 -3.060 0.003687 ** M9 -2483.262 387.798 -6.403 7.18e-08 *** M10 -1885.761 387.404 -4.868 1.37e-05 *** M11 -1653.361 387.167 -4.270 9.67e-05 *** t 81.039 7.824 10.358 1.31e-13 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 612 on 46 degrees of freedom Multiple R-squared: 0.9106, Adjusted R-squared: 0.8853 F-statistic: 36.04 on 13 and 46 DF, p-value: < 2.2e-16 > 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.442251436 0.88450287 0.5577486 [2,] 0.277006390 0.55401278 0.7229936 [3,] 0.159072779 0.31814556 0.8409272 [4,] 0.170697679 0.34139536 0.8293023 [5,] 0.134034607 0.26806921 0.8659654 [6,] 0.083142550 0.16628510 0.9168575 [7,] 0.046280094 0.09256019 0.9537199 [8,] 0.024432639 0.04886528 0.9755674 [9,] 0.022332710 0.04466542 0.9776673 [10,] 0.011780020 0.02356004 0.9882200 [11,] 0.005502995 0.01100599 0.9944970 [12,] 0.012541969 0.02508394 0.9874580 [13,] 0.006971655 0.01394331 0.9930283 [14,] 0.006929885 0.01385977 0.9930701 [15,] 0.037679077 0.07535815 0.9623209 [16,] 0.033466252 0.06693250 0.9665337 [17,] 0.072199783 0.14439957 0.9278002 [18,] 0.059852960 0.11970592 0.9401470 [19,] 0.044436082 0.08887216 0.9555639 [20,] 0.037047433 0.07409487 0.9629526 [21,] 0.110616733 0.22123347 0.8893833 [22,] 0.130114196 0.26022839 0.8698858 [23,] 0.085112923 0.17022585 0.9148871 [24,] 0.055428248 0.11085650 0.9445718 [25,] 0.028106453 0.05621291 0.9718935 [26,] 0.019715549 0.03943110 0.9802845 [27,] 0.011581718 0.02316344 0.9884183 > postscript(file="/var/www/html/rcomp/tmp/1ra9y1227551398.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/2hytu1227551398.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/3cg461227551398.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/4xpl61227551398.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/52jje1227551398.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 597.59457 48.25457 -543.24543 481.99457 -627.58543 206.46326 7 8 9 10 11 12 199.22326 -804.67674 313.50326 -558.13674 -329.47674 43.72326 13 14 15 16 17 18 455.82163 -595.91837 389.28163 177.22163 105.14163 382.19032 19 20 21 22 23 24 187.55032 256.25032 875.23032 -452.70968 -220.24968 62.75032 25 26 27 28 29 30 595.64869 -165.09131 93.90869 -456.95131 171.46869 602.41738 31 32 33 34 35 36 -973.82262 439.47738 541.75738 -408.58262 -360.32262 299.07738 37 38 39 40 41 42 -1032.32425 620.43575 -38.66425 -501.82425 -76.80425 -283.69901 43 44 45 46 47 48 -129.33901 317.06099 -467.85901 146.40099 -459.33901 169.76099 49 50 51 52 53 54 -616.74065 92.31935 98.71935 299.55935 427.77935 -907.37195 55 56 57 58 59 60 716.38805 -208.11195 -1262.63195 1273.02805 1369.38805 -575.31195 > postscript(file="/var/www/html/rcomp/tmp/6z4j51227551398.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 597.59457 NA 1 48.25457 597.59457 2 -543.24543 48.25457 3 481.99457 -543.24543 4 -627.58543 481.99457 5 206.46326 -627.58543 6 199.22326 206.46326 7 -804.67674 199.22326 8 313.50326 -804.67674 9 -558.13674 313.50326 10 -329.47674 -558.13674 11 43.72326 -329.47674 12 455.82163 43.72326 13 -595.91837 455.82163 14 389.28163 -595.91837 15 177.22163 389.28163 16 105.14163 177.22163 17 382.19032 105.14163 18 187.55032 382.19032 19 256.25032 187.55032 20 875.23032 256.25032 21 -452.70968 875.23032 22 -220.24968 -452.70968 23 62.75032 -220.24968 24 595.64869 62.75032 25 -165.09131 595.64869 26 93.90869 -165.09131 27 -456.95131 93.90869 28 171.46869 -456.95131 29 602.41738 171.46869 30 -973.82262 602.41738 31 439.47738 -973.82262 32 541.75738 439.47738 33 -408.58262 541.75738 34 -360.32262 -408.58262 35 299.07738 -360.32262 36 -1032.32425 299.07738 37 620.43575 -1032.32425 38 -38.66425 620.43575 39 -501.82425 -38.66425 40 -76.80425 -501.82425 41 -283.69901 -76.80425 42 -129.33901 -283.69901 43 317.06099 -129.33901 44 -467.85901 317.06099 45 146.40099 -467.85901 46 -459.33901 146.40099 47 169.76099 -459.33901 48 -616.74065 169.76099 49 92.31935 -616.74065 50 98.71935 92.31935 51 299.55935 98.71935 52 427.77935 299.55935 53 -907.37195 427.77935 54 716.38805 -907.37195 55 -208.11195 716.38805 56 -1262.63195 -208.11195 57 1273.02805 -1262.63195 58 1369.38805 1273.02805 59 -575.31195 1369.38805 60 NA -575.31195 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 48.25457 597.59457 [2,] -543.24543 48.25457 [3,] 481.99457 -543.24543 [4,] -627.58543 481.99457 [5,] 206.46326 -627.58543 [6,] 199.22326 206.46326 [7,] -804.67674 199.22326 [8,] 313.50326 -804.67674 [9,] -558.13674 313.50326 [10,] -329.47674 -558.13674 [11,] 43.72326 -329.47674 [12,] 455.82163 43.72326 [13,] -595.91837 455.82163 [14,] 389.28163 -595.91837 [15,] 177.22163 389.28163 [16,] 105.14163 177.22163 [17,] 382.19032 105.14163 [18,] 187.55032 382.19032 [19,] 256.25032 187.55032 [20,] 875.23032 256.25032 [21,] -452.70968 875.23032 [22,] -220.24968 -452.70968 [23,] 62.75032 -220.24968 [24,] 595.64869 62.75032 [25,] -165.09131 595.64869 [26,] 93.90869 -165.09131 [27,] -456.95131 93.90869 [28,] 171.46869 -456.95131 [29,] 602.41738 171.46869 [30,] -973.82262 602.41738 [31,] 439.47738 -973.82262 [32,] 541.75738 439.47738 [33,] -408.58262 541.75738 [34,] -360.32262 -408.58262 [35,] 299.07738 -360.32262 [36,] -1032.32425 299.07738 [37,] 620.43575 -1032.32425 [38,] -38.66425 620.43575 [39,] -501.82425 -38.66425 [40,] -76.80425 -501.82425 [41,] -283.69901 -76.80425 [42,] -129.33901 -283.69901 [43,] 317.06099 -129.33901 [44,] -467.85901 317.06099 [45,] 146.40099 -467.85901 [46,] -459.33901 146.40099 [47,] 169.76099 -459.33901 [48,] -616.74065 169.76099 [49,] 92.31935 -616.74065 [50,] 98.71935 92.31935 [51,] 299.55935 98.71935 [52,] 427.77935 299.55935 [53,] -907.37195 427.77935 [54,] 716.38805 -907.37195 [55,] -208.11195 716.38805 [56,] -1262.63195 -208.11195 [57,] 1273.02805 -1262.63195 [58,] 1369.38805 1273.02805 [59,] -575.31195 1369.38805 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 48.25457 597.59457 2 -543.24543 48.25457 3 481.99457 -543.24543 4 -627.58543 481.99457 5 206.46326 -627.58543 6 199.22326 206.46326 7 -804.67674 199.22326 8 313.50326 -804.67674 9 -558.13674 313.50326 10 -329.47674 -558.13674 11 43.72326 -329.47674 12 455.82163 43.72326 13 -595.91837 455.82163 14 389.28163 -595.91837 15 177.22163 389.28163 16 105.14163 177.22163 17 382.19032 105.14163 18 187.55032 382.19032 19 256.25032 187.55032 20 875.23032 256.25032 21 -452.70968 875.23032 22 -220.24968 -452.70968 23 62.75032 -220.24968 24 595.64869 62.75032 25 -165.09131 595.64869 26 93.90869 -165.09131 27 -456.95131 93.90869 28 171.46869 -456.95131 29 602.41738 171.46869 30 -973.82262 602.41738 31 439.47738 -973.82262 32 541.75738 439.47738 33 -408.58262 541.75738 34 -360.32262 -408.58262 35 299.07738 -360.32262 36 -1032.32425 299.07738 37 620.43575 -1032.32425 38 -38.66425 620.43575 39 -501.82425 -38.66425 40 -76.80425 -501.82425 41 -283.69901 -76.80425 42 -129.33901 -283.69901 43 317.06099 -129.33901 44 -467.85901 317.06099 45 146.40099 -467.85901 46 -459.33901 146.40099 47 169.76099 -459.33901 48 -616.74065 169.76099 49 92.31935 -616.74065 50 98.71935 92.31935 51 299.55935 98.71935 52 427.77935 299.55935 53 -907.37195 427.77935 54 716.38805 -907.37195 55 -208.11195 716.38805 56 -1262.63195 -208.11195 57 1273.02805 -1262.63195 58 1369.38805 1273.02805 59 -575.31195 1369.38805 > 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/78n541227551398.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/8docv1227551398.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/9fn5s1227551398.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/10ywyh1227551398.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/115aay1227551398.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/1276dt1227551398.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/133qyp1227551398.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/14tlhu1227551398.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/155mom1227551398.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/16ieva1227551398.tab") + } > > system("convert tmp/1ra9y1227551398.ps tmp/1ra9y1227551398.png") > system("convert tmp/2hytu1227551398.ps tmp/2hytu1227551398.png") > system("convert tmp/3cg461227551398.ps tmp/3cg461227551398.png") > system("convert tmp/4xpl61227551398.ps tmp/4xpl61227551398.png") > system("convert tmp/52jje1227551398.ps tmp/52jje1227551398.png") > system("convert tmp/6z4j51227551398.ps tmp/6z4j51227551398.png") > system("convert tmp/78n541227551398.ps tmp/78n541227551398.png") > system("convert tmp/8docv1227551398.ps tmp/8docv1227551398.png") > system("convert tmp/9fn5s1227551398.ps tmp/9fn5s1227551398.png") > system("convert tmp/10ywyh1227551398.ps tmp/10ywyh1227551398.png") > > > proc.time() user system elapsed 2.415 1.588 3.971