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(10,24.1,9.2,24.1,9.2,24.1,9.5,21.3,9.6,21.3,9.5,21.3,9.1,19.1,8.9,19.1,9,19.1,10.1,26.2,10.3,26.2,10.2,26.2,9.6,21.7,9.2,21.7,9.3,21.7,9.4,19.4,9.4,19.4,9.2,19.4,9,19.5,9,19.5,9,19.5,9.8,28.7,10,28.7,9.8,28.7,9.3,21.8,9,21.8,9,21.8,9.1,20,9.1,20,9.1,20,9.2,22.6,8.8,22.6,8.3,22.6,8.4,22.4,8.1,22.4,7.7,22.4,7.9,18.6,7.9,18.6,8,18.6,7.9,16.2,7.6,16.2,7.1,16.2,6.8,13.8,6.5,13.8,6.9,13.8,8.2,24.1,8.7,24.1,8.3,24.1,7.9,19.9,7.5,19.9,7.8,19.9,8.3,22.3,8.4,22.3,8.2,22.3,7.7,20.9,7.2,20.9,7.3,20.9,8.1,25.5,8.5,25.5,8.4,25.5),dim=c(2,60),dimnames=list(c('TWV','WV-25'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('TWV','WV-25'),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
TWV WV-25 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 10.0 24.1 1 0 0 0 0 0 0 0 0 0 0
2 9.2 24.1 0 1 0 0 0 0 0 0 0 0 0
3 9.2 24.1 0 0 1 0 0 0 0 0 0 0 0
4 9.5 21.3 0 0 0 1 0 0 0 0 0 0 0
5 9.6 21.3 0 0 0 0 1 0 0 0 0 0 0
6 9.5 21.3 0 0 0 0 0 1 0 0 0 0 0
7 9.1 19.1 0 0 0 0 0 0 1 0 0 0 0
8 8.9 19.1 0 0 0 0 0 0 0 1 0 0 0
9 9.0 19.1 0 0 0 0 0 0 0 0 1 0 0
10 10.1 26.2 0 0 0 0 0 0 0 0 0 1 0
11 10.3 26.2 0 0 0 0 0 0 0 0 0 0 1
12 10.2 26.2 0 0 0 0 0 0 0 0 0 0 0
13 9.6 21.7 1 0 0 0 0 0 0 0 0 0 0
14 9.2 21.7 0 1 0 0 0 0 0 0 0 0 0
15 9.3 21.7 0 0 1 0 0 0 0 0 0 0 0
16 9.4 19.4 0 0 0 1 0 0 0 0 0 0 0
17 9.4 19.4 0 0 0 0 1 0 0 0 0 0 0
18 9.2 19.4 0 0 0 0 0 1 0 0 0 0 0
19 9.0 19.5 0 0 0 0 0 0 1 0 0 0 0
20 9.0 19.5 0 0 0 0 0 0 0 1 0 0 0
21 9.0 19.5 0 0 0 0 0 0 0 0 1 0 0
22 9.8 28.7 0 0 0 0 0 0 0 0 0 1 0
23 10.0 28.7 0 0 0 0 0 0 0 0 0 0 1
24 9.8 28.7 0 0 0 0 0 0 0 0 0 0 0
25 9.3 21.8 1 0 0 0 0 0 0 0 0 0 0
26 9.0 21.8 0 1 0 0 0 0 0 0 0 0 0
27 9.0 21.8 0 0 1 0 0 0 0 0 0 0 0
28 9.1 20.0 0 0 0 1 0 0 0 0 0 0 0
29 9.1 20.0 0 0 0 0 1 0 0 0 0 0 0
30 9.1 20.0 0 0 0 0 0 1 0 0 0 0 0
31 9.2 22.6 0 0 0 0 0 0 1 0 0 0 0
32 8.8 22.6 0 0 0 0 0 0 0 1 0 0 0
33 8.3 22.6 0 0 0 0 0 0 0 0 1 0 0
34 8.4 22.4 0 0 0 0 0 0 0 0 0 1 0
35 8.1 22.4 0 0 0 0 0 0 0 0 0 0 1
36 7.7 22.4 0 0 0 0 0 0 0 0 0 0 0
37 7.9 18.6 1 0 0 0 0 0 0 0 0 0 0
38 7.9 18.6 0 1 0 0 0 0 0 0 0 0 0
39 8.0 18.6 0 0 1 0 0 0 0 0 0 0 0
40 7.9 16.2 0 0 0 1 0 0 0 0 0 0 0
41 7.6 16.2 0 0 0 0 1 0 0 0 0 0 0
42 7.1 16.2 0 0 0 0 0 1 0 0 0 0 0
43 6.8 13.8 0 0 0 0 0 0 1 0 0 0 0
44 6.5 13.8 0 0 0 0 0 0 0 1 0 0 0
45 6.9 13.8 0 0 0 0 0 0 0 0 1 0 0
46 8.2 24.1 0 0 0 0 0 0 0 0 0 1 0
47 8.7 24.1 0 0 0 0 0 0 0 0 0 0 1
48 8.3 24.1 0 0 0 0 0 0 0 0 0 0 0
49 7.9 19.9 1 0 0 0 0 0 0 0 0 0 0
50 7.5 19.9 0 1 0 0 0 0 0 0 0 0 0
51 7.8 19.9 0 0 1 0 0 0 0 0 0 0 0
52 8.3 22.3 0 0 0 1 0 0 0 0 0 0 0
53 8.4 22.3 0 0 0 0 1 0 0 0 0 0 0
54 8.2 22.3 0 0 0 0 0 1 0 0 0 0 0
55 7.7 20.9 0 0 0 0 0 0 1 0 0 0 0
56 7.2 20.9 0 0 0 0 0 0 0 1 0 0 0
57 7.3 20.9 0 0 0 0 0 0 0 0 1 0 0
58 8.1 25.5 0 0 0 0 0 0 0 0 0 1 0
59 8.5 25.5 0 0 0 0 0 0 0 0 0 0 1
60 8.4 25.5 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) `WV-25` M1 M2 M3 M4
2.5300 0.2502 1.1008 0.7208 0.8208 1.3461
M5 M6 M7 M8 M9 M10
1.3261 1.1261 1.0312 0.7512 0.7712 0.0400
M11
0.2400
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.31034 -0.40841 0.02243 0.51601 1.11484
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.53001 1.04145 2.429 0.01900 *
`WV-25` 0.25020 0.03916 6.389 6.93e-08 ***
M1 1.10082 0.46893 2.348 0.02316 *
M2 0.72082 0.46893 1.537 0.13096
M3 0.82082 0.46893 1.750 0.08657 .
M4 1.34609 0.49033 2.745 0.00854 **
M5 1.32609 0.49033 2.704 0.00950 **
M6 1.12609 0.49033 2.297 0.02615 *
M7 1.03122 0.50230 2.053 0.04566 *
M8 0.75122 0.50230 1.496 0.14146
M9 0.77122 0.50230 1.535 0.13140
M10 0.04000 0.43972 0.091 0.92791
M11 0.24000 0.43972 0.546 0.58778
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6953 on 47 degrees of freedom
Multiple R-squared: 0.5318, Adjusted R-squared: 0.4123
F-statistic: 4.449 on 12 and 47 DF, p-value: 9.983e-05
> 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,] 1.735080e-02 0.0347016043 0.982649198
[2,] 4.264061e-03 0.0085281216 0.995735939
[3,] 1.493281e-03 0.0029865618 0.998506719
[4,] 4.270888e-04 0.0008541776 0.999572911
[5,] 1.416135e-04 0.0002832270 0.999858387
[6,] 5.217037e-05 0.0001043407 0.999947830
[7,] 1.479137e-04 0.0002958275 0.999852086
[8,] 1.486560e-04 0.0002973120 0.999851344
[9,] 1.943240e-04 0.0003886480 0.999805676
[10,] 7.507958e-04 0.0015015916 0.999249204
[11,] 5.200472e-04 0.0010400943 0.999479953
[12,] 3.616154e-04 0.0007232307 0.999638385
[13,] 4.949365e-04 0.0009898731 0.999505063
[14,] 1.031981e-03 0.0020639617 0.998968019
[15,] 3.728711e-03 0.0074574220 0.996271289
[16,] 1.125188e-02 0.0225037578 0.988748121
[17,] 1.378729e-01 0.2757457747 0.862127113
[18,] 4.522742e-01 0.9045483227 0.547725839
[19,] 9.370383e-01 0.1259234025 0.062961701
[20,] 9.858443e-01 0.0283114186 0.014155709
[21,] 9.960856e-01 0.0078288188 0.003914409
[22,] 9.943328e-01 0.0113344448 0.005667222
[23,] 9.960694e-01 0.0078611033 0.003930552
[24,] 9.942172e-01 0.0115656192 0.005782810
[25,] 9.896912e-01 0.0206176455 0.010308823
[26,] 9.790621e-01 0.0418758897 0.020937945
[27,] 9.898316e-01 0.0203367536 0.010168377
[28,] 9.864525e-01 0.0270950628 0.013547531
[29,] 9.772517e-01 0.0454966622 0.022748331
> postscript(file="/var/www/html/rcomp/tmp/1d2jv1258662256.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/23l4a1258662256.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/3w4gq1258662256.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/4sxrh1258662256.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/5723t1258662256.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.339433445 -0.080566555 -0.180566555 0.294712788 0.414712788 0.514712788
7 8 9 10 11 12
0.760015738 0.840015738 0.920015738 0.974838689 0.974838689 1.114838689
13 14 15 16 17 18
0.539905574 0.519905574 0.519905574 0.670086557 0.690086557 0.690086557
19 20 21 22 23 24
0.559937049 0.839937049 0.819937049 0.049346888 0.049346888 0.089346888
25 26 27 28 29 30
0.214885902 0.294885902 0.194885902 0.219968525 0.239968525 0.439968525
31 32 33 34 35 36
-0.015672784 -0.135672784 -0.655672784 0.225586227 -0.274413773 -0.434413773
37 38 39 40 41 42
-0.384484592 -0.004484592 -0.004484592 -0.029283937 -0.309283937 -0.609283937
43 44 45 46 47 48
-0.213941644 -0.233941644 0.146058356 -0.399748198 -0.099748198 -0.259748198
49 50 51 52 53 54
-0.709740329 -0.729740329 -0.529740329 -1.155483932 -1.035483932 -1.035483932
55 56 57 58 59 60
-1.090338359 -1.310338359 -1.230338359 -0.850023606 -0.650023606 -0.510023606
> postscript(file="/var/www/html/rcomp/tmp/6yol01258662256.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.339433445 NA
1 -0.080566555 0.339433445
2 -0.180566555 -0.080566555
3 0.294712788 -0.180566555
4 0.414712788 0.294712788
5 0.514712788 0.414712788
6 0.760015738 0.514712788
7 0.840015738 0.760015738
8 0.920015738 0.840015738
9 0.974838689 0.920015738
10 0.974838689 0.974838689
11 1.114838689 0.974838689
12 0.539905574 1.114838689
13 0.519905574 0.539905574
14 0.519905574 0.519905574
15 0.670086557 0.519905574
16 0.690086557 0.670086557
17 0.690086557 0.690086557
18 0.559937049 0.690086557
19 0.839937049 0.559937049
20 0.819937049 0.839937049
21 0.049346888 0.819937049
22 0.049346888 0.049346888
23 0.089346888 0.049346888
24 0.214885902 0.089346888
25 0.294885902 0.214885902
26 0.194885902 0.294885902
27 0.219968525 0.194885902
28 0.239968525 0.219968525
29 0.439968525 0.239968525
30 -0.015672784 0.439968525
31 -0.135672784 -0.015672784
32 -0.655672784 -0.135672784
33 0.225586227 -0.655672784
34 -0.274413773 0.225586227
35 -0.434413773 -0.274413773
36 -0.384484592 -0.434413773
37 -0.004484592 -0.384484592
38 -0.004484592 -0.004484592
39 -0.029283937 -0.004484592
40 -0.309283937 -0.029283937
41 -0.609283937 -0.309283937
42 -0.213941644 -0.609283937
43 -0.233941644 -0.213941644
44 0.146058356 -0.233941644
45 -0.399748198 0.146058356
46 -0.099748198 -0.399748198
47 -0.259748198 -0.099748198
48 -0.709740329 -0.259748198
49 -0.729740329 -0.709740329
50 -0.529740329 -0.729740329
51 -1.155483932 -0.529740329
52 -1.035483932 -1.155483932
53 -1.035483932 -1.035483932
54 -1.090338359 -1.035483932
55 -1.310338359 -1.090338359
56 -1.230338359 -1.310338359
57 -0.850023606 -1.230338359
58 -0.650023606 -0.850023606
59 -0.510023606 -0.650023606
60 NA -0.510023606
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.080566555 0.339433445
[2,] -0.180566555 -0.080566555
[3,] 0.294712788 -0.180566555
[4,] 0.414712788 0.294712788
[5,] 0.514712788 0.414712788
[6,] 0.760015738 0.514712788
[7,] 0.840015738 0.760015738
[8,] 0.920015738 0.840015738
[9,] 0.974838689 0.920015738
[10,] 0.974838689 0.974838689
[11,] 1.114838689 0.974838689
[12,] 0.539905574 1.114838689
[13,] 0.519905574 0.539905574
[14,] 0.519905574 0.519905574
[15,] 0.670086557 0.519905574
[16,] 0.690086557 0.670086557
[17,] 0.690086557 0.690086557
[18,] 0.559937049 0.690086557
[19,] 0.839937049 0.559937049
[20,] 0.819937049 0.839937049
[21,] 0.049346888 0.819937049
[22,] 0.049346888 0.049346888
[23,] 0.089346888 0.049346888
[24,] 0.214885902 0.089346888
[25,] 0.294885902 0.214885902
[26,] 0.194885902 0.294885902
[27,] 0.219968525 0.194885902
[28,] 0.239968525 0.219968525
[29,] 0.439968525 0.239968525
[30,] -0.015672784 0.439968525
[31,] -0.135672784 -0.015672784
[32,] -0.655672784 -0.135672784
[33,] 0.225586227 -0.655672784
[34,] -0.274413773 0.225586227
[35,] -0.434413773 -0.274413773
[36,] -0.384484592 -0.434413773
[37,] -0.004484592 -0.384484592
[38,] -0.004484592 -0.004484592
[39,] -0.029283937 -0.004484592
[40,] -0.309283937 -0.029283937
[41,] -0.609283937 -0.309283937
[42,] -0.213941644 -0.609283937
[43,] -0.233941644 -0.213941644
[44,] 0.146058356 -0.233941644
[45,] -0.399748198 0.146058356
[46,] -0.099748198 -0.399748198
[47,] -0.259748198 -0.099748198
[48,] -0.709740329 -0.259748198
[49,] -0.729740329 -0.709740329
[50,] -0.529740329 -0.729740329
[51,] -1.155483932 -0.529740329
[52,] -1.035483932 -1.155483932
[53,] -1.035483932 -1.035483932
[54,] -1.090338359 -1.035483932
[55,] -1.310338359 -1.090338359
[56,] -1.230338359 -1.310338359
[57,] -0.850023606 -1.230338359
[58,] -0.650023606 -0.850023606
[59,] -0.510023606 -0.650023606
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.080566555 0.339433445
2 -0.180566555 -0.080566555
3 0.294712788 -0.180566555
4 0.414712788 0.294712788
5 0.514712788 0.414712788
6 0.760015738 0.514712788
7 0.840015738 0.760015738
8 0.920015738 0.840015738
9 0.974838689 0.920015738
10 0.974838689 0.974838689
11 1.114838689 0.974838689
12 0.539905574 1.114838689
13 0.519905574 0.539905574
14 0.519905574 0.519905574
15 0.670086557 0.519905574
16 0.690086557 0.670086557
17 0.690086557 0.690086557
18 0.559937049 0.690086557
19 0.839937049 0.559937049
20 0.819937049 0.839937049
21 0.049346888 0.819937049
22 0.049346888 0.049346888
23 0.089346888 0.049346888
24 0.214885902 0.089346888
25 0.294885902 0.214885902
26 0.194885902 0.294885902
27 0.219968525 0.194885902
28 0.239968525 0.219968525
29 0.439968525 0.239968525
30 -0.015672784 0.439968525
31 -0.135672784 -0.015672784
32 -0.655672784 -0.135672784
33 0.225586227 -0.655672784
34 -0.274413773 0.225586227
35 -0.434413773 -0.274413773
36 -0.384484592 -0.434413773
37 -0.004484592 -0.384484592
38 -0.004484592 -0.004484592
39 -0.029283937 -0.004484592
40 -0.309283937 -0.029283937
41 -0.609283937 -0.309283937
42 -0.213941644 -0.609283937
43 -0.233941644 -0.213941644
44 0.146058356 -0.233941644
45 -0.399748198 0.146058356
46 -0.099748198 -0.399748198
47 -0.259748198 -0.099748198
48 -0.709740329 -0.259748198
49 -0.729740329 -0.709740329
50 -0.529740329 -0.729740329
51 -1.155483932 -0.529740329
52 -1.035483932 -1.155483932
53 -1.035483932 -1.035483932
54 -1.090338359 -1.035483932
55 -1.310338359 -1.090338359
56 -1.230338359 -1.310338359
57 -0.850023606 -1.230338359
58 -0.650023606 -0.850023606
59 -0.510023606 -0.650023606
> 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/7cp2o1258662256.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/83z2y1258662256.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/90b9b1258662256.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/102sik1258662256.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/118hwd1258662256.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/12vapg1258662256.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/13gx8q1258662256.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/14lmng1258662256.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/157q0o1258662256.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/16ytuo1258662256.tab")
+ }
>
> system("convert tmp/1d2jv1258662256.ps tmp/1d2jv1258662256.png")
> system("convert tmp/23l4a1258662256.ps tmp/23l4a1258662256.png")
> system("convert tmp/3w4gq1258662256.ps tmp/3w4gq1258662256.png")
> system("convert tmp/4sxrh1258662256.ps tmp/4sxrh1258662256.png")
> system("convert tmp/5723t1258662256.ps tmp/5723t1258662256.png")
> system("convert tmp/6yol01258662256.ps tmp/6yol01258662256.png")
> system("convert tmp/7cp2o1258662256.ps tmp/7cp2o1258662256.png")
> system("convert tmp/83z2y1258662256.ps tmp/83z2y1258662256.png")
> system("convert tmp/90b9b1258662256.ps tmp/90b9b1258662256.png")
> system("convert tmp/102sik1258662256.ps tmp/102sik1258662256.png")
>
>
> proc.time()
user system elapsed
2.393 1.597 2.865