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(90.09
+ ,85.61
+ ,87.703
+ ,81.71
+ ,100.639
+ ,85.52
+ ,90.09
+ ,87.703
+ ,83.042
+ ,86.51
+ ,100.639
+ ,90.09
+ ,89.956
+ ,86.66
+ ,83.042
+ ,100.639
+ ,89.561
+ ,87.27
+ ,89.956
+ ,83.042
+ ,105.38
+ ,87.62
+ ,89.561
+ ,89.956
+ ,86.554
+ ,88.17
+ ,105.38
+ ,89.561
+ ,93.131
+ ,87.99
+ ,86.554
+ ,105.38
+ ,92.812
+ ,88.83
+ ,93.131
+ ,86.554
+ ,102.195
+ ,88.75
+ ,92.812
+ ,93.131
+ ,88.925
+ ,88.81
+ ,102.195
+ ,92.812
+ ,94.184
+ ,89.43
+ ,88.925
+ ,102.195
+ ,94.196
+ ,89.5
+ ,94.184
+ ,88.925
+ ,108.932
+ ,89.34
+ ,94.196
+ ,94.184
+ ,91.134
+ ,89.75
+ ,108.932
+ ,94.196
+ ,97.149
+ ,90.26
+ ,91.134
+ ,108.932
+ ,96.415
+ ,90.32
+ ,97.149
+ ,91.134
+ ,112.432
+ ,90.76
+ ,96.415
+ ,97.149
+ ,92.47
+ ,91.53
+ ,112.432
+ ,96.415
+ ,98.61410515
+ ,92.35
+ ,92.47
+ ,112.432
+ ,97.80117197
+ ,93.04
+ ,98.61410515
+ ,92.47
+ ,111.8560178
+ ,93.35
+ ,97.80117197
+ ,98.61410515
+ ,95.63981455
+ ,93.54
+ ,111.8560178
+ ,97.80117197
+ ,104.1120262
+ ,95.07
+ ,95.63981455
+ ,111.8560178
+ ,104.0148224
+ ,95.39
+ ,104.1120262
+ ,95.63981455
+ ,118.1743476
+ ,95.43
+ ,104.0148224
+ ,104.1120262
+ ,102.033431
+ ,96.09
+ ,118.1743476
+ ,104.0148224
+ ,109.3138852
+ ,96.35
+ ,102.033431
+ ,118.1743476
+ ,108.1523649
+ ,96.6
+ ,109.3138852
+ ,102.033431
+ ,121.30381
+ ,96.62
+ ,108.1523649
+ ,109.3138852
+ ,103.8725146
+ ,97.6
+ ,121.30381
+ ,108.1523649
+ ,112.7185207
+ ,97.67
+ ,103.8725146
+ ,121.30381
+ ,109.0381253
+ ,98.23
+ ,112.7185207
+ ,103.8725146
+ ,122.4434864
+ ,98.29
+ ,109.0381253
+ ,112.7185207
+ ,106.6325686
+ ,98.89
+ ,122.4434864
+ ,109.0381253
+ ,113.8153852
+ ,99.88
+ ,106.6325686
+ ,122.4434864
+ ,111.1071252
+ ,100.42
+ ,113.8153852
+ ,106.6325686
+ ,130.039536
+ ,100.81
+ ,111.1071252
+ ,113.8153852
+ ,109.6121057
+ ,101.5
+ ,130.039536
+ ,111.1071252
+ ,116.8592117
+ ,102.59
+ ,109.6121057
+ ,130.039536
+ ,113.8982545
+ ,103.58
+ ,116.8592117
+ ,109.6121057
+ ,128.9375926
+ ,103.47
+ ,113.8982545
+ ,116.8592117
+ ,111.8120023
+ ,103.77
+ ,128.9375926
+ ,113.8982545
+ ,119.9689463
+ ,104.65
+ ,111.8120023
+ ,128.9375926
+ ,117.018539
+ ,105.12
+ ,119.9689463
+ ,111.8120023
+ ,132.4743387
+ ,104.97
+ ,117.018539
+ ,119.9689463
+ ,116.3369106
+ ,105.58
+ ,132.4743387
+ ,117.018539
+ ,124.6405636
+ ,106.17
+ ,116.3369106
+ ,132.4743387
+ ,121.025249
+ ,106.52
+ ,124.6405636
+ ,116.3369106
+ ,137.2054829
+ ,107.87
+ ,121.025249
+ ,124.6405636
+ ,120.0187687
+ ,109.63
+ ,137.2054829
+ ,121.025249
+ ,127.0443429
+ ,111.54
+ ,120.0187687
+ ,137.2054829
+ ,124.349043
+ ,112.47
+ ,127.0443429
+ ,120.0187687
+ ,143.6114438
+ ,111.63
+ ,124.349043
+ ,127.0443429)
+ ,dim=c(4
+ ,54)
+ ,dimnames=list(c('LKI'
+ ,'CPI'
+ ,'LKI_1'
+ ,'LKI_2')
+ ,1:54))
> y <- array(NA,dim=c(4,54),dimnames=list(c('LKI','CPI','LKI_1','LKI_2'),1:54))
> 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 Quarterly 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
LKI CPI LKI_1 LKI_2 Q1 Q2 Q3
1 90.09000 85.61 87.70300 81.71000 1 0 0
2 100.63900 85.52 90.09000 87.70300 0 1 0
3 83.04200 86.51 100.63900 90.09000 0 0 1
4 89.95600 86.66 83.04200 100.63900 0 0 0
5 89.56100 87.27 89.95600 83.04200 1 0 0
6 105.38000 87.62 89.56100 89.95600 0 1 0
7 86.55400 88.17 105.38000 89.56100 0 0 1
8 93.13100 87.99 86.55400 105.38000 0 0 0
9 92.81200 88.83 93.13100 86.55400 1 0 0
10 102.19500 88.75 92.81200 93.13100 0 1 0
11 88.92500 88.81 102.19500 92.81200 0 0 1
12 94.18400 89.43 88.92500 102.19500 0 0 0
13 94.19600 89.50 94.18400 88.92500 1 0 0
14 108.93200 89.34 94.19600 94.18400 0 1 0
15 91.13400 89.75 108.93200 94.19600 0 0 1
16 97.14900 90.26 91.13400 108.93200 0 0 0
17 96.41500 90.32 97.14900 91.13400 1 0 0
18 112.43200 90.76 96.41500 97.14900 0 1 0
19 92.47000 91.53 112.43200 96.41500 0 0 1
20 98.61411 92.35 92.47000 112.43200 0 0 0
21 97.80117 93.04 98.61411 92.47000 1 0 0
22 111.85602 93.35 97.80117 98.61411 0 1 0
23 95.63981 93.54 111.85602 97.80117 0 0 1
24 104.11203 95.07 95.63981 111.85602 0 0 0
25 104.01482 95.39 104.11203 95.63981 1 0 0
26 118.17435 95.43 104.01482 104.11203 0 1 0
27 102.03343 96.09 118.17435 104.01482 0 0 1
28 109.31389 96.35 102.03343 118.17435 0 0 0
29 108.15236 96.60 109.31389 102.03343 1 0 0
30 121.30381 96.62 108.15236 109.31389 0 1 0
31 103.87251 97.60 121.30381 108.15236 0 0 1
32 112.71852 97.67 103.87251 121.30381 0 0 0
33 109.03813 98.23 112.71852 103.87251 1 0 0
34 122.44349 98.29 109.03813 112.71852 0 1 0
35 106.63257 98.89 122.44349 109.03813 0 0 1
36 113.81539 99.88 106.63257 122.44349 0 0 0
37 111.10713 100.42 113.81539 106.63257 1 0 0
38 130.03954 100.81 111.10713 113.81539 0 1 0
39 109.61211 101.50 130.03954 111.10713 0 0 1
40 116.85921 102.59 109.61211 130.03954 0 0 0
41 113.89825 103.58 116.85921 109.61211 1 0 0
42 128.93759 103.47 113.89825 116.85921 0 1 0
43 111.81200 103.77 128.93759 113.89825 0 0 1
44 119.96895 104.65 111.81200 128.93759 0 0 0
45 117.01854 105.12 119.96895 111.81200 1 0 0
46 132.47434 104.97 117.01854 119.96895 0 1 0
47 116.33691 105.58 132.47434 117.01854 0 0 1
48 124.64056 106.17 116.33691 132.47434 0 0 0
49 121.02525 106.52 124.64056 116.33691 1 0 0
50 137.20548 107.87 121.02525 124.64056 0 1 0
51 120.01877 109.63 137.20548 121.02525 0 0 1
52 127.04434 111.54 120.01877 137.20548 0 0 0
53 124.34904 112.47 127.04434 120.01877 1 0 0
54 143.61144 111.63 124.34904 127.04434 0 1 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) CPI LKI_1 LKI_2 Q1 Q2
-17.2458 0.5088 0.3072 0.3802 2.6207 15.0229
Q3
-6.6510
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.65762 -0.95106 -0.02457 1.04772 3.56638
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -17.2458 6.3458 -2.718 0.00918 **
CPI 0.5088 0.2060 2.470 0.01720 *
LKI_1 0.3072 0.1399 2.196 0.03306 *
LKI_2 0.3802 0.1428 2.662 0.01059 *
Q1 2.6207 3.2148 0.815 0.41907
Q2 15.0229 2.1233 7.075 6.29e-09 ***
Q3 -6.6510 3.9999 -1.663 0.10301
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.618 on 47 degrees of freedom
Multiple R-squared: 0.9882, Adjusted R-squared: 0.9867
F-statistic: 656.6 on 6 and 47 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.9333850 0.1332300 0.06661501
[2,] 0.9219378 0.1561244 0.07806220
[3,] 0.8652176 0.2695649 0.13478244
[4,] 0.8089806 0.3820387 0.19101937
[5,] 0.8995521 0.2008957 0.10044785
[6,] 0.8886026 0.2227948 0.11139742
[7,] 0.8470955 0.3058090 0.15290448
[8,] 0.7890267 0.4219466 0.21097332
[9,] 0.8308029 0.3383942 0.16919709
[10,] 0.8120341 0.3759317 0.18796586
[11,] 0.8605685 0.2788631 0.13943154
[12,] 0.8416970 0.3166059 0.15830297
[13,] 0.8370785 0.3258430 0.16292152
[14,] 0.7961801 0.4076399 0.20381995
[15,] 0.7687760 0.4624481 0.23122404
[16,] 0.7356316 0.5287369 0.26436843
[17,] 0.6935192 0.6129615 0.30648077
[18,] 0.6450351 0.7099298 0.35496488
[19,] 0.6010162 0.7979676 0.39898378
[20,] 0.6070525 0.7858949 0.39294747
[21,] 0.5818896 0.8362208 0.41811040
[22,] 0.4956285 0.9912569 0.50437154
[23,] 0.5317176 0.9365648 0.46828239
[24,] 0.4919876 0.9839752 0.50801242
[25,] 0.6319816 0.7360368 0.36801838
[26,] 0.5759134 0.8481732 0.42408658
[27,] 0.4751958 0.9503916 0.52480419
[28,] 0.4404135 0.8808270 0.55958651
[29,] 0.7267168 0.5465664 0.27328319
[30,] 0.7911910 0.4176180 0.20880902
[31,] 0.7299877 0.5400246 0.27001231
[32,] 0.7040241 0.5919518 0.29597588
[33,] 0.7020133 0.5959733 0.29798667
[34,] 0.5544858 0.8910283 0.44551416
[35,] 0.4278185 0.8556369 0.57218154
> postscript(file="/var/www/html/rcomp/tmp/1byd61293199912.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/2byd61293199912.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/3byd61293199912.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/447c91293199912.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/547c91293199912.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 = 54
Frequency = 1
1 2 3 4 5 6
3.148913704 -1.670305705 -2.245402921 -0.663497749 0.576765350 1.308173894
7 8 9 10 11 12
-0.833338873 -1.046618456 0.723417001 -4.657618194 0.954475979 -0.243730337
13 14 15 16 17 18
0.541590593 0.953672981 0.089356880 -0.941040575 0.592654845 1.922214670
19 20 21 22 23 24
-1.399170986 -2.280419819 -0.363105656 -0.954394528 0.397913453 1.078798462
25 26 27 28 29 30
1.760732376 0.306474678 1.190663157 1.263019627 1.253746816 -0.418343782
31 32 33 34 35 36
-0.273002823 2.241260763 -0.434962642 -1.694887132 1.143835667 0.932494808
37 38 39 40 41 42
-0.866534999 3.566383842 -0.324760179 -1.205829071 -1.751070499 -0.903643854
43 44 45 46 47 48
-0.002459674 0.598937641 -1.206049401 -0.270969411 1.328701891 1.762445504
49 50 51 52 53 54
-1.067162335 -0.022338091 -0.026811570 -1.495820797 -2.908935154 2.535580632
> postscript(file="/var/www/html/rcomp/tmp/647c91293199912.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 = 54
Frequency = 1
lag(myerror, k = 1) myerror
0 3.148913704 NA
1 -1.670305705 3.148913704
2 -2.245402921 -1.670305705
3 -0.663497749 -2.245402921
4 0.576765350 -0.663497749
5 1.308173894 0.576765350
6 -0.833338873 1.308173894
7 -1.046618456 -0.833338873
8 0.723417001 -1.046618456
9 -4.657618194 0.723417001
10 0.954475979 -4.657618194
11 -0.243730337 0.954475979
12 0.541590593 -0.243730337
13 0.953672981 0.541590593
14 0.089356880 0.953672981
15 -0.941040575 0.089356880
16 0.592654845 -0.941040575
17 1.922214670 0.592654845
18 -1.399170986 1.922214670
19 -2.280419819 -1.399170986
20 -0.363105656 -2.280419819
21 -0.954394528 -0.363105656
22 0.397913453 -0.954394528
23 1.078798462 0.397913453
24 1.760732376 1.078798462
25 0.306474678 1.760732376
26 1.190663157 0.306474678
27 1.263019627 1.190663157
28 1.253746816 1.263019627
29 -0.418343782 1.253746816
30 -0.273002823 -0.418343782
31 2.241260763 -0.273002823
32 -0.434962642 2.241260763
33 -1.694887132 -0.434962642
34 1.143835667 -1.694887132
35 0.932494808 1.143835667
36 -0.866534999 0.932494808
37 3.566383842 -0.866534999
38 -0.324760179 3.566383842
39 -1.205829071 -0.324760179
40 -1.751070499 -1.205829071
41 -0.903643854 -1.751070499
42 -0.002459674 -0.903643854
43 0.598937641 -0.002459674
44 -1.206049401 0.598937641
45 -0.270969411 -1.206049401
46 1.328701891 -0.270969411
47 1.762445504 1.328701891
48 -1.067162335 1.762445504
49 -0.022338091 -1.067162335
50 -0.026811570 -0.022338091
51 -1.495820797 -0.026811570
52 -2.908935154 -1.495820797
53 2.535580632 -2.908935154
54 NA 2.535580632
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.670305705 3.148913704
[2,] -2.245402921 -1.670305705
[3,] -0.663497749 -2.245402921
[4,] 0.576765350 -0.663497749
[5,] 1.308173894 0.576765350
[6,] -0.833338873 1.308173894
[7,] -1.046618456 -0.833338873
[8,] 0.723417001 -1.046618456
[9,] -4.657618194 0.723417001
[10,] 0.954475979 -4.657618194
[11,] -0.243730337 0.954475979
[12,] 0.541590593 -0.243730337
[13,] 0.953672981 0.541590593
[14,] 0.089356880 0.953672981
[15,] -0.941040575 0.089356880
[16,] 0.592654845 -0.941040575
[17,] 1.922214670 0.592654845
[18,] -1.399170986 1.922214670
[19,] -2.280419819 -1.399170986
[20,] -0.363105656 -2.280419819
[21,] -0.954394528 -0.363105656
[22,] 0.397913453 -0.954394528
[23,] 1.078798462 0.397913453
[24,] 1.760732376 1.078798462
[25,] 0.306474678 1.760732376
[26,] 1.190663157 0.306474678
[27,] 1.263019627 1.190663157
[28,] 1.253746816 1.263019627
[29,] -0.418343782 1.253746816
[30,] -0.273002823 -0.418343782
[31,] 2.241260763 -0.273002823
[32,] -0.434962642 2.241260763
[33,] -1.694887132 -0.434962642
[34,] 1.143835667 -1.694887132
[35,] 0.932494808 1.143835667
[36,] -0.866534999 0.932494808
[37,] 3.566383842 -0.866534999
[38,] -0.324760179 3.566383842
[39,] -1.205829071 -0.324760179
[40,] -1.751070499 -1.205829071
[41,] -0.903643854 -1.751070499
[42,] -0.002459674 -0.903643854
[43,] 0.598937641 -0.002459674
[44,] -1.206049401 0.598937641
[45,] -0.270969411 -1.206049401
[46,] 1.328701891 -0.270969411
[47,] 1.762445504 1.328701891
[48,] -1.067162335 1.762445504
[49,] -0.022338091 -1.067162335
[50,] -0.026811570 -0.022338091
[51,] -1.495820797 -0.026811570
[52,] -2.908935154 -1.495820797
[53,] 2.535580632 -2.908935154
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.670305705 3.148913704
2 -2.245402921 -1.670305705
3 -0.663497749 -2.245402921
4 0.576765350 -0.663497749
5 1.308173894 0.576765350
6 -0.833338873 1.308173894
7 -1.046618456 -0.833338873
8 0.723417001 -1.046618456
9 -4.657618194 0.723417001
10 0.954475979 -4.657618194
11 -0.243730337 0.954475979
12 0.541590593 -0.243730337
13 0.953672981 0.541590593
14 0.089356880 0.953672981
15 -0.941040575 0.089356880
16 0.592654845 -0.941040575
17 1.922214670 0.592654845
18 -1.399170986 1.922214670
19 -2.280419819 -1.399170986
20 -0.363105656 -2.280419819
21 -0.954394528 -0.363105656
22 0.397913453 -0.954394528
23 1.078798462 0.397913453
24 1.760732376 1.078798462
25 0.306474678 1.760732376
26 1.190663157 0.306474678
27 1.263019627 1.190663157
28 1.253746816 1.263019627
29 -0.418343782 1.253746816
30 -0.273002823 -0.418343782
31 2.241260763 -0.273002823
32 -0.434962642 2.241260763
33 -1.694887132 -0.434962642
34 1.143835667 -1.694887132
35 0.932494808 1.143835667
36 -0.866534999 0.932494808
37 3.566383842 -0.866534999
38 -0.324760179 3.566383842
39 -1.205829071 -0.324760179
40 -1.751070499 -1.205829071
41 -0.903643854 -1.751070499
42 -0.002459674 -0.903643854
43 0.598937641 -0.002459674
44 -1.206049401 0.598937641
45 -0.270969411 -1.206049401
46 1.328701891 -0.270969411
47 1.762445504 1.328701891
48 -1.067162335 1.762445504
49 -0.022338091 -1.067162335
50 -0.026811570 -0.022338091
51 -1.495820797 -0.026811570
52 -2.908935154 -1.495820797
53 2.535580632 -2.908935154
> 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/7ppsx1293199912.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/8ppsx1293199912.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/9ppsx1293199912.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/10ppsx1293199912.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/11wrb01293199913.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/12o0al1293199913.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/13djpx1293199913.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/14tev61293199913.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/159tno1293199913.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/1653ke1293199913.tab")
+ }
>
> try(system("convert tmp/1byd61293199912.ps tmp/1byd61293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/2byd61293199912.ps tmp/2byd61293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/3byd61293199912.ps tmp/3byd61293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/447c91293199912.ps tmp/447c91293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/547c91293199912.ps tmp/547c91293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/647c91293199912.ps tmp/647c91293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ppsx1293199912.ps tmp/7ppsx1293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ppsx1293199912.ps tmp/8ppsx1293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ppsx1293199912.ps tmp/9ppsx1293199912.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ppsx1293199912.ps tmp/10ppsx1293199912.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.464 1.645 6.436