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(3.37
+ ,100.7
+ ,101.1
+ ,101.2
+ ,3.51
+ ,100.1
+ ,100.7
+ ,101.1
+ ,3.75
+ ,99.9
+ ,100.1
+ ,100.7
+ ,4.11
+ ,99.7
+ ,99.9
+ ,100.1
+ ,4.25
+ ,99.5
+ ,99.7
+ ,99.9
+ ,4.25
+ ,99.2
+ ,99.5
+ ,99.7
+ ,4.5
+ ,99
+ ,99.2
+ ,99.5
+ ,4.7
+ ,99
+ ,99
+ ,99.2
+ ,4.75
+ ,99.3
+ ,99
+ ,99
+ ,4.75
+ ,99.5
+ ,99.3
+ ,99
+ ,4.75
+ ,99.7
+ ,99.5
+ ,99.3
+ ,4.75
+ ,100
+ ,99.7
+ ,99.5
+ ,4.75
+ ,100.4
+ ,100
+ ,99.7
+ ,4.75
+ ,100.6
+ ,100.4
+ ,100
+ ,4.58
+ ,100.7
+ ,100.6
+ ,100.4
+ ,4.5
+ ,100.7
+ ,100.7
+ ,100.6
+ ,4.5
+ ,100.6
+ ,100.7
+ ,100.7
+ ,4.49
+ ,100.5
+ ,100.6
+ ,100.7
+ ,4.03
+ ,100.6
+ ,100.5
+ ,100.6
+ ,3.75
+ ,100.5
+ ,100.6
+ ,100.5
+ ,3.39
+ ,100.4
+ ,100.5
+ ,100.6
+ ,3.25
+ ,100.3
+ ,100.4
+ ,100.5
+ ,3.25
+ ,100.4
+ ,100.3
+ ,100.4
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.3
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.5
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.6
+ ,100.5
+ ,100.4
+ ,3.25
+ ,100.6
+ ,100.6
+ ,100.5
+ ,3.25
+ ,100.5
+ ,100.6
+ ,100.6
+ ,3.25
+ ,100.5
+ ,100.5
+ ,100.6
+ ,3.25
+ ,100.7
+ ,100.5
+ ,100.5
+ ,2.85
+ ,101.1
+ ,100.7
+ ,100.5
+ ,2.75
+ ,101.5
+ ,101.1
+ ,100.7
+ ,2.75
+ ,101.9
+ ,101.5
+ ,101.1
+ ,2.55
+ ,102.1
+ ,101.9
+ ,101.5
+ ,2.5
+ ,102.1
+ ,102.1
+ ,101.9
+ ,2.5
+ ,102.1
+ ,102.1
+ ,102.1
+ ,2.1
+ ,102.4
+ ,102.1
+ ,102.1
+ ,2
+ ,102.8
+ ,102.4
+ ,102.1
+ ,2
+ ,103.1
+ ,102.8
+ ,102.4
+ ,2
+ ,103.1
+ ,103.1
+ ,102.8
+ ,2
+ ,102.9
+ ,103.1
+ ,103.1
+ ,2
+ ,102.4
+ ,102.9
+ ,103.1
+ ,2
+ ,101.9
+ ,102.4
+ ,102.9
+ ,2
+ ,101.3
+ ,101.9
+ ,102.4
+ ,2
+ ,100.7
+ ,101.3
+ ,101.9
+ ,2
+ ,100.6
+ ,100.7
+ ,101.3
+ ,2
+ ,101
+ ,100.6
+ ,100.7
+ ,2
+ ,101.5
+ ,101
+ ,100.6
+ ,2
+ ,101.9
+ ,101.5
+ ,101
+ ,2
+ ,102.1
+ ,101.9
+ ,101.5
+ ,2
+ ,102.3
+ ,102.1
+ ,101.9
+ ,2
+ ,102.5
+ ,102.3
+ ,102.1
+ ,2
+ ,102.9
+ ,102.5
+ ,102.3
+ ,2
+ ,103.6
+ ,102.9
+ ,102.5
+ ,2
+ ,104.3
+ ,103.6
+ ,102.9)
+ ,dim=c(4
+ ,58)
+ ,dimnames=list(c('rente'
+ ,'tprod'
+ ,'y1'
+ ,'y2')
+ ,1:58))
> y <- array(NA,dim=c(4,58),dimnames=list(c('rente','tprod','y1','y2'),1:58))
> 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 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'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
tprod rente y1 y2 t
1 100.7 3.37 101.1 101.2 1
2 100.1 3.51 100.7 101.1 2
3 99.9 3.75 100.1 100.7 3
4 99.7 4.11 99.9 100.1 4
5 99.5 4.25 99.7 99.9 5
6 99.2 4.25 99.5 99.7 6
7 99.0 4.50 99.2 99.5 7
8 99.0 4.70 99.0 99.2 8
9 99.3 4.75 99.0 99.0 9
10 99.5 4.75 99.3 99.0 10
11 99.7 4.75 99.5 99.3 11
12 100.0 4.75 99.7 99.5 12
13 100.4 4.75 100.0 99.7 13
14 100.6 4.75 100.4 100.0 14
15 100.7 4.58 100.6 100.4 15
16 100.7 4.50 100.7 100.6 16
17 100.6 4.50 100.7 100.7 17
18 100.5 4.49 100.6 100.7 18
19 100.6 4.03 100.5 100.6 19
20 100.5 3.75 100.6 100.5 20
21 100.4 3.39 100.5 100.6 21
22 100.3 3.25 100.4 100.5 22
23 100.4 3.25 100.3 100.4 23
24 100.4 3.25 100.4 100.3 24
25 100.4 3.25 100.4 100.4 25
26 100.4 3.25 100.4 100.4 26
27 100.4 3.25 100.4 100.4 27
28 100.5 3.25 100.4 100.4 28
29 100.6 3.25 100.5 100.4 29
30 100.6 3.25 100.6 100.5 30
31 100.5 3.25 100.6 100.6 31
32 100.5 3.25 100.5 100.6 32
33 100.7 3.25 100.5 100.5 33
34 101.1 2.85 100.7 100.5 34
35 101.5 2.75 101.1 100.7 35
36 101.9 2.75 101.5 101.1 36
37 102.1 2.55 101.9 101.5 37
38 102.1 2.50 102.1 101.9 38
39 102.1 2.50 102.1 102.1 39
40 102.4 2.10 102.1 102.1 40
41 102.8 2.00 102.4 102.1 41
42 103.1 2.00 102.8 102.4 42
43 103.1 2.00 103.1 102.8 43
44 102.9 2.00 103.1 103.1 44
45 102.4 2.00 102.9 103.1 45
46 101.9 2.00 102.4 102.9 46
47 101.3 2.00 101.9 102.4 47
48 100.7 2.00 101.3 101.9 48
49 100.6 2.00 100.7 101.3 49
50 101.0 2.00 100.6 100.7 50
51 101.5 2.00 101.0 100.6 51
52 101.9 2.00 101.5 101.0 52
53 102.1 2.00 101.9 101.5 53
54 102.3 2.00 102.1 101.9 54
55 102.5 2.00 102.3 102.1 55
56 102.9 2.00 102.5 102.3 56
57 103.6 2.00 102.9 102.5 57
58 104.3 2.00 103.6 102.9 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) rente y1 y2 t
12.990819 0.008226 1.717709 -0.849062 0.009086
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.24362 -0.09585 -0.03050 0.08129 0.40889
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.990819 3.641248 3.568 0.000774 ***
rente 0.008226 0.059448 0.138 0.890471
y1 1.717709 0.080118 21.440 < 2e-16 ***
y2 -0.849062 0.085439 -9.938 1.05e-13 ***
t 0.009086 0.003184 2.853 0.006156 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1536 on 53 degrees of freedom
Multiple R-squared: 0.985, Adjusted R-squared: 0.9839
F-statistic: 869.1 on 4 and 53 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.559511775 0.880976450 0.4404882
[2,] 0.836521856 0.326956289 0.1634781
[3,] 0.745483415 0.509033170 0.2545166
[4,] 0.635149375 0.729701250 0.3648506
[5,] 0.523746083 0.952507835 0.4762539
[6,] 0.426493273 0.852986547 0.5735067
[7,] 0.445741023 0.891482045 0.5542590
[8,] 0.404646620 0.809293240 0.5953534
[9,] 0.342242782 0.684485565 0.6577572
[10,] 0.282301247 0.564602494 0.7176988
[11,] 0.206113241 0.412226482 0.7938868
[12,] 0.237583420 0.475166840 0.7624166
[13,] 0.240033387 0.480066773 0.7599666
[14,] 0.176882595 0.353765189 0.8231174
[15,] 0.124544527 0.249089054 0.8754555
[16,] 0.134918284 0.269836568 0.8650817
[17,] 0.102022075 0.204044150 0.8979779
[18,] 0.068841671 0.137683341 0.9311583
[19,] 0.045144922 0.090289843 0.9548551
[20,] 0.028908748 0.057817496 0.9710913
[21,] 0.018899271 0.037798541 0.9811007
[22,] 0.011082088 0.022164176 0.9889179
[23,] 0.008575664 0.017151328 0.9914243
[24,] 0.009538215 0.019076430 0.9904618
[25,] 0.005466668 0.010933336 0.9945333
[26,] 0.004166976 0.008333952 0.9958330
[27,] 0.008557586 0.017115171 0.9914424
[28,] 0.006978279 0.013956559 0.9930217
[29,] 0.006025493 0.012050986 0.9939745
[30,] 0.003614722 0.007229445 0.9963853
[31,] 0.002715310 0.005430621 0.9972847
[32,] 0.006666816 0.013333633 0.9933332
[33,] 0.014918760 0.029837519 0.9850812
[34,] 0.039783075 0.079566151 0.9602169
[35,] 0.053781692 0.107563384 0.9462183
[36,] 0.049076279 0.098152558 0.9509237
[37,] 0.070105599 0.140211198 0.9298944
[38,] 0.074850397 0.149700794 0.9251496
[39,] 0.135811890 0.271623780 0.8641881
[40,] 0.165804602 0.331609205 0.8341954
[41,] 0.110897508 0.221795015 0.8891025
[42,] 0.116296644 0.232593289 0.8837034
[43,] 0.808370413 0.383259174 0.1916296
> postscript(file="/var/www/html/rcomp/tmp/1rp641258731729.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/2q1qw1258731729.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/30i5n1258731729.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/4kk5c1258731729.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/507lg1258731729.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 = 58
Frequency = 1
1 2 3 4 5 6
-0.062989773 -0.071049365 0.408891772 0.030949655 -0.005558002 -0.140914014
7 8 9 10 11 12
-0.006555593 0.071537005 0.192227810 -0.132170539 -0.030079396 0.087105563
13 14 15 16 17 18
0.132519581 -0.108931158 -0.020535407 -0.030921424 -0.055100768 0.007666907
19 20 21 22 23 24
0.189230110 -0.174229253 -0.023676286 -0.044745412 0.133033819 -0.132728832
25 26 27 28 29 30
-0.056908175 -0.065993702 -0.075079229 0.015835244 -0.065021223 -0.160971507
31 32 33 34 35 36
-0.185150850 -0.022465436 0.083542854 0.134205857 0.008671537 0.052126982
37 38 39 40 41 42
-0.102772368 -0.115363740 0.045363101 0.339567985 0.215992239 0.074541500
43 44 45 46 47 48
-0.110232114 -0.064599090 -0.230142735 -0.050185926 -0.224947667 -0.227938467
49 50 51 52 53 54
0.184164549 0.237412861 -0.043662613 -0.171978109 -0.243616480 -0.056619154
55 56 57 58
-0.039434195 0.177750765 0.351393842 0.179536465
> postscript(file="/var/www/html/rcomp/tmp/694wm1258731729.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 = 58
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.062989773 NA
1 -0.071049365 -0.062989773
2 0.408891772 -0.071049365
3 0.030949655 0.408891772
4 -0.005558002 0.030949655
5 -0.140914014 -0.005558002
6 -0.006555593 -0.140914014
7 0.071537005 -0.006555593
8 0.192227810 0.071537005
9 -0.132170539 0.192227810
10 -0.030079396 -0.132170539
11 0.087105563 -0.030079396
12 0.132519581 0.087105563
13 -0.108931158 0.132519581
14 -0.020535407 -0.108931158
15 -0.030921424 -0.020535407
16 -0.055100768 -0.030921424
17 0.007666907 -0.055100768
18 0.189230110 0.007666907
19 -0.174229253 0.189230110
20 -0.023676286 -0.174229253
21 -0.044745412 -0.023676286
22 0.133033819 -0.044745412
23 -0.132728832 0.133033819
24 -0.056908175 -0.132728832
25 -0.065993702 -0.056908175
26 -0.075079229 -0.065993702
27 0.015835244 -0.075079229
28 -0.065021223 0.015835244
29 -0.160971507 -0.065021223
30 -0.185150850 -0.160971507
31 -0.022465436 -0.185150850
32 0.083542854 -0.022465436
33 0.134205857 0.083542854
34 0.008671537 0.134205857
35 0.052126982 0.008671537
36 -0.102772368 0.052126982
37 -0.115363740 -0.102772368
38 0.045363101 -0.115363740
39 0.339567985 0.045363101
40 0.215992239 0.339567985
41 0.074541500 0.215992239
42 -0.110232114 0.074541500
43 -0.064599090 -0.110232114
44 -0.230142735 -0.064599090
45 -0.050185926 -0.230142735
46 -0.224947667 -0.050185926
47 -0.227938467 -0.224947667
48 0.184164549 -0.227938467
49 0.237412861 0.184164549
50 -0.043662613 0.237412861
51 -0.171978109 -0.043662613
52 -0.243616480 -0.171978109
53 -0.056619154 -0.243616480
54 -0.039434195 -0.056619154
55 0.177750765 -0.039434195
56 0.351393842 0.177750765
57 0.179536465 0.351393842
58 NA 0.179536465
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.071049365 -0.062989773
[2,] 0.408891772 -0.071049365
[3,] 0.030949655 0.408891772
[4,] -0.005558002 0.030949655
[5,] -0.140914014 -0.005558002
[6,] -0.006555593 -0.140914014
[7,] 0.071537005 -0.006555593
[8,] 0.192227810 0.071537005
[9,] -0.132170539 0.192227810
[10,] -0.030079396 -0.132170539
[11,] 0.087105563 -0.030079396
[12,] 0.132519581 0.087105563
[13,] -0.108931158 0.132519581
[14,] -0.020535407 -0.108931158
[15,] -0.030921424 -0.020535407
[16,] -0.055100768 -0.030921424
[17,] 0.007666907 -0.055100768
[18,] 0.189230110 0.007666907
[19,] -0.174229253 0.189230110
[20,] -0.023676286 -0.174229253
[21,] -0.044745412 -0.023676286
[22,] 0.133033819 -0.044745412
[23,] -0.132728832 0.133033819
[24,] -0.056908175 -0.132728832
[25,] -0.065993702 -0.056908175
[26,] -0.075079229 -0.065993702
[27,] 0.015835244 -0.075079229
[28,] -0.065021223 0.015835244
[29,] -0.160971507 -0.065021223
[30,] -0.185150850 -0.160971507
[31,] -0.022465436 -0.185150850
[32,] 0.083542854 -0.022465436
[33,] 0.134205857 0.083542854
[34,] 0.008671537 0.134205857
[35,] 0.052126982 0.008671537
[36,] -0.102772368 0.052126982
[37,] -0.115363740 -0.102772368
[38,] 0.045363101 -0.115363740
[39,] 0.339567985 0.045363101
[40,] 0.215992239 0.339567985
[41,] 0.074541500 0.215992239
[42,] -0.110232114 0.074541500
[43,] -0.064599090 -0.110232114
[44,] -0.230142735 -0.064599090
[45,] -0.050185926 -0.230142735
[46,] -0.224947667 -0.050185926
[47,] -0.227938467 -0.224947667
[48,] 0.184164549 -0.227938467
[49,] 0.237412861 0.184164549
[50,] -0.043662613 0.237412861
[51,] -0.171978109 -0.043662613
[52,] -0.243616480 -0.171978109
[53,] -0.056619154 -0.243616480
[54,] -0.039434195 -0.056619154
[55,] 0.177750765 -0.039434195
[56,] 0.351393842 0.177750765
[57,] 0.179536465 0.351393842
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.071049365 -0.062989773
2 0.408891772 -0.071049365
3 0.030949655 0.408891772
4 -0.005558002 0.030949655
5 -0.140914014 -0.005558002
6 -0.006555593 -0.140914014
7 0.071537005 -0.006555593
8 0.192227810 0.071537005
9 -0.132170539 0.192227810
10 -0.030079396 -0.132170539
11 0.087105563 -0.030079396
12 0.132519581 0.087105563
13 -0.108931158 0.132519581
14 -0.020535407 -0.108931158
15 -0.030921424 -0.020535407
16 -0.055100768 -0.030921424
17 0.007666907 -0.055100768
18 0.189230110 0.007666907
19 -0.174229253 0.189230110
20 -0.023676286 -0.174229253
21 -0.044745412 -0.023676286
22 0.133033819 -0.044745412
23 -0.132728832 0.133033819
24 -0.056908175 -0.132728832
25 -0.065993702 -0.056908175
26 -0.075079229 -0.065993702
27 0.015835244 -0.075079229
28 -0.065021223 0.015835244
29 -0.160971507 -0.065021223
30 -0.185150850 -0.160971507
31 -0.022465436 -0.185150850
32 0.083542854 -0.022465436
33 0.134205857 0.083542854
34 0.008671537 0.134205857
35 0.052126982 0.008671537
36 -0.102772368 0.052126982
37 -0.115363740 -0.102772368
38 0.045363101 -0.115363740
39 0.339567985 0.045363101
40 0.215992239 0.339567985
41 0.074541500 0.215992239
42 -0.110232114 0.074541500
43 -0.064599090 -0.110232114
44 -0.230142735 -0.064599090
45 -0.050185926 -0.230142735
46 -0.224947667 -0.050185926
47 -0.227938467 -0.224947667
48 0.184164549 -0.227938467
49 0.237412861 0.184164549
50 -0.043662613 0.237412861
51 -0.171978109 -0.043662613
52 -0.243616480 -0.171978109
53 -0.056619154 -0.243616480
54 -0.039434195 -0.056619154
55 0.177750765 -0.039434195
56 0.351393842 0.177750765
57 0.179536465 0.351393842
> 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/7qwdk1258731729.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/8suro1258731729.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/9iul81258731729.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/10repp1258731729.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/115a3f1258731729.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/129az91258731729.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/13hqho1258731729.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/14mhmr1258731729.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/1517t71258731729.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/167rkm1258731730.tab")
+ }
> system("convert tmp/1rp641258731729.ps tmp/1rp641258731729.png")
> system("convert tmp/2q1qw1258731729.ps tmp/2q1qw1258731729.png")
> system("convert tmp/30i5n1258731729.ps tmp/30i5n1258731729.png")
> system("convert tmp/4kk5c1258731729.ps tmp/4kk5c1258731729.png")
> system("convert tmp/507lg1258731729.ps tmp/507lg1258731729.png")
> system("convert tmp/694wm1258731729.ps tmp/694wm1258731729.png")
> system("convert tmp/7qwdk1258731729.ps tmp/7qwdk1258731729.png")
> system("convert tmp/8suro1258731729.ps tmp/8suro1258731729.png")
> system("convert tmp/9iul81258731729.ps tmp/9iul81258731729.png")
> system("convert tmp/10repp1258731729.ps tmp/10repp1258731729.png")
>
>
> proc.time()
user system elapsed
2.497 1.619 7.078