R version 2.6.1 (2007-11-26) Copyright (C) 2007 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(92,1,84,2,76,3,71,4,79,5,86,6,68,7,89,8,90,9,74,10,82,11,75,12,86,13,79,14,63,15,86,16,67,17,75,18,85,19,78,20,85,21,81,22,76,23,84,24,77,25,84,26,73,27,75,28,76,29,70,30,71,31,85,32,74,33,82,34,66,35,68,36,79,37,94,38,71,39,75,40),dim=c(2,40),dimnames=list(c('Price','Sequence'),1:40)) > y <- array(NA,dim=c(2,40),dimnames=list(c('Price','Sequence'),1:40)) > 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 = 'Do not include Seasonal 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 > 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 Price Sequence 1 92 1 2 84 2 3 76 3 4 71 4 5 79 5 6 86 6 7 68 7 8 89 8 9 90 9 10 74 10 11 82 11 12 75 12 13 86 13 14 79 14 15 63 15 16 86 16 17 67 17 18 75 18 19 85 19 20 78 20 21 85 21 22 81 22 23 76 23 24 84 24 25 77 25 26 84 26 27 73 27 28 75 28 29 76 29 30 70 30 31 71 31 32 85 32 33 74 33 34 82 34 35 66 35 36 68 36 37 79 37 38 94 38 39 71 39 40 75 40 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Sequence 81.2192 -0.1436 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -16.0649 -4.6606 -0.5515 6.2981 18.2384 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 81.2192 2.3968 33.89 <2e-16 *** Sequence -0.1436 0.1019 -1.41 0.167 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.438 on 38 degrees of freedom Multiple R-Squared: 0.0497, Adjusted R-squared: 0.0247 F-statistic: 1.988 on 1 and 38 DF, p-value: 0.1667 > 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.39497509 0.7899502 0.6050249 [2,] 0.62118881 0.7576224 0.3788112 [3,] 0.59818785 0.8036243 0.4018121 [4,] 0.80196127 0.3960775 0.1980387 [5,] 0.84359869 0.3128026 0.1564013 [6,] 0.80973802 0.3805240 0.1902620 [7,] 0.73614050 0.5277190 0.2638595 [8,] 0.66369944 0.6726011 0.3363006 [9,] 0.64788526 0.7042295 0.3521147 [10,] 0.55074618 0.8985076 0.4492538 [11,] 0.78311334 0.4337733 0.2168867 [12,] 0.79748673 0.4050265 0.2025133 [13,] 0.85481382 0.2903724 0.1451862 [14,] 0.81148087 0.3770383 0.1885191 [15,] 0.80819074 0.3836185 0.1918093 [16,] 0.74000925 0.5199815 0.2599907 [17,] 0.72596553 0.5480689 0.2740345 [18,] 0.65473099 0.6905380 0.3452690 [19,] 0.56555313 0.8688937 0.4344469 [20,] 0.54076927 0.9184615 0.4592307 [21,] 0.44331495 0.8866299 0.5566850 [22,] 0.45532132 0.9106426 0.5446787 [23,] 0.37142996 0.7428599 0.6285700 [24,] 0.28141828 0.5628366 0.7185817 [25,] 0.20286018 0.4057204 0.7971398 [26,] 0.16035007 0.3207001 0.8396499 [27,] 0.12353787 0.2470757 0.8764621 [28,] 0.13364704 0.2672941 0.8663530 [29,] 0.07718772 0.1543754 0.9228123 [30,] 0.07902640 0.1580528 0.9209736 [31,] 0.06095967 0.1219193 0.9390403 > postscript(file="/var/www/html/rcomp/tmp/12ivh1203695741.ps",horizontal=F,pagecentre=F,paper="special",width=0.55555555555556,height=1.3888888888889) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') Error in plot.new() : figure margins too large Calls: plot -> plot.default -> plot.new Execution halted