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(94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1,104.5,105.1,95.1,88.7,86.3,91.8,111.5,99.7,97.5,111.7,86.2,95.4),dim=c(1,68),dimnames=list(c('productie'),1:68))
> y <- array(NA,dim=c(1,68),dimnames=list(c('productie'),1:68))
> 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
productie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 94.6 1 0 0 0 0 0 0 0 0 0 0 1
2 95.9 0 1 0 0 0 0 0 0 0 0 0 2
3 104.7 0 0 1 0 0 0 0 0 0 0 0 3
4 102.8 0 0 0 1 0 0 0 0 0 0 0 4
5 98.1 0 0 0 0 1 0 0 0 0 0 0 5
6 113.9 0 0 0 0 0 1 0 0 0 0 0 6
7 80.9 0 0 0 0 0 0 1 0 0 0 0 7
8 95.7 0 0 0 0 0 0 0 1 0 0 0 8
9 113.2 0 0 0 0 0 0 0 0 1 0 0 9
10 105.9 0 0 0 0 0 0 0 0 0 1 0 10
11 108.8 0 0 0 0 0 0 0 0 0 0 1 11
12 102.3 0 0 0 0 0 0 0 0 0 0 0 12
13 99.0 1 0 0 0 0 0 0 0 0 0 0 13
14 100.7 0 1 0 0 0 0 0 0 0 0 0 14
15 115.5 0 0 1 0 0 0 0 0 0 0 0 15
16 100.7 0 0 0 1 0 0 0 0 0 0 0 16
17 109.9 0 0 0 0 1 0 0 0 0 0 0 17
18 114.6 0 0 0 0 0 1 0 0 0 0 0 18
19 85.4 0 0 0 0 0 0 1 0 0 0 0 19
20 100.5 0 0 0 0 0 0 0 1 0 0 0 20
21 114.8 0 0 0 0 0 0 0 0 1 0 0 21
22 116.5 0 0 0 0 0 0 0 0 0 1 0 22
23 112.9 0 0 0 0 0 0 0 0 0 0 1 23
24 102.0 0 0 0 0 0 0 0 0 0 0 0 24
25 106.0 1 0 0 0 0 0 0 0 0 0 0 25
26 105.3 0 1 0 0 0 0 0 0 0 0 0 26
27 118.8 0 0 1 0 0 0 0 0 0 0 0 27
28 106.1 0 0 0 1 0 0 0 0 0 0 0 28
29 109.3 0 0 0 0 1 0 0 0 0 0 0 29
30 117.2 0 0 0 0 0 1 0 0 0 0 0 30
31 92.5 0 0 0 0 0 0 1 0 0 0 0 31
32 104.2 0 0 0 0 0 0 0 1 0 0 0 32
33 112.5 0 0 0 0 0 0 0 0 1 0 0 33
34 122.4 0 0 0 0 0 0 0 0 0 1 0 34
35 113.3 0 0 0 0 0 0 0 0 0 0 1 35
36 100.0 0 0 0 0 0 0 0 0 0 0 0 36
37 110.7 1 0 0 0 0 0 0 0 0 0 0 37
38 112.8 0 1 0 0 0 0 0 0 0 0 0 38
39 109.8 0 0 1 0 0 0 0 0 0 0 0 39
40 117.3 0 0 0 1 0 0 0 0 0 0 0 40
41 109.1 0 0 0 0 1 0 0 0 0 0 0 41
42 115.9 0 0 0 0 0 1 0 0 0 0 0 42
43 96.0 0 0 0 0 0 0 1 0 0 0 0 43
44 99.8 0 0 0 0 0 0 0 1 0 0 0 44
45 116.8 0 0 0 0 0 0 0 0 1 0 0 45
46 115.7 0 0 0 0 0 0 0 0 0 1 0 46
47 99.4 0 0 0 0 0 0 0 0 0 0 1 47
48 94.3 0 0 0 0 0 0 0 0 0 0 0 48
49 91.0 1 0 0 0 0 0 0 0 0 0 0 49
50 93.2 0 1 0 0 0 0 0 0 0 0 0 50
51 103.1 0 0 1 0 0 0 0 0 0 0 0 51
52 94.1 0 0 0 1 0 0 0 0 0 0 0 52
53 91.8 0 0 0 0 1 0 0 0 0 0 0 53
54 102.7 0 0 0 0 0 1 0 0 0 0 0 54
55 82.6 0 0 0 0 0 0 1 0 0 0 0 55
56 89.1 0 0 0 0 0 0 0 1 0 0 0 56
57 104.5 0 0 0 0 0 0 0 0 1 0 0 57
58 105.1 0 0 0 0 0 0 0 0 0 1 0 58
59 95.1 0 0 0 0 0 0 0 0 0 0 1 59
60 88.7 0 0 0 0 0 0 0 0 0 0 0 60
61 86.3 1 0 0 0 0 0 0 0 0 0 0 61
62 91.8 0 1 0 0 0 0 0 0 0 0 0 62
63 111.5 0 0 1 0 0 0 0 0 0 0 0 63
64 99.7 0 0 0 1 0 0 0 0 0 0 0 64
65 97.5 0 0 0 0 1 0 0 0 0 0 0 65
66 111.7 0 0 0 0 0 1 0 0 0 0 0 66
67 86.2 0 0 0 0 0 0 1 0 0 0 0 67
68 95.4 0 0 0 0 0 0 0 1 0 0 0 68
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) M1 M2 M3 M4 M5
101.15833 -0.04032 2.07907 12.79847 5.78454 5.05394
M6 M7 M8 M9 M10 M11
15.20667 -10.09060 0.19546 14.59181 15.45454 8.33727
t
-0.10273
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.6856 -5.1299 0.1121 3.9415 14.4664
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 101.15833 3.32336 30.439 < 2e-16 ***
M1 -0.04032 4.03008 -0.010 0.99205
M2 2.07907 4.02818 0.516 0.60783
M3 12.79847 4.02670 3.178 0.00243 **
M4 5.78454 4.02564 1.437 0.15640
M5 5.05394 4.02501 1.256 0.21456
M6 15.20667 4.02479 3.778 0.00039 ***
M7 -10.09060 4.02501 -2.507 0.01516 *
M8 0.19546 4.02564 0.049 0.96145
M9 14.59181 4.20558 3.470 0.00102 **
M10 15.45454 4.20457 3.676 0.00054 ***
M11 8.33727 4.20396 1.983 0.05235 .
t -0.10273 0.04128 -2.488 0.01589 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.647 on 55 degrees of freedom
Multiple R-squared: 0.6337, Adjusted R-squared: 0.5538
F-statistic: 7.929 on 12 and 55 DF, p-value: 2.515e-08
> 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.2461569750 0.4923139499 0.753843025
[2,] 0.2233153451 0.4466306902 0.776684655
[3,] 0.1673279974 0.3346559948 0.832672003
[4,] 0.1172968950 0.2345937900 0.882703105
[5,] 0.0679045431 0.1358090863 0.932095457
[6,] 0.0435210625 0.0870421251 0.956478937
[7,] 0.0437094332 0.0874188664 0.956290567
[8,] 0.0226307870 0.0452615740 0.977369213
[9,] 0.0183640279 0.0367280558 0.981635972
[10,] 0.0098726140 0.0197452279 0.990127386
[11,] 0.0048615569 0.0097231138 0.995138443
[12,] 0.0022748938 0.0045497875 0.997725106
[13,] 0.0016759150 0.0033518300 0.998324085
[14,] 0.0007897615 0.0015795230 0.999210239
[15,] 0.0005612493 0.0011224986 0.999438751
[16,] 0.0003834948 0.0007669896 0.999616505
[17,] 0.0001630991 0.0003261981 0.999836901
[18,] 0.0005892210 0.0011784421 0.999410779
[19,] 0.0004880570 0.0009761140 0.999511943
[20,] 0.0003973808 0.0007947616 0.999602619
[21,] 0.0007268072 0.0014536144 0.999273193
[22,] 0.0012738475 0.0025476950 0.998726152
[23,] 0.0027896551 0.0055793102 0.997210345
[24,] 0.0106830298 0.0213660595 0.989316970
[25,] 0.0385183653 0.0770367307 0.961481635
[26,] 0.0561133275 0.1122266550 0.943886672
[27,] 0.0606449962 0.1212899923 0.939355004
[28,] 0.0785489348 0.1570978696 0.921451065
[29,] 0.1032929853 0.2065859706 0.896707015
[30,] 0.2077316104 0.4154632208 0.792268390
[31,] 0.4317383980 0.8634767961 0.568261602
[32,] 0.7033157066 0.5933685868 0.296684293
[33,] 0.8548596841 0.2902806318 0.145140316
[34,] 0.9747990087 0.0504019825 0.025200991
[35,] 0.9976109795 0.0047780410 0.002389021
[36,] 0.9946582890 0.0106834221 0.005341711
[37,] 0.9792389399 0.0415221203 0.020761060
> postscript(file="/var/www/html/rcomp/tmp/1b5dq1290885677.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/2b5dq1290885677.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/3lecb1290885677.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/4lecb1290885677.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/5lecb1290885677.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 = 68
Frequency = 1
1 2 3 4 5 6
-6.41527778 -7.13194444 -8.94861111 -3.73194444 -7.59861111 -1.84861111
7 8 9 10 11 12
-9.44861111 -4.83194444 -1.62555556 -9.68555556 0.43444444 2.37444444
13 14 15 16 17 18
-0.78250000 -1.09916667 3.08416667 -4.59916667 5.43416667 0.08416667
19 20 21 22 23 24
-3.71583333 1.20083333 1.20722222 2.14722222 5.76722222 3.30722222
25 26 27 28 29 30
7.45027778 4.73361111 7.61694444 2.03361111 6.06694444 3.91694444
31 32 33 34 35 36
4.61694444 6.13361111 0.14000000 9.28000000 7.40000000 2.54000000
37 38 39 40 41 42
13.38305556 13.46638889 -0.15027778 14.46638889 7.09972222 3.84972222
43 44 45 46 47 48
9.34972222 2.96638889 5.67277778 3.81277778 -5.26722222 -1.92722222
49 50 51 52 53 54
-5.08416667 -4.90083333 -5.61750000 -7.50083333 -8.96750000 -8.11750000
55 56 57 58 59 60
-2.81750000 -6.50083333 -5.39444444 -5.55444444 -8.33444444 -6.29444444
61 62 63 64 65 66
-8.55138889 -5.06805556 4.01527778 -0.66805556 -2.03472222 2.11527778
67 68
2.01527778 1.03194444
> postscript(file="/var/www/html/rcomp/tmp/6e6ce1290885677.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 = 68
Frequency = 1
lag(myerror, k = 1) myerror
0 -6.41527778 NA
1 -7.13194444 -6.41527778
2 -8.94861111 -7.13194444
3 -3.73194444 -8.94861111
4 -7.59861111 -3.73194444
5 -1.84861111 -7.59861111
6 -9.44861111 -1.84861111
7 -4.83194444 -9.44861111
8 -1.62555556 -4.83194444
9 -9.68555556 -1.62555556
10 0.43444444 -9.68555556
11 2.37444444 0.43444444
12 -0.78250000 2.37444444
13 -1.09916667 -0.78250000
14 3.08416667 -1.09916667
15 -4.59916667 3.08416667
16 5.43416667 -4.59916667
17 0.08416667 5.43416667
18 -3.71583333 0.08416667
19 1.20083333 -3.71583333
20 1.20722222 1.20083333
21 2.14722222 1.20722222
22 5.76722222 2.14722222
23 3.30722222 5.76722222
24 7.45027778 3.30722222
25 4.73361111 7.45027778
26 7.61694444 4.73361111
27 2.03361111 7.61694444
28 6.06694444 2.03361111
29 3.91694444 6.06694444
30 4.61694444 3.91694444
31 6.13361111 4.61694444
32 0.14000000 6.13361111
33 9.28000000 0.14000000
34 7.40000000 9.28000000
35 2.54000000 7.40000000
36 13.38305556 2.54000000
37 13.46638889 13.38305556
38 -0.15027778 13.46638889
39 14.46638889 -0.15027778
40 7.09972222 14.46638889
41 3.84972222 7.09972222
42 9.34972222 3.84972222
43 2.96638889 9.34972222
44 5.67277778 2.96638889
45 3.81277778 5.67277778
46 -5.26722222 3.81277778
47 -1.92722222 -5.26722222
48 -5.08416667 -1.92722222
49 -4.90083333 -5.08416667
50 -5.61750000 -4.90083333
51 -7.50083333 -5.61750000
52 -8.96750000 -7.50083333
53 -8.11750000 -8.96750000
54 -2.81750000 -8.11750000
55 -6.50083333 -2.81750000
56 -5.39444444 -6.50083333
57 -5.55444444 -5.39444444
58 -8.33444444 -5.55444444
59 -6.29444444 -8.33444444
60 -8.55138889 -6.29444444
61 -5.06805556 -8.55138889
62 4.01527778 -5.06805556
63 -0.66805556 4.01527778
64 -2.03472222 -0.66805556
65 2.11527778 -2.03472222
66 2.01527778 2.11527778
67 1.03194444 2.01527778
68 NA 1.03194444
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -7.13194444 -6.41527778
[2,] -8.94861111 -7.13194444
[3,] -3.73194444 -8.94861111
[4,] -7.59861111 -3.73194444
[5,] -1.84861111 -7.59861111
[6,] -9.44861111 -1.84861111
[7,] -4.83194444 -9.44861111
[8,] -1.62555556 -4.83194444
[9,] -9.68555556 -1.62555556
[10,] 0.43444444 -9.68555556
[11,] 2.37444444 0.43444444
[12,] -0.78250000 2.37444444
[13,] -1.09916667 -0.78250000
[14,] 3.08416667 -1.09916667
[15,] -4.59916667 3.08416667
[16,] 5.43416667 -4.59916667
[17,] 0.08416667 5.43416667
[18,] -3.71583333 0.08416667
[19,] 1.20083333 -3.71583333
[20,] 1.20722222 1.20083333
[21,] 2.14722222 1.20722222
[22,] 5.76722222 2.14722222
[23,] 3.30722222 5.76722222
[24,] 7.45027778 3.30722222
[25,] 4.73361111 7.45027778
[26,] 7.61694444 4.73361111
[27,] 2.03361111 7.61694444
[28,] 6.06694444 2.03361111
[29,] 3.91694444 6.06694444
[30,] 4.61694444 3.91694444
[31,] 6.13361111 4.61694444
[32,] 0.14000000 6.13361111
[33,] 9.28000000 0.14000000
[34,] 7.40000000 9.28000000
[35,] 2.54000000 7.40000000
[36,] 13.38305556 2.54000000
[37,] 13.46638889 13.38305556
[38,] -0.15027778 13.46638889
[39,] 14.46638889 -0.15027778
[40,] 7.09972222 14.46638889
[41,] 3.84972222 7.09972222
[42,] 9.34972222 3.84972222
[43,] 2.96638889 9.34972222
[44,] 5.67277778 2.96638889
[45,] 3.81277778 5.67277778
[46,] -5.26722222 3.81277778
[47,] -1.92722222 -5.26722222
[48,] -5.08416667 -1.92722222
[49,] -4.90083333 -5.08416667
[50,] -5.61750000 -4.90083333
[51,] -7.50083333 -5.61750000
[52,] -8.96750000 -7.50083333
[53,] -8.11750000 -8.96750000
[54,] -2.81750000 -8.11750000
[55,] -6.50083333 -2.81750000
[56,] -5.39444444 -6.50083333
[57,] -5.55444444 -5.39444444
[58,] -8.33444444 -5.55444444
[59,] -6.29444444 -8.33444444
[60,] -8.55138889 -6.29444444
[61,] -5.06805556 -8.55138889
[62,] 4.01527778 -5.06805556
[63,] -0.66805556 4.01527778
[64,] -2.03472222 -0.66805556
[65,] 2.11527778 -2.03472222
[66,] 2.01527778 2.11527778
[67,] 1.03194444 2.01527778
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -7.13194444 -6.41527778
2 -8.94861111 -7.13194444
3 -3.73194444 -8.94861111
4 -7.59861111 -3.73194444
5 -1.84861111 -7.59861111
6 -9.44861111 -1.84861111
7 -4.83194444 -9.44861111
8 -1.62555556 -4.83194444
9 -9.68555556 -1.62555556
10 0.43444444 -9.68555556
11 2.37444444 0.43444444
12 -0.78250000 2.37444444
13 -1.09916667 -0.78250000
14 3.08416667 -1.09916667
15 -4.59916667 3.08416667
16 5.43416667 -4.59916667
17 0.08416667 5.43416667
18 -3.71583333 0.08416667
19 1.20083333 -3.71583333
20 1.20722222 1.20083333
21 2.14722222 1.20722222
22 5.76722222 2.14722222
23 3.30722222 5.76722222
24 7.45027778 3.30722222
25 4.73361111 7.45027778
26 7.61694444 4.73361111
27 2.03361111 7.61694444
28 6.06694444 2.03361111
29 3.91694444 6.06694444
30 4.61694444 3.91694444
31 6.13361111 4.61694444
32 0.14000000 6.13361111
33 9.28000000 0.14000000
34 7.40000000 9.28000000
35 2.54000000 7.40000000
36 13.38305556 2.54000000
37 13.46638889 13.38305556
38 -0.15027778 13.46638889
39 14.46638889 -0.15027778
40 7.09972222 14.46638889
41 3.84972222 7.09972222
42 9.34972222 3.84972222
43 2.96638889 9.34972222
44 5.67277778 2.96638889
45 3.81277778 5.67277778
46 -5.26722222 3.81277778
47 -1.92722222 -5.26722222
48 -5.08416667 -1.92722222
49 -4.90083333 -5.08416667
50 -5.61750000 -4.90083333
51 -7.50083333 -5.61750000
52 -8.96750000 -7.50083333
53 -8.11750000 -8.96750000
54 -2.81750000 -8.11750000
55 -6.50083333 -2.81750000
56 -5.39444444 -6.50083333
57 -5.55444444 -5.39444444
58 -8.33444444 -5.55444444
59 -6.29444444 -8.33444444
60 -8.55138889 -6.29444444
61 -5.06805556 -8.55138889
62 4.01527778 -5.06805556
63 -0.66805556 4.01527778
64 -2.03472222 -0.66805556
65 2.11527778 -2.03472222
66 2.01527778 2.11527778
67 1.03194444 2.01527778
> 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/77xth1290885677.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/87xth1290885677.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/97xth1290885677.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/10z6sk1290885677.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/113p981290885677.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/1267pw1290885677.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/13kz541290885677.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/14yao51290885678.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/15js4b1290885678.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/16nb3z1290885678.tab")
+ }
>
> try(system("convert tmp/1b5dq1290885677.ps tmp/1b5dq1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/2b5dq1290885677.ps tmp/2b5dq1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/3lecb1290885677.ps tmp/3lecb1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/4lecb1290885677.ps tmp/4lecb1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/5lecb1290885677.ps tmp/5lecb1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/6e6ce1290885677.ps tmp/6e6ce1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/77xth1290885677.ps tmp/77xth1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/87xth1290885677.ps tmp/87xth1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/97xth1290885677.ps tmp/97xth1290885677.png",intern=TRUE))
character(0)
> try(system("convert tmp/10z6sk1290885677.ps tmp/10z6sk1290885677.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.531 1.593 6.176