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 = '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 x y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 12300.0 0 1 0 0 0 0 0 0 0 0 0 0 2 12092.8 0 0 1 0 0 0 0 0 0 0 0 0 3 12380.8 0 0 0 1 0 0 0 0 0 0 0 0 4 12196.9 0 0 0 0 1 0 0 0 0 0 0 0 5 9455.0 0 0 0 0 0 1 0 0 0 0 0 0 6 13168.0 0 0 0 0 0 0 1 0 0 0 0 0 7 13427.9 0 0 0 0 0 0 0 1 0 0 0 0 8 11980.5 0 0 0 0 0 0 0 0 1 0 0 0 9 11884.8 0 0 0 0 0 0 0 0 0 1 0 0 10 11691.7 0 0 0 0 0 0 0 0 0 0 1 0 11 12233.8 0 0 0 0 0 0 0 0 0 0 0 1 12 14341.4 0 0 0 0 0 0 0 0 0 0 0 0 13 13130.7 0 1 0 0 0 0 0 0 0 0 0 0 14 12421.1 0 0 1 0 0 0 0 0 0 0 0 0 15 14285.8 0 0 0 1 0 0 0 0 0 0 0 0 16 12864.6 0 0 0 0 1 0 0 0 0 0 0 0 17 11160.2 0 0 0 0 0 1 0 0 0 0 0 0 18 14316.2 0 0 0 0 0 0 1 0 0 0 0 0 19 14388.7 0 0 0 0 0 0 0 1 0 0 0 0 20 14013.9 0 0 0 0 0 0 0 0 1 0 0 0 21 13419.0 0 0 0 0 0 0 0 0 0 1 0 0 22 12769.6 0 0 0 0 0 0 0 0 0 0 1 0 23 13315.5 0 0 0 0 0 0 0 0 0 0 0 1 24 15332.9 0 0 0 0 0 0 0 0 0 0 0 0 25 14243.0 0 1 0 0 0 0 0 0 0 0 0 0 26 13824.4 0 0 1 0 0 0 0 0 0 0 0 0 27 14962.9 0 0 0 1 0 0 0 0 0 0 0 0 28 13202.9 0 0 0 0 1 0 0 0 0 0 0 0 29 12199.0 0 0 0 0 0 1 0 0 0 0 0 0 30 15508.9 0 0 0 0 0 0 1 0 0 0 0 0 31 14199.8 0 0 0 0 0 0 0 1 0 0 0 0 32 15169.6 0 0 0 0 0 0 0 0 1 0 0 0 33 14058.0 0 0 0 0 0 0 0 0 0 1 0 0 34 13786.2 0 0 0 0 0 0 0 0 0 0 1 0 35 14147.9 0 0 0 0 0 0 0 0 0 0 0 1 36 16541.7 0 0 0 0 0 0 0 0 0 0 0 0 37 13587.5 0 1 0 0 0 0 0 0 0 0 0 0 38 15582.4 0 0 1 0 0 0 0 0 0 0 0 0 39 15802.8 0 0 0 1 0 0 0 0 0 0 0 0 40 14130.5 0 0 0 0 1 0 0 0 0 0 0 0 41 12923.2 0 0 0 0 0 1 0 0 0 0 0 0 42 15612.2 1 0 0 0 0 0 1 0 0 0 0 0 43 16033.7 1 0 0 0 0 0 0 1 0 0 0 0 44 16036.6 1 0 0 0 0 0 0 0 1 0 0 0 45 14037.8 1 0 0 0 0 0 0 0 0 1 0 0 46 15330.6 1 0 0 0 0 0 0 0 0 0 1 0 47 15038.3 1 0 0 0 0 0 0 0 0 0 0 1 48 17401.8 1 0 0 0 0 0 0 0 0 0 0 0 49 14992.5 1 1 0 0 0 0 0 0 0 0 0 0 50 16043.7 1 0 1 0 0 0 0 0 0 0 0 0 51 16929.6 1 0 0 1 0 0 0 0 0 0 0 0 52 15921.3 1 0 0 0 1 0 0 0 0 0 0 0 53 14417.2 1 0 0 0 0 1 0 0 0 0 0 0 54 15961.0 1 0 0 0 0 0 1 0 0 0 0 0 55 17851.9 1 0 0 0 0 0 0 1 0 0 0 0 56 16483.9 1 0 0 0 0 0 0 0 1 0 0 0 57 14215.5 1 0 0 0 0 0 0 0 0 1 0 0 58 17429.7 1 0 0 0 0 0 0 0 0 0 1 0 59 17839.5 1 0 0 0 0 0 0 0 0 0 0 1 60 17629.2 1 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) y M1 M2 M3 M4 15270.1 2448.1 -2109.0 -1766.9 -887.4 -2096.5 M5 M6 M7 M8 M9 M10 -3728.9 -1336.1 -1069.0 -1512.5 -2726.4 -2047.8 M11 -1734.4 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2086.29 -766.99 -15.88 588.15 2079.15 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 15270.1 510.0 29.940 < 2e-16 *** y 2448.1 313.9 7.799 5.09e-10 *** M1 -2109.0 701.9 -3.005 0.004253 ** M2 -1766.9 701.9 -2.517 0.015293 * M3 -887.4 701.9 -1.264 0.212360 M4 -2096.5 701.9 -2.987 0.004466 ** M5 -3728.9 701.9 -5.313 2.90e-06 *** M6 -1336.1 699.1 -1.911 0.062077 . M7 -1069.0 699.1 -1.529 0.132929 M8 -1512.5 699.1 -2.164 0.035615 * M9 -2726.4 699.1 -3.900 0.000305 *** M10 -2047.8 699.1 -2.929 0.005226 ** M11 -1734.4 699.1 -2.481 0.016738 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1105 on 47 degrees of freedom Multiple R-squared: 0.7021, Adjusted R-squared: 0.626 F-statistic: 9.229 on 12 and 47 DF, p-value: 8.837e-09 > 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.6470593 0.7058814 0.3529407 [2,] 0.7429579 0.5140842 0.2570421 [3,] 0.6965941 0.6068118 0.3034059 [4,] 0.6316363 0.7367274 0.3683637 [5,] 0.7343391 0.5313218 0.2656609 [6,] 0.7308522 0.5382955 0.2691478 [7,] 0.7413846 0.5172309 0.2586154 [8,] 0.7362554 0.5274893 0.2637446 [9,] 0.7001410 0.5997180 0.2998590 [10,] 0.7233313 0.5533374 0.2766687 [11,] 0.7690049 0.4619902 0.2309951 [12,] 0.7823737 0.4352525 0.2176263 [13,] 0.7540572 0.4918857 0.2459428 [14,] 0.7864400 0.4271201 0.2135600 [15,] 0.8179486 0.3641029 0.1820514 [16,] 0.8051141 0.3897718 0.1948859 [17,] 0.8181101 0.3637798 0.1818899 [18,] 0.8406024 0.3187951 0.1593976 [19,] 0.8463488 0.3073025 0.1536512 [20,] 0.8362451 0.3275098 0.1637549 [21,] 0.7994428 0.4011144 0.2005572 [22,] 0.7155764 0.5688471 0.2844236 [23,] 0.7501365 0.4997271 0.2498635 [24,] 0.6973760 0.6052480 0.3026240 [25,] 0.6048944 0.7902113 0.3951056 [26,] 0.5192858 0.9614285 0.4807142 [27,] 0.3864883 0.7729766 0.6135117 [28,] 0.3698290 0.7396579 0.6301710 [29,] 0.2344662 0.4689324 0.7655338 > postscript(file="/var/www/html/freestat/rcomp/tmp/1gph11227551246.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/freestat/rcomp/tmp/20d021227551246.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/freestat/rcomp/tmp/3l5qa1227551246.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/freestat/rcomp/tmp/48ccx1227551246.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/freestat/rcomp/tmp/5fuic1227551246.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 -861.114839 -1410.454839 -2001.954839 -976.714839 -2086.294839 -766.009677 7 8 9 10 11 12 -773.249677 -1777.149677 -658.969677 -1530.609677 -1301.949677 -928.749677 13 14 15 16 17 18 -30.414839 -1082.154839 -96.954839 -309.014839 -381.094839 382.190323 19 20 21 22 23 24 187.550323 256.250323 875.230323 -452.709677 -220.249677 62.750323 25 26 27 28 29 30 1081.885161 321.145161 580.145161 29.285161 657.705161 1574.890323 31 32 33 34 35 36 -1.349677 1411.950323 1514.230323 563.890323 612.150323 1271.550323 37 38 39 40 41 42 426.385161 2079.145161 1420.045161 956.885161 1381.905161 -769.935484 43 44 45 46 47 48 -615.575484 -169.175484 -954.095484 -339.835484 -945.575484 -316.475484 49 50 51 52 53 54 -616.740645 92.319355 98.719355 299.559355 427.779355 -421.135484 55 56 57 58 59 60 1202.624516 278.124516 -776.395484 1759.264516 1855.624516 -89.075484 > postscript(file="/var/www/html/freestat/rcomp/tmp/6frso1227551246.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 -861.114839 NA 1 -1410.454839 -861.114839 2 -2001.954839 -1410.454839 3 -976.714839 -2001.954839 4 -2086.294839 -976.714839 5 -766.009677 -2086.294839 6 -773.249677 -766.009677 7 -1777.149677 -773.249677 8 -658.969677 -1777.149677 9 -1530.609677 -658.969677 10 -1301.949677 -1530.609677 11 -928.749677 -1301.949677 12 -30.414839 -928.749677 13 -1082.154839 -30.414839 14 -96.954839 -1082.154839 15 -309.014839 -96.954839 16 -381.094839 -309.014839 17 382.190323 -381.094839 18 187.550323 382.190323 19 256.250323 187.550323 20 875.230323 256.250323 21 -452.709677 875.230323 22 -220.249677 -452.709677 23 62.750323 -220.249677 24 1081.885161 62.750323 25 321.145161 1081.885161 26 580.145161 321.145161 27 29.285161 580.145161 28 657.705161 29.285161 29 1574.890323 657.705161 30 -1.349677 1574.890323 31 1411.950323 -1.349677 32 1514.230323 1411.950323 33 563.890323 1514.230323 34 612.150323 563.890323 35 1271.550323 612.150323 36 426.385161 1271.550323 37 2079.145161 426.385161 38 1420.045161 2079.145161 39 956.885161 1420.045161 40 1381.905161 956.885161 41 -769.935484 1381.905161 42 -615.575484 -769.935484 43 -169.175484 -615.575484 44 -954.095484 -169.175484 45 -339.835484 -954.095484 46 -945.575484 -339.835484 47 -316.475484 -945.575484 48 -616.740645 -316.475484 49 92.319355 -616.740645 50 98.719355 92.319355 51 299.559355 98.719355 52 427.779355 299.559355 53 -421.135484 427.779355 54 1202.624516 -421.135484 55 278.124516 1202.624516 56 -776.395484 278.124516 57 1759.264516 -776.395484 58 1855.624516 1759.264516 59 -89.075484 1855.624516 60 NA -89.075484 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1410.454839 -861.114839 [2,] -2001.954839 -1410.454839 [3,] -976.714839 -2001.954839 [4,] -2086.294839 -976.714839 [5,] -766.009677 -2086.294839 [6,] -773.249677 -766.009677 [7,] -1777.149677 -773.249677 [8,] -658.969677 -1777.149677 [9,] -1530.609677 -658.969677 [10,] -1301.949677 -1530.609677 [11,] -928.749677 -1301.949677 [12,] -30.414839 -928.749677 [13,] -1082.154839 -30.414839 [14,] -96.954839 -1082.154839 [15,] -309.014839 -96.954839 [16,] -381.094839 -309.014839 [17,] 382.190323 -381.094839 [18,] 187.550323 382.190323 [19,] 256.250323 187.550323 [20,] 875.230323 256.250323 [21,] -452.709677 875.230323 [22,] -220.249677 -452.709677 [23,] 62.750323 -220.249677 [24,] 1081.885161 62.750323 [25,] 321.145161 1081.885161 [26,] 580.145161 321.145161 [27,] 29.285161 580.145161 [28,] 657.705161 29.285161 [29,] 1574.890323 657.705161 [30,] -1.349677 1574.890323 [31,] 1411.950323 -1.349677 [32,] 1514.230323 1411.950323 [33,] 563.890323 1514.230323 [34,] 612.150323 563.890323 [35,] 1271.550323 612.150323 [36,] 426.385161 1271.550323 [37,] 2079.145161 426.385161 [38,] 1420.045161 2079.145161 [39,] 956.885161 1420.045161 [40,] 1381.905161 956.885161 [41,] -769.935484 1381.905161 [42,] -615.575484 -769.935484 [43,] -169.175484 -615.575484 [44,] -954.095484 -169.175484 [45,] -339.835484 -954.095484 [46,] -945.575484 -339.835484 [47,] -316.475484 -945.575484 [48,] -616.740645 -316.475484 [49,] 92.319355 -616.740645 [50,] 98.719355 92.319355 [51,] 299.559355 98.719355 [52,] 427.779355 299.559355 [53,] -421.135484 427.779355 [54,] 1202.624516 -421.135484 [55,] 278.124516 1202.624516 [56,] -776.395484 278.124516 [57,] 1759.264516 -776.395484 [58,] 1855.624516 1759.264516 [59,] -89.075484 1855.624516 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1410.454839 -861.114839 2 -2001.954839 -1410.454839 3 -976.714839 -2001.954839 4 -2086.294839 -976.714839 5 -766.009677 -2086.294839 6 -773.249677 -766.009677 7 -1777.149677 -773.249677 8 -658.969677 -1777.149677 9 -1530.609677 -658.969677 10 -1301.949677 -1530.609677 11 -928.749677 -1301.949677 12 -30.414839 -928.749677 13 -1082.154839 -30.414839 14 -96.954839 -1082.154839 15 -309.014839 -96.954839 16 -381.094839 -309.014839 17 382.190323 -381.094839 18 187.550323 382.190323 19 256.250323 187.550323 20 875.230323 256.250323 21 -452.709677 875.230323 22 -220.249677 -452.709677 23 62.750323 -220.249677 24 1081.885161 62.750323 25 321.145161 1081.885161 26 580.145161 321.145161 27 29.285161 580.145161 28 657.705161 29.285161 29 1574.890323 657.705161 30 -1.349677 1574.890323 31 1411.950323 -1.349677 32 1514.230323 1411.950323 33 563.890323 1514.230323 34 612.150323 563.890323 35 1271.550323 612.150323 36 426.385161 1271.550323 37 2079.145161 426.385161 38 1420.045161 2079.145161 39 956.885161 1420.045161 40 1381.905161 956.885161 41 -769.935484 1381.905161 42 -615.575484 -769.935484 43 -169.175484 -615.575484 44 -954.095484 -169.175484 45 -339.835484 -954.095484 46 -945.575484 -339.835484 47 -316.475484 -945.575484 48 -616.740645 -316.475484 49 92.319355 -616.740645 50 98.719355 92.319355 51 299.559355 98.719355 52 427.779355 299.559355 53 -421.135484 427.779355 54 1202.624516 -421.135484 55 278.124516 1202.624516 56 -776.395484 278.124516 57 1759.264516 -776.395484 58 1855.624516 1759.264516 59 -89.075484 1855.624516 > 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/freestat/rcomp/tmp/7xhd21227551246.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/freestat/rcomp/tmp/8g6l61227551246.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/freestat/rcomp/tmp/9m8ko1227551246.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/freestat/rcomp/tmp/109onp1227551246.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11d7s31227551246.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/freestat/rcomp/tmp/128tln1227551246.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/freestat/rcomp/tmp/13rs481227551246.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/freestat/rcomp/tmp/1424341227551246.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/freestat/rcomp/tmp/15f0301227551246.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/freestat/rcomp/tmp/1654pt1227551246.tab") + } > > system("convert tmp/1gph11227551246.ps tmp/1gph11227551246.png") > system("convert tmp/20d021227551246.ps tmp/20d021227551246.png") > system("convert tmp/3l5qa1227551246.ps tmp/3l5qa1227551246.png") > system("convert tmp/48ccx1227551246.ps tmp/48ccx1227551246.png") > system("convert tmp/5fuic1227551246.ps tmp/5fuic1227551246.png") > system("convert tmp/6frso1227551246.ps tmp/6frso1227551246.png") > system("convert tmp/7xhd21227551246.ps tmp/7xhd21227551246.png") > system("convert tmp/8g6l61227551246.ps tmp/8g6l61227551246.png") > system("convert tmp/9m8ko1227551246.ps tmp/9m8ko1227551246.png") > system("convert tmp/109onp1227551246.ps tmp/109onp1227551246.png") > > > proc.time() user system elapsed 3.634 2.475 4.060