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(3016,0,2155,0,2172,0,2150,0,2533,0,2058,0,2160,0,2260,0,2498,0,2695,0,2799,0,2946,0,2930,0,2318,0,2540,0,2570,0,2669,0,2450,0,2842,0,3440,0,2678,0,2981,0,2260,0,2844,0,2546,0,2456,0,2295,0,2379,0,2479,0,2057,0,2280,0,2351,0,2276,0,2548,1,2311,1,2201,1,2725,1,2408,1,2139,1,1898,1,2537,1,2068,1,2063,1,2520,1,2434,1,2190,1,2794,1,2070,1,2615,1,2265,1,2139,1,2428,1,2137,1,1823,1,2063,1,1806,1,1758,1,2243,1,1993,1,1932,1,2465,1),dim=c(2,61),dimnames=list(c('y','x'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('y','x'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 3016 0 1 0 0 0 0 0 0 0 0 0 0 2 2155 0 0 1 0 0 0 0 0 0 0 0 0 3 2172 0 0 0 1 0 0 0 0 0 0 0 0 4 2150 0 0 0 0 1 0 0 0 0 0 0 0 5 2533 0 0 0 0 0 1 0 0 0 0 0 0 6 2058 0 0 0 0 0 0 1 0 0 0 0 0 7 2160 0 0 0 0 0 0 0 1 0 0 0 0 8 2260 0 0 0 0 0 0 0 0 1 0 0 0 9 2498 0 0 0 0 0 0 0 0 0 1 0 0 10 2695 0 0 0 0 0 0 0 0 0 0 1 0 11 2799 0 0 0 0 0 0 0 0 0 0 0 1 12 2946 0 0 0 0 0 0 0 0 0 0 0 0 13 2930 0 1 0 0 0 0 0 0 0 0 0 0 14 2318 0 0 1 0 0 0 0 0 0 0 0 0 15 2540 0 0 0 1 0 0 0 0 0 0 0 0 16 2570 0 0 0 0 1 0 0 0 0 0 0 0 17 2669 0 0 0 0 0 1 0 0 0 0 0 0 18 2450 0 0 0 0 0 0 1 0 0 0 0 0 19 2842 0 0 0 0 0 0 0 1 0 0 0 0 20 3440 0 0 0 0 0 0 0 0 1 0 0 0 21 2678 0 0 0 0 0 0 0 0 0 1 0 0 22 2981 0 0 0 0 0 0 0 0 0 0 1 0 23 2260 0 0 0 0 0 0 0 0 0 0 0 1 24 2844 0 0 0 0 0 0 0 0 0 0 0 0 25 2546 0 1 0 0 0 0 0 0 0 0 0 0 26 2456 0 0 1 0 0 0 0 0 0 0 0 0 27 2295 0 0 0 1 0 0 0 0 0 0 0 0 28 2379 0 0 0 0 1 0 0 0 0 0 0 0 29 2479 0 0 0 0 0 1 0 0 0 0 0 0 30 2057 0 0 0 0 0 0 1 0 0 0 0 0 31 2280 0 0 0 0 0 0 0 1 0 0 0 0 32 2351 0 0 0 0 0 0 0 0 1 0 0 0 33 2276 0 0 0 0 0 0 0 0 0 1 0 0 34 2548 1 0 0 0 0 0 0 0 0 0 1 0 35 2311 1 0 0 0 0 0 0 0 0 0 0 1 36 2201 1 0 0 0 0 0 0 0 0 0 0 0 37 2725 1 1 0 0 0 0 0 0 0 0 0 0 38 2408 1 0 1 0 0 0 0 0 0 0 0 0 39 2139 1 0 0 1 0 0 0 0 0 0 0 0 40 1898 1 0 0 0 1 0 0 0 0 0 0 0 41 2537 1 0 0 0 0 1 0 0 0 0 0 0 42 2068 1 0 0 0 0 0 1 0 0 0 0 0 43 2063 1 0 0 0 0 0 0 1 0 0 0 0 44 2520 1 0 0 0 0 0 0 0 1 0 0 0 45 2434 1 0 0 0 0 0 0 0 0 1 0 0 46 2190 1 0 0 0 0 0 0 0 0 0 1 0 47 2794 1 0 0 0 0 0 0 0 0 0 0 1 48 2070 1 0 0 0 0 0 0 0 0 0 0 0 49 2615 1 1 0 0 0 0 0 0 0 0 0 0 50 2265 1 0 1 0 0 0 0 0 0 0 0 0 51 2139 1 0 0 1 0 0 0 0 0 0 0 0 52 2428 1 0 0 0 1 0 0 0 0 0 0 0 53 2137 1 0 0 0 0 1 0 0 0 0 0 0 54 1823 1 0 0 0 0 0 1 0 0 0 0 0 55 2063 1 0 0 0 0 0 0 1 0 0 0 0 56 1806 1 0 0 0 0 0 0 0 1 0 0 0 57 1758 1 0 0 0 0 0 0 0 0 1 0 0 58 2243 1 0 0 0 0 0 0 0 0 0 1 0 59 1993 1 0 0 0 0 0 0 0 0 0 0 1 60 1932 1 0 0 0 0 0 0 0 0 0 0 0 61 2465 1 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x M1 M2 M3 M4 2589.64 -318.40 285.73 -141.88 -205.28 -177.28 M5 M6 M7 M8 M9 M10 8.72 -371.08 -180.68 13.12 -133.48 132.80 M11 32.80 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -478.36 -180.16 -27.56 167.84 837.24 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2589.64 131.78 19.651 < 2e-16 *** x -318.40 72.54 -4.389 6.22e-05 *** M1 285.73 168.57 1.695 0.0966 . M2 -141.88 176.50 -0.804 0.4255 M3 -205.28 176.50 -1.163 0.2506 M4 -177.28 176.50 -1.004 0.3202 M5 8.72 176.50 0.049 0.9608 M6 -371.08 176.50 -2.102 0.0408 * M7 -180.68 176.50 -1.024 0.3111 M8 13.12 176.50 0.074 0.9411 M9 -133.48 176.50 -0.756 0.4532 M10 132.80 175.91 0.755 0.4540 M11 32.80 175.91 0.186 0.8529 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 278.1 on 48 degrees of freedom Multiple R-squared: 0.4467, Adjusted R-squared: 0.3084 F-statistic: 3.23 on 12 and 48 DF, p-value: 0.001862 > 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.40507128 0.81014256 0.59492872 [2,] 0.25712878 0.51425756 0.74287122 [3,] 0.26158678 0.52317355 0.73841322 [4,] 0.48950129 0.97900258 0.51049871 [5,] 0.96464766 0.07070467 0.03535234 [6,] 0.95169375 0.09661250 0.04830625 [7,] 0.94930925 0.10138149 0.05069075 [8,] 0.95368845 0.09262309 0.04631155 [9,] 0.96636283 0.06727434 0.03363717 [10,] 0.96421040 0.07157921 0.03578960 [11,] 0.94498124 0.11003751 0.05501876 [12,] 0.91214147 0.17571705 0.08785853 [13,] 0.86655913 0.26688175 0.13344087 [14,] 0.81026123 0.37947755 0.18973877 [15,] 0.74966240 0.50067520 0.25033760 [16,] 0.68106183 0.63787635 0.31893817 [17,] 0.66421274 0.67157452 0.33578726 [18,] 0.59829030 0.80341939 0.40170970 [19,] 0.54968142 0.90063715 0.45031858 [20,] 0.45323796 0.90647592 0.54676204 [21,] 0.40682603 0.81365206 0.59317397 [22,] 0.34191722 0.68383444 0.65808278 [23,] 0.28915425 0.57830849 0.71084575 [24,] 0.20427621 0.40855242 0.79572379 [25,] 0.20880990 0.41761979 0.79119010 [26,] 0.18175060 0.36350120 0.81824940 [27,] 0.12633226 0.25266452 0.87366774 [28,] 0.07318348 0.14636696 0.92681652 [29,] 0.11576435 0.23152870 0.88423565 [30,] 0.19652468 0.39304936 0.80347532 > postscript(file="/var/www/html/rcomp/tmp/1z7av1261270796.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/2rkcq1261270796.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/3wa2f1261270796.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/41o4y1261270796.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/56znt1261270796.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 = 61 Frequency = 1 1 2 3 4 5 6 140.632653 -292.760544 -212.360544 -262.360544 -65.360544 -160.560544 7 8 9 10 11 12 -248.960544 -342.760544 41.839456 -27.440816 176.559184 356.359184 13 14 15 16 17 18 54.632653 -129.760544 155.639456 157.639456 70.639456 231.439456 19 20 21 22 23 24 433.039456 837.239456 221.839456 258.559184 -362.440816 254.359184 25 26 27 28 29 30 -329.367347 8.239456 -89.360544 -33.360544 -119.360544 -161.560544 31 32 33 34 35 36 -128.960544 -251.760544 -180.160544 143.960544 6.960544 -70.239456 37 38 39 40 41 42 168.034014 278.640816 73.040816 -195.959184 257.040816 167.840816 43 44 45 46 47 48 -27.559184 235.640816 296.240816 -214.039456 489.960544 -201.239456 49 50 51 52 53 54 58.034014 135.640816 73.040816 334.040816 -142.959184 -77.159184 55 56 57 58 59 60 -27.559184 -478.359184 -379.759184 -161.039456 -311.039456 -339.239456 61 -91.965986 > postscript(file="/var/www/html/rcomp/tmp/6argw1261270796.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 140.632653 NA 1 -292.760544 140.632653 2 -212.360544 -292.760544 3 -262.360544 -212.360544 4 -65.360544 -262.360544 5 -160.560544 -65.360544 6 -248.960544 -160.560544 7 -342.760544 -248.960544 8 41.839456 -342.760544 9 -27.440816 41.839456 10 176.559184 -27.440816 11 356.359184 176.559184 12 54.632653 356.359184 13 -129.760544 54.632653 14 155.639456 -129.760544 15 157.639456 155.639456 16 70.639456 157.639456 17 231.439456 70.639456 18 433.039456 231.439456 19 837.239456 433.039456 20 221.839456 837.239456 21 258.559184 221.839456 22 -362.440816 258.559184 23 254.359184 -362.440816 24 -329.367347 254.359184 25 8.239456 -329.367347 26 -89.360544 8.239456 27 -33.360544 -89.360544 28 -119.360544 -33.360544 29 -161.560544 -119.360544 30 -128.960544 -161.560544 31 -251.760544 -128.960544 32 -180.160544 -251.760544 33 143.960544 -180.160544 34 6.960544 143.960544 35 -70.239456 6.960544 36 168.034014 -70.239456 37 278.640816 168.034014 38 73.040816 278.640816 39 -195.959184 73.040816 40 257.040816 -195.959184 41 167.840816 257.040816 42 -27.559184 167.840816 43 235.640816 -27.559184 44 296.240816 235.640816 45 -214.039456 296.240816 46 489.960544 -214.039456 47 -201.239456 489.960544 48 58.034014 -201.239456 49 135.640816 58.034014 50 73.040816 135.640816 51 334.040816 73.040816 52 -142.959184 334.040816 53 -77.159184 -142.959184 54 -27.559184 -77.159184 55 -478.359184 -27.559184 56 -379.759184 -478.359184 57 -161.039456 -379.759184 58 -311.039456 -161.039456 59 -339.239456 -311.039456 60 -91.965986 -339.239456 61 NA -91.965986 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -292.760544 140.632653 [2,] -212.360544 -292.760544 [3,] -262.360544 -212.360544 [4,] -65.360544 -262.360544 [5,] -160.560544 -65.360544 [6,] -248.960544 -160.560544 [7,] -342.760544 -248.960544 [8,] 41.839456 -342.760544 [9,] -27.440816 41.839456 [10,] 176.559184 -27.440816 [11,] 356.359184 176.559184 [12,] 54.632653 356.359184 [13,] -129.760544 54.632653 [14,] 155.639456 -129.760544 [15,] 157.639456 155.639456 [16,] 70.639456 157.639456 [17,] 231.439456 70.639456 [18,] 433.039456 231.439456 [19,] 837.239456 433.039456 [20,] 221.839456 837.239456 [21,] 258.559184 221.839456 [22,] -362.440816 258.559184 [23,] 254.359184 -362.440816 [24,] -329.367347 254.359184 [25,] 8.239456 -329.367347 [26,] -89.360544 8.239456 [27,] -33.360544 -89.360544 [28,] -119.360544 -33.360544 [29,] -161.560544 -119.360544 [30,] -128.960544 -161.560544 [31,] -251.760544 -128.960544 [32,] -180.160544 -251.760544 [33,] 143.960544 -180.160544 [34,] 6.960544 143.960544 [35,] -70.239456 6.960544 [36,] 168.034014 -70.239456 [37,] 278.640816 168.034014 [38,] 73.040816 278.640816 [39,] -195.959184 73.040816 [40,] 257.040816 -195.959184 [41,] 167.840816 257.040816 [42,] -27.559184 167.840816 [43,] 235.640816 -27.559184 [44,] 296.240816 235.640816 [45,] -214.039456 296.240816 [46,] 489.960544 -214.039456 [47,] -201.239456 489.960544 [48,] 58.034014 -201.239456 [49,] 135.640816 58.034014 [50,] 73.040816 135.640816 [51,] 334.040816 73.040816 [52,] -142.959184 334.040816 [53,] -77.159184 -142.959184 [54,] -27.559184 -77.159184 [55,] -478.359184 -27.559184 [56,] -379.759184 -478.359184 [57,] -161.039456 -379.759184 [58,] -311.039456 -161.039456 [59,] -339.239456 -311.039456 [60,] -91.965986 -339.239456 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -292.760544 140.632653 2 -212.360544 -292.760544 3 -262.360544 -212.360544 4 -65.360544 -262.360544 5 -160.560544 -65.360544 6 -248.960544 -160.560544 7 -342.760544 -248.960544 8 41.839456 -342.760544 9 -27.440816 41.839456 10 176.559184 -27.440816 11 356.359184 176.559184 12 54.632653 356.359184 13 -129.760544 54.632653 14 155.639456 -129.760544 15 157.639456 155.639456 16 70.639456 157.639456 17 231.439456 70.639456 18 433.039456 231.439456 19 837.239456 433.039456 20 221.839456 837.239456 21 258.559184 221.839456 22 -362.440816 258.559184 23 254.359184 -362.440816 24 -329.367347 254.359184 25 8.239456 -329.367347 26 -89.360544 8.239456 27 -33.360544 -89.360544 28 -119.360544 -33.360544 29 -161.560544 -119.360544 30 -128.960544 -161.560544 31 -251.760544 -128.960544 32 -180.160544 -251.760544 33 143.960544 -180.160544 34 6.960544 143.960544 35 -70.239456 6.960544 36 168.034014 -70.239456 37 278.640816 168.034014 38 73.040816 278.640816 39 -195.959184 73.040816 40 257.040816 -195.959184 41 167.840816 257.040816 42 -27.559184 167.840816 43 235.640816 -27.559184 44 296.240816 235.640816 45 -214.039456 296.240816 46 489.960544 -214.039456 47 -201.239456 489.960544 48 58.034014 -201.239456 49 135.640816 58.034014 50 73.040816 135.640816 51 334.040816 73.040816 52 -142.959184 334.040816 53 -77.159184 -142.959184 54 -27.559184 -77.159184 55 -478.359184 -27.559184 56 -379.759184 -478.359184 57 -161.039456 -379.759184 58 -311.039456 -161.039456 59 -339.239456 -311.039456 60 -91.965986 -339.239456 > 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/7s9gi1261270796.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/8dsev1261270796.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/92xnx1261270796.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/10ewfb1261270796.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/11oqy71261270796.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/12sn931261270797.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/13bg0k1261270797.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/14pucg1261270797.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/154vd31261270797.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/16fbzx1261270797.tab") + } > > try(system("convert tmp/1z7av1261270796.ps tmp/1z7av1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/2rkcq1261270796.ps tmp/2rkcq1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/3wa2f1261270796.ps tmp/3wa2f1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/41o4y1261270796.ps tmp/41o4y1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/56znt1261270796.ps tmp/56znt1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/6argw1261270796.ps tmp/6argw1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/7s9gi1261270796.ps tmp/7s9gi1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/8dsev1261270796.ps tmp/8dsev1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/92xnx1261270796.ps tmp/92xnx1261270796.png",intern=TRUE)) character(0) > try(system("convert tmp/10ewfb1261270796.ps tmp/10ewfb1261270796.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.451 1.586 3.039