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. Natural language support but running in an English locale 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(104.37 + ,1 + ,1 + ,167.16 + ,101.56 + ,100.93 + ,104.89 + ,2 + ,2 + ,179.84 + ,102.13 + ,101.18 + ,105.15 + ,3 + ,3 + ,174.44 + ,102.39 + ,101.11 + ,105.72 + ,4 + ,4 + ,180.35 + ,102.42 + ,102.42 + ,106.38 + ,5 + ,5 + ,193.17 + ,103.87 + ,102.37 + ,106.40 + ,6 + ,6 + ,195.16 + ,104.44 + ,101.95 + ,106.47 + ,7 + ,7 + ,202.43 + ,104.97 + ,102.20 + ,106.59 + ,8 + ,8 + ,189.91 + ,105.17 + ,103.35 + ,106.76 + ,9 + ,9 + ,195.98 + ,105.35 + ,103.65 + ,107.35 + ,10 + ,10 + ,212.09 + ,104.65 + ,102.06 + ,107.81 + ,11 + ,11 + ,205.81 + ,106.62 + ,102.66 + ,108.03 + ,12 + ,12 + ,204.31 + ,107.05 + ,102.32 + ,109.08 + ,1 + ,13 + ,196.07 + ,112.30 + ,102.21 + ,109.86 + ,2 + ,14 + ,199.98 + ,114.70 + ,102.33 + ,110.29 + ,3 + ,15 + ,199.1 + ,115.40 + ,104.41 + ,110.34 + ,4 + ,16 + ,198.31 + ,115.64 + ,104.33 + ,110.59 + ,5 + ,17 + ,195.72 + ,115.66 + ,105.27 + ,110.64 + ,6 + ,18 + ,223.04 + ,114.50 + ,105.34 + ,110.83 + ,7 + ,19 + ,238.41 + ,115.14 + ,104.88 + ,111.51 + ,8 + ,20 + ,259.73 + ,115.41 + ,105.49 + ,113.32 + ,9 + ,21 + ,326.54 + ,119.32 + ,105.90 + ,115.89 + ,10 + ,22 + ,335.15 + ,124.77 + ,105.39 + ,116.51 + ,11 + ,23 + ,321.81 + ,130.96 + ,104.40 + ,117.44 + ,12 + ,24 + ,368.62 + ,141.02 + ,106.19 + ,118.25 + ,1 + ,25 + ,369.59 + ,150.60 + ,106.54 + ,118.65 + ,2 + ,26 + ,425 + ,151.10 + ,108.26 + ,118.52 + ,3 + ,27 + ,439.72 + ,157.19 + ,106.95 + ,119.07 + ,4 + ,28 + ,362.23 + ,157.28 + ,108.32 + ,119.12 + ,5 + ,29 + ,328.76 + ,156.54 + ,108.35 + ,119.28 + ,6 + ,30 + ,348.55 + ,159.62 + ,109.29 + ,119.30 + ,7 + ,31 + ,328.18 + ,163.77 + ,109.46 + ,119.44 + ,8 + ,32 + ,329.34 + ,165.08 + ,109.50 + ,119.57 + ,9 + ,33 + ,295.55 + ,164.75 + ,109.84 + ,119.93 + ,10 + ,34 + ,237.38 + ,163.93 + ,108.73 + ,120.03 + ,11 + ,35 + ,226.85 + ,157.51 + ,109.38 + ,119.66 + ,12 + ,36 + ,220.14 + ,153.36 + ,109.97 + ,119.46 + ,1 + ,37 + ,239.36 + ,156.83 + ,111.10 + ,119.48 + ,2 + ,38 + ,224.69 + ,154.98 + ,110.53 + ,119.56 + ,3 + ,39 + ,230.98 + ,155.02 + ,110.23 + ,119.43 + ,4 + ,40 + ,233.47 + ,153.34 + ,109.41 + ,119.57 + ,5 + ,41 + ,256.7 + ,153.19 + ,108.94 + ,119.59 + ,6 + ,42 + ,253.41 + ,152.80 + ,109.81 + ,119.50 + ,7 + ,43 + ,224.95 + ,152.97 + ,109.20 + ,119.54 + ,8 + ,44 + ,210.37 + ,152.96 + ,109.45 + ,119.56 + ,9 + ,45 + ,191.09 + ,152.35 + ,110.61 + ,119.61 + ,10 + ,46 + ,198.85 + ,151.88 + ,109.44 + ,119.64 + ,11 + ,47 + ,211.04 + ,150.27 + ,109.77 + ,119.60 + ,12 + ,48 + ,206.25 + ,148.80 + ,108.04 + ,119.71 + ,1 + ,49 + ,201.19 + ,149.28 + ,109.65 + ,119.72 + ,2 + ,50 + ,194.37 + ,148.64 + ,111.69 + ,119.66 + ,3 + ,51 + ,191.08 + ,150.36 + ,111.65 + ,119.76 + ,4 + ,52 + ,192.87 + ,149.69 + ,112.04 + ,119.80 + ,5 + ,53 + ,181.61 + ,152.94 + ,111.42 + ,119.88 + ,6 + ,54 + ,157.67 + ,155.18 + ,112.25 + ,119.78 + ,7 + ,55 + ,196.14 + ,156.32 + ,111.46 + ,120.08 + ,8 + ,56 + ,246.35 + ,156.25 + ,111.62 + ,120.22 + ,9 + ,57 + ,271.9 + ,155.52 + ,111.77) + ,dim=c(6 + ,57) + ,dimnames=list(c('Brood' + ,'Maand' + ,'Trend' + ,'Tarwe' + ,'Meel' + ,'Water') + ,1:57)) > y <- array(NA,dim=c(6,57),dimnames=list(c('Brood','Maand','Trend','Tarwe','Meel','Water'),1:57)) > 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 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 Brood Maand Trend Tarwe Meel Water 1 104.37 1 1 167.16 101.56 100.93 2 104.89 2 2 179.84 102.13 101.18 3 105.15 3 3 174.44 102.39 101.11 4 105.72 4 4 180.35 102.42 102.42 5 106.38 5 5 193.17 103.87 102.37 6 106.40 6 6 195.16 104.44 101.95 7 106.47 7 7 202.43 104.97 102.20 8 106.59 8 8 189.91 105.17 103.35 9 106.76 9 9 195.98 105.35 103.65 10 107.35 10 10 212.09 104.65 102.06 11 107.81 11 11 205.81 106.62 102.66 12 108.03 12 12 204.31 107.05 102.32 13 109.08 1 13 196.07 112.30 102.21 14 109.86 2 14 199.98 114.70 102.33 15 110.29 3 15 199.10 115.40 104.41 16 110.34 4 16 198.31 115.64 104.33 17 110.59 5 17 195.72 115.66 105.27 18 110.64 6 18 223.04 114.50 105.34 19 110.83 7 19 238.41 115.14 104.88 20 111.51 8 20 259.73 115.41 105.49 21 113.32 9 21 326.54 119.32 105.90 22 115.89 10 22 335.15 124.77 105.39 23 116.51 11 23 321.81 130.96 104.40 24 117.44 12 24 368.62 141.02 106.19 25 118.25 1 25 369.59 150.60 106.54 26 118.65 2 26 425.00 151.10 108.26 27 118.52 3 27 439.72 157.19 106.95 28 119.07 4 28 362.23 157.28 108.32 29 119.12 5 29 328.76 156.54 108.35 30 119.28 6 30 348.55 159.62 109.29 31 119.30 7 31 328.18 163.77 109.46 32 119.44 8 32 329.34 165.08 109.50 33 119.57 9 33 295.55 164.75 109.84 34 119.93 10 34 237.38 163.93 108.73 35 120.03 11 35 226.85 157.51 109.38 36 119.66 12 36 220.14 153.36 109.97 37 119.46 1 37 239.36 156.83 111.10 38 119.48 2 38 224.69 154.98 110.53 39 119.56 3 39 230.98 155.02 110.23 40 119.43 4 40 233.47 153.34 109.41 41 119.57 5 41 256.70 153.19 108.94 42 119.59 6 42 253.41 152.80 109.81 43 119.50 7 43 224.95 152.97 109.20 44 119.54 8 44 210.37 152.96 109.45 45 119.56 9 45 191.09 152.35 110.61 46 119.61 10 46 198.85 151.88 109.44 47 119.64 11 47 211.04 150.27 109.77 48 119.60 12 48 206.25 148.80 108.04 49 119.71 1 49 201.19 149.28 109.65 50 119.72 2 50 194.37 148.64 111.69 51 119.66 3 51 191.08 150.36 111.65 52 119.76 4 52 192.87 149.69 112.04 53 119.80 5 53 181.61 152.94 111.42 54 119.88 6 54 157.67 155.18 112.25 55 119.78 7 55 196.14 156.32 111.46 56 120.08 8 56 246.35 156.25 111.62 57 120.22 9 57 271.90 155.52 111.77 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Maand Trend Tarwe Meel Water 86.27374 0.04693 0.14030 0.01195 0.13658 0.02789 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.0820 -0.4712 0.1567 0.5589 2.0734 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 86.273736 13.330912 6.472 3.72e-08 *** Maand 0.046933 0.033617 1.396 0.169 Trend 0.140300 0.024151 5.809 4.07e-07 *** Tarwe 0.011952 0.002367 5.049 6.04e-06 *** Meel 0.136582 0.016335 8.361 3.98e-11 *** Water 0.027895 0.139972 0.199 0.843 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.8318 on 51 degrees of freedom Multiple R-squared: 0.9802, Adjusted R-squared: 0.9782 F-statistic: 503.7 on 5 and 51 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,] 5.505756e-02 1.101151e-01 9.449424e-01 [2,] 1.697017e-02 3.394034e-02 9.830298e-01 [3,] 1.255367e-02 2.510735e-02 9.874463e-01 [4,] 6.257984e-03 1.251597e-02 9.937420e-01 [5,] 2.033485e-03 4.066971e-03 9.979665e-01 [6,] 7.559689e-04 1.511938e-03 9.992440e-01 [7,] 2.843852e-04 5.687703e-04 9.997156e-01 [8,] 9.882150e-05 1.976430e-04 9.999012e-01 [9,] 3.786053e-05 7.572105e-05 9.999621e-01 [10,] 3.250764e-05 6.501528e-05 9.999675e-01 [11,] 1.820385e-04 3.640771e-04 9.998180e-01 [12,] 3.900350e-03 7.800699e-03 9.960997e-01 [13,] 1.831936e-01 3.663872e-01 8.168064e-01 [14,] 3.918706e-01 7.837412e-01 6.081294e-01 [15,] 8.603613e-01 2.792774e-01 1.396387e-01 [16,] 9.999884e-01 2.315680e-05 1.157840e-05 [17,] 9.999998e-01 4.868224e-07 2.434112e-07 [18,] 9.999998e-01 3.539711e-07 1.769855e-07 [19,] 1.000000e+00 1.635407e-09 8.177036e-10 [20,] 1.000000e+00 6.582337e-09 3.291169e-09 [21,] 1.000000e+00 2.252722e-08 1.126361e-08 [22,] 1.000000e+00 7.113891e-08 3.556946e-08 [23,] 1.000000e+00 7.161776e-08 3.580888e-08 [24,] 1.000000e+00 5.114634e-08 2.557317e-08 [25,] 1.000000e+00 3.083497e-08 1.541749e-08 [26,] 1.000000e+00 6.467498e-08 3.233749e-08 [27,] 1.000000e+00 2.345534e-11 1.172767e-11 [28,] 1.000000e+00 2.328673e-12 1.164336e-12 [29,] 1.000000e+00 2.027902e-11 1.013951e-11 [30,] 1.000000e+00 1.680899e-10 8.404495e-11 [31,] 1.000000e+00 3.942946e-10 1.971473e-10 [32,] 1.000000e+00 2.107714e-09 1.053857e-09 [33,] 1.000000e+00 1.059561e-08 5.297805e-09 [34,] 1.000000e+00 7.280366e-08 3.640183e-08 [35,] 9.999998e-01 4.603414e-07 2.301707e-07 [36,] 9.999982e-01 3.653384e-06 1.826692e-06 [37,] 9.999842e-01 3.160472e-05 1.580236e-05 [38,] 9.998772e-01 2.456642e-04 1.228321e-04 [39,] 9.991132e-01 1.773646e-03 8.868230e-04 [40,] 9.936496e-01 1.270086e-02 6.350432e-03 > postscript(file="/var/www/html/freestat/rcomp/tmp/19g9l1292775699.ps",horizontal=F,onefile=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/29g9l1292775699.ps",horizontal=F,onefile=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/3k89p1292775699.ps",horizontal=F,onefile=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/4k89p1292775699.ps",horizontal=F,onefile=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/5k89p1292775699.ps",horizontal=F,onefile=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 = 57 Frequency = 1 1 2 3 4 5 6 7 -0.7755658 -0.6791762 -0.5754274 -0.3039370 -0.1810443 -0.4381981 -0.7216848 8 9 10 11 12 13 14 -0.6986745 -0.8214099 -0.4712300 -0.4092080 -0.4077594 0.4027010 0.6175912 15 16 17 18 19 20 21 0.7172467 0.5589073 0.6236768 0.3163967 0.0608800 0.2449366 0.5237166 22 23 24 25 26 27 28 2.0734313 1.8478118 0.6071583 0.4633092 -0.1024558 -1.3908644 -0.1524444 29 30 31 32 33 34 35 0.2105900 -0.5000674 -0.9953953 -1.2365312 -0.8543181 0.1566579 1.0540034 36 37 38 39 40 41 42 1.1273250 0.5681090 0.8447884 0.6652820 0.5706196 0.2793387 0.1804258 43 44 45 46 47 48 49 0.2371438 0.2585629 0.3727212 0.2395708 0.1473339 0.2263843 0.6623537 50 51 52 53 54 55 56 0.5971398 0.1554234 0.1274267 -0.3118233 -0.4620217 -1.3427156 -1.8249623 57 -2.0820491 > postscript(file="/var/www/html/freestat/rcomp/tmp/6dhq91292775699.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.7755658 NA 1 -0.6791762 -0.7755658 2 -0.5754274 -0.6791762 3 -0.3039370 -0.5754274 4 -0.1810443 -0.3039370 5 -0.4381981 -0.1810443 6 -0.7216848 -0.4381981 7 -0.6986745 -0.7216848 8 -0.8214099 -0.6986745 9 -0.4712300 -0.8214099 10 -0.4092080 -0.4712300 11 -0.4077594 -0.4092080 12 0.4027010 -0.4077594 13 0.6175912 0.4027010 14 0.7172467 0.6175912 15 0.5589073 0.7172467 16 0.6236768 0.5589073 17 0.3163967 0.6236768 18 0.0608800 0.3163967 19 0.2449366 0.0608800 20 0.5237166 0.2449366 21 2.0734313 0.5237166 22 1.8478118 2.0734313 23 0.6071583 1.8478118 24 0.4633092 0.6071583 25 -0.1024558 0.4633092 26 -1.3908644 -0.1024558 27 -0.1524444 -1.3908644 28 0.2105900 -0.1524444 29 -0.5000674 0.2105900 30 -0.9953953 -0.5000674 31 -1.2365312 -0.9953953 32 -0.8543181 -1.2365312 33 0.1566579 -0.8543181 34 1.0540034 0.1566579 35 1.1273250 1.0540034 36 0.5681090 1.1273250 37 0.8447884 0.5681090 38 0.6652820 0.8447884 39 0.5706196 0.6652820 40 0.2793387 0.5706196 41 0.1804258 0.2793387 42 0.2371438 0.1804258 43 0.2585629 0.2371438 44 0.3727212 0.2585629 45 0.2395708 0.3727212 46 0.1473339 0.2395708 47 0.2263843 0.1473339 48 0.6623537 0.2263843 49 0.5971398 0.6623537 50 0.1554234 0.5971398 51 0.1274267 0.1554234 52 -0.3118233 0.1274267 53 -0.4620217 -0.3118233 54 -1.3427156 -0.4620217 55 -1.8249623 -1.3427156 56 -2.0820491 -1.8249623 57 NA -2.0820491 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.6791762 -0.7755658 [2,] -0.5754274 -0.6791762 [3,] -0.3039370 -0.5754274 [4,] -0.1810443 -0.3039370 [5,] -0.4381981 -0.1810443 [6,] -0.7216848 -0.4381981 [7,] -0.6986745 -0.7216848 [8,] -0.8214099 -0.6986745 [9,] -0.4712300 -0.8214099 [10,] -0.4092080 -0.4712300 [11,] -0.4077594 -0.4092080 [12,] 0.4027010 -0.4077594 [13,] 0.6175912 0.4027010 [14,] 0.7172467 0.6175912 [15,] 0.5589073 0.7172467 [16,] 0.6236768 0.5589073 [17,] 0.3163967 0.6236768 [18,] 0.0608800 0.3163967 [19,] 0.2449366 0.0608800 [20,] 0.5237166 0.2449366 [21,] 2.0734313 0.5237166 [22,] 1.8478118 2.0734313 [23,] 0.6071583 1.8478118 [24,] 0.4633092 0.6071583 [25,] -0.1024558 0.4633092 [26,] -1.3908644 -0.1024558 [27,] -0.1524444 -1.3908644 [28,] 0.2105900 -0.1524444 [29,] -0.5000674 0.2105900 [30,] -0.9953953 -0.5000674 [31,] -1.2365312 -0.9953953 [32,] -0.8543181 -1.2365312 [33,] 0.1566579 -0.8543181 [34,] 1.0540034 0.1566579 [35,] 1.1273250 1.0540034 [36,] 0.5681090 1.1273250 [37,] 0.8447884 0.5681090 [38,] 0.6652820 0.8447884 [39,] 0.5706196 0.6652820 [40,] 0.2793387 0.5706196 [41,] 0.1804258 0.2793387 [42,] 0.2371438 0.1804258 [43,] 0.2585629 0.2371438 [44,] 0.3727212 0.2585629 [45,] 0.2395708 0.3727212 [46,] 0.1473339 0.2395708 [47,] 0.2263843 0.1473339 [48,] 0.6623537 0.2263843 [49,] 0.5971398 0.6623537 [50,] 0.1554234 0.5971398 [51,] 0.1274267 0.1554234 [52,] -0.3118233 0.1274267 [53,] -0.4620217 -0.3118233 [54,] -1.3427156 -0.4620217 [55,] -1.8249623 -1.3427156 [56,] -2.0820491 -1.8249623 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.6791762 -0.7755658 2 -0.5754274 -0.6791762 3 -0.3039370 -0.5754274 4 -0.1810443 -0.3039370 5 -0.4381981 -0.1810443 6 -0.7216848 -0.4381981 7 -0.6986745 -0.7216848 8 -0.8214099 -0.6986745 9 -0.4712300 -0.8214099 10 -0.4092080 -0.4712300 11 -0.4077594 -0.4092080 12 0.4027010 -0.4077594 13 0.6175912 0.4027010 14 0.7172467 0.6175912 15 0.5589073 0.7172467 16 0.6236768 0.5589073 17 0.3163967 0.6236768 18 0.0608800 0.3163967 19 0.2449366 0.0608800 20 0.5237166 0.2449366 21 2.0734313 0.5237166 22 1.8478118 2.0734313 23 0.6071583 1.8478118 24 0.4633092 0.6071583 25 -0.1024558 0.4633092 26 -1.3908644 -0.1024558 27 -0.1524444 -1.3908644 28 0.2105900 -0.1524444 29 -0.5000674 0.2105900 30 -0.9953953 -0.5000674 31 -1.2365312 -0.9953953 32 -0.8543181 -1.2365312 33 0.1566579 -0.8543181 34 1.0540034 0.1566579 35 1.1273250 1.0540034 36 0.5681090 1.1273250 37 0.8447884 0.5681090 38 0.6652820 0.8447884 39 0.5706196 0.6652820 40 0.2793387 0.5706196 41 0.1804258 0.2793387 42 0.2371438 0.1804258 43 0.2585629 0.2371438 44 0.3727212 0.2585629 45 0.2395708 0.3727212 46 0.1473339 0.2395708 47 0.2263843 0.1473339 48 0.6623537 0.2263843 49 0.5971398 0.6623537 50 0.1554234 0.5971398 51 0.1274267 0.1554234 52 -0.3118233 0.1274267 53 -0.4620217 -0.3118233 54 -1.3427156 -0.4620217 55 -1.8249623 -1.3427156 56 -2.0820491 -1.8249623 > 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/7dhq91292775699.ps",horizontal=F,onefile=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/8nqpc1292775699.ps",horizontal=F,onefile=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/9nqpc1292775699.ps",horizontal=F,onefile=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/10nqpc1292775699.ps",horizontal=F,onefile=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/11kinl1292775699.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/12u94o1292775699.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/13jsji1292775699.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/14ntio1292775699.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/15fkzr1292775699.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/16bcf01292775699.tab") + } > > try(system("convert tmp/19g9l1292775699.ps tmp/19g9l1292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/29g9l1292775699.ps tmp/29g9l1292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/3k89p1292775699.ps tmp/3k89p1292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/4k89p1292775699.ps tmp/4k89p1292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/5k89p1292775699.ps tmp/5k89p1292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/6dhq91292775699.ps tmp/6dhq91292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/7dhq91292775699.ps tmp/7dhq91292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/8nqpc1292775699.ps tmp/8nqpc1292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/9nqpc1292775699.ps tmp/9nqpc1292775699.png",intern=TRUE)) character(0) > try(system("convert tmp/10nqpc1292775699.ps tmp/10nqpc1292775699.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.770 2.398 4.105