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.
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(2236,0,2084.9,0,2409.5,0,2199.3,0,2203.5,0,2254.1,0,1975.8,0,1742.2,0,2520.6,0,2438.1,0,2126.3,0,2267.5,0,2201.1,0,2128.5,0,2596,1,2458.2,0,2210.5,0,2621.2,0,2231.4,0,2103.6,0,2685.8,0,2539.3,0,2462.4,0,2693.3,0,2307.7,0,2385.9,0,2737.6,1,2653.9,0,2545.4,0,2848.8,0,2359.5,0,2488.3,0,2861.1,0,2717.9,0,2844,0,2749,0,2652.9,0,2660.2,0,3187.1,1,2774.1,0,3158.2,0,3244.6,0,2665.5,0,2820.8,0,2983.4,0,3077.4,0,3024.8,0,2731.8,0,3046.2,0,2834.8,0,3292.8,0,2946.1,0,3196.9,0,3284.2,0,3003,0,2979,0,3137.4,0,3630.2,0,3270.7,0,2942.3,0),dim=c(2,60),dimnames=list(c('The_Netherlands','Dummy'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('The_Netherlands','Dummy'),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
The_Netherlands Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 2236.0 0 1 0 0 0 0 0 0 0 0 0 0 1
2 2084.9 0 0 1 0 0 0 0 0 0 0 0 0 2
3 2409.5 0 0 0 1 0 0 0 0 0 0 0 0 3
4 2199.3 0 0 0 0 1 0 0 0 0 0 0 0 4
5 2203.5 0 0 0 0 0 1 0 0 0 0 0 0 5
6 2254.1 0 0 0 0 0 0 1 0 0 0 0 0 6
7 1975.8 0 0 0 0 0 0 0 1 0 0 0 0 7
8 1742.2 0 0 0 0 0 0 0 0 1 0 0 0 8
9 2520.6 0 0 0 0 0 0 0 0 0 1 0 0 9
10 2438.1 0 0 0 0 0 0 0 0 0 0 1 0 10
11 2126.3 0 0 0 0 0 0 0 0 0 0 0 1 11
12 2267.5 0 0 0 0 0 0 0 0 0 0 0 0 12
13 2201.1 0 1 0 0 0 0 0 0 0 0 0 0 13
14 2128.5 0 0 1 0 0 0 0 0 0 0 0 0 14
15 2596.0 1 0 0 1 0 0 0 0 0 0 0 0 15
16 2458.2 0 0 0 0 1 0 0 0 0 0 0 0 16
17 2210.5 0 0 0 0 0 1 0 0 0 0 0 0 17
18 2621.2 0 0 0 0 0 0 1 0 0 0 0 0 18
19 2231.4 0 0 0 0 0 0 0 1 0 0 0 0 19
20 2103.6 0 0 0 0 0 0 0 0 1 0 0 0 20
21 2685.8 0 0 0 0 0 0 0 0 0 1 0 0 21
22 2539.3 0 0 0 0 0 0 0 0 0 0 1 0 22
23 2462.4 0 0 0 0 0 0 0 0 0 0 0 1 23
24 2693.3 0 0 0 0 0 0 0 0 0 0 0 0 24
25 2307.7 0 1 0 0 0 0 0 0 0 0 0 0 25
26 2385.9 0 0 1 0 0 0 0 0 0 0 0 0 26
27 2737.6 1 0 0 1 0 0 0 0 0 0 0 0 27
28 2653.9 0 0 0 0 1 0 0 0 0 0 0 0 28
29 2545.4 0 0 0 0 0 1 0 0 0 0 0 0 29
30 2848.8 0 0 0 0 0 0 1 0 0 0 0 0 30
31 2359.5 0 0 0 0 0 0 0 1 0 0 0 0 31
32 2488.3 0 0 0 0 0 0 0 0 1 0 0 0 32
33 2861.1 0 0 0 0 0 0 0 0 0 1 0 0 33
34 2717.9 0 0 0 0 0 0 0 0 0 0 1 0 34
35 2844.0 0 0 0 0 0 0 0 0 0 0 0 1 35
36 2749.0 0 0 0 0 0 0 0 0 0 0 0 0 36
37 2652.9 0 1 0 0 0 0 0 0 0 0 0 0 37
38 2660.2 0 0 1 0 0 0 0 0 0 0 0 0 38
39 3187.1 1 0 0 1 0 0 0 0 0 0 0 0 39
40 2774.1 0 0 0 0 1 0 0 0 0 0 0 0 40
41 3158.2 0 0 0 0 0 1 0 0 0 0 0 0 41
42 3244.6 0 0 0 0 0 0 1 0 0 0 0 0 42
43 2665.5 0 0 0 0 0 0 0 1 0 0 0 0 43
44 2820.8 0 0 0 0 0 0 0 0 1 0 0 0 44
45 2983.4 0 0 0 0 0 0 0 0 0 1 0 0 45
46 3077.4 0 0 0 0 0 0 0 0 0 0 1 0 46
47 3024.8 0 0 0 0 0 0 0 0 0 0 0 1 47
48 2731.8 0 0 0 0 0 0 0 0 0 0 0 0 48
49 3046.2 0 1 0 0 0 0 0 0 0 0 0 0 49
50 2834.8 0 0 1 0 0 0 0 0 0 0 0 0 50
51 3292.8 0 0 0 1 0 0 0 0 0 0 0 0 51
52 2946.1 0 0 0 0 1 0 0 0 0 0 0 0 52
53 3196.9 0 0 0 0 0 1 0 0 0 0 0 0 53
54 3284.2 0 0 0 0 0 0 1 0 0 0 0 0 54
55 3003.0 0 0 0 0 0 0 0 1 0 0 0 0 55
56 2979.0 0 0 0 0 0 0 0 0 1 0 0 0 56
57 3137.4 0 0 0 0 0 0 0 0 0 1 0 0 57
58 3630.2 0 0 0 0 0 0 0 0 0 0 1 0 58
59 3270.7 0 0 0 0 0 0 0 0 0 0 0 1 59
60 2942.3 0 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) Dummy M1 M2 M3 M4
1970.25 -10.92 27.88 -61.66 351.00 86.55
M5 M6 M7 M8 M9 M10
123.50 291.55 -131.61 -171.50 219.76 243.05
M11 t
88.49 19.63
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-216.891 -87.573 2.805 74.465 278.602
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1970.252 70.596 27.909 < 2e-16 ***
Dummy -10.917 122.892 -0.089 0.92960
M1 27.883 85.884 0.325 0.74691
M2 -61.662 85.756 -0.719 0.47575
M3 351.002 113.009 3.106 0.00324 **
M4 86.546 85.535 1.012 0.31692
M5 123.500 85.443 1.445 0.15512
M6 291.555 85.364 3.415 0.00134 **
M7 -131.611 85.296 -1.543 0.12968
M8 -171.497 85.241 -2.012 0.05011 .
M9 219.757 85.198 2.579 0.01316 *
M10 243.052 85.167 2.854 0.00646 **
M11 88.486 85.148 1.039 0.30415
t 19.626 1.024 19.164 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 134.6 on 46 degrees of freedom
Multiple R-squared: 0.9097, Adjusted R-squared: 0.8842
F-statistic: 35.64 on 13 and 46 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.2958779 0.5917559 0.7041221
[2,] 0.4746068 0.9492137 0.5253932
[3,] 0.3725306 0.7450612 0.6274694
[4,] 0.3896268 0.7792535 0.6103732
[5,] 0.2913102 0.5826205 0.7086898
[6,] 0.2143271 0.4286541 0.7856729
[7,] 0.1946791 0.3893582 0.8053209
[8,] 0.3691873 0.7383745 0.6308127
[9,] 0.4271017 0.8542034 0.5728983
[10,] 0.3253133 0.6506266 0.6746867
[11,] 0.2769349 0.5538698 0.7230651
[12,] 0.2364297 0.4728594 0.7635703
[13,] 0.2702443 0.5404887 0.7297557
[14,] 0.2331144 0.4662289 0.7668856
[15,] 0.1905386 0.3810773 0.8094614
[16,] 0.2647608 0.5295216 0.7352392
[17,] 0.2213586 0.4427172 0.7786414
[18,] 0.3989067 0.7978134 0.6010933
[19,] 0.4099522 0.8199045 0.5900478
[20,] 0.4877494 0.9754988 0.5122506
[21,] 0.4778858 0.9557716 0.5221142
[22,] 0.3706111 0.7412222 0.6293889
[23,] 0.3174490 0.6348980 0.6825510
[24,] 0.2313798 0.4627597 0.7686202
[25,] 0.3984895 0.7969789 0.6015105
[26,] 0.4706054 0.9412109 0.5293946
[27,] 0.3236212 0.6472423 0.6763788
> postscript(file="/var/www/html/rcomp/tmp/1uk971229298717.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/2ztiv1229298717.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/39iea1229298717.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/4b1gh1229298717.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/5o5ni1229298717.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
218.2383333 137.0583333 29.3683333 63.9983333 11.6183333 -125.4616667
7 8 9 10 11 12
-0.2216667 -213.5616667 153.9583333 28.5383333 -148.3216667 61.7383333
13 14 15 16 17 18
-52.1708333 -54.8508333 -8.7241667 87.3891667 -216.8908333 6.1291667
19 20 21 22 23 24
19.8691667 -87.6708333 83.6491667 -105.7708333 -47.7308333 252.0291667
25 26 27 28 29 30
-181.0800000 -32.9600000 -102.6333333 47.5800000 -117.5000000 -1.7800000
31 32 33 34 35 36
-87.5400000 61.5200000 23.4400000 -162.6800000 98.3600000 72.2200000
37 38 39 40 41 42
-71.3891667 5.8308333 111.3575000 -67.7291667 259.7908333 158.5108333
43 44 45 46 47 48
-17.0491667 158.5108333 -89.7691667 -38.6891667 43.6508333 -180.4891667
49 50 51 52 53 54
86.4016667 -55.0783333 -29.3683333 -131.2383333 62.9816667 -37.3983333
55 56 57 58 59 60
84.9416667 81.2016667 -171.2783333 278.6016667 54.0416667 -205.4983333
> postscript(file="/var/www/html/rcomp/tmp/6fbxq1229298717.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 218.2383333 NA
1 137.0583333 218.2383333
2 29.3683333 137.0583333
3 63.9983333 29.3683333
4 11.6183333 63.9983333
5 -125.4616667 11.6183333
6 -0.2216667 -125.4616667
7 -213.5616667 -0.2216667
8 153.9583333 -213.5616667
9 28.5383333 153.9583333
10 -148.3216667 28.5383333
11 61.7383333 -148.3216667
12 -52.1708333 61.7383333
13 -54.8508333 -52.1708333
14 -8.7241667 -54.8508333
15 87.3891667 -8.7241667
16 -216.8908333 87.3891667
17 6.1291667 -216.8908333
18 19.8691667 6.1291667
19 -87.6708333 19.8691667
20 83.6491667 -87.6708333
21 -105.7708333 83.6491667
22 -47.7308333 -105.7708333
23 252.0291667 -47.7308333
24 -181.0800000 252.0291667
25 -32.9600000 -181.0800000
26 -102.6333333 -32.9600000
27 47.5800000 -102.6333333
28 -117.5000000 47.5800000
29 -1.7800000 -117.5000000
30 -87.5400000 -1.7800000
31 61.5200000 -87.5400000
32 23.4400000 61.5200000
33 -162.6800000 23.4400000
34 98.3600000 -162.6800000
35 72.2200000 98.3600000
36 -71.3891667 72.2200000
37 5.8308333 -71.3891667
38 111.3575000 5.8308333
39 -67.7291667 111.3575000
40 259.7908333 -67.7291667
41 158.5108333 259.7908333
42 -17.0491667 158.5108333
43 158.5108333 -17.0491667
44 -89.7691667 158.5108333
45 -38.6891667 -89.7691667
46 43.6508333 -38.6891667
47 -180.4891667 43.6508333
48 86.4016667 -180.4891667
49 -55.0783333 86.4016667
50 -29.3683333 -55.0783333
51 -131.2383333 -29.3683333
52 62.9816667 -131.2383333
53 -37.3983333 62.9816667
54 84.9416667 -37.3983333
55 81.2016667 84.9416667
56 -171.2783333 81.2016667
57 278.6016667 -171.2783333
58 54.0416667 278.6016667
59 -205.4983333 54.0416667
60 NA -205.4983333
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 137.0583333 218.2383333
[2,] 29.3683333 137.0583333
[3,] 63.9983333 29.3683333
[4,] 11.6183333 63.9983333
[5,] -125.4616667 11.6183333
[6,] -0.2216667 -125.4616667
[7,] -213.5616667 -0.2216667
[8,] 153.9583333 -213.5616667
[9,] 28.5383333 153.9583333
[10,] -148.3216667 28.5383333
[11,] 61.7383333 -148.3216667
[12,] -52.1708333 61.7383333
[13,] -54.8508333 -52.1708333
[14,] -8.7241667 -54.8508333
[15,] 87.3891667 -8.7241667
[16,] -216.8908333 87.3891667
[17,] 6.1291667 -216.8908333
[18,] 19.8691667 6.1291667
[19,] -87.6708333 19.8691667
[20,] 83.6491667 -87.6708333
[21,] -105.7708333 83.6491667
[22,] -47.7308333 -105.7708333
[23,] 252.0291667 -47.7308333
[24,] -181.0800000 252.0291667
[25,] -32.9600000 -181.0800000
[26,] -102.6333333 -32.9600000
[27,] 47.5800000 -102.6333333
[28,] -117.5000000 47.5800000
[29,] -1.7800000 -117.5000000
[30,] -87.5400000 -1.7800000
[31,] 61.5200000 -87.5400000
[32,] 23.4400000 61.5200000
[33,] -162.6800000 23.4400000
[34,] 98.3600000 -162.6800000
[35,] 72.2200000 98.3600000
[36,] -71.3891667 72.2200000
[37,] 5.8308333 -71.3891667
[38,] 111.3575000 5.8308333
[39,] -67.7291667 111.3575000
[40,] 259.7908333 -67.7291667
[41,] 158.5108333 259.7908333
[42,] -17.0491667 158.5108333
[43,] 158.5108333 -17.0491667
[44,] -89.7691667 158.5108333
[45,] -38.6891667 -89.7691667
[46,] 43.6508333 -38.6891667
[47,] -180.4891667 43.6508333
[48,] 86.4016667 -180.4891667
[49,] -55.0783333 86.4016667
[50,] -29.3683333 -55.0783333
[51,] -131.2383333 -29.3683333
[52,] 62.9816667 -131.2383333
[53,] -37.3983333 62.9816667
[54,] 84.9416667 -37.3983333
[55,] 81.2016667 84.9416667
[56,] -171.2783333 81.2016667
[57,] 278.6016667 -171.2783333
[58,] 54.0416667 278.6016667
[59,] -205.4983333 54.0416667
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 137.0583333 218.2383333
2 29.3683333 137.0583333
3 63.9983333 29.3683333
4 11.6183333 63.9983333
5 -125.4616667 11.6183333
6 -0.2216667 -125.4616667
7 -213.5616667 -0.2216667
8 153.9583333 -213.5616667
9 28.5383333 153.9583333
10 -148.3216667 28.5383333
11 61.7383333 -148.3216667
12 -52.1708333 61.7383333
13 -54.8508333 -52.1708333
14 -8.7241667 -54.8508333
15 87.3891667 -8.7241667
16 -216.8908333 87.3891667
17 6.1291667 -216.8908333
18 19.8691667 6.1291667
19 -87.6708333 19.8691667
20 83.6491667 -87.6708333
21 -105.7708333 83.6491667
22 -47.7308333 -105.7708333
23 252.0291667 -47.7308333
24 -181.0800000 252.0291667
25 -32.9600000 -181.0800000
26 -102.6333333 -32.9600000
27 47.5800000 -102.6333333
28 -117.5000000 47.5800000
29 -1.7800000 -117.5000000
30 -87.5400000 -1.7800000
31 61.5200000 -87.5400000
32 23.4400000 61.5200000
33 -162.6800000 23.4400000
34 98.3600000 -162.6800000
35 72.2200000 98.3600000
36 -71.3891667 72.2200000
37 5.8308333 -71.3891667
38 111.3575000 5.8308333
39 -67.7291667 111.3575000
40 259.7908333 -67.7291667
41 158.5108333 259.7908333
42 -17.0491667 158.5108333
43 158.5108333 -17.0491667
44 -89.7691667 158.5108333
45 -38.6891667 -89.7691667
46 43.6508333 -38.6891667
47 -180.4891667 43.6508333
48 86.4016667 -180.4891667
49 -55.0783333 86.4016667
50 -29.3683333 -55.0783333
51 -131.2383333 -29.3683333
52 62.9816667 -131.2383333
53 -37.3983333 62.9816667
54 84.9416667 -37.3983333
55 81.2016667 84.9416667
56 -171.2783333 81.2016667
57 278.6016667 -171.2783333
58 54.0416667 278.6016667
59 -205.4983333 54.0416667
> 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/77d3t1229298717.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/8l39d1229298717.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/9rhba1229298717.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/10pddk1229298717.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/11fsds1229298717.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/128ep91229298718.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/134j871229298718.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/14crr01229298718.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/15mbyv1229298718.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/1604jj1229298718.tab")
+ }
>
> system("convert tmp/1uk971229298717.ps tmp/1uk971229298717.png")
> system("convert tmp/2ztiv1229298717.ps tmp/2ztiv1229298717.png")
> system("convert tmp/39iea1229298717.ps tmp/39iea1229298717.png")
> system("convert tmp/4b1gh1229298717.ps tmp/4b1gh1229298717.png")
> system("convert tmp/5o5ni1229298717.ps tmp/5o5ni1229298717.png")
> system("convert tmp/6fbxq1229298717.ps tmp/6fbxq1229298717.png")
> system("convert tmp/77d3t1229298717.ps tmp/77d3t1229298717.png")
> system("convert tmp/8l39d1229298717.ps tmp/8l39d1229298717.png")
> system("convert tmp/9rhba1229298717.ps tmp/9rhba1229298717.png")
> system("convert tmp/10pddk1229298717.ps tmp/10pddk1229298717.png")
>
>
> proc.time()
user system elapsed
2.466 1.615 3.063