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(115.6,37.2,111.9,37.2,107,34.7,107.1,32.5,100.6,33.5,99.2,31.5,108.4,31.2,103,27,99.8,26.7,115,26.5,90.8,26,95.9,27.2,114.4,30.5,108.2,33.7,112.6,34.2,109.1,36.7,105,36.2,105,38.5,118.5,40,103.7,42.5,112.5,43.5,116.6,43.3,96.6,45.5,101.9,44.3,116.5,43,119.3,43.5,115.4,41.5,108.5,42.5,111.5,41.3,108.8,39.5,121.8,38.5,109.6,41,112.2,44.5,119.6,46,104.1,44,105.3,41.5,115,41.3,124.1,38,116.8,38,107.5,36.2,115.6,38.7,116.2,38.7,116.3,39.2,119,35.7,111.9,36.5,118.6,36.7,106.9,34.7,103.2,35,118.6,28.2,118.7,23.7,102.8,15,100.6,8.7,94.9,11,94.5,7.5,102.9,5.7,95.3,9.3,92.5,10.2,102.7,15.7,91.5,18.1,89.5,20.8),dim=c(2,60),dimnames=list(c('Ipzb','Cvn'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Ipzb','Cvn'),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 = '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
Ipzb Cvn M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 115.6 37.2 1 0 0 0 0 0 0 0 0 0 0
2 111.9 37.2 0 1 0 0 0 0 0 0 0 0 0
3 107.0 34.7 0 0 1 0 0 0 0 0 0 0 0
4 107.1 32.5 0 0 0 1 0 0 0 0 0 0 0
5 100.6 33.5 0 0 0 0 1 0 0 0 0 0 0
6 99.2 31.5 0 0 0 0 0 1 0 0 0 0 0
7 108.4 31.2 0 0 0 0 0 0 1 0 0 0 0
8 103.0 27.0 0 0 0 0 0 0 0 1 0 0 0
9 99.8 26.7 0 0 0 0 0 0 0 0 1 0 0
10 115.0 26.5 0 0 0 0 0 0 0 0 0 1 0
11 90.8 26.0 0 0 0 0 0 0 0 0 0 0 1
12 95.9 27.2 0 0 0 0 0 0 0 0 0 0 0
13 114.4 30.5 1 0 0 0 0 0 0 0 0 0 0
14 108.2 33.7 0 1 0 0 0 0 0 0 0 0 0
15 112.6 34.2 0 0 1 0 0 0 0 0 0 0 0
16 109.1 36.7 0 0 0 1 0 0 0 0 0 0 0
17 105.0 36.2 0 0 0 0 1 0 0 0 0 0 0
18 105.0 38.5 0 0 0 0 0 1 0 0 0 0 0
19 118.5 40.0 0 0 0 0 0 0 1 0 0 0 0
20 103.7 42.5 0 0 0 0 0 0 0 1 0 0 0
21 112.5 43.5 0 0 0 0 0 0 0 0 1 0 0
22 116.6 43.3 0 0 0 0 0 0 0 0 0 1 0
23 96.6 45.5 0 0 0 0 0 0 0 0 0 0 1
24 101.9 44.3 0 0 0 0 0 0 0 0 0 0 0
25 116.5 43.0 1 0 0 0 0 0 0 0 0 0 0
26 119.3 43.5 0 1 0 0 0 0 0 0 0 0 0
27 115.4 41.5 0 0 1 0 0 0 0 0 0 0 0
28 108.5 42.5 0 0 0 1 0 0 0 0 0 0 0
29 111.5 41.3 0 0 0 0 1 0 0 0 0 0 0
30 108.8 39.5 0 0 0 0 0 1 0 0 0 0 0
31 121.8 38.5 0 0 0 0 0 0 1 0 0 0 0
32 109.6 41.0 0 0 0 0 0 0 0 1 0 0 0
33 112.2 44.5 0 0 0 0 0 0 0 0 1 0 0
34 119.6 46.0 0 0 0 0 0 0 0 0 0 1 0
35 104.1 44.0 0 0 0 0 0 0 0 0 0 0 1
36 105.3 41.5 0 0 0 0 0 0 0 0 0 0 0
37 115.0 41.3 1 0 0 0 0 0 0 0 0 0 0
38 124.1 38.0 0 1 0 0 0 0 0 0 0 0 0
39 116.8 38.0 0 0 1 0 0 0 0 0 0 0 0
40 107.5 36.2 0 0 0 1 0 0 0 0 0 0 0
41 115.6 38.7 0 0 0 0 1 0 0 0 0 0 0
42 116.2 38.7 0 0 0 0 0 1 0 0 0 0 0
43 116.3 39.2 0 0 0 0 0 0 1 0 0 0 0
44 119.0 35.7 0 0 0 0 0 0 0 1 0 0 0
45 111.9 36.5 0 0 0 0 0 0 0 0 1 0 0
46 118.6 36.7 0 0 0 0 0 0 0 0 0 1 0
47 106.9 34.7 0 0 0 0 0 0 0 0 0 0 1
48 103.2 35.0 0 0 0 0 0 0 0 0 0 0 0
49 118.6 28.2 1 0 0 0 0 0 0 0 0 0 0
50 118.7 23.7 0 1 0 0 0 0 0 0 0 0 0
51 102.8 15.0 0 0 1 0 0 0 0 0 0 0 0
52 100.6 8.7 0 0 0 1 0 0 0 0 0 0 0
53 94.9 11.0 0 0 0 0 1 0 0 0 0 0 0
54 94.5 7.5 0 0 0 0 0 1 0 0 0 0 0
55 102.9 5.7 0 0 0 0 0 0 1 0 0 0 0
56 95.3 9.3 0 0 0 0 0 0 0 1 0 0 0
57 92.5 10.2 0 0 0 0 0 0 0 0 1 0 0
58 102.7 15.7 0 0 0 0 0 0 0 0 0 1 0
59 91.5 18.1 0 0 0 0 0 0 0 0 0 0 1
60 89.5 20.8 0 0 0 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) Cvn M1 M2 M3 M4
83.9746 0.4498 15.8344 16.6233 12.2458 8.4975
M5 M6 M7 M8 M9 M10
7.0887 6.7585 15.6974 8.1565 7.2857 15.3940
M11
-1.1350
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.5563 -3.0601 -0.2384 2.0595 10.8109
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 83.97464 2.78663 30.135 < 2e-16 ***
Cvn 0.44980 0.05576 8.067 2.02e-10 ***
M1 15.83445 2.90875 5.444 1.85e-06 ***
M2 16.62329 2.90711 5.718 7.17e-07 ***
M3 12.24579 2.90659 4.213 0.000113 ***
M4 8.49752 2.90915 2.921 0.005346 **
M5 7.08868 2.90737 2.438 0.018596 *
M6 6.75848 2.90964 2.323 0.024570 *
M7 15.69744 2.91028 5.394 2.20e-06 ***
M8 8.15648 2.90975 2.803 0.007331 **
M9 7.28571 2.90714 2.506 0.015725 *
M10 15.39398 2.90597 5.297 3.06e-06 ***
M11 -1.13502 2.90597 -0.391 0.697871
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.595 on 47 degrees of freedom
Multiple R-squared: 0.7786, Adjusted R-squared: 0.7221
F-statistic: 13.78 on 12 and 47 DF, p-value: 1.339e-11
> 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.19283554 0.38567108 0.80716446
[2,] 0.12887705 0.25775409 0.87112295
[3,] 0.07260524 0.14521048 0.92739476
[4,] 0.05408050 0.10816100 0.94591950
[5,] 0.17425037 0.34850074 0.82574963
[6,] 0.14897774 0.29795547 0.85102226
[7,] 0.16073846 0.32147692 0.83926154
[8,] 0.17001910 0.34003819 0.82998090
[9,] 0.11482766 0.22965532 0.88517234
[10,] 0.08353943 0.16707885 0.91646057
[11,] 0.15499945 0.30999890 0.84500055
[12,] 0.11764347 0.23528693 0.88235653
[13,] 0.11027040 0.22054079 0.88972960
[14,] 0.12862124 0.25724249 0.87137876
[15,] 0.14163060 0.28326119 0.85836940
[16,] 0.17613533 0.35227067 0.82386467
[17,] 0.21434157 0.42868314 0.78565843
[18,] 0.15938785 0.31877570 0.84061215
[19,] 0.11568791 0.23137582 0.88431209
[20,] 0.15236238 0.30472477 0.84763762
[21,] 0.11212420 0.22424841 0.88787580
[22,] 0.23789532 0.47579064 0.76210468
[23,] 0.36544159 0.73088318 0.63455841
[24,] 0.29149778 0.58299557 0.70850222
[25,] 0.56611392 0.86777217 0.43388608
[26,] 0.53700932 0.92598135 0.46299068
[27,] 0.50133825 0.99732350 0.49866175
[28,] 0.97112452 0.05775096 0.02887548
[29,] 0.95726329 0.08547342 0.04273671
> postscript(file="/var/www/html/rcomp/tmp/12cdm1258727961.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/292r41258727961.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/3qau11258727961.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/4w5q61258727961.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/5ckd91258727961.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
-0.941771734 -5.430610374 -4.828602503 0.009232201 -5.531732378 -5.701929159
7 8 9 10 11 12
-5.305944901 -1.275806801 -3.470098037 3.711594985 -3.734507341 -0.309290882
13 14 15 16 17 18
0.871909834 -7.556299107 0.996299107 0.120058681 -2.346201070 -3.050551693
19 20 21 22 23 24
0.835786770 -7.547756699 1.673207881 -2.245099097 -6.705670115 -2.000925930
25 26 27 28 29 30
-2.650630405 -0.864370655 0.512735607 -3.088799990 1.859802512 0.299645088
31 32 33 34 35 36
4.810491599 -0.973051870 0.923404662 -0.459567789 1.469034714 2.658523084
37 38 39 40 41 42
-3.385964933 6.409547051 3.487046874 -1.255039710 7.129290882 8.059487663
43 44 45 46 47 48
-1.004370655 10.810905192 4.221830415 2.723602149 8.452204652 3.482244008
49 50 51 52 53 54
6.106457238 7.441733085 -0.167479085 4.214548818 -1.111159947 0.393348101
55 56 57 58 59 60
0.664037188 -1.014289822 -3.348344921 -3.730530248 0.518938090 -3.830550280
> postscript(file="/var/www/html/rcomp/tmp/6s5x61258727961.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 -0.941771734 NA
1 -5.430610374 -0.941771734
2 -4.828602503 -5.430610374
3 0.009232201 -4.828602503
4 -5.531732378 0.009232201
5 -5.701929159 -5.531732378
6 -5.305944901 -5.701929159
7 -1.275806801 -5.305944901
8 -3.470098037 -1.275806801
9 3.711594985 -3.470098037
10 -3.734507341 3.711594985
11 -0.309290882 -3.734507341
12 0.871909834 -0.309290882
13 -7.556299107 0.871909834
14 0.996299107 -7.556299107
15 0.120058681 0.996299107
16 -2.346201070 0.120058681
17 -3.050551693 -2.346201070
18 0.835786770 -3.050551693
19 -7.547756699 0.835786770
20 1.673207881 -7.547756699
21 -2.245099097 1.673207881
22 -6.705670115 -2.245099097
23 -2.000925930 -6.705670115
24 -2.650630405 -2.000925930
25 -0.864370655 -2.650630405
26 0.512735607 -0.864370655
27 -3.088799990 0.512735607
28 1.859802512 -3.088799990
29 0.299645088 1.859802512
30 4.810491599 0.299645088
31 -0.973051870 4.810491599
32 0.923404662 -0.973051870
33 -0.459567789 0.923404662
34 1.469034714 -0.459567789
35 2.658523084 1.469034714
36 -3.385964933 2.658523084
37 6.409547051 -3.385964933
38 3.487046874 6.409547051
39 -1.255039710 3.487046874
40 7.129290882 -1.255039710
41 8.059487663 7.129290882
42 -1.004370655 8.059487663
43 10.810905192 -1.004370655
44 4.221830415 10.810905192
45 2.723602149 4.221830415
46 8.452204652 2.723602149
47 3.482244008 8.452204652
48 6.106457238 3.482244008
49 7.441733085 6.106457238
50 -0.167479085 7.441733085
51 4.214548818 -0.167479085
52 -1.111159947 4.214548818
53 0.393348101 -1.111159947
54 0.664037188 0.393348101
55 -1.014289822 0.664037188
56 -3.348344921 -1.014289822
57 -3.730530248 -3.348344921
58 0.518938090 -3.730530248
59 -3.830550280 0.518938090
60 NA -3.830550280
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -5.430610374 -0.941771734
[2,] -4.828602503 -5.430610374
[3,] 0.009232201 -4.828602503
[4,] -5.531732378 0.009232201
[5,] -5.701929159 -5.531732378
[6,] -5.305944901 -5.701929159
[7,] -1.275806801 -5.305944901
[8,] -3.470098037 -1.275806801
[9,] 3.711594985 -3.470098037
[10,] -3.734507341 3.711594985
[11,] -0.309290882 -3.734507341
[12,] 0.871909834 -0.309290882
[13,] -7.556299107 0.871909834
[14,] 0.996299107 -7.556299107
[15,] 0.120058681 0.996299107
[16,] -2.346201070 0.120058681
[17,] -3.050551693 -2.346201070
[18,] 0.835786770 -3.050551693
[19,] -7.547756699 0.835786770
[20,] 1.673207881 -7.547756699
[21,] -2.245099097 1.673207881
[22,] -6.705670115 -2.245099097
[23,] -2.000925930 -6.705670115
[24,] -2.650630405 -2.000925930
[25,] -0.864370655 -2.650630405
[26,] 0.512735607 -0.864370655
[27,] -3.088799990 0.512735607
[28,] 1.859802512 -3.088799990
[29,] 0.299645088 1.859802512
[30,] 4.810491599 0.299645088
[31,] -0.973051870 4.810491599
[32,] 0.923404662 -0.973051870
[33,] -0.459567789 0.923404662
[34,] 1.469034714 -0.459567789
[35,] 2.658523084 1.469034714
[36,] -3.385964933 2.658523084
[37,] 6.409547051 -3.385964933
[38,] 3.487046874 6.409547051
[39,] -1.255039710 3.487046874
[40,] 7.129290882 -1.255039710
[41,] 8.059487663 7.129290882
[42,] -1.004370655 8.059487663
[43,] 10.810905192 -1.004370655
[44,] 4.221830415 10.810905192
[45,] 2.723602149 4.221830415
[46,] 8.452204652 2.723602149
[47,] 3.482244008 8.452204652
[48,] 6.106457238 3.482244008
[49,] 7.441733085 6.106457238
[50,] -0.167479085 7.441733085
[51,] 4.214548818 -0.167479085
[52,] -1.111159947 4.214548818
[53,] 0.393348101 -1.111159947
[54,] 0.664037188 0.393348101
[55,] -1.014289822 0.664037188
[56,] -3.348344921 -1.014289822
[57,] -3.730530248 -3.348344921
[58,] 0.518938090 -3.730530248
[59,] -3.830550280 0.518938090
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -5.430610374 -0.941771734
2 -4.828602503 -5.430610374
3 0.009232201 -4.828602503
4 -5.531732378 0.009232201
5 -5.701929159 -5.531732378
6 -5.305944901 -5.701929159
7 -1.275806801 -5.305944901
8 -3.470098037 -1.275806801
9 3.711594985 -3.470098037
10 -3.734507341 3.711594985
11 -0.309290882 -3.734507341
12 0.871909834 -0.309290882
13 -7.556299107 0.871909834
14 0.996299107 -7.556299107
15 0.120058681 0.996299107
16 -2.346201070 0.120058681
17 -3.050551693 -2.346201070
18 0.835786770 -3.050551693
19 -7.547756699 0.835786770
20 1.673207881 -7.547756699
21 -2.245099097 1.673207881
22 -6.705670115 -2.245099097
23 -2.000925930 -6.705670115
24 -2.650630405 -2.000925930
25 -0.864370655 -2.650630405
26 0.512735607 -0.864370655
27 -3.088799990 0.512735607
28 1.859802512 -3.088799990
29 0.299645088 1.859802512
30 4.810491599 0.299645088
31 -0.973051870 4.810491599
32 0.923404662 -0.973051870
33 -0.459567789 0.923404662
34 1.469034714 -0.459567789
35 2.658523084 1.469034714
36 -3.385964933 2.658523084
37 6.409547051 -3.385964933
38 3.487046874 6.409547051
39 -1.255039710 3.487046874
40 7.129290882 -1.255039710
41 8.059487663 7.129290882
42 -1.004370655 8.059487663
43 10.810905192 -1.004370655
44 4.221830415 10.810905192
45 2.723602149 4.221830415
46 8.452204652 2.723602149
47 3.482244008 8.452204652
48 6.106457238 3.482244008
49 7.441733085 6.106457238
50 -0.167479085 7.441733085
51 4.214548818 -0.167479085
52 -1.111159947 4.214548818
53 0.393348101 -1.111159947
54 0.664037188 0.393348101
55 -1.014289822 0.664037188
56 -3.348344921 -1.014289822
57 -3.730530248 -3.348344921
58 0.518938090 -3.730530248
59 -3.830550280 0.518938090
> 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/7te5l1258727961.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/88qvg1258727961.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/97m7u1258727961.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/10lfu81258727961.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/11hrle1258727961.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/12x49h1258727961.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/13ilqr1258727961.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/14zyxr1258727961.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/15ivhh1258727961.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/1639vm1258727961.tab")
+ }
>
> system("convert tmp/12cdm1258727961.ps tmp/12cdm1258727961.png")
> system("convert tmp/292r41258727961.ps tmp/292r41258727961.png")
> system("convert tmp/3qau11258727961.ps tmp/3qau11258727961.png")
> system("convert tmp/4w5q61258727961.ps tmp/4w5q61258727961.png")
> system("convert tmp/5ckd91258727961.ps tmp/5ckd91258727961.png")
> system("convert tmp/6s5x61258727961.ps tmp/6s5x61258727961.png")
> system("convert tmp/7te5l1258727961.ps tmp/7te5l1258727961.png")
> system("convert tmp/88qvg1258727961.ps tmp/88qvg1258727961.png")
> system("convert tmp/97m7u1258727961.ps tmp/97m7u1258727961.png")
> system("convert tmp/10lfu81258727961.ps tmp/10lfu81258727961.png")
>
>
> proc.time()
user system elapsed
2.423 1.589 2.868