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(1038.00,0,934.00,0,988.00,0,870.00,0,854.00,0,834.00,0,872.00,0,954.00,0,870.00,0,1238.00,0,1082.00,0,1053.00,0,934.00,0,787.00,0,1081.00,0,908.00,0,995.00,0,825.00,0,822.00,0,856.00,0,887.00,0,1094.00,0,990.00,0,936.00,0,1097.00,0,918.00,0,926.00,0,907.00,0,899.00,0,971.00,0,1087.00,0,1000.00,0,1071.00,0,1190.00,0,1116.00,0,1070.00,0,1314.00,0,1068.00,0,1185.00,0,1215.00,0,1145.00,0,1251.00,1,1363.00,1,1368.00,1,1535.00,1,1853.00,1,1866.00,1,2023.00,1,1373.00,1,1968.00,1,1424.00,1,1160.00,1,1243.00,1,1375.00,1,1539.00,1,1773.00,1,1906.00,1,2076.00,1,2004.00,1),dim=c(2,59),dimnames=list(c('Asielaanvragen','Verandering'),1:59))
> y <- array(NA,dim=c(2,59),dimnames=list(c('Asielaanvragen','Verandering'),1:59))
> 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
Asielaanvragen Verandering M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 1038 0 1 0 0 0 0 0 0 0 0 0 0 1
2 934 0 0 1 0 0 0 0 0 0 0 0 0 2
3 988 0 0 0 1 0 0 0 0 0 0 0 0 3
4 870 0 0 0 0 1 0 0 0 0 0 0 0 4
5 854 0 0 0 0 0 1 0 0 0 0 0 0 5
6 834 0 0 0 0 0 0 1 0 0 0 0 0 6
7 872 0 0 0 0 0 0 0 1 0 0 0 0 7
8 954 0 0 0 0 0 0 0 0 1 0 0 0 8
9 870 0 0 0 0 0 0 0 0 0 1 0 0 9
10 1238 0 0 0 0 0 0 0 0 0 0 1 0 10
11 1082 0 0 0 0 0 0 0 0 0 0 0 1 11
12 1053 0 0 0 0 0 0 0 0 0 0 0 0 12
13 934 0 1 0 0 0 0 0 0 0 0 0 0 13
14 787 0 0 1 0 0 0 0 0 0 0 0 0 14
15 1081 0 0 0 1 0 0 0 0 0 0 0 0 15
16 908 0 0 0 0 1 0 0 0 0 0 0 0 16
17 995 0 0 0 0 0 1 0 0 0 0 0 0 17
18 825 0 0 0 0 0 0 1 0 0 0 0 0 18
19 822 0 0 0 0 0 0 0 1 0 0 0 0 19
20 856 0 0 0 0 0 0 0 0 1 0 0 0 20
21 887 0 0 0 0 0 0 0 0 0 1 0 0 21
22 1094 0 0 0 0 0 0 0 0 0 0 1 0 22
23 990 0 0 0 0 0 0 0 0 0 0 0 1 23
24 936 0 0 0 0 0 0 0 0 0 0 0 0 24
25 1097 0 1 0 0 0 0 0 0 0 0 0 0 25
26 918 0 0 1 0 0 0 0 0 0 0 0 0 26
27 926 0 0 0 1 0 0 0 0 0 0 0 0 27
28 907 0 0 0 0 1 0 0 0 0 0 0 0 28
29 899 0 0 0 0 0 1 0 0 0 0 0 0 29
30 971 0 0 0 0 0 0 1 0 0 0 0 0 30
31 1087 0 0 0 0 0 0 0 1 0 0 0 0 31
32 1000 0 0 0 0 0 0 0 0 1 0 0 0 32
33 1071 0 0 0 0 0 0 0 0 0 1 0 0 33
34 1190 0 0 0 0 0 0 0 0 0 0 1 0 34
35 1116 0 0 0 0 0 0 0 0 0 0 0 1 35
36 1070 0 0 0 0 0 0 0 0 0 0 0 0 36
37 1314 0 1 0 0 0 0 0 0 0 0 0 0 37
38 1068 0 0 1 0 0 0 0 0 0 0 0 0 38
39 1185 0 0 0 1 0 0 0 0 0 0 0 0 39
40 1215 0 0 0 0 1 0 0 0 0 0 0 0 40
41 1145 0 0 0 0 0 1 0 0 0 0 0 0 41
42 1251 1 0 0 0 0 0 1 0 0 0 0 0 42
43 1363 1 0 0 0 0 0 0 1 0 0 0 0 43
44 1368 1 0 0 0 0 0 0 0 1 0 0 0 44
45 1535 1 0 0 0 0 0 0 0 0 1 0 0 45
46 1853 1 0 0 0 0 0 0 0 0 0 1 0 46
47 1866 1 0 0 0 0 0 0 0 0 0 0 1 47
48 2023 1 0 0 0 0 0 0 0 0 0 0 0 48
49 1373 1 1 0 0 0 0 0 0 0 0 0 0 49
50 1968 1 0 1 0 0 0 0 0 0 0 0 0 50
51 1424 1 0 0 1 0 0 0 0 0 0 0 0 51
52 1160 1 0 0 0 1 0 0 0 0 0 0 0 52
53 1243 1 0 0 0 0 1 0 0 0 0 0 0 53
54 1375 1 0 0 0 0 0 1 0 0 0 0 0 54
55 1539 1 0 0 0 0 0 0 1 0 0 0 0 55
56 1773 1 0 0 0 0 0 0 0 1 0 0 0 56
57 1906 1 0 0 0 0 0 0 0 0 1 0 0 57
58 2076 1 0 0 0 0 0 0 0 0 0 1 0 58
59 2004 1 0 0 0 0 0 0 0 0 0 0 1 59
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Verandering M1 M2 M3 M4
980.866 433.158 -67.418 -89.663 -109.908 -224.752
M5 M6 M7 M8 M9 M10
-215.597 -284.274 -204.918 -157.363 -99.808 130.547
M11 t
45.902 6.045
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-343.60 -114.58 -2.57 100.02 341.40
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 980.866 95.985 10.219 2.63e-13 ***
Verandering 433.158 78.714 5.503 1.70e-06 ***
M1 -67.418 110.817 -0.608 0.54600
M2 -89.663 110.695 -0.810 0.42220
M3 -109.908 110.614 -0.994 0.32572
M4 -224.752 110.573 -2.033 0.04802 *
M5 -215.597 110.572 -1.950 0.05744 .
M6 -284.274 111.170 -2.557 0.01400 *
M7 -204.918 111.011 -1.846 0.07149 .
M8 -157.363 110.893 -1.419 0.16277
M9 -99.808 110.814 -0.901 0.37255
M10 130.547 110.776 1.178 0.24480
M11 45.902 110.779 0.414 0.68058
t 6.045 2.114 2.859 0.00642 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 164.8 on 45 degrees of freedom
Multiple R-squared: 0.8282, Adjusted R-squared: 0.7786
F-statistic: 16.69 on 13 and 45 DF, p-value: 4.516e-13
> 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,] 2.121691e-01 0.4243381132 0.7878309
[2,] 1.022567e-01 0.2045133203 0.8977433
[3,] 4.618999e-02 0.0923799816 0.9538100
[4,] 2.364988e-02 0.0472997577 0.9763501
[5,] 9.167711e-03 0.0183354226 0.9908323
[6,] 6.061945e-03 0.0121238903 0.9939381
[7,] 2.574940e-03 0.0051498807 0.9974251
[8,] 1.303825e-03 0.0026076504 0.9986962
[9,] 1.699135e-03 0.0033982702 0.9983009
[10,] 9.069085e-04 0.0018138171 0.9990931
[11,] 4.749814e-04 0.0009499627 0.9995250
[12,] 1.992993e-04 0.0003985985 0.9998007
[13,] 7.597698e-05 0.0001519540 0.9999240
[14,] 1.091587e-04 0.0002183174 0.9998908
[15,] 4.359586e-04 0.0008719172 0.9995640
[16,] 1.938661e-04 0.0003877321 0.9998061
[17,] 1.632752e-04 0.0003265504 0.9998367
[18,] 7.726500e-05 0.0001545300 0.9999227
[19,] 5.895215e-05 0.0001179043 0.9999410
[20,] 7.065806e-04 0.0014131612 0.9992934
[21,] 1.799971e-03 0.0035999414 0.9982000
[22,] 4.434254e-01 0.8868507610 0.5565746
[23,] 5.278592e-01 0.9442816590 0.4721408
[24,] 5.553447e-01 0.8893106742 0.4446553
[25,] 4.191351e-01 0.8382701882 0.5808649
[26,] 3.696012e-01 0.7392024164 0.6303988
> postscript(file="/var/www/html/rcomp/tmp/1eb7x1292951181.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/rcomp/tmp/2p2701292951181.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/rcomp/tmp/3p2701292951181.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/rcomp/tmp/4p2701292951181.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/rcomp/tmp/5p2701292951181.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 = 59
Frequency = 1
1 2 3 4 5 6
118.5071429 30.7071429 98.9071429 89.7071429 58.5071429 101.1386905
7 8 9 10 11 12
53.7386905 82.1386905 -65.4613095 66.1386905 -11.2613095 -0.4038690
13 14 15 16 17 18
-58.0306548 -188.8306548 119.3693452 55.1693452 126.9693452 19.6008929
19 20 21 22 23 24
-68.7991071 -88.3991071 -120.9991071 -150.3991071 -175.7991071 -189.9416667
25 26 27 28 29 30
32.4315476 -130.3684524 -108.1684524 -18.3684524 -41.5684524 93.0630952
31 32 33 34 35 36
123.6630952 -16.9369048 -9.5369048 -126.9369048 -122.3369048 -128.4794643
37 38 39 40 41 42
176.8937500 -52.9062500 78.2937500 217.0937500 131.8937500 -132.6324405
43 44 45 46 47 48
-106.0324405 -154.6324405 -51.2324405 30.3675595 121.9675595 318.8250000
49 50 51 52 53 54
-269.8017857 341.3982143 -188.4017857 -343.6017857 -275.8017857 -81.1702381
55 56 57 58 59
-2.5702381 177.8297619 247.2297619 180.8297619 187.4297619
> postscript(file="/var/www/html/rcomp/tmp/60tol1292951181.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 = 59
Frequency = 1
lag(myerror, k = 1) myerror
0 118.5071429 NA
1 30.7071429 118.5071429
2 98.9071429 30.7071429
3 89.7071429 98.9071429
4 58.5071429 89.7071429
5 101.1386905 58.5071429
6 53.7386905 101.1386905
7 82.1386905 53.7386905
8 -65.4613095 82.1386905
9 66.1386905 -65.4613095
10 -11.2613095 66.1386905
11 -0.4038690 -11.2613095
12 -58.0306548 -0.4038690
13 -188.8306548 -58.0306548
14 119.3693452 -188.8306548
15 55.1693452 119.3693452
16 126.9693452 55.1693452
17 19.6008929 126.9693452
18 -68.7991071 19.6008929
19 -88.3991071 -68.7991071
20 -120.9991071 -88.3991071
21 -150.3991071 -120.9991071
22 -175.7991071 -150.3991071
23 -189.9416667 -175.7991071
24 32.4315476 -189.9416667
25 -130.3684524 32.4315476
26 -108.1684524 -130.3684524
27 -18.3684524 -108.1684524
28 -41.5684524 -18.3684524
29 93.0630952 -41.5684524
30 123.6630952 93.0630952
31 -16.9369048 123.6630952
32 -9.5369048 -16.9369048
33 -126.9369048 -9.5369048
34 -122.3369048 -126.9369048
35 -128.4794643 -122.3369048
36 176.8937500 -128.4794643
37 -52.9062500 176.8937500
38 78.2937500 -52.9062500
39 217.0937500 78.2937500
40 131.8937500 217.0937500
41 -132.6324405 131.8937500
42 -106.0324405 -132.6324405
43 -154.6324405 -106.0324405
44 -51.2324405 -154.6324405
45 30.3675595 -51.2324405
46 121.9675595 30.3675595
47 318.8250000 121.9675595
48 -269.8017857 318.8250000
49 341.3982143 -269.8017857
50 -188.4017857 341.3982143
51 -343.6017857 -188.4017857
52 -275.8017857 -343.6017857
53 -81.1702381 -275.8017857
54 -2.5702381 -81.1702381
55 177.8297619 -2.5702381
56 247.2297619 177.8297619
57 180.8297619 247.2297619
58 187.4297619 180.8297619
59 NA 187.4297619
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 30.7071429 118.5071429
[2,] 98.9071429 30.7071429
[3,] 89.7071429 98.9071429
[4,] 58.5071429 89.7071429
[5,] 101.1386905 58.5071429
[6,] 53.7386905 101.1386905
[7,] 82.1386905 53.7386905
[8,] -65.4613095 82.1386905
[9,] 66.1386905 -65.4613095
[10,] -11.2613095 66.1386905
[11,] -0.4038690 -11.2613095
[12,] -58.0306548 -0.4038690
[13,] -188.8306548 -58.0306548
[14,] 119.3693452 -188.8306548
[15,] 55.1693452 119.3693452
[16,] 126.9693452 55.1693452
[17,] 19.6008929 126.9693452
[18,] -68.7991071 19.6008929
[19,] -88.3991071 -68.7991071
[20,] -120.9991071 -88.3991071
[21,] -150.3991071 -120.9991071
[22,] -175.7991071 -150.3991071
[23,] -189.9416667 -175.7991071
[24,] 32.4315476 -189.9416667
[25,] -130.3684524 32.4315476
[26,] -108.1684524 -130.3684524
[27,] -18.3684524 -108.1684524
[28,] -41.5684524 -18.3684524
[29,] 93.0630952 -41.5684524
[30,] 123.6630952 93.0630952
[31,] -16.9369048 123.6630952
[32,] -9.5369048 -16.9369048
[33,] -126.9369048 -9.5369048
[34,] -122.3369048 -126.9369048
[35,] -128.4794643 -122.3369048
[36,] 176.8937500 -128.4794643
[37,] -52.9062500 176.8937500
[38,] 78.2937500 -52.9062500
[39,] 217.0937500 78.2937500
[40,] 131.8937500 217.0937500
[41,] -132.6324405 131.8937500
[42,] -106.0324405 -132.6324405
[43,] -154.6324405 -106.0324405
[44,] -51.2324405 -154.6324405
[45,] 30.3675595 -51.2324405
[46,] 121.9675595 30.3675595
[47,] 318.8250000 121.9675595
[48,] -269.8017857 318.8250000
[49,] 341.3982143 -269.8017857
[50,] -188.4017857 341.3982143
[51,] -343.6017857 -188.4017857
[52,] -275.8017857 -343.6017857
[53,] -81.1702381 -275.8017857
[54,] -2.5702381 -81.1702381
[55,] 177.8297619 -2.5702381
[56,] 247.2297619 177.8297619
[57,] 180.8297619 247.2297619
[58,] 187.4297619 180.8297619
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 30.7071429 118.5071429
2 98.9071429 30.7071429
3 89.7071429 98.9071429
4 58.5071429 89.7071429
5 101.1386905 58.5071429
6 53.7386905 101.1386905
7 82.1386905 53.7386905
8 -65.4613095 82.1386905
9 66.1386905 -65.4613095
10 -11.2613095 66.1386905
11 -0.4038690 -11.2613095
12 -58.0306548 -0.4038690
13 -188.8306548 -58.0306548
14 119.3693452 -188.8306548
15 55.1693452 119.3693452
16 126.9693452 55.1693452
17 19.6008929 126.9693452
18 -68.7991071 19.6008929
19 -88.3991071 -68.7991071
20 -120.9991071 -88.3991071
21 -150.3991071 -120.9991071
22 -175.7991071 -150.3991071
23 -189.9416667 -175.7991071
24 32.4315476 -189.9416667
25 -130.3684524 32.4315476
26 -108.1684524 -130.3684524
27 -18.3684524 -108.1684524
28 -41.5684524 -18.3684524
29 93.0630952 -41.5684524
30 123.6630952 93.0630952
31 -16.9369048 123.6630952
32 -9.5369048 -16.9369048
33 -126.9369048 -9.5369048
34 -122.3369048 -126.9369048
35 -128.4794643 -122.3369048
36 176.8937500 -128.4794643
37 -52.9062500 176.8937500
38 78.2937500 -52.9062500
39 217.0937500 78.2937500
40 131.8937500 217.0937500
41 -132.6324405 131.8937500
42 -106.0324405 -132.6324405
43 -154.6324405 -106.0324405
44 -51.2324405 -154.6324405
45 30.3675595 -51.2324405
46 121.9675595 30.3675595
47 318.8250000 121.9675595
48 -269.8017857 318.8250000
49 341.3982143 -269.8017857
50 -188.4017857 341.3982143
51 -343.6017857 -188.4017857
52 -275.8017857 -343.6017857
53 -81.1702381 -275.8017857
54 -2.5702381 -81.1702381
55 177.8297619 -2.5702381
56 247.2297619 177.8297619
57 180.8297619 247.2297619
58 187.4297619 180.8297619
> 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/7a2no1292951181.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/rcomp/tmp/8a2no1292951181.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/rcomp/tmp/9a2no1292951181.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/rcomp/tmp/103c491292951181.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/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/11ou3f1292951181.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/12sv131292951181.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/13onzu1292951181.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/14r5g01292951181.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/15vnen1292951181.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/16y6cb1292951181.tab")
+ }
>
> try(system("convert tmp/1eb7x1292951181.ps tmp/1eb7x1292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/2p2701292951181.ps tmp/2p2701292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/3p2701292951181.ps tmp/3p2701292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/4p2701292951181.ps tmp/4p2701292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/5p2701292951181.ps tmp/5p2701292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/60tol1292951181.ps tmp/60tol1292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/7a2no1292951181.ps tmp/7a2no1292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/8a2no1292951181.ps tmp/8a2no1292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/9a2no1292951181.ps tmp/9a2no1292951181.png",intern=TRUE))
character(0)
> try(system("convert tmp/103c491292951181.ps tmp/103c491292951181.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.462 1.640 5.628