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(100
+ ,100
+ ,96.21064363
+ ,97.82226485
+ ,96.31280765
+ ,94.04971502
+ ,107.1793443
+ ,91.12460521
+ ,114.9066592
+ ,93.13202153
+ ,92.56060184
+ ,93.88342812
+ ,114.9995356
+ ,92.55349954
+ ,107.1236185
+ ,94.43494835
+ ,117.7765394
+ ,96.25017563
+ ,107.3650971
+ ,100.4355715
+ ,106.2970187
+ ,101.5036685
+ ,114.5072908
+ ,99.39789728
+ ,98.0031578
+ ,99.68990733
+ ,103.0649206
+ ,101.6895041
+ ,100.2879168
+ ,103.6652759
+ ,104.6066685
+ ,103.0532766
+ ,111.1544534
+ ,100.9500712
+ ,104.9874617
+ ,102.345366
+ ,109.9284852
+ ,101.6472299
+ ,111.5352466
+ ,99.56809393
+ ,132.4974459
+ ,95.67727392
+ ,100.3436426
+ ,96.58494865
+ ,123.0983561
+ ,96.32604937
+ ,114.2379493
+ ,95.37109101
+ ,104.569518
+ ,96.00056203
+ ,109.0833101
+ ,96.88367859
+ ,106.9843039
+ ,94.85280372
+ ,133.6769759
+ ,92.46943974
+ ,124.8537197
+ ,93.99180173
+ ,122.5132349
+ ,93.45262168
+ ,116.8013374
+ ,92.26698759
+ ,116.0118882
+ ,90.39653498
+ ,129.7575926
+ ,90.43001228
+ ,125.1973623
+ ,91.04995327
+ ,143.7912139
+ ,89.07845784
+ ,127.9465032
+ ,89.69314509
+ ,130.2962757
+ ,87.92459054
+ ,108.4424631
+ ,85.8789319
+ ,129.3675118
+ ,83.20612366
+ ,143.6797622
+ ,83.85722053
+ ,131.8844618
+ ,83.01393462
+ ,117.6186496
+ ,82.84508195
+ ,118.9560695
+ ,78.68864276
+ ,104.8202842
+ ,77.56959675
+ ,134.624315
+ ,78.53689529
+ ,140.401226
+ ,78.55717715
+ ,143.8005015
+ ,77.4761291
+ ,153.4317823
+ ,81.58931659
+ ,153.2924677
+ ,85.02428326
+ ,127.3149438
+ ,91.71290159
+ ,153.5525216
+ ,95.96293061
+ ,136.9276493
+ ,90.84689022
+ ,131.7730101
+ ,92.28788036
+ ,144.3391845
+ ,95.56511274
+ ,107.4208229
+ ,93.62452884
+ ,113.6249652
+ ,92.63071726
+ ,124.2221603
+ ,89.50914211
+ ,102.0618557
+ ,87.17171779
+ ,96.36853348
+ ,86.72624975
+ ,111.6838488
+ ,85.63212844)
+ ,dim=c(2
+ ,60)
+ ,dimnames=list(c('Import'
+ ,'Wisselkoers')
+ ,1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Import','Wisselkoers'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Import Wisselkoers
1 100.00000 100.00000
2 96.21064 97.82226
3 96.31281 94.04972
4 107.17934 91.12461
5 114.90666 93.13202
6 92.56060 93.88343
7 114.99954 92.55350
8 107.12362 94.43495
9 117.77654 96.25018
10 107.36510 100.43557
11 106.29702 101.50367
12 114.50729 99.39790
13 98.00316 99.68991
14 103.06492 101.68950
15 100.28792 103.66528
16 104.60667 103.05328
17 111.15445 100.95007
18 104.98746 102.34537
19 109.92849 101.64723
20 111.53525 99.56809
21 132.49745 95.67727
22 100.34364 96.58495
23 123.09836 96.32605
24 114.23795 95.37109
25 104.56952 96.00056
26 109.08331 96.88368
27 106.98430 94.85280
28 133.67698 92.46944
29 124.85372 93.99180
30 122.51323 93.45262
31 116.80134 92.26699
32 116.01189 90.39653
33 129.75759 90.43001
34 125.19736 91.04995
35 143.79121 89.07846
36 127.94650 89.69315
37 130.29628 87.92459
38 108.44246 85.87893
39 129.36751 83.20612
40 143.67976 83.85722
41 131.88446 83.01393
42 117.61865 82.84508
43 118.95607 78.68864
44 104.82028 77.56960
45 134.62431 78.53690
46 140.40123 78.55718
47 143.80050 77.47613
48 153.43178 81.58932
49 153.29247 85.02428
50 127.31494 91.71290
51 153.55252 95.96293
52 136.92765 90.84689
53 131.77301 92.28788
54 144.33918 95.56511
55 107.42082 93.62453
56 113.62497 92.63072
57 124.22216 89.50914
58 102.06186 87.17172
59 96.36853 86.72625
60 111.68385 85.63213
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Wisselkoers
221.604 -1.119
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-29.972 -9.451 -1.087 7.408 39.345
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 221.6037 24.2674 9.132 8.04e-13 ***
Wisselkoers -1.1191 0.2627 -4.260 7.58e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 14.01 on 58 degrees of freedom
Multiple R-squared: 0.2384, Adjusted R-squared: 0.2252
F-statistic: 18.15 on 1 and 58 DF, p-value: 7.582e-05
> 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.1731433060 0.346286612 0.8268567
[2,] 0.1859608636 0.371921727 0.8140391
[3,] 0.1622377492 0.324475498 0.8377623
[4,] 0.0942392899 0.188478580 0.9057607
[5,] 0.1441898884 0.288379777 0.8558101
[6,] 0.0986368408 0.197273682 0.9013632
[7,] 0.0594050696 0.118810139 0.9405949
[8,] 0.0487310349 0.097462070 0.9512690
[9,] 0.0368653304 0.073730661 0.9631347
[10,] 0.0207298579 0.041459716 0.9792701
[11,] 0.0118095531 0.023619106 0.9881904
[12,] 0.0062634597 0.012526919 0.9937365
[13,] 0.0041370576 0.008274115 0.9958629
[14,] 0.0021119860 0.004223972 0.9978880
[15,] 0.0012119850 0.002423970 0.9987880
[16,] 0.0007301068 0.001460214 0.9992699
[17,] 0.0094069877 0.018813975 0.9905930
[18,] 0.0084308192 0.016861638 0.9915692
[19,] 0.0103518161 0.020703632 0.9896482
[20,] 0.0066974307 0.013394861 0.9933026
[21,] 0.0051595578 0.010319116 0.9948404
[22,] 0.0034386035 0.006877207 0.9965614
[23,] 0.0026588009 0.005317602 0.9973412
[24,] 0.0075894843 0.015178969 0.9924105
[25,] 0.0068900665 0.013780133 0.9931099
[26,] 0.0050348907 0.010069781 0.9949651
[27,] 0.0031899092 0.006379818 0.9968101
[28,] 0.0020464229 0.004092846 0.9979536
[29,] 0.0016990388 0.003398078 0.9983010
[30,] 0.0010615477 0.002123095 0.9989385
[31,] 0.0026481531 0.005296306 0.9973518
[32,] 0.0015281851 0.003056370 0.9984718
[33,] 0.0008434286 0.001686857 0.9991566
[34,] 0.0018706826 0.003741365 0.9981293
[35,] 0.0009905293 0.001981059 0.9990095
[36,] 0.0010851288 0.002170258 0.9989149
[37,] 0.0005704061 0.001140812 0.9994296
[38,] 0.0005181727 0.001036345 0.9994818
[39,] 0.0005137087 0.001027417 0.9994863
[40,] 0.0031749416 0.006349883 0.9968251
[41,] 0.0017203396 0.003440679 0.9982797
[42,] 0.0010840914 0.002168183 0.9989159
[43,] 0.0009118075 0.001823615 0.9990882
[44,] 0.0091148892 0.018229778 0.9908851
[45,] 0.3106533945 0.621306789 0.6893466
[46,] 0.2329914742 0.465982948 0.7670085
[47,] 0.3772623624 0.754524725 0.6227376
[48,] 0.4640063397 0.928012679 0.5359937
[49,] 0.4173815686 0.834763137 0.5826184
[50,] 0.6827835027 0.634432995 0.3172165
[51,] 0.5909620652 0.818075870 0.4090379
> postscript(file="/var/www/html/rcomp/tmp/17kt81258731540.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/28uyn1258731540.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/36f9v1258731540.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/4mq7k1258731540.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/5xoj81258731540.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
-9.6891291 -15.9156891 -20.0355592 -12.4426476 -2.4687407 -23.9738644
7 8 9 10 11 12
-3.0233149 -8.7936160 3.8908093 -1.8365639 -1.7092858 4.1443208
13 14 15 16 17 18
-12.0330103 -4.7334067 -5.2992333 -1.6653982 2.5285927 -2.0768604
19 20 21 22 23 24
2.0828469 1.3627515 17.9705551 -13.1674276 9.2975398 -0.6316049
25 26 27 28 29 30
-9.5955662 -4.0934377 -8.4652895 15.5600502 8.4405394 5.4966334
31 32 33 34 35 36
-1.5421618 -4.4249206 9.3582498 5.4918240 21.8792843 6.7224984
37 38 39 40 41 42
7.0930001 -17.0502032 0.8835827 15.9245056 3.1854451 -11.2693378
43 44 45 46 47 48
-14.5835803 -29.9717415 0.9148376 6.7144469 8.9038718 23.1384100
49 50 51 52 53 54
26.8433247 8.3513415 39.3453223 16.9948538 13.4528930 29.6867690
55 56 57 58 59 60
-9.4033894 -4.3114674 2.7922293 -21.9839944 -28.1758604 -14.0850266
> postscript(file="/var/www/html/rcomp/tmp/63n071258731540.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 -9.6891291 NA
1 -15.9156891 -9.6891291
2 -20.0355592 -15.9156891
3 -12.4426476 -20.0355592
4 -2.4687407 -12.4426476
5 -23.9738644 -2.4687407
6 -3.0233149 -23.9738644
7 -8.7936160 -3.0233149
8 3.8908093 -8.7936160
9 -1.8365639 3.8908093
10 -1.7092858 -1.8365639
11 4.1443208 -1.7092858
12 -12.0330103 4.1443208
13 -4.7334067 -12.0330103
14 -5.2992333 -4.7334067
15 -1.6653982 -5.2992333
16 2.5285927 -1.6653982
17 -2.0768604 2.5285927
18 2.0828469 -2.0768604
19 1.3627515 2.0828469
20 17.9705551 1.3627515
21 -13.1674276 17.9705551
22 9.2975398 -13.1674276
23 -0.6316049 9.2975398
24 -9.5955662 -0.6316049
25 -4.0934377 -9.5955662
26 -8.4652895 -4.0934377
27 15.5600502 -8.4652895
28 8.4405394 15.5600502
29 5.4966334 8.4405394
30 -1.5421618 5.4966334
31 -4.4249206 -1.5421618
32 9.3582498 -4.4249206
33 5.4918240 9.3582498
34 21.8792843 5.4918240
35 6.7224984 21.8792843
36 7.0930001 6.7224984
37 -17.0502032 7.0930001
38 0.8835827 -17.0502032
39 15.9245056 0.8835827
40 3.1854451 15.9245056
41 -11.2693378 3.1854451
42 -14.5835803 -11.2693378
43 -29.9717415 -14.5835803
44 0.9148376 -29.9717415
45 6.7144469 0.9148376
46 8.9038718 6.7144469
47 23.1384100 8.9038718
48 26.8433247 23.1384100
49 8.3513415 26.8433247
50 39.3453223 8.3513415
51 16.9948538 39.3453223
52 13.4528930 16.9948538
53 29.6867690 13.4528930
54 -9.4033894 29.6867690
55 -4.3114674 -9.4033894
56 2.7922293 -4.3114674
57 -21.9839944 2.7922293
58 -28.1758604 -21.9839944
59 -14.0850266 -28.1758604
60 NA -14.0850266
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -15.9156891 -9.6891291
[2,] -20.0355592 -15.9156891
[3,] -12.4426476 -20.0355592
[4,] -2.4687407 -12.4426476
[5,] -23.9738644 -2.4687407
[6,] -3.0233149 -23.9738644
[7,] -8.7936160 -3.0233149
[8,] 3.8908093 -8.7936160
[9,] -1.8365639 3.8908093
[10,] -1.7092858 -1.8365639
[11,] 4.1443208 -1.7092858
[12,] -12.0330103 4.1443208
[13,] -4.7334067 -12.0330103
[14,] -5.2992333 -4.7334067
[15,] -1.6653982 -5.2992333
[16,] 2.5285927 -1.6653982
[17,] -2.0768604 2.5285927
[18,] 2.0828469 -2.0768604
[19,] 1.3627515 2.0828469
[20,] 17.9705551 1.3627515
[21,] -13.1674276 17.9705551
[22,] 9.2975398 -13.1674276
[23,] -0.6316049 9.2975398
[24,] -9.5955662 -0.6316049
[25,] -4.0934377 -9.5955662
[26,] -8.4652895 -4.0934377
[27,] 15.5600502 -8.4652895
[28,] 8.4405394 15.5600502
[29,] 5.4966334 8.4405394
[30,] -1.5421618 5.4966334
[31,] -4.4249206 -1.5421618
[32,] 9.3582498 -4.4249206
[33,] 5.4918240 9.3582498
[34,] 21.8792843 5.4918240
[35,] 6.7224984 21.8792843
[36,] 7.0930001 6.7224984
[37,] -17.0502032 7.0930001
[38,] 0.8835827 -17.0502032
[39,] 15.9245056 0.8835827
[40,] 3.1854451 15.9245056
[41,] -11.2693378 3.1854451
[42,] -14.5835803 -11.2693378
[43,] -29.9717415 -14.5835803
[44,] 0.9148376 -29.9717415
[45,] 6.7144469 0.9148376
[46,] 8.9038718 6.7144469
[47,] 23.1384100 8.9038718
[48,] 26.8433247 23.1384100
[49,] 8.3513415 26.8433247
[50,] 39.3453223 8.3513415
[51,] 16.9948538 39.3453223
[52,] 13.4528930 16.9948538
[53,] 29.6867690 13.4528930
[54,] -9.4033894 29.6867690
[55,] -4.3114674 -9.4033894
[56,] 2.7922293 -4.3114674
[57,] -21.9839944 2.7922293
[58,] -28.1758604 -21.9839944
[59,] -14.0850266 -28.1758604
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -15.9156891 -9.6891291
2 -20.0355592 -15.9156891
3 -12.4426476 -20.0355592
4 -2.4687407 -12.4426476
5 -23.9738644 -2.4687407
6 -3.0233149 -23.9738644
7 -8.7936160 -3.0233149
8 3.8908093 -8.7936160
9 -1.8365639 3.8908093
10 -1.7092858 -1.8365639
11 4.1443208 -1.7092858
12 -12.0330103 4.1443208
13 -4.7334067 -12.0330103
14 -5.2992333 -4.7334067
15 -1.6653982 -5.2992333
16 2.5285927 -1.6653982
17 -2.0768604 2.5285927
18 2.0828469 -2.0768604
19 1.3627515 2.0828469
20 17.9705551 1.3627515
21 -13.1674276 17.9705551
22 9.2975398 -13.1674276
23 -0.6316049 9.2975398
24 -9.5955662 -0.6316049
25 -4.0934377 -9.5955662
26 -8.4652895 -4.0934377
27 15.5600502 -8.4652895
28 8.4405394 15.5600502
29 5.4966334 8.4405394
30 -1.5421618 5.4966334
31 -4.4249206 -1.5421618
32 9.3582498 -4.4249206
33 5.4918240 9.3582498
34 21.8792843 5.4918240
35 6.7224984 21.8792843
36 7.0930001 6.7224984
37 -17.0502032 7.0930001
38 0.8835827 -17.0502032
39 15.9245056 0.8835827
40 3.1854451 15.9245056
41 -11.2693378 3.1854451
42 -14.5835803 -11.2693378
43 -29.9717415 -14.5835803
44 0.9148376 -29.9717415
45 6.7144469 0.9148376
46 8.9038718 6.7144469
47 23.1384100 8.9038718
48 26.8433247 23.1384100
49 8.3513415 26.8433247
50 39.3453223 8.3513415
51 16.9948538 39.3453223
52 13.4528930 16.9948538
53 29.6867690 13.4528930
54 -9.4033894 29.6867690
55 -4.3114674 -9.4033894
56 2.7922293 -4.3114674
57 -21.9839944 2.7922293
58 -28.1758604 -21.9839944
59 -14.0850266 -28.1758604
> 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/7e0ae1258731540.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/8gdvj1258731540.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/9prct1258731540.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/10qzey1258731540.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/11kgrt1258731540.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/12o7z01258731540.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/13gocj1258731540.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/14wkak1258731540.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/15hyqn1258731540.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/16lijc1258731540.tab")
+ }
>
> system("convert tmp/17kt81258731540.ps tmp/17kt81258731540.png")
> system("convert tmp/28uyn1258731540.ps tmp/28uyn1258731540.png")
> system("convert tmp/36f9v1258731540.ps tmp/36f9v1258731540.png")
> system("convert tmp/4mq7k1258731540.ps tmp/4mq7k1258731540.png")
> system("convert tmp/5xoj81258731540.ps tmp/5xoj81258731540.png")
> system("convert tmp/63n071258731540.ps tmp/63n071258731540.png")
> system("convert tmp/7e0ae1258731540.ps tmp/7e0ae1258731540.png")
> system("convert tmp/8gdvj1258731540.ps tmp/8gdvj1258731540.png")
> system("convert tmp/9prct1258731540.ps tmp/9prct1258731540.png")
> system("convert tmp/10qzey1258731540.ps tmp/10qzey1258731540.png")
>
>
> proc.time()
user system elapsed
2.539 1.624 3.040