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(308347,0,298427,0,289231,0,291975,0,294912,0,293488,0,290555,0,284736,0,281818,0,287854,0,316263,0,325412,0,326011,0,328282,0,317480,0,317539,0,313737,0,312276,0,309391,0,302950,0,300316,0,304035,0,333476,0,337698,0,335932,0,323931,0,313927,0,314485,1,313218,1,309664,1,302963,1,298989,1,298423,1,301631,1,329765,1,335083,1,327616,1,309119,1,295916,1,291413,1,291542,1,284678,1,276475,1,272566,1,264981,1,263290,1,296806,1,303598,1,286994,1,276427,1,266424,1,267153,1,268381,1,262522,1,255542,1,253158,1,243803,1,250741,1,280445,1,285257,1,270976,1,261076,1,255603,1),dim=c(2,63),dimnames=list(c('Vrouwen','Dummy'),1:63))
> y <- array(NA,dim=c(2,63),dimnames=list(c('Vrouwen','Dummy'),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 = '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
Vrouwen Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 308347 0 1 0 0 0 0 0 0 0 0 0 0
2 298427 0 0 1 0 0 0 0 0 0 0 0 0
3 289231 0 0 0 1 0 0 0 0 0 0 0 0
4 291975 0 0 0 0 1 0 0 0 0 0 0 0
5 294912 0 0 0 0 0 1 0 0 0 0 0 0
6 293488 0 0 0 0 0 0 1 0 0 0 0 0
7 290555 0 0 0 0 0 0 0 1 0 0 0 0
8 284736 0 0 0 0 0 0 0 0 1 0 0 0
9 281818 0 0 0 0 0 0 0 0 0 1 0 0
10 287854 0 0 0 0 0 0 0 0 0 0 1 0
11 316263 0 0 0 0 0 0 0 0 0 0 0 1
12 325412 0 0 0 0 0 0 0 0 0 0 0 0
13 326011 0 1 0 0 0 0 0 0 0 0 0 0
14 328282 0 0 1 0 0 0 0 0 0 0 0 0
15 317480 0 0 0 1 0 0 0 0 0 0 0 0
16 317539 0 0 0 0 1 0 0 0 0 0 0 0
17 313737 0 0 0 0 0 1 0 0 0 0 0 0
18 312276 0 0 0 0 0 0 1 0 0 0 0 0
19 309391 0 0 0 0 0 0 0 1 0 0 0 0
20 302950 0 0 0 0 0 0 0 0 1 0 0 0
21 300316 0 0 0 0 0 0 0 0 0 1 0 0
22 304035 0 0 0 0 0 0 0 0 0 0 1 0
23 333476 0 0 0 0 0 0 0 0 0 0 0 1
24 337698 0 0 0 0 0 0 0 0 0 0 0 0
25 335932 0 1 0 0 0 0 0 0 0 0 0 0
26 323931 0 0 1 0 0 0 0 0 0 0 0 0
27 313927 0 0 0 1 0 0 0 0 0 0 0 0
28 314485 1 0 0 0 1 0 0 0 0 0 0 0
29 313218 1 0 0 0 0 1 0 0 0 0 0 0
30 309664 1 0 0 0 0 0 1 0 0 0 0 0
31 302963 1 0 0 0 0 0 0 1 0 0 0 0
32 298989 1 0 0 0 0 0 0 0 1 0 0 0
33 298423 1 0 0 0 0 0 0 0 0 1 0 0
34 301631 1 0 0 0 0 0 0 0 0 0 1 0
35 329765 1 0 0 0 0 0 0 0 0 0 0 1
36 335083 1 0 0 0 0 0 0 0 0 0 0 0
37 327616 1 1 0 0 0 0 0 0 0 0 0 0
38 309119 1 0 1 0 0 0 0 0 0 0 0 0
39 295916 1 0 0 1 0 0 0 0 0 0 0 0
40 291413 1 0 0 0 1 0 0 0 0 0 0 0
41 291542 1 0 0 0 0 1 0 0 0 0 0 0
42 284678 1 0 0 0 0 0 1 0 0 0 0 0
43 276475 1 0 0 0 0 0 0 1 0 0 0 0
44 272566 1 0 0 0 0 0 0 0 1 0 0 0
45 264981 1 0 0 0 0 0 0 0 0 1 0 0
46 263290 1 0 0 0 0 0 0 0 0 0 1 0
47 296806 1 0 0 0 0 0 0 0 0 0 0 1
48 303598 1 0 0 0 0 0 0 0 0 0 0 0
49 286994 1 1 0 0 0 0 0 0 0 0 0 0
50 276427 1 0 1 0 0 0 0 0 0 0 0 0
51 266424 1 0 0 1 0 0 0 0 0 0 0 0
52 267153 1 0 0 0 1 0 0 0 0 0 0 0
53 268381 1 0 0 0 0 1 0 0 0 0 0 0
54 262522 1 0 0 0 0 0 1 0 0 0 0 0
55 255542 1 0 0 0 0 0 0 1 0 0 0 0
56 253158 1 0 0 0 0 0 0 0 1 0 0 0
57 243803 1 0 0 0 0 0 0 0 0 1 0 0
58 250741 1 0 0 0 0 0 0 0 0 0 1 0
59 280445 1 0 0 0 0 0 0 0 0 0 0 1
60 285257 1 0 0 0 0 0 0 0 0 0 0 0
61 270976 1 1 0 0 0 0 0 0 0 0 0 0
62 261076 1 0 1 0 0 0 0 0 0 0 0 0
63 255603 1 0 0 1 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Dummy M1 M2 M3 M4
331454 -23408 -10438 -20207 -29987 -20897
M5 M6 M7 M8 M9 M10
-21052 -24884 -30424 -34930 -39541 -35899
M11
-6059
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-26764 -12745 -1147 12572 30007
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 331454 9047 36.637 < 2e-16 ***
Dummy -23408 4892 -4.785 1.56e-05 ***
M1 -10438 11597 -0.900 0.37243
M2 -20207 11597 -1.742 0.08759 .
M3 -29987 11597 -2.586 0.01268 *
M4 -20897 12102 -1.727 0.09040 .
M5 -21052 12102 -1.739 0.08810 .
M6 -24884 12102 -2.056 0.04501 *
M7 -30424 12102 -2.514 0.01520 *
M8 -34930 12102 -2.886 0.00574 **
M9 -39541 12102 -3.267 0.00197 **
M10 -35899 12102 -2.966 0.00461 **
M11 -6059 12102 -0.501 0.61883
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 19140 on 50 degrees of freedom
Multiple R-squared: 0.4855, Adjusted R-squared: 0.362
F-statistic: 3.932 on 12 and 50 DF, p-value: 0.0002904
> 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.597912332 0.804175335 0.4020877
[2,] 0.486815803 0.973631606 0.5131842
[3,] 0.390275864 0.780551728 0.6097241
[4,] 0.308236646 0.616473291 0.6917634
[5,] 0.238419723 0.476839447 0.7615803
[6,] 0.182196049 0.364392098 0.8178040
[7,] 0.131278286 0.262556572 0.8687217
[8,] 0.094860512 0.189721024 0.9051395
[9,] 0.062032408 0.124064816 0.9379676
[10,] 0.047939614 0.095879229 0.9520604
[11,] 0.029454339 0.058908678 0.9705457
[12,] 0.017522369 0.035044737 0.9824776
[13,] 0.011808515 0.023617030 0.9881915
[14,] 0.007796907 0.015593814 0.9922031
[15,] 0.005534015 0.011068030 0.9944660
[16,] 0.004237656 0.008475312 0.9957623
[17,] 0.003239394 0.006478789 0.9967606
[18,] 0.003403518 0.006807036 0.9965965
[19,] 0.004232051 0.008464102 0.9957679
[20,] 0.005321488 0.010642975 0.9946785
[21,] 0.007792497 0.015584995 0.9922075
[22,] 0.024791443 0.049582886 0.9752086
[23,] 0.072406432 0.144812865 0.9275936
[24,] 0.175439722 0.350879444 0.8245603
[25,] 0.228459453 0.456918907 0.7715405
[26,] 0.276738101 0.553476201 0.7232619
[27,] 0.343383499 0.686766998 0.6566165
[28,] 0.417359135 0.834718270 0.5826409
[29,] 0.459293429 0.918586858 0.5407066
[30,] 0.544804083 0.910391834 0.4551959
[31,] 0.521236066 0.957527868 0.4787639
[32,] 0.495843958 0.991687915 0.5041560
> postscript(file="/var/www/html/rcomp/tmp/1iqu81229462221.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/2gp4y1229462221.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/3k8bw1229462221.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/4bmyi1229462221.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/5ht4v1229462221.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 = 63
Frequency = 1
1 2 3 4 5 6
-12669.5327 -12820.5327 -12236.3660 -18582.6392 -15490.6392 -13082.2392
7 8 9 10 11 12
-10474.8392 -11788.4392 -10094.8392 -7700.8392 -9132.6392 -6042.2392
13 14 15 16 17 18
4994.4673 17034.4673 16012.6340 6981.3608 3334.3608 5705.7608
19 20 21 22 23 24
8361.1608 6425.5608 8403.1608 8480.1608 8080.3608 6243.7608
25 26 27 28 29 30
14915.4673 12683.4673 12459.6340 27335.0928 26223.0928 26501.4928
31 32 33 34 35 36
25340.8928 25872.2928 29917.8928 29483.8928 27777.0928 27036.4928
37 38 39 40 41 42
30007.1993 21279.1993 17856.3660 4263.0928 4547.0928 1515.4928
43 44 45 46 47 48
-1147.1072 -550.7072 -3524.1072 -8857.1072 -5181.9072 -4448.5072
49 50 51 52 53 54
-10614.8007 -11412.8007 -11635.6340 -19996.9072 -18613.9072 -20640.5072
55 56 57 58 59 60
-22080.1072 -19958.7072 -24702.1072 -21406.1072 -21542.9072 -22789.5072
61 62 63
-26632.8007 -26763.8007 -22456.6340
> postscript(file="/var/www/html/rcomp/tmp/66gxe1229462222.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 = 63
Frequency = 1
lag(myerror, k = 1) myerror
0 -12669.5327 NA
1 -12820.5327 -12669.5327
2 -12236.3660 -12820.5327
3 -18582.6392 -12236.3660
4 -15490.6392 -18582.6392
5 -13082.2392 -15490.6392
6 -10474.8392 -13082.2392
7 -11788.4392 -10474.8392
8 -10094.8392 -11788.4392
9 -7700.8392 -10094.8392
10 -9132.6392 -7700.8392
11 -6042.2392 -9132.6392
12 4994.4673 -6042.2392
13 17034.4673 4994.4673
14 16012.6340 17034.4673
15 6981.3608 16012.6340
16 3334.3608 6981.3608
17 5705.7608 3334.3608
18 8361.1608 5705.7608
19 6425.5608 8361.1608
20 8403.1608 6425.5608
21 8480.1608 8403.1608
22 8080.3608 8480.1608
23 6243.7608 8080.3608
24 14915.4673 6243.7608
25 12683.4673 14915.4673
26 12459.6340 12683.4673
27 27335.0928 12459.6340
28 26223.0928 27335.0928
29 26501.4928 26223.0928
30 25340.8928 26501.4928
31 25872.2928 25340.8928
32 29917.8928 25872.2928
33 29483.8928 29917.8928
34 27777.0928 29483.8928
35 27036.4928 27777.0928
36 30007.1993 27036.4928
37 21279.1993 30007.1993
38 17856.3660 21279.1993
39 4263.0928 17856.3660
40 4547.0928 4263.0928
41 1515.4928 4547.0928
42 -1147.1072 1515.4928
43 -550.7072 -1147.1072
44 -3524.1072 -550.7072
45 -8857.1072 -3524.1072
46 -5181.9072 -8857.1072
47 -4448.5072 -5181.9072
48 -10614.8007 -4448.5072
49 -11412.8007 -10614.8007
50 -11635.6340 -11412.8007
51 -19996.9072 -11635.6340
52 -18613.9072 -19996.9072
53 -20640.5072 -18613.9072
54 -22080.1072 -20640.5072
55 -19958.7072 -22080.1072
56 -24702.1072 -19958.7072
57 -21406.1072 -24702.1072
58 -21542.9072 -21406.1072
59 -22789.5072 -21542.9072
60 -26632.8007 -22789.5072
61 -26763.8007 -26632.8007
62 -22456.6340 -26763.8007
63 NA -22456.6340
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -12820.5327 -12669.5327
[2,] -12236.3660 -12820.5327
[3,] -18582.6392 -12236.3660
[4,] -15490.6392 -18582.6392
[5,] -13082.2392 -15490.6392
[6,] -10474.8392 -13082.2392
[7,] -11788.4392 -10474.8392
[8,] -10094.8392 -11788.4392
[9,] -7700.8392 -10094.8392
[10,] -9132.6392 -7700.8392
[11,] -6042.2392 -9132.6392
[12,] 4994.4673 -6042.2392
[13,] 17034.4673 4994.4673
[14,] 16012.6340 17034.4673
[15,] 6981.3608 16012.6340
[16,] 3334.3608 6981.3608
[17,] 5705.7608 3334.3608
[18,] 8361.1608 5705.7608
[19,] 6425.5608 8361.1608
[20,] 8403.1608 6425.5608
[21,] 8480.1608 8403.1608
[22,] 8080.3608 8480.1608
[23,] 6243.7608 8080.3608
[24,] 14915.4673 6243.7608
[25,] 12683.4673 14915.4673
[26,] 12459.6340 12683.4673
[27,] 27335.0928 12459.6340
[28,] 26223.0928 27335.0928
[29,] 26501.4928 26223.0928
[30,] 25340.8928 26501.4928
[31,] 25872.2928 25340.8928
[32,] 29917.8928 25872.2928
[33,] 29483.8928 29917.8928
[34,] 27777.0928 29483.8928
[35,] 27036.4928 27777.0928
[36,] 30007.1993 27036.4928
[37,] 21279.1993 30007.1993
[38,] 17856.3660 21279.1993
[39,] 4263.0928 17856.3660
[40,] 4547.0928 4263.0928
[41,] 1515.4928 4547.0928
[42,] -1147.1072 1515.4928
[43,] -550.7072 -1147.1072
[44,] -3524.1072 -550.7072
[45,] -8857.1072 -3524.1072
[46,] -5181.9072 -8857.1072
[47,] -4448.5072 -5181.9072
[48,] -10614.8007 -4448.5072
[49,] -11412.8007 -10614.8007
[50,] -11635.6340 -11412.8007
[51,] -19996.9072 -11635.6340
[52,] -18613.9072 -19996.9072
[53,] -20640.5072 -18613.9072
[54,] -22080.1072 -20640.5072
[55,] -19958.7072 -22080.1072
[56,] -24702.1072 -19958.7072
[57,] -21406.1072 -24702.1072
[58,] -21542.9072 -21406.1072
[59,] -22789.5072 -21542.9072
[60,] -26632.8007 -22789.5072
[61,] -26763.8007 -26632.8007
[62,] -22456.6340 -26763.8007
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -12820.5327 -12669.5327
2 -12236.3660 -12820.5327
3 -18582.6392 -12236.3660
4 -15490.6392 -18582.6392
5 -13082.2392 -15490.6392
6 -10474.8392 -13082.2392
7 -11788.4392 -10474.8392
8 -10094.8392 -11788.4392
9 -7700.8392 -10094.8392
10 -9132.6392 -7700.8392
11 -6042.2392 -9132.6392
12 4994.4673 -6042.2392
13 17034.4673 4994.4673
14 16012.6340 17034.4673
15 6981.3608 16012.6340
16 3334.3608 6981.3608
17 5705.7608 3334.3608
18 8361.1608 5705.7608
19 6425.5608 8361.1608
20 8403.1608 6425.5608
21 8480.1608 8403.1608
22 8080.3608 8480.1608
23 6243.7608 8080.3608
24 14915.4673 6243.7608
25 12683.4673 14915.4673
26 12459.6340 12683.4673
27 27335.0928 12459.6340
28 26223.0928 27335.0928
29 26501.4928 26223.0928
30 25340.8928 26501.4928
31 25872.2928 25340.8928
32 29917.8928 25872.2928
33 29483.8928 29917.8928
34 27777.0928 29483.8928
35 27036.4928 27777.0928
36 30007.1993 27036.4928
37 21279.1993 30007.1993
38 17856.3660 21279.1993
39 4263.0928 17856.3660
40 4547.0928 4263.0928
41 1515.4928 4547.0928
42 -1147.1072 1515.4928
43 -550.7072 -1147.1072
44 -3524.1072 -550.7072
45 -8857.1072 -3524.1072
46 -5181.9072 -8857.1072
47 -4448.5072 -5181.9072
48 -10614.8007 -4448.5072
49 -11412.8007 -10614.8007
50 -11635.6340 -11412.8007
51 -19996.9072 -11635.6340
52 -18613.9072 -19996.9072
53 -20640.5072 -18613.9072
54 -22080.1072 -20640.5072
55 -19958.7072 -22080.1072
56 -24702.1072 -19958.7072
57 -21406.1072 -24702.1072
58 -21542.9072 -21406.1072
59 -22789.5072 -21542.9072
60 -26632.8007 -22789.5072
61 -26763.8007 -26632.8007
62 -22456.6340 -26763.8007
> 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/7ebgs1229462222.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/8gmzw1229462222.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/9u7941229462222.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/107cer1229462222.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/112flq1229462222.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/12d25d1229462222.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/13m6mw1229462222.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/14u27p1229462222.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/15sz1s1229462222.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/16osk41229462222.tab")
+ }
>
> system("convert tmp/1iqu81229462221.ps tmp/1iqu81229462221.png")
> system("convert tmp/2gp4y1229462221.ps tmp/2gp4y1229462221.png")
> system("convert tmp/3k8bw1229462221.ps tmp/3k8bw1229462221.png")
> system("convert tmp/4bmyi1229462221.ps tmp/4bmyi1229462221.png")
> system("convert tmp/5ht4v1229462221.ps tmp/5ht4v1229462221.png")
> system("convert tmp/66gxe1229462222.ps tmp/66gxe1229462222.png")
> system("convert tmp/7ebgs1229462222.ps tmp/7ebgs1229462222.png")
> system("convert tmp/8gmzw1229462222.ps tmp/8gmzw1229462222.png")
> system("convert tmp/9u7941229462222.ps tmp/9u7941229462222.png")
> system("convert tmp/107cer1229462222.ps tmp/107cer1229462222.png")
>
>
> proc.time()
user system elapsed
2.552 1.642 9.075