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(-999.00
+ ,-999.00
+ ,38.60
+ ,6654.00
+ ,5712.00
+ ,645.00
+ ,3.00
+ ,5.00
+ ,3.00
+ ,6.30
+ ,2.00
+ ,4.50
+ ,1.00
+ ,6600.00
+ ,42.00
+ ,3.00
+ ,1.00
+ ,3.00
+ ,-999.00
+ ,-999.00
+ ,14.00
+ ,3.39
+ ,44.50
+ ,60.00
+ ,1.00
+ ,1.00
+ ,1.00
+ ,-999.00
+ ,-999.00
+ ,-999.00
+ ,0.92
+ ,5.70
+ ,25.00
+ ,5.00
+ ,2.00
+ ,3.00
+ ,2.10
+ ,1.80
+ ,69.00
+ ,2547.00
+ ,4603.00
+ ,624.00
+ ,3.00
+ ,5.00
+ ,4.00
+ ,9.10
+ ,0.70
+ ,27.00
+ ,10.55
+ ,179.50
+ ,180.00
+ ,4.00
+ ,4.00
+ ,4.00
+ ,15.80
+ ,3.90
+ ,19.00
+ ,0.02
+ ,0.30
+ ,35.00
+ ,1.00
+ ,1.00
+ ,1.00
+ ,5.20
+ ,1.00
+ ,30.40
+ ,160.00
+ ,169.00
+ ,392.00
+ ,4.00
+ ,5.00
+ ,4.00
+ ,10.90
+ ,3.60
+ ,28.00
+ ,3.30
+ ,25.60
+ ,63.00
+ ,1.00
+ ,2.00
+ ,1.00
+ ,8.30
+ ,1.40
+ ,50.00
+ ,52.16
+ ,440.00
+ ,230.00
+ ,1.00
+ ,1.00
+ ,1.00
+ ,11.00
+ ,1.50
+ ,7.00
+ ,0.43
+ ,6.40
+ ,112.00
+ ,5.00
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+ ,0.60
+ ,20.00
+ ,55.50
+ ,175.00
+ ,151.00
+ ,5.00
+ ,5.00
+ ,5.00
+ ,-999.00
+ ,-999.00
+ ,12.70
+ ,1.40
+ ,12.50
+ ,90.00
+ ,2.00
+ ,2.00
+ ,2.00
+ ,8.10
+ ,2.20
+ ,3.50
+ ,0.06
+ ,1.00
+ ,-999.00
+ ,3.00
+ ,1.00
+ ,2.00
+ ,11.00
+ ,2.30
+ ,4.50
+ ,0.90
+ ,2.60
+ ,60.00
+ ,2.00
+ ,1.00
+ ,2.00
+ ,4.90
+ ,0.50
+ ,7.50
+ ,2.00
+ ,12.30
+ ,200.00
+ ,3.00
+ ,1.00
+ ,3.00
+ ,13.20
+ ,2.60
+ ,2.30
+ ,0.10
+ ,2.50
+ ,46.00
+ ,3.00
+ ,2.00
+ ,2.00
+ ,9.70
+ ,0.60
+ ,24.00
+ ,4.19
+ ,58.00
+ ,210.00
+ ,4.00
+ ,3.00
+ ,4.00
+ ,12.80
+ ,6.60
+ ,3.00
+ ,3.50
+ ,3.90
+ ,14.00
+ ,2.00
+ ,1.00
+ ,1.00
+ ,-999.00
+ ,-999.00
+ ,13.00
+ ,4.05
+ ,17.00
+ ,38.00
+ ,3.00
+ ,1.00
+ ,1.00)
+ ,dim=c(9
+ ,62)
+ ,dimnames=list(c('SWS'
+ ,'PS'
+ ,'L'
+ ,'Wb'
+ ,'Wbr'
+ ,'Tg'
+ ,'P'
+ ,'S'
+ ,'D
')
+ ,1:62))
> y <- array(NA,dim=c(9,62),dimnames=list(c('SWS','PS','L','Wb','Wbr','Tg','P','S','D
'),1:62))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '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
PS SWS L Wb Wbr Tg P S D\r
1 -999.0 -999.0 38.6 6654.00 5712.00 645.0 3 5 3
2 2.0 6.3 4.5 1.00 6600.00 42.0 3 1 3
3 -999.0 -999.0 14.0 3.39 44.50 60.0 1 1 1
4 -999.0 -999.0 -999.0 0.92 5.70 25.0 5 2 3
5 1.8 2.1 69.0 2547.00 4603.00 624.0 3 5 4
6 0.7 9.1 27.0 10.55 179.50 180.0 4 4 4
7 3.9 15.8 19.0 0.02 0.30 35.0 1 1 1
8 1.0 5.2 30.4 160.00 169.00 392.0 4 5 4
9 3.6 10.9 28.0 3.30 25.60 63.0 1 2 1
10 1.4 8.3 50.0 52.16 440.00 230.0 1 1 1
11 1.5 11.0 7.0 0.43 6.40 112.0 5 4 4
12 0.7 3.2 30.0 465.00 423.00 281.0 5 5 5
13 2.7 7.6 -999.0 0.55 2.40 -999.0 2 1 2
14 -999.0 -999.0 40.0 187.10 419.00 365.0 5 5 5
15 2.1 6.3 3.5 0.08 1.20 42.0 1 1 1
16 0.0 8.6 50.0 3.00 25.00 28.0 2 2 2
17 4.1 6.6 6.0 0.79 3500.00 42.0 2 2 2
18 1.2 9.5 10.4 0.20 5.00 120.0 2 2 2
19 1.3 4.8 34.0 1.41 17.50 -999.0 1 2 1
20 6.1 12.0 7.0 60.00 81.00 -999.0 1 1 1
21 0.3 -999.0 28.0 529.00 680.00 400.0 5 5 5
22 0.5 3.3 20.0 27.66 115.00 148.0 5 5 5
23 3.4 11.0 3.9 0.12 1.00 16.0 3 1 2
24 -999.0 -999.0 39.3 207.00 406.00 252.0 1 4 1
25 1.5 4.7 41.0 85.00 325.00 310.0 1 3 1
26 -999.0 -999.0 16.2 36.33 119.50 63.0 1 1 1
27 3.4 10.4 9.0 0.10 4.00 28.0 5 1 3
28 0.8 7.4 7.6 1.04 5.50 68.0 5 3 4
29 0.8 2.1 46.0 521.00 655.00 336.0 5 5 5
30 -999.0 -999.0 22.4 100.00 157.00 100.0 1 1 1
31 -999.0 -999.0 16.3 35.00 56.00 33.0 3 5 4
32 1.4 7.7 2.6 0.01 0.14 21.5 5 2 4
33 2.0 17.9 24.0 0.01 0.25 50.0 1 1 1
34 1.9 6.1 100.0 62.00 1320.00 267.0 1 1 1
35 2.4 8.2 -999.0 0.12 3.00 30.0 2 1 1
36 2.8 8.4 -999.0 1.35 8.10 45.0 3 1 3
37 1.3 11.9 3.2 0.02 0.40 19.0 4 1 3
38 2.0 10.8 2.0 0.05 0.33 30.0 4 1 3
39 5.6 13.8 5.0 1.70 6.30 12.0 2 1 1
40 3.1 14.3 6.5 3.50 10.80 120.0 2 1 1
41 1.0 -999.0 23.6 250.00 490.00 440.0 5 5 5
42 1.8 15.2 12.0 0.48 15.50 140.0 2 2 2
43 0.9 10.0 20.2 10.00 115.00 170.0 4 4 4
44 1.8 11.9 13.0 1.62 11.40 17.0 2 1 2
45 1.9 6.5 27.0 192.00 180.00 115.0 4 4 4
46 0.9 7.5 18.0 2.50 12.10 31.0 5 5 5
47 -999.0 -999.0 13.7 4.29 39.20 63.0 2 2 2
48 2.6 10.6 4.7 0.28 1.90 21.0 3 1 3
49 2.4 7.4 9.8 4.24 50.40 52.0 1 1 1
50 1.2 8.4 29.0 6.80 179.00 164.0 2 3 2
51 0.9 5.7 7.0 0.75 12.30 225.0 2 2 2
52 0.5 4.9 6.0 3.60 21.00 225.0 3 2 3
53 -999.0 -999.0 17.0 14.83 98.20 150.0 5 5 5
54 0.6 3.2 20.0 55.50 175.00 151.0 5 5 5
55 -999.0 -999.0 12.7 1.40 12.50 90.0 2 2 2
56 2.2 8.1 3.5 0.06 1.00 -999.0 3 1 2
57 2.3 11.0 4.5 0.90 2.60 60.0 2 1 2
58 0.5 4.9 7.5 2.00 12.30 200.0 3 1 3
59 2.6 13.2 2.3 0.10 2.50 46.0 3 2 2
60 0.6 9.7 24.0 4.19 58.00 210.0 4 3 4
61 6.6 12.8 3.0 3.50 3.90 14.0 2 1 1
62 -999.0 -999.0 13.0 4.05 17.00 38.0 3 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) SWS L Wb Wbr Tg
-88.274586 0.854592 0.014151 -0.021007 0.002427 0.034494
P S `D\r`
-9.184887 -1.641399 44.113444
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-233.67 -70.48 -14.62 40.42 771.14
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -88.274586 51.817459 -1.704 0.0943 .
SWS 0.854592 0.055676 15.349 <2e-16 ***
L 0.014151 0.093199 0.152 0.8799
Wb -0.021007 0.035368 -0.594 0.5551
Wbr 0.002427 0.023306 0.104 0.9174
Tg 0.034494 0.082084 0.420 0.6760
P -9.184887 42.276019 -0.217 0.8288
S -1.641399 28.367960 -0.058 0.9541
`D\r` 44.113444 56.064845 0.787 0.4349
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 170.1 on 53 degrees of freedom
Multiple R-squared: 0.8418, Adjusted R-squared: 0.8179
F-statistic: 35.25 on 8 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,] 5.360977e-06 1.072195e-05 9.999946e-01
[2,] 9.942074e-08 1.988415e-07 9.999999e-01
[3,] 3.205716e-09 6.411433e-09 1.000000e+00
[4,] 1.432355e-10 2.864711e-10 1.000000e+00
[5,] 2.334051e-12 4.668103e-12 1.000000e+00
[6,] 4.986497e-14 9.972993e-14 1.000000e+00
[7,] 7.723146e-16 1.544629e-15 1.000000e+00
[8,] 2.315991e-17 4.631982e-17 1.000000e+00
[9,] 3.892317e-19 7.784634e-19 1.000000e+00
[10,] 9.752541e-01 4.949171e-02 2.474585e-02
[11,] 9.632158e-01 7.356842e-02 3.678421e-02
[12,] 9.429266e-01 1.141469e-01 5.707343e-02
[13,] 9.213447e-01 1.573107e-01 7.865533e-02
[14,] 8.957688e-01 2.084624e-01 1.042312e-01
[15,] 8.752970e-01 2.494060e-01 1.247030e-01
[16,] 8.272376e-01 3.455249e-01 1.727624e-01
[17,] 7.699901e-01 4.600197e-01 2.300099e-01
[18,] 9.605587e-01 7.888259e-02 3.944130e-02
[19,] 9.744880e-01 5.102395e-02 2.551198e-02
[20,] 9.735011e-01 5.299773e-02 2.649887e-02
[21,] 9.577495e-01 8.450093e-02 4.225046e-02
[22,] 9.354128e-01 1.291745e-01 6.458724e-02
[23,] 9.950914e-01 9.817175e-03 4.908588e-03
[24,] 9.916434e-01 1.671328e-02 8.356639e-03
[25,] 9.984373e-01 3.125400e-03 1.562700e-03
[26,] 9.968237e-01 6.352585e-03 3.176293e-03
[27,] 9.945002e-01 1.099950e-02 5.499750e-03
[28,] 9.891954e-01 2.160918e-02 1.080459e-02
[29,] 9.795822e-01 4.083550e-02 2.041775e-02
[30,] 1.000000e+00 7.677367e-21 3.838684e-21
[31,] 1.000000e+00 8.100111e-20 4.050055e-20
[32,] 1.000000e+00 3.686397e-18 1.843199e-18
[33,] 1.000000e+00 1.876165e-16 9.380823e-17
[34,] 1.000000e+00 6.398656e-15 3.199328e-15
[35,] 1.000000e+00 3.889394e-13 1.944697e-13
[36,] 1.000000e+00 3.035149e-11 1.517574e-11
[37,] 1.000000e+00 1.688384e-09 8.441922e-10
[38,] 9.999999e-01 1.468149e-07 7.340746e-08
[39,] 9.999948e-01 1.043002e-05 5.215008e-06
> postscript(file="/var/www/html/rcomp/tmp/19oqz1292934883.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/29oqz1292934883.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/32xpk1292934883.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/42xpk1292934883.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/52xpk1292934883.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 = 62
Frequency = 1
1 2 3 4 5 6
-50.444266 -35.766028 -92.580202 -126.841558 -32.580406 -58.755900
7 8 9 10 11 12
43.908419 -57.677369 48.351618 40.680853 -47.558540 -81.571576
13 14 15 16 17 18
64.865975 -233.667198 50.203998 12.679739 10.146928 10.487279
19 20 21 22 23 24
87.792175 86.256477 771.144195 -85.567561 22.636254 -91.237051
25 26 27 28 29 30
45.477066 -92.204889 -3.088461 -45.299171 -82.041854 -92.322387
31 32 33 34 35 36
-198.450249 -44.930853 39.625524 39.147708 72.661976 -6.654892
37 38 39 40 41 42
-15.255656 -13.977257 57.514690 50.867719 765.126856 5.483982
43 44 45 46 47 48
-58.738852 10.925232 -49.281284 -84.971524 -125.934824 -22.117967
49 50 51 52 53 54
49.097818 11.004065 9.854817 -24.737164 -228.765765 -85.046384
55 56 57 58 59 60
-126.847907 58.930254 10.837647 -25.549935 20.581315 -61.841092
61 62
59.372235 -73.356792
> postscript(file="/var/www/html/rcomp/tmp/6d7651292934883.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 = 62
Frequency = 1
lag(myerror, k = 1) myerror
0 -50.444266 NA
1 -35.766028 -50.444266
2 -92.580202 -35.766028
3 -126.841558 -92.580202
4 -32.580406 -126.841558
5 -58.755900 -32.580406
6 43.908419 -58.755900
7 -57.677369 43.908419
8 48.351618 -57.677369
9 40.680853 48.351618
10 -47.558540 40.680853
11 -81.571576 -47.558540
12 64.865975 -81.571576
13 -233.667198 64.865975
14 50.203998 -233.667198
15 12.679739 50.203998
16 10.146928 12.679739
17 10.487279 10.146928
18 87.792175 10.487279
19 86.256477 87.792175
20 771.144195 86.256477
21 -85.567561 771.144195
22 22.636254 -85.567561
23 -91.237051 22.636254
24 45.477066 -91.237051
25 -92.204889 45.477066
26 -3.088461 -92.204889
27 -45.299171 -3.088461
28 -82.041854 -45.299171
29 -92.322387 -82.041854
30 -198.450249 -92.322387
31 -44.930853 -198.450249
32 39.625524 -44.930853
33 39.147708 39.625524
34 72.661976 39.147708
35 -6.654892 72.661976
36 -15.255656 -6.654892
37 -13.977257 -15.255656
38 57.514690 -13.977257
39 50.867719 57.514690
40 765.126856 50.867719
41 5.483982 765.126856
42 -58.738852 5.483982
43 10.925232 -58.738852
44 -49.281284 10.925232
45 -84.971524 -49.281284
46 -125.934824 -84.971524
47 -22.117967 -125.934824
48 49.097818 -22.117967
49 11.004065 49.097818
50 9.854817 11.004065
51 -24.737164 9.854817
52 -228.765765 -24.737164
53 -85.046384 -228.765765
54 -126.847907 -85.046384
55 58.930254 -126.847907
56 10.837647 58.930254
57 -25.549935 10.837647
58 20.581315 -25.549935
59 -61.841092 20.581315
60 59.372235 -61.841092
61 -73.356792 59.372235
62 NA -73.356792
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -35.766028 -50.444266
[2,] -92.580202 -35.766028
[3,] -126.841558 -92.580202
[4,] -32.580406 -126.841558
[5,] -58.755900 -32.580406
[6,] 43.908419 -58.755900
[7,] -57.677369 43.908419
[8,] 48.351618 -57.677369
[9,] 40.680853 48.351618
[10,] -47.558540 40.680853
[11,] -81.571576 -47.558540
[12,] 64.865975 -81.571576
[13,] -233.667198 64.865975
[14,] 50.203998 -233.667198
[15,] 12.679739 50.203998
[16,] 10.146928 12.679739
[17,] 10.487279 10.146928
[18,] 87.792175 10.487279
[19,] 86.256477 87.792175
[20,] 771.144195 86.256477
[21,] -85.567561 771.144195
[22,] 22.636254 -85.567561
[23,] -91.237051 22.636254
[24,] 45.477066 -91.237051
[25,] -92.204889 45.477066
[26,] -3.088461 -92.204889
[27,] -45.299171 -3.088461
[28,] -82.041854 -45.299171
[29,] -92.322387 -82.041854
[30,] -198.450249 -92.322387
[31,] -44.930853 -198.450249
[32,] 39.625524 -44.930853
[33,] 39.147708 39.625524
[34,] 72.661976 39.147708
[35,] -6.654892 72.661976
[36,] -15.255656 -6.654892
[37,] -13.977257 -15.255656
[38,] 57.514690 -13.977257
[39,] 50.867719 57.514690
[40,] 765.126856 50.867719
[41,] 5.483982 765.126856
[42,] -58.738852 5.483982
[43,] 10.925232 -58.738852
[44,] -49.281284 10.925232
[45,] -84.971524 -49.281284
[46,] -125.934824 -84.971524
[47,] -22.117967 -125.934824
[48,] 49.097818 -22.117967
[49,] 11.004065 49.097818
[50,] 9.854817 11.004065
[51,] -24.737164 9.854817
[52,] -228.765765 -24.737164
[53,] -85.046384 -228.765765
[54,] -126.847907 -85.046384
[55,] 58.930254 -126.847907
[56,] 10.837647 58.930254
[57,] -25.549935 10.837647
[58,] 20.581315 -25.549935
[59,] -61.841092 20.581315
[60,] 59.372235 -61.841092
[61,] -73.356792 59.372235
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -35.766028 -50.444266
2 -92.580202 -35.766028
3 -126.841558 -92.580202
4 -32.580406 -126.841558
5 -58.755900 -32.580406
6 43.908419 -58.755900
7 -57.677369 43.908419
8 48.351618 -57.677369
9 40.680853 48.351618
10 -47.558540 40.680853
11 -81.571576 -47.558540
12 64.865975 -81.571576
13 -233.667198 64.865975
14 50.203998 -233.667198
15 12.679739 50.203998
16 10.146928 12.679739
17 10.487279 10.146928
18 87.792175 10.487279
19 86.256477 87.792175
20 771.144195 86.256477
21 -85.567561 771.144195
22 22.636254 -85.567561
23 -91.237051 22.636254
24 45.477066 -91.237051
25 -92.204889 45.477066
26 -3.088461 -92.204889
27 -45.299171 -3.088461
28 -82.041854 -45.299171
29 -92.322387 -82.041854
30 -198.450249 -92.322387
31 -44.930853 -198.450249
32 39.625524 -44.930853
33 39.147708 39.625524
34 72.661976 39.147708
35 -6.654892 72.661976
36 -15.255656 -6.654892
37 -13.977257 -15.255656
38 57.514690 -13.977257
39 50.867719 57.514690
40 765.126856 50.867719
41 5.483982 765.126856
42 -58.738852 5.483982
43 10.925232 -58.738852
44 -49.281284 10.925232
45 -84.971524 -49.281284
46 -125.934824 -84.971524
47 -22.117967 -125.934824
48 49.097818 -22.117967
49 11.004065 49.097818
50 9.854817 11.004065
51 -24.737164 9.854817
52 -228.765765 -24.737164
53 -85.046384 -228.765765
54 -126.847907 -85.046384
55 58.930254 -126.847907
56 10.837647 58.930254
57 -25.549935 10.837647
58 20.581315 -25.549935
59 -61.841092 20.581315
60 59.372235 -61.841092
61 -73.356792 59.372235
> 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/7oy581292934883.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/8oy581292934883.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/9oy581292934883.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/10g75b1292934883.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/1128lh1292934883.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/12nq251292934883.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/13jihe1292934883.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/14u9zh1292934883.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/15fax41292934883.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/16tkdv1292934883.tab")
+ }
>
> try(system("convert tmp/19oqz1292934883.ps tmp/19oqz1292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/29oqz1292934883.ps tmp/29oqz1292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/32xpk1292934883.ps tmp/32xpk1292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/42xpk1292934883.ps tmp/42xpk1292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/52xpk1292934883.ps tmp/52xpk1292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/6d7651292934883.ps tmp/6d7651292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/7oy581292934883.ps tmp/7oy581292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/8oy581292934883.ps tmp/8oy581292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/9oy581292934883.ps tmp/9oy581292934883.png",intern=TRUE))
character(0)
> try(system("convert tmp/10g75b1292934883.ps tmp/10g75b1292934883.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.582 1.630 5.936