R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,350000 + ,15 + ,250000 + ,550 + ,22 + ,70000 + ,18 + ,600000 + ,95 + ,6 + ,180000 + ,10 + ,100000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,350000 + ,15 + ,250000 + ,550 + ,22 + ,70000 + ,18 + ,600000 + ,95 + ,6 + ,180000 + ,10 + ,100000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,350000 + ,15 + ,250000 + ,550 + ,22 + ,70000 + ,18 + ,600000 + ,95 + ,6 + ,180000 + ,10 + ,100000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,350000 + ,15 + ,250000 + ,550 + ,22 + ,70000 + ,18 + ,600000 + ,95 + ,6 + ,180000 + ,10 + ,100000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,350000 + ,15 + ,250000 + ,550 + ,22 + ,70000 + ,18 + ,600000 + ,95 + ,6 + ,180000 + ,10 + ,100000 + ,200 + ,10 + ,30000 + ,14 + ,200000 + ,150 + ,8 + ,25000 + ,12 + ,150000 + ,350 + ,15 + ,40000 + ,15 + ,300000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,350000 + ,15 + ,250000 + ,550 + ,22 + ,70000 + ,18 + ,600000 + ,95 + ,6 + ,180000 + ,10 + ,100000 + ,550 + ,20 + ,60000 + ,16 + ,500000 + ,200 + ,10 + ,350000 + ,15 + ,250000 + ,550 + ,22 + ,70000 + ,18 + ,600000 + ,95 + ,6 + ,180000 + ,10 + ,100000 + ,200 + ,10 + ,30000 + ,14 + ,200000) + ,dim=c(5 + ,63) + ,dimnames=list(c('mē' + ,'kamers' + ,'inkomens' + ,'aantrekkelijkheid' + ,'prijs') + ,1:63)) > y <- array(NA,dim=c(5,63),dimnames=list(c('mē','kamers','inkomens','aantrekkelijkheid','prijs'),1:63)) > 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 = '5' > 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 prijs m\262 kamers inkomens aantrekkelijkheid 1 200000 200 10 30000 14 2 150000 150 8 25000 12 3 300000 350 15 40000 15 4 500000 550 20 60000 16 5 250000 200 10 350000 15 6 600000 550 22 70000 18 7 100000 95 6 180000 10 8 200000 200 10 30000 14 9 150000 150 8 25000 12 10 300000 350 15 40000 15 11 500000 550 20 60000 16 12 200000 200 10 30000 14 13 150000 150 8 25000 12 14 300000 350 15 40000 15 15 500000 550 20 60000 16 16 200000 200 10 30000 14 17 150000 150 8 25000 12 18 300000 350 15 40000 15 19 500000 550 20 60000 16 20 250000 200 10 350000 15 21 600000 550 22 70000 18 22 100000 95 6 180000 10 23 200000 200 10 30000 14 24 150000 150 8 25000 12 25 300000 350 15 40000 15 26 500000 550 20 60000 16 27 250000 200 10 350000 15 28 600000 550 22 70000 18 29 100000 95 6 180000 10 30 200000 200 10 30000 14 31 150000 150 8 25000 12 32 300000 350 15 40000 15 33 500000 550 20 60000 16 34 250000 200 10 350000 15 35 600000 550 22 70000 18 36 100000 95 6 180000 10 37 200000 200 10 30000 14 38 150000 150 8 25000 12 39 300000 350 15 40000 15 40 500000 550 20 60000 16 41 200000 200 10 30000 14 42 150000 150 8 25000 12 43 300000 350 15 40000 15 44 500000 550 20 60000 16 45 200000 200 10 30000 14 46 150000 150 8 25000 12 47 300000 350 15 40000 15 48 500000 550 20 60000 16 49 250000 200 10 350000 15 50 600000 550 22 70000 18 51 100000 95 6 180000 10 52 200000 200 10 30000 14 53 150000 150 8 25000 12 54 300000 350 15 40000 15 55 500000 550 20 60000 16 56 250000 200 10 350000 15 57 600000 550 22 70000 18 58 100000 95 6 180000 10 59 500000 550 20 60000 16 60 250000 200 10 350000 15 61 600000 550 22 70000 18 62 100000 95 6 180000 10 63 200000 200 10 30000 14 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `m\262` kamers inkomens -1.276e+05 -6.348e+01 3.205e+04 1.799e-01 aantrekkelijkheid 6.461e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -47813 -2835 2509 18483 33193 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.276e+05 3.107e+04 -4.108 0.000127 *** `m\262` -6.348e+01 2.176e+02 -0.292 0.771532 kamers 3.205e+04 7.936e+03 4.039 0.000160 *** inkomens 1.799e-01 3.469e-02 5.184 2.87e-06 *** aantrekkelijkheid 6.461e+02 4.327e+03 0.149 0.881821 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 24360 on 58 degrees of freedom Multiple R-squared: 0.9798, Adjusted R-squared: 0.9784 F-statistic: 702.9 on 4 and 58 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,] 0.8774966 2.450068e-01 1.225034e-01 [2,] 0.8120083 3.759834e-01 1.879917e-01 [3,] 0.9263817 1.472366e-01 7.361831e-02 [4,] 0.8733415 2.533169e-01 1.266585e-01 [5,] 0.8046900 3.906201e-01 1.953100e-01 [6,] 0.7503289 4.993422e-01 2.496711e-01 [7,] 0.8567460 2.865081e-01 1.432540e-01 [8,] 0.7926437 4.147126e-01 2.073563e-01 [9,] 0.7184047 5.631906e-01 2.815953e-01 [10,] 0.6655643 6.688715e-01 3.344357e-01 [11,] 0.7772604 4.454792e-01 2.227396e-01 [12,] 0.7052432 5.895135e-01 2.947568e-01 [13,] 0.6265852 7.468296e-01 3.734148e-01 [14,] 0.7842312 4.315377e-01 2.157688e-01 [15,] 0.7187132 5.625735e-01 2.812868e-01 [16,] 0.6474518 7.050964e-01 3.525482e-01 [17,] 0.6059691 7.880618e-01 3.940309e-01 [18,] 0.7613737 4.772525e-01 2.386263e-01 [19,] 0.6947961 6.104079e-01 3.052039e-01 [20,] 0.6224109 7.551783e-01 3.775891e-01 [21,] 0.6976581 6.046838e-01 3.023419e-01 [22,] 0.6261217 7.477565e-01 3.738783e-01 [23,] 0.5526367 8.947266e-01 4.473633e-01 [24,] 0.5149979 9.700042e-01 4.850021e-01 [25,] 0.7010278 5.979445e-01 2.989722e-01 [26,] 0.6291381 7.417239e-01 3.708619e-01 [27,] 0.5531844 8.936312e-01 4.468156e-01 [28,] 0.6029238 7.941525e-01 3.970762e-01 [29,] 0.5249813 9.500373e-01 4.750187e-01 [30,] 0.4484169 8.968338e-01 5.515831e-01 [31,] 0.4122963 8.245925e-01 5.877037e-01 [32,] 0.6203901 7.592198e-01 3.796099e-01 [33,] 0.5390321 9.219358e-01 4.609679e-01 [34,] 0.4591405 9.182809e-01 5.408595e-01 [35,] 0.4261195 8.522391e-01 5.738805e-01 [36,] 0.6806431 6.387138e-01 3.193569e-01 [37,] 0.5962494 8.075012e-01 4.037506e-01 [38,] 0.5106126 9.787748e-01 4.893874e-01 [39,] 0.4869470 9.738940e-01 5.130530e-01 [40,] 0.8291570 3.416859e-01 1.708430e-01 [41,] 0.7541250 4.917500e-01 2.458750e-01 [42,] 0.6618447 6.763106e-01 3.381553e-01 [43,] 0.6191814 7.616372e-01 3.808186e-01 [44,] 0.5036072 9.927856e-01 4.963928e-01 [45,] 0.3878905 7.757810e-01 6.121095e-01 [46,] 0.3887985 7.775970e-01 6.112015e-01 [47,] 1.0000000 2.527870e-60 1.263935e-60 [48,] 1.0000000 1.711189e-45 8.555947e-46 > postscript(file="/var/wessaorg/rcomp/tmp/1qaob1321999162.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/wessaorg/rcomp/tmp/2rh2v1321999162.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/wessaorg/rcomp/tmp/35nhl1321999162.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/wessaorg/rcomp/tmp/42mtj1321999162.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/wessaorg/rcomp/tmp/5r8qz1321999162.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 = 63 Frequency = 1 1 2 3 4 5 6 5363.6940 18482.8674 -47813.2732 385.1167 -2834.6330 33192.8256 7 8 9 10 11 12 2508.5418 5363.6940 18482.8674 -47813.2732 385.1167 5363.6940 13 14 15 16 17 18 18482.8674 -47813.2732 385.1167 5363.6940 18482.8674 -47813.2732 19 20 21 22 23 24 385.1167 -2834.6330 33192.8256 2508.5418 5363.6940 18482.8674 25 26 27 28 29 30 -47813.2732 385.1167 -2834.6330 33192.8256 2508.5418 5363.6940 31 32 33 34 35 36 18482.8674 -47813.2732 385.1167 -2834.6330 33192.8256 2508.5418 37 38 39 40 41 42 5363.6940 18482.8674 -47813.2732 385.1167 5363.6940 18482.8674 43 44 45 46 47 48 -47813.2732 385.1167 5363.6940 18482.8674 -47813.2732 385.1167 49 50 51 52 53 54 -2834.6330 33192.8256 2508.5418 5363.6940 18482.8674 -47813.2732 55 56 57 58 59 60 385.1167 -2834.6330 33192.8256 2508.5418 385.1167 -2834.6330 61 62 63 33192.8256 2508.5418 5363.6940 > postscript(file="/var/wessaorg/rcomp/tmp/6uwa71321999162.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 = 63 Frequency = 1 lag(myerror, k = 1) myerror 0 5363.6940 NA 1 18482.8674 5363.6940 2 -47813.2732 18482.8674 3 385.1167 -47813.2732 4 -2834.6330 385.1167 5 33192.8256 -2834.6330 6 2508.5418 33192.8256 7 5363.6940 2508.5418 8 18482.8674 5363.6940 9 -47813.2732 18482.8674 10 385.1167 -47813.2732 11 5363.6940 385.1167 12 18482.8674 5363.6940 13 -47813.2732 18482.8674 14 385.1167 -47813.2732 15 5363.6940 385.1167 16 18482.8674 5363.6940 17 -47813.2732 18482.8674 18 385.1167 -47813.2732 19 -2834.6330 385.1167 20 33192.8256 -2834.6330 21 2508.5418 33192.8256 22 5363.6940 2508.5418 23 18482.8674 5363.6940 24 -47813.2732 18482.8674 25 385.1167 -47813.2732 26 -2834.6330 385.1167 27 33192.8256 -2834.6330 28 2508.5418 33192.8256 29 5363.6940 2508.5418 30 18482.8674 5363.6940 31 -47813.2732 18482.8674 32 385.1167 -47813.2732 33 -2834.6330 385.1167 34 33192.8256 -2834.6330 35 2508.5418 33192.8256 36 5363.6940 2508.5418 37 18482.8674 5363.6940 38 -47813.2732 18482.8674 39 385.1167 -47813.2732 40 5363.6940 385.1167 41 18482.8674 5363.6940 42 -47813.2732 18482.8674 43 385.1167 -47813.2732 44 5363.6940 385.1167 45 18482.8674 5363.6940 46 -47813.2732 18482.8674 47 385.1167 -47813.2732 48 -2834.6330 385.1167 49 33192.8256 -2834.6330 50 2508.5418 33192.8256 51 5363.6940 2508.5418 52 18482.8674 5363.6940 53 -47813.2732 18482.8674 54 385.1167 -47813.2732 55 -2834.6330 385.1167 56 33192.8256 -2834.6330 57 2508.5418 33192.8256 58 385.1167 2508.5418 59 -2834.6330 385.1167 60 33192.8256 -2834.6330 61 2508.5418 33192.8256 62 5363.6940 2508.5418 63 NA 5363.6940 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 18482.8674 5363.6940 [2,] -47813.2732 18482.8674 [3,] 385.1167 -47813.2732 [4,] -2834.6330 385.1167 [5,] 33192.8256 -2834.6330 [6,] 2508.5418 33192.8256 [7,] 5363.6940 2508.5418 [8,] 18482.8674 5363.6940 [9,] -47813.2732 18482.8674 [10,] 385.1167 -47813.2732 [11,] 5363.6940 385.1167 [12,] 18482.8674 5363.6940 [13,] -47813.2732 18482.8674 [14,] 385.1167 -47813.2732 [15,] 5363.6940 385.1167 [16,] 18482.8674 5363.6940 [17,] -47813.2732 18482.8674 [18,] 385.1167 -47813.2732 [19,] -2834.6330 385.1167 [20,] 33192.8256 -2834.6330 [21,] 2508.5418 33192.8256 [22,] 5363.6940 2508.5418 [23,] 18482.8674 5363.6940 [24,] -47813.2732 18482.8674 [25,] 385.1167 -47813.2732 [26,] -2834.6330 385.1167 [27,] 33192.8256 -2834.6330 [28,] 2508.5418 33192.8256 [29,] 5363.6940 2508.5418 [30,] 18482.8674 5363.6940 [31,] -47813.2732 18482.8674 [32,] 385.1167 -47813.2732 [33,] -2834.6330 385.1167 [34,] 33192.8256 -2834.6330 [35,] 2508.5418 33192.8256 [36,] 5363.6940 2508.5418 [37,] 18482.8674 5363.6940 [38,] -47813.2732 18482.8674 [39,] 385.1167 -47813.2732 [40,] 5363.6940 385.1167 [41,] 18482.8674 5363.6940 [42,] -47813.2732 18482.8674 [43,] 385.1167 -47813.2732 [44,] 5363.6940 385.1167 [45,] 18482.8674 5363.6940 [46,] -47813.2732 18482.8674 [47,] 385.1167 -47813.2732 [48,] -2834.6330 385.1167 [49,] 33192.8256 -2834.6330 [50,] 2508.5418 33192.8256 [51,] 5363.6940 2508.5418 [52,] 18482.8674 5363.6940 [53,] -47813.2732 18482.8674 [54,] 385.1167 -47813.2732 [55,] -2834.6330 385.1167 [56,] 33192.8256 -2834.6330 [57,] 2508.5418 33192.8256 [58,] 385.1167 2508.5418 [59,] -2834.6330 385.1167 [60,] 33192.8256 -2834.6330 [61,] 2508.5418 33192.8256 [62,] 5363.6940 2508.5418 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 18482.8674 5363.6940 2 -47813.2732 18482.8674 3 385.1167 -47813.2732 4 -2834.6330 385.1167 5 33192.8256 -2834.6330 6 2508.5418 33192.8256 7 5363.6940 2508.5418 8 18482.8674 5363.6940 9 -47813.2732 18482.8674 10 385.1167 -47813.2732 11 5363.6940 385.1167 12 18482.8674 5363.6940 13 -47813.2732 18482.8674 14 385.1167 -47813.2732 15 5363.6940 385.1167 16 18482.8674 5363.6940 17 -47813.2732 18482.8674 18 385.1167 -47813.2732 19 -2834.6330 385.1167 20 33192.8256 -2834.6330 21 2508.5418 33192.8256 22 5363.6940 2508.5418 23 18482.8674 5363.6940 24 -47813.2732 18482.8674 25 385.1167 -47813.2732 26 -2834.6330 385.1167 27 33192.8256 -2834.6330 28 2508.5418 33192.8256 29 5363.6940 2508.5418 30 18482.8674 5363.6940 31 -47813.2732 18482.8674 32 385.1167 -47813.2732 33 -2834.6330 385.1167 34 33192.8256 -2834.6330 35 2508.5418 33192.8256 36 5363.6940 2508.5418 37 18482.8674 5363.6940 38 -47813.2732 18482.8674 39 385.1167 -47813.2732 40 5363.6940 385.1167 41 18482.8674 5363.6940 42 -47813.2732 18482.8674 43 385.1167 -47813.2732 44 5363.6940 385.1167 45 18482.8674 5363.6940 46 -47813.2732 18482.8674 47 385.1167 -47813.2732 48 -2834.6330 385.1167 49 33192.8256 -2834.6330 50 2508.5418 33192.8256 51 5363.6940 2508.5418 52 18482.8674 5363.6940 53 -47813.2732 18482.8674 54 385.1167 -47813.2732 55 -2834.6330 385.1167 56 33192.8256 -2834.6330 57 2508.5418 33192.8256 58 385.1167 2508.5418 59 -2834.6330 385.1167 60 33192.8256 -2834.6330 61 2508.5418 33192.8256 62 5363.6940 2508.5418 > 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/wessaorg/rcomp/tmp/7425x1321999162.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/wessaorg/rcomp/tmp/890dz1321999162.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/wessaorg/rcomp/tmp/9b1a31321999162.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/wessaorg/rcomp/tmp/10idyn1321999162.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/111g941321999162.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/wessaorg/rcomp/tmp/1232nu1321999162.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/wessaorg/rcomp/tmp/13bdt61321999162.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/wessaorg/rcomp/tmp/1494de1321999162.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/wessaorg/rcomp/tmp/156jcg1321999162.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/wessaorg/rcomp/tmp/16jpgv1321999162.tab") + } > > try(system("convert tmp/1qaob1321999162.ps tmp/1qaob1321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/2rh2v1321999162.ps tmp/2rh2v1321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/35nhl1321999162.ps tmp/35nhl1321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/42mtj1321999162.ps tmp/42mtj1321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/5r8qz1321999162.ps tmp/5r8qz1321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/6uwa71321999162.ps tmp/6uwa71321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/7425x1321999162.ps tmp/7425x1321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/890dz1321999162.ps tmp/890dz1321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/9b1a31321999162.ps tmp/9b1a31321999162.png",intern=TRUE)) character(0) > try(system("convert tmp/10idyn1321999162.ps tmp/10idyn1321999162.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.525 0.636 4.183