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(1.4816,133.91,1.4562,133.14,1.4268,135.31,1.4088,133.09,1.4016,135.39,1.3650,131.85,1.3190,130.25,1.3050,127.65,1.2785,118.30,1.3239,119.73,1.3449,122.51,1.2732,123.28,1.3322,133.52,1.4369,153.20,1.4975,163.63,1.5770,168.45,1.5553,166.26,1.5557,162.31,1.5750,161.56,1.5527,156.59,1.4748,157.97,1.4718,158.68,1.4570,163.55,1.4684,162.89,1.4227,164.95,1.3896,159.82,1.3622,159.05,1.3716,166.76,1.3419,164.55,1.3511,163.22,1.3516,160.68,1.3242,155.24,1.3074,157.60,1.2999,156.56,1.3213,154.82,1.2881,151.11,1.2611,149.65,1.2727,148.99,1.2811,148.53,1.2684,146.70,1.2650,145.11,1.2770,142.70,1.2271,143.59,1.2020,140.96,1.1938,140.77,1.2103,139.81,1.1856,140.58,1.1786,139.59,1.2015,138.05,1.2256,136.06,1.2292,135.98,1.2037,134.75,1.2165,132.22,1.2694,135.37,1.2938,138.84,1.3201,138.83,1.3014,136.55,1.3119,135.63,1.3408,139.14,1.2991,136.09),dim=c(2,60),dimnames=list(c('dollar/euro','japanseyen/euro'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('dollar/euro','japanseyen/euro'),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 = '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
dollar/euro japanseyen/euro M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 1.4816 133.91 1 0 0 0 0 0 0 0 0 0 0 1
2 1.4562 133.14 0 1 0 0 0 0 0 0 0 0 0 2
3 1.4268 135.31 0 0 1 0 0 0 0 0 0 0 0 3
4 1.4088 133.09 0 0 0 1 0 0 0 0 0 0 0 4
5 1.4016 135.39 0 0 0 0 1 0 0 0 0 0 0 5
6 1.3650 131.85 0 0 0 0 0 1 0 0 0 0 0 6
7 1.3190 130.25 0 0 0 0 0 0 1 0 0 0 0 7
8 1.3050 127.65 0 0 0 0 0 0 0 1 0 0 0 8
9 1.2785 118.30 0 0 0 0 0 0 0 0 1 0 0 9
10 1.3239 119.73 0 0 0 0 0 0 0 0 0 1 0 10
11 1.3449 122.51 0 0 0 0 0 0 0 0 0 0 1 11
12 1.2732 123.28 0 0 0 0 0 0 0 0 0 0 0 12
13 1.3322 133.52 1 0 0 0 0 0 0 0 0 0 0 13
14 1.4369 153.20 0 1 0 0 0 0 0 0 0 0 0 14
15 1.4975 163.63 0 0 1 0 0 0 0 0 0 0 0 15
16 1.5770 168.45 0 0 0 1 0 0 0 0 0 0 0 16
17 1.5553 166.26 0 0 0 0 1 0 0 0 0 0 0 17
18 1.5557 162.31 0 0 0 0 0 1 0 0 0 0 0 18
19 1.5750 161.56 0 0 0 0 0 0 1 0 0 0 0 19
20 1.5527 156.59 0 0 0 0 0 0 0 1 0 0 0 20
21 1.4748 157.97 0 0 0 0 0 0 0 0 1 0 0 21
22 1.4718 158.68 0 0 0 0 0 0 0 0 0 1 0 22
23 1.4570 163.55 0 0 0 0 0 0 0 0 0 0 1 23
24 1.4684 162.89 0 0 0 0 0 0 0 0 0 0 0 24
25 1.4227 164.95 1 0 0 0 0 0 0 0 0 0 0 25
26 1.3896 159.82 0 1 0 0 0 0 0 0 0 0 0 26
27 1.3622 159.05 0 0 1 0 0 0 0 0 0 0 0 27
28 1.3716 166.76 0 0 0 1 0 0 0 0 0 0 0 28
29 1.3419 164.55 0 0 0 0 1 0 0 0 0 0 0 29
30 1.3511 163.22 0 0 0 0 0 1 0 0 0 0 0 30
31 1.3516 160.68 0 0 0 0 0 0 1 0 0 0 0 31
32 1.3242 155.24 0 0 0 0 0 0 0 1 0 0 0 32
33 1.3074 157.60 0 0 0 0 0 0 0 0 1 0 0 33
34 1.2999 156.56 0 0 0 0 0 0 0 0 0 1 0 34
35 1.3213 154.82 0 0 0 0 0 0 0 0 0 0 1 35
36 1.2881 151.11 0 0 0 0 0 0 0 0 0 0 0 36
37 1.2611 149.65 1 0 0 0 0 0 0 0 0 0 0 37
38 1.2727 148.99 0 1 0 0 0 0 0 0 0 0 0 38
39 1.2811 148.53 0 0 1 0 0 0 0 0 0 0 0 39
40 1.2684 146.70 0 0 0 1 0 0 0 0 0 0 0 40
41 1.2650 145.11 0 0 0 0 1 0 0 0 0 0 0 41
42 1.2770 142.70 0 0 0 0 0 1 0 0 0 0 0 42
43 1.2271 143.59 0 0 0 0 0 0 1 0 0 0 0 43
44 1.2020 140.96 0 0 0 0 0 0 0 1 0 0 0 44
45 1.1938 140.77 0 0 0 0 0 0 0 0 1 0 0 45
46 1.2103 139.81 0 0 0 0 0 0 0 0 0 1 0 46
47 1.1856 140.58 0 0 0 0 0 0 0 0 0 0 1 47
48 1.1786 139.59 0 0 0 0 0 0 0 0 0 0 0 48
49 1.2015 138.05 1 0 0 0 0 0 0 0 0 0 0 49
50 1.2256 136.06 0 1 0 0 0 0 0 0 0 0 0 50
51 1.2292 135.98 0 0 1 0 0 0 0 0 0 0 0 51
52 1.2037 134.75 0 0 0 1 0 0 0 0 0 0 0 52
53 1.2165 132.22 0 0 0 0 1 0 0 0 0 0 0 53
54 1.2694 135.37 0 0 0 0 0 1 0 0 0 0 0 54
55 1.2938 138.84 0 0 0 0 0 0 1 0 0 0 0 55
56 1.3201 138.83 0 0 0 0 0 0 0 1 0 0 0 56
57 1.3014 136.55 0 0 0 0 0 0 0 0 1 0 0 57
58 1.3119 135.63 0 0 0 0 0 0 0 0 0 1 0 58
59 1.3408 139.14 0 0 0 0 0 0 0 0 0 0 1 59
60 1.2991 136.09 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `japanseyen/euro` M1 M2
8.708e-01 3.983e-03 -9.291e-03 2.036e-03
M3 M4 M5 M6
1.659e-05 4.595e-03 3.525e-03 2.136e-02
M7 M8 M9 M10
1.525e-02 1.904e-02 -3.332e-04 1.648e-02
M11 t
1.854e-02 -3.814e-03
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.08445 -0.05561 -0.01085 0.04122 0.12226
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.708e-01 1.051e-01 8.283 1.14e-10 ***
`japanseyen/euro` 3.983e-03 6.911e-04 5.763 6.54e-07 ***
M1 -9.291e-03 4.483e-02 -0.207 0.837
M2 2.036e-03 4.482e-02 0.045 0.964
M3 1.659e-05 4.488e-02 0.000370 1.000
M4 4.595e-03 4.492e-02 0.102 0.919
M5 3.525e-03 4.479e-02 0.079 0.938
M6 2.136e-02 4.465e-02 0.478 0.635
M7 1.525e-02 4.461e-02 0.342 0.734
M8 1.904e-02 4.449e-02 0.428 0.671
M9 -3.332e-04 4.446e-02 -0.007 0.994
M10 1.648e-02 4.444e-02 0.371 0.712
M11 1.854e-02 4.444e-02 0.417 0.679
t -3.814e-03 5.344e-04 -7.138 5.66e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.07025 on 46 degrees of freedom
Multiple R-squared: 0.6589, Adjusted R-squared: 0.5625
F-statistic: 6.835 on 13 and 46 DF, p-value: 4.523e-07
> 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.04625772 0.092515449 0.9537422753
[2,] 0.05894329 0.117886586 0.9410567071
[3,] 0.15814108 0.316282153 0.8418589234
[4,] 0.31119538 0.622390762 0.6888046189
[5,] 0.36632109 0.732642181 0.6336789097
[6,] 0.56102213 0.877955733 0.4389778663
[7,] 0.77949060 0.441018806 0.2205094028
[8,] 0.92442787 0.151144260 0.0755721300
[9,] 0.95339127 0.093217466 0.0466087332
[10,] 0.97335368 0.053292647 0.0266463236
[11,] 0.98053610 0.038927802 0.0194639012
[12,] 0.97443588 0.051128238 0.0255641189
[13,] 0.98081731 0.038365380 0.0191826902
[14,] 0.99572548 0.008549034 0.0042745170
[15,] 0.99113003 0.017739939 0.0088699693
[16,] 0.98861015 0.022779704 0.0113898519
[17,] 0.98411738 0.031765232 0.0158826161
[18,] 0.99588430 0.008231408 0.0041157041
[19,] 0.99398314 0.012033729 0.0060168647
[20,] 0.99923941 0.001521175 0.0007605876
[21,] 0.99891354 0.002172922 0.0010864611
[22,] 0.99858218 0.002835638 0.0014178188
[23,] 0.99764596 0.004708080 0.0023540402
[24,] 0.99457043 0.010859132 0.0054295659
[25,] 0.99716896 0.005662086 0.0028310431
[26,] 0.99589725 0.008205494 0.0041027471
[27,] 0.99372382 0.012552365 0.0062761823
> postscript(file="/var/www/html/rcomp/tmp/1odf11258722226.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/227gd1258722226.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/3jt151258722226.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/4iewk1258722226.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/5s0kv1258722226.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
0.0904885935 0.0606425877 0.0284331189 0.0185118635 0.0070350159
6 7 8 9 10
-0.0294810973 -0.0591900335 -0.0628011873 -0.0288742744 -0.0021718027
11 12 13 14 15
0.0095125819 -0.0429010625 -0.0115845516 0.0072107706 0.0320991683
16 17 18 19 20
0.0916354165 0.0835436269 0.0856606705 0.1178659215 0.1153952104
21 22 23 24 25
0.0551812162 0.0363516705 0.0039109390 0.0402934266 -0.0005065936
26 27 28 29 30
-0.0206853716 -0.0391839115 -0.0612594267 -0.0772715501 -0.0767907765
31 32 33 34 35
-0.0562554020 -0.0619539579 -0.0649715951 -0.0813303498 -0.0512414078
36 37 38 39 40
-0.0473098273 -0.0553885994 -0.0486727692 -0.0326061349 -0.0387808809
41 42 43 44 45
-0.0309626560 -0.0233799085 -0.0669072844 -0.0814989390 -0.0657591378
46 47 48 49 50
-0.0584365573 -0.0844457213 -0.0651487416 -0.0230088489 0.0015047824
51 52 53 54 55
0.0112577592 -0.0101069723 0.0176555633 0.0439911119 0.0644867984
56 57 58 59 60
0.0908588739 0.1044237911 0.1055870393 0.1222636083 0.1150662048
> postscript(file="/var/www/html/rcomp/tmp/6h3ee1258722226.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.0904885935 NA
1 0.0606425877 0.0904885935
2 0.0284331189 0.0606425877
3 0.0185118635 0.0284331189
4 0.0070350159 0.0185118635
5 -0.0294810973 0.0070350159
6 -0.0591900335 -0.0294810973
7 -0.0628011873 -0.0591900335
8 -0.0288742744 -0.0628011873
9 -0.0021718027 -0.0288742744
10 0.0095125819 -0.0021718027
11 -0.0429010625 0.0095125819
12 -0.0115845516 -0.0429010625
13 0.0072107706 -0.0115845516
14 0.0320991683 0.0072107706
15 0.0916354165 0.0320991683
16 0.0835436269 0.0916354165
17 0.0856606705 0.0835436269
18 0.1178659215 0.0856606705
19 0.1153952104 0.1178659215
20 0.0551812162 0.1153952104
21 0.0363516705 0.0551812162
22 0.0039109390 0.0363516705
23 0.0402934266 0.0039109390
24 -0.0005065936 0.0402934266
25 -0.0206853716 -0.0005065936
26 -0.0391839115 -0.0206853716
27 -0.0612594267 -0.0391839115
28 -0.0772715501 -0.0612594267
29 -0.0767907765 -0.0772715501
30 -0.0562554020 -0.0767907765
31 -0.0619539579 -0.0562554020
32 -0.0649715951 -0.0619539579
33 -0.0813303498 -0.0649715951
34 -0.0512414078 -0.0813303498
35 -0.0473098273 -0.0512414078
36 -0.0553885994 -0.0473098273
37 -0.0486727692 -0.0553885994
38 -0.0326061349 -0.0486727692
39 -0.0387808809 -0.0326061349
40 -0.0309626560 -0.0387808809
41 -0.0233799085 -0.0309626560
42 -0.0669072844 -0.0233799085
43 -0.0814989390 -0.0669072844
44 -0.0657591378 -0.0814989390
45 -0.0584365573 -0.0657591378
46 -0.0844457213 -0.0584365573
47 -0.0651487416 -0.0844457213
48 -0.0230088489 -0.0651487416
49 0.0015047824 -0.0230088489
50 0.0112577592 0.0015047824
51 -0.0101069723 0.0112577592
52 0.0176555633 -0.0101069723
53 0.0439911119 0.0176555633
54 0.0644867984 0.0439911119
55 0.0908588739 0.0644867984
56 0.1044237911 0.0908588739
57 0.1055870393 0.1044237911
58 0.1222636083 0.1055870393
59 0.1150662048 0.1222636083
60 NA 0.1150662048
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.0606425877 0.0904885935
[2,] 0.0284331189 0.0606425877
[3,] 0.0185118635 0.0284331189
[4,] 0.0070350159 0.0185118635
[5,] -0.0294810973 0.0070350159
[6,] -0.0591900335 -0.0294810973
[7,] -0.0628011873 -0.0591900335
[8,] -0.0288742744 -0.0628011873
[9,] -0.0021718027 -0.0288742744
[10,] 0.0095125819 -0.0021718027
[11,] -0.0429010625 0.0095125819
[12,] -0.0115845516 -0.0429010625
[13,] 0.0072107706 -0.0115845516
[14,] 0.0320991683 0.0072107706
[15,] 0.0916354165 0.0320991683
[16,] 0.0835436269 0.0916354165
[17,] 0.0856606705 0.0835436269
[18,] 0.1178659215 0.0856606705
[19,] 0.1153952104 0.1178659215
[20,] 0.0551812162 0.1153952104
[21,] 0.0363516705 0.0551812162
[22,] 0.0039109390 0.0363516705
[23,] 0.0402934266 0.0039109390
[24,] -0.0005065936 0.0402934266
[25,] -0.0206853716 -0.0005065936
[26,] -0.0391839115 -0.0206853716
[27,] -0.0612594267 -0.0391839115
[28,] -0.0772715501 -0.0612594267
[29,] -0.0767907765 -0.0772715501
[30,] -0.0562554020 -0.0767907765
[31,] -0.0619539579 -0.0562554020
[32,] -0.0649715951 -0.0619539579
[33,] -0.0813303498 -0.0649715951
[34,] -0.0512414078 -0.0813303498
[35,] -0.0473098273 -0.0512414078
[36,] -0.0553885994 -0.0473098273
[37,] -0.0486727692 -0.0553885994
[38,] -0.0326061349 -0.0486727692
[39,] -0.0387808809 -0.0326061349
[40,] -0.0309626560 -0.0387808809
[41,] -0.0233799085 -0.0309626560
[42,] -0.0669072844 -0.0233799085
[43,] -0.0814989390 -0.0669072844
[44,] -0.0657591378 -0.0814989390
[45,] -0.0584365573 -0.0657591378
[46,] -0.0844457213 -0.0584365573
[47,] -0.0651487416 -0.0844457213
[48,] -0.0230088489 -0.0651487416
[49,] 0.0015047824 -0.0230088489
[50,] 0.0112577592 0.0015047824
[51,] -0.0101069723 0.0112577592
[52,] 0.0176555633 -0.0101069723
[53,] 0.0439911119 0.0176555633
[54,] 0.0644867984 0.0439911119
[55,] 0.0908588739 0.0644867984
[56,] 0.1044237911 0.0908588739
[57,] 0.1055870393 0.1044237911
[58,] 0.1222636083 0.1055870393
[59,] 0.1150662048 0.1222636083
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.0606425877 0.0904885935
2 0.0284331189 0.0606425877
3 0.0185118635 0.0284331189
4 0.0070350159 0.0185118635
5 -0.0294810973 0.0070350159
6 -0.0591900335 -0.0294810973
7 -0.0628011873 -0.0591900335
8 -0.0288742744 -0.0628011873
9 -0.0021718027 -0.0288742744
10 0.0095125819 -0.0021718027
11 -0.0429010625 0.0095125819
12 -0.0115845516 -0.0429010625
13 0.0072107706 -0.0115845516
14 0.0320991683 0.0072107706
15 0.0916354165 0.0320991683
16 0.0835436269 0.0916354165
17 0.0856606705 0.0835436269
18 0.1178659215 0.0856606705
19 0.1153952104 0.1178659215
20 0.0551812162 0.1153952104
21 0.0363516705 0.0551812162
22 0.0039109390 0.0363516705
23 0.0402934266 0.0039109390
24 -0.0005065936 0.0402934266
25 -0.0206853716 -0.0005065936
26 -0.0391839115 -0.0206853716
27 -0.0612594267 -0.0391839115
28 -0.0772715501 -0.0612594267
29 -0.0767907765 -0.0772715501
30 -0.0562554020 -0.0767907765
31 -0.0619539579 -0.0562554020
32 -0.0649715951 -0.0619539579
33 -0.0813303498 -0.0649715951
34 -0.0512414078 -0.0813303498
35 -0.0473098273 -0.0512414078
36 -0.0553885994 -0.0473098273
37 -0.0486727692 -0.0553885994
38 -0.0326061349 -0.0486727692
39 -0.0387808809 -0.0326061349
40 -0.0309626560 -0.0387808809
41 -0.0233799085 -0.0309626560
42 -0.0669072844 -0.0233799085
43 -0.0814989390 -0.0669072844
44 -0.0657591378 -0.0814989390
45 -0.0584365573 -0.0657591378
46 -0.0844457213 -0.0584365573
47 -0.0651487416 -0.0844457213
48 -0.0230088489 -0.0651487416
49 0.0015047824 -0.0230088489
50 0.0112577592 0.0015047824
51 -0.0101069723 0.0112577592
52 0.0176555633 -0.0101069723
53 0.0439911119 0.0176555633
54 0.0644867984 0.0439911119
55 0.0908588739 0.0644867984
56 0.1044237911 0.0908588739
57 0.1055870393 0.1044237911
58 0.1222636083 0.1055870393
59 0.1150662048 0.1222636083
> 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/7oh4t1258722227.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/8pwj11258722227.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/9rm4l1258722227.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/10lfwa1258722227.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/11z80x1258722227.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/12e1p51258722227.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/138j2i1258722227.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/14tel01258722227.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/15x2bt1258722227.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/16p8by1258722227.tab")
+ }
>
> system("convert tmp/1odf11258722226.ps tmp/1odf11258722226.png")
> system("convert tmp/227gd1258722226.ps tmp/227gd1258722226.png")
> system("convert tmp/3jt151258722226.ps tmp/3jt151258722226.png")
> system("convert tmp/4iewk1258722226.ps tmp/4iewk1258722226.png")
> system("convert tmp/5s0kv1258722226.ps tmp/5s0kv1258722226.png")
> system("convert tmp/6h3ee1258722226.ps tmp/6h3ee1258722226.png")
> system("convert tmp/7oh4t1258722227.ps tmp/7oh4t1258722227.png")
> system("convert tmp/8pwj11258722227.ps tmp/8pwj11258722227.png")
> system("convert tmp/9rm4l1258722227.ps tmp/9rm4l1258722227.png")
> system("convert tmp/10lfwa1258722227.ps tmp/10lfwa1258722227.png")
>
>
> proc.time()
user system elapsed
2.381 1.562 4.600