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(2253,14.9,2218,18.6,1855,19.1,2187,18.8,1852,18.2,1570,18,1851,19,1954,20.7,1828,21.2,2251,20.7,2277,19.6,2085,18.6,2282,18.7,2266,23.8,1878,24.9,2267,24.8,2069,23.8,1746,22.3,2299,21.7,2360,20.7,2214,19.7,2825,18.4,2355,17.4,2333,17,3016,18,2155,23.8,2172,25.5,2150,25.6,2533,23.7,2058,22,2160,21.3,2260,20.7,2498,20.4,2695,20.3,2799,20.4,2946,19.8,2930,19.5,2318,23.1,2540,23.5,2570,23.5,2669,22.9,2450,21.9,2842,21.5,3440,20.5,2678,20.2,2981,19.4,2260,19.2,2844,18.8,2546,18.8,2456,22.6,2295,23.3,2379,23,2479,21.4,2057,19.9,2280,18.8,2351,18.6,2276,18.4,2548,18.6,2311,19.9,2201,19.2),dim=c(2,60),dimnames=list(c('wngb','<25'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('wngb','<25'),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 wngb <25 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 2253 14.9 1 0 0 0 0 0 0 0 0 0 0 1 2 2218 18.6 0 1 0 0 0 0 0 0 0 0 0 2 3 1855 19.1 0 0 1 0 0 0 0 0 0 0 0 3 4 2187 18.8 0 0 0 1 0 0 0 0 0 0 0 4 5 1852 18.2 0 0 0 0 1 0 0 0 0 0 0 5 6 1570 18.0 0 0 0 0 0 1 0 0 0 0 0 6 7 1851 19.0 0 0 0 0 0 0 1 0 0 0 0 7 8 1954 20.7 0 0 0 0 0 0 0 1 0 0 0 8 9 1828 21.2 0 0 0 0 0 0 0 0 1 0 0 9 10 2251 20.7 0 0 0 0 0 0 0 0 0 1 0 10 11 2277 19.6 0 0 0 0 0 0 0 0 0 0 1 11 12 2085 18.6 0 0 0 0 0 0 0 0 0 0 0 12 13 2282 18.7 1 0 0 0 0 0 0 0 0 0 0 13 14 2266 23.8 0 1 0 0 0 0 0 0 0 0 0 14 15 1878 24.9 0 0 1 0 0 0 0 0 0 0 0 15 16 2267 24.8 0 0 0 1 0 0 0 0 0 0 0 16 17 2069 23.8 0 0 0 0 1 0 0 0 0 0 0 17 18 1746 22.3 0 0 0 0 0 1 0 0 0 0 0 18 19 2299 21.7 0 0 0 0 0 0 1 0 0 0 0 19 20 2360 20.7 0 0 0 0 0 0 0 1 0 0 0 20 21 2214 19.7 0 0 0 0 0 0 0 0 1 0 0 21 22 2825 18.4 0 0 0 0 0 0 0 0 0 1 0 22 23 2355 17.4 0 0 0 0 0 0 0 0 0 0 1 23 24 2333 17.0 0 0 0 0 0 0 0 0 0 0 0 24 25 3016 18.0 1 0 0 0 0 0 0 0 0 0 0 25 26 2155 23.8 0 1 0 0 0 0 0 0 0 0 0 26 27 2172 25.5 0 0 1 0 0 0 0 0 0 0 0 27 28 2150 25.6 0 0 0 1 0 0 0 0 0 0 0 28 29 2533 23.7 0 0 0 0 1 0 0 0 0 0 0 29 30 2058 22.0 0 0 0 0 0 1 0 0 0 0 0 30 31 2160 21.3 0 0 0 0 0 0 1 0 0 0 0 31 32 2260 20.7 0 0 0 0 0 0 0 1 0 0 0 32 33 2498 20.4 0 0 0 0 0 0 0 0 1 0 0 33 34 2695 20.3 0 0 0 0 0 0 0 0 0 1 0 34 35 2799 20.4 0 0 0 0 0 0 0 0 0 0 1 35 36 2946 19.8 0 0 0 0 0 0 0 0 0 0 0 36 37 2930 19.5 1 0 0 0 0 0 0 0 0 0 0 37 38 2318 23.1 0 1 0 0 0 0 0 0 0 0 0 38 39 2540 23.5 0 0 1 0 0 0 0 0 0 0 0 39 40 2570 23.5 0 0 0 1 0 0 0 0 0 0 0 40 41 2669 22.9 0 0 0 0 1 0 0 0 0 0 0 41 42 2450 21.9 0 0 0 0 0 1 0 0 0 0 0 42 43 2842 21.5 0 0 0 0 0 0 1 0 0 0 0 43 44 3440 20.5 0 0 0 0 0 0 0 1 0 0 0 44 45 2678 20.2 0 0 0 0 0 0 0 0 1 0 0 45 46 2981 19.4 0 0 0 0 0 0 0 0 0 1 0 46 47 2260 19.2 0 0 0 0 0 0 0 0 0 0 1 47 48 2844 18.8 0 0 0 0 0 0 0 0 0 0 0 48 49 2546 18.8 1 0 0 0 0 0 0 0 0 0 0 49 50 2456 22.6 0 1 0 0 0 0 0 0 0 0 0 50 51 2295 23.3 0 0 1 0 0 0 0 0 0 0 0 51 52 2379 23.0 0 0 0 1 0 0 0 0 0 0 0 52 53 2479 21.4 0 0 0 0 1 0 0 0 0 0 0 53 54 2057 19.9 0 0 0 0 0 1 0 0 0 0 0 54 55 2280 18.8 0 0 0 0 0 0 1 0 0 0 0 55 56 2351 18.6 0 0 0 0 0 0 0 1 0 0 0 56 57 2276 18.4 0 0 0 0 0 0 0 0 1 0 0 57 58 2548 18.6 0 0 0 0 0 0 0 0 0 1 0 58 59 2311 19.9 0 0 0 0 0 0 0 0 0 0 1 59 60 2201 19.2 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) `<25` M1 M2 M3 M4 1681.394 25.680 239.567 -205.134 -371.241 -214.468 M5 M6 M7 M8 M9 M10 -184.301 -507.106 -196.570 -13.228 -189.660 175.472 M11 t -88.414 8.908 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -507.95 -185.76 -36.66 181.10 853.42 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1681.394 447.085 3.761 0.000477 *** `<25` 25.680 23.578 1.089 0.281760 M1 239.567 179.371 1.336 0.188252 M2 -205.134 201.199 -1.020 0.313270 M3 -371.241 211.048 -1.759 0.085222 . M4 -214.468 209.102 -1.026 0.310416 M5 -184.301 196.018 -0.940 0.352015 M6 -507.106 185.822 -2.729 0.008969 ** M7 -196.570 183.298 -1.072 0.289132 M8 -13.228 181.886 -0.073 0.942338 M9 -189.660 180.498 -1.051 0.298858 M10 175.472 178.652 0.982 0.331138 M11 -88.414 178.147 -0.496 0.622050 t 8.908 2.194 4.060 0.000189 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 280.6 on 46 degrees of freedom Multiple R-squared: 0.4979, Adjusted R-squared: 0.356 F-statistic: 3.508 on 13 and 46 DF, p-value: 0.0007974 > 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.0122714685 0.0245429369 0.9877285 [2,] 0.0046756261 0.0093512522 0.9953244 [3,] 0.0073077722 0.0146155445 0.9926922 [4,] 0.0023839815 0.0047679629 0.9976160 [5,] 0.0008932019 0.0017864038 0.9991068 [6,] 0.0002559738 0.0005119477 0.9997440 [7,] 0.0020221451 0.0040442903 0.9979779 [8,] 0.0009001603 0.0018003206 0.9990998 [9,] 0.0020043946 0.0040087892 0.9979956 [10,] 0.0116893276 0.0233786553 0.9883107 [11,] 0.0068224127 0.0136448254 0.9931776 [12,] 0.0149191901 0.0298383803 0.9850808 [13,] 0.0134278247 0.0268556494 0.9865722 [14,] 0.0086482811 0.0172965622 0.9913517 [15,] 0.0179797123 0.0359594246 0.9820203 [16,] 0.1483374226 0.2966748453 0.8516626 [17,] 0.1534668594 0.3069337187 0.8465331 [18,] 0.3133359118 0.6266718236 0.6866641 [19,] 0.2499999855 0.4999999710 0.7500000 [20,] 0.2683081609 0.5366163218 0.7316918 [21,] 0.1885217130 0.3770434260 0.8114783 [22,] 0.3169947316 0.6339894632 0.6830053 [23,] 0.2273747267 0.4547494535 0.7726253 [24,] 0.1666818835 0.3333637670 0.8333181 [25,] 0.1567952553 0.3135905105 0.8432047 [26,] 0.1243098534 0.2486197068 0.8756901 [27,] 0.1040586994 0.2081173989 0.8959413 > postscript(file="/var/www/html/rcomp/tmp/10nbc1258737461.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/2a9zh1258737461.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/3f52i1258737461.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/4zav51258737461.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/56pxt1258737461.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 -59.506192 246.270011 27.628521 201.650973 -157.016383 -119.983067 7 8 9 10 11 12 -184.108260 -317.014416 -288.331436 -226.531436 82.694430 -180.947060 13 14 15 16 17 18 -234.990550 53.833248 -205.216416 20.669978 -190.725262 -161.307570 19 20 21 22 23 24 87.655700 -17.913674 29.289740 299.633971 110.291808 1.242145 25 26 27 28 29 30 410.086394 -164.066011 -33.523848 -223.773512 168.943508 51.497259 31 32 33 34 35 36 -147.971443 -224.812933 188.414278 13.942163 370.351682 435.438076 37 38 39 40 41 42 178.666702 -89.989067 278.937472 143.255837 218.588481 339.166029 43 44 45 46 47 48 421.993241 853.423866 266.651078 216.155165 -244.731230 252.219107 49 50 51 52 53 54 -294.256354 -46.048181 -67.825729 -141.803277 -39.790344 -109.372651 55 56 57 58 59 60 -177.569237 -293.682843 -196.023660 -303.199863 -318.606691 -507.952268 > postscript(file="/var/www/html/rcomp/tmp/68zgw1258737461.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 -59.506192 NA 1 246.270011 -59.506192 2 27.628521 246.270011 3 201.650973 27.628521 4 -157.016383 201.650973 5 -119.983067 -157.016383 6 -184.108260 -119.983067 7 -317.014416 -184.108260 8 -288.331436 -317.014416 9 -226.531436 -288.331436 10 82.694430 -226.531436 11 -180.947060 82.694430 12 -234.990550 -180.947060 13 53.833248 -234.990550 14 -205.216416 53.833248 15 20.669978 -205.216416 16 -190.725262 20.669978 17 -161.307570 -190.725262 18 87.655700 -161.307570 19 -17.913674 87.655700 20 29.289740 -17.913674 21 299.633971 29.289740 22 110.291808 299.633971 23 1.242145 110.291808 24 410.086394 1.242145 25 -164.066011 410.086394 26 -33.523848 -164.066011 27 -223.773512 -33.523848 28 168.943508 -223.773512 29 51.497259 168.943508 30 -147.971443 51.497259 31 -224.812933 -147.971443 32 188.414278 -224.812933 33 13.942163 188.414278 34 370.351682 13.942163 35 435.438076 370.351682 36 178.666702 435.438076 37 -89.989067 178.666702 38 278.937472 -89.989067 39 143.255837 278.937472 40 218.588481 143.255837 41 339.166029 218.588481 42 421.993241 339.166029 43 853.423866 421.993241 44 266.651078 853.423866 45 216.155165 266.651078 46 -244.731230 216.155165 47 252.219107 -244.731230 48 -294.256354 252.219107 49 -46.048181 -294.256354 50 -67.825729 -46.048181 51 -141.803277 -67.825729 52 -39.790344 -141.803277 53 -109.372651 -39.790344 54 -177.569237 -109.372651 55 -293.682843 -177.569237 56 -196.023660 -293.682843 57 -303.199863 -196.023660 58 -318.606691 -303.199863 59 -507.952268 -318.606691 60 NA -507.952268 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 246.270011 -59.506192 [2,] 27.628521 246.270011 [3,] 201.650973 27.628521 [4,] -157.016383 201.650973 [5,] -119.983067 -157.016383 [6,] -184.108260 -119.983067 [7,] -317.014416 -184.108260 [8,] -288.331436 -317.014416 [9,] -226.531436 -288.331436 [10,] 82.694430 -226.531436 [11,] -180.947060 82.694430 [12,] -234.990550 -180.947060 [13,] 53.833248 -234.990550 [14,] -205.216416 53.833248 [15,] 20.669978 -205.216416 [16,] -190.725262 20.669978 [17,] -161.307570 -190.725262 [18,] 87.655700 -161.307570 [19,] -17.913674 87.655700 [20,] 29.289740 -17.913674 [21,] 299.633971 29.289740 [22,] 110.291808 299.633971 [23,] 1.242145 110.291808 [24,] 410.086394 1.242145 [25,] -164.066011 410.086394 [26,] -33.523848 -164.066011 [27,] -223.773512 -33.523848 [28,] 168.943508 -223.773512 [29,] 51.497259 168.943508 [30,] -147.971443 51.497259 [31,] -224.812933 -147.971443 [32,] 188.414278 -224.812933 [33,] 13.942163 188.414278 [34,] 370.351682 13.942163 [35,] 435.438076 370.351682 [36,] 178.666702 435.438076 [37,] -89.989067 178.666702 [38,] 278.937472 -89.989067 [39,] 143.255837 278.937472 [40,] 218.588481 143.255837 [41,] 339.166029 218.588481 [42,] 421.993241 339.166029 [43,] 853.423866 421.993241 [44,] 266.651078 853.423866 [45,] 216.155165 266.651078 [46,] -244.731230 216.155165 [47,] 252.219107 -244.731230 [48,] -294.256354 252.219107 [49,] -46.048181 -294.256354 [50,] -67.825729 -46.048181 [51,] -141.803277 -67.825729 [52,] -39.790344 -141.803277 [53,] -109.372651 -39.790344 [54,] -177.569237 -109.372651 [55,] -293.682843 -177.569237 [56,] -196.023660 -293.682843 [57,] -303.199863 -196.023660 [58,] -318.606691 -303.199863 [59,] -507.952268 -318.606691 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 246.270011 -59.506192 2 27.628521 246.270011 3 201.650973 27.628521 4 -157.016383 201.650973 5 -119.983067 -157.016383 6 -184.108260 -119.983067 7 -317.014416 -184.108260 8 -288.331436 -317.014416 9 -226.531436 -288.331436 10 82.694430 -226.531436 11 -180.947060 82.694430 12 -234.990550 -180.947060 13 53.833248 -234.990550 14 -205.216416 53.833248 15 20.669978 -205.216416 16 -190.725262 20.669978 17 -161.307570 -190.725262 18 87.655700 -161.307570 19 -17.913674 87.655700 20 29.289740 -17.913674 21 299.633971 29.289740 22 110.291808 299.633971 23 1.242145 110.291808 24 410.086394 1.242145 25 -164.066011 410.086394 26 -33.523848 -164.066011 27 -223.773512 -33.523848 28 168.943508 -223.773512 29 51.497259 168.943508 30 -147.971443 51.497259 31 -224.812933 -147.971443 32 188.414278 -224.812933 33 13.942163 188.414278 34 370.351682 13.942163 35 435.438076 370.351682 36 178.666702 435.438076 37 -89.989067 178.666702 38 278.937472 -89.989067 39 143.255837 278.937472 40 218.588481 143.255837 41 339.166029 218.588481 42 421.993241 339.166029 43 853.423866 421.993241 44 266.651078 853.423866 45 216.155165 266.651078 46 -244.731230 216.155165 47 252.219107 -244.731230 48 -294.256354 252.219107 49 -46.048181 -294.256354 50 -67.825729 -46.048181 51 -141.803277 -67.825729 52 -39.790344 -141.803277 53 -109.372651 -39.790344 54 -177.569237 -109.372651 55 -293.682843 -177.569237 56 -196.023660 -293.682843 57 -303.199863 -196.023660 58 -318.606691 -303.199863 59 -507.952268 -318.606691 > 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/78h6q1258737461.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/8z6561258737461.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/94xkn1258737461.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/10nrmz1258737461.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/115v291258737461.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/12mnai1258737461.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/13ubza1258737461.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/14ih541258737461.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/1549mg1258737461.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/16vtn11258737461.tab") + } > system("convert tmp/10nbc1258737461.ps tmp/10nbc1258737461.png") > system("convert tmp/2a9zh1258737461.ps tmp/2a9zh1258737461.png") > system("convert tmp/3f52i1258737461.ps tmp/3f52i1258737461.png") > system("convert tmp/4zav51258737461.ps tmp/4zav51258737461.png") > system("convert tmp/56pxt1258737461.ps tmp/56pxt1258737461.png") > system("convert tmp/68zgw1258737461.ps tmp/68zgw1258737461.png") > system("convert tmp/78h6q1258737461.ps tmp/78h6q1258737461.png") > system("convert tmp/8z6561258737461.ps tmp/8z6561258737461.png") > system("convert tmp/94xkn1258737461.ps tmp/94xkn1258737461.png") > system("convert tmp/10nrmz1258737461.ps tmp/10nrmz1258737461.png") > > > proc.time() user system elapsed 2.399 1.584 4.087