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(8.9,11.1,8.9,10.9,8.6,10,8.3,9.2,8.3,9.2,8.3,9.5,8.4,9.6,8.5,9.5,8.4,9.1,8.6,8.9,8.5,9,8.5,10.1,8.4,10.3,8.5,10.2,8.5,9.6,8.5,9.2,8.5,9.3,8.5,9.4,8.5,9.4,8.5,9.2,8.5,9,8.6,9,8.4,9,8.1,9.8,8.0,10,8.0,9.8,8.0,9.3,8.0,9,7.9,9,7.8,9.1,7.8,9.1,7.9,9.1,8.1,9.2,8.0,8.8,7.6,8.3,7.3,8.4,7.0,8.1,6.8,7.7,7.0,7.9,7.1,7.9,7.2,8,7.1,7.9,6.9,7.6,6.7,7.1,6.7,6.8,6.6,6.5,6.9,6.9,7.3,8.2,7.5,8.7,7.3,8.3,7.1,7.9,6.9,7.5,7.1,7.8,7.5,8.3,7.7,8.4,7.8,8.2,7.8,7.7,7.7,7.2,7.8,7.3,7.8,8.1,7.9,8.5),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> 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 = '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
Y X
1 8.9 11.1
2 8.9 10.9
3 8.6 10.0
4 8.3 9.2
5 8.3 9.2
6 8.3 9.5
7 8.4 9.6
8 8.5 9.5
9 8.4 9.1
10 8.6 8.9
11 8.5 9.0
12 8.5 10.1
13 8.4 10.3
14 8.5 10.2
15 8.5 9.6
16 8.5 9.2
17 8.5 9.3
18 8.5 9.4
19 8.5 9.4
20 8.5 9.2
21 8.5 9.0
22 8.6 9.0
23 8.4 9.0
24 8.1 9.8
25 8.0 10.0
26 8.0 9.8
27 8.0 9.3
28 8.0 9.0
29 7.9 9.0
30 7.8 9.1
31 7.8 9.1
32 7.9 9.1
33 8.1 9.2
34 8.0 8.8
35 7.6 8.3
36 7.3 8.4
37 7.0 8.1
38 6.8 7.7
39 7.0 7.9
40 7.1 7.9
41 7.2 8.0
42 7.1 7.9
43 6.9 7.6
44 6.7 7.1
45 6.7 6.8
46 6.6 6.5
47 6.9 6.9
48 7.3 8.2
49 7.5 8.7
50 7.3 8.3
51 7.1 7.9
52 6.9 7.5
53 7.1 7.8
54 7.5 8.3
55 7.7 8.4
56 7.8 8.2
57 7.8 7.7
58 7.7 7.2
59 7.8 7.3
60 7.8 8.1
61 7.9 8.5
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
3.1000 0.5444
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.54363 -0.26498 -0.03836 0.23622 0.72615
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.09999 0.38024 8.153 3.02e-11 ***
X 0.54436 0.04324 12.591 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3322 on 59 degrees of freedom
Multiple R-squared: 0.7288, Adjusted R-squared: 0.7242
F-statistic: 158.5 on 1 and 59 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,] 1.135817e-03 2.271634e-03 0.9988641828
[2,] 1.273990e-03 2.547979e-03 0.9987260103
[3,] 1.786455e-04 3.572911e-04 0.9998213545
[4,] 1.667139e-04 3.334278e-04 0.9998332861
[5,] 1.339932e-04 2.679865e-04 0.9998660068
[6,] 4.297355e-03 8.594711e-03 0.9957026446
[7,] 3.131024e-03 6.262048e-03 0.9968689759
[8,] 1.629963e-03 3.259925e-03 0.9983700373
[9,] 2.281983e-03 4.563967e-03 0.9977180166
[10,] 1.112093e-03 2.224185e-03 0.9988879074
[11,] 4.456742e-04 8.913483e-04 0.9995543258
[12,] 2.475536e-04 4.951072e-04 0.9997524464
[13,] 1.220191e-04 2.440383e-04 0.9998779809
[14,] 5.483033e-05 1.096607e-04 0.9999451697
[15,] 2.501197e-05 5.002394e-05 0.9999749880
[16,] 1.534301e-05 3.068601e-05 0.9999846570
[17,] 1.489815e-05 2.979631e-05 0.9999851018
[18,] 4.802862e-05 9.605724e-05 0.9999519714
[19,] 4.570257e-05 9.140513e-05 0.9999542974
[20,] 7.406301e-04 1.481260e-03 0.9992593699
[21,] 9.694207e-03 1.938841e-02 0.9903057928
[22,] 2.943286e-02 5.886572e-02 0.9705671424
[23,] 4.381735e-02 8.763471e-02 0.9561826463
[24,] 5.185694e-02 1.037139e-01 0.9481430616
[25,] 6.881956e-02 1.376391e-01 0.9311804447
[26,] 1.053248e-01 2.106497e-01 0.8946751697
[27,] 1.343218e-01 2.686436e-01 0.8656781994
[28,] 1.302854e-01 2.605708e-01 0.8697145949
[29,] 1.072336e-01 2.144672e-01 0.8927663965
[30,] 9.670087e-02 1.934017e-01 0.9032991324
[31,] 1.018488e-01 2.036976e-01 0.8981511892
[32,] 1.675958e-01 3.351916e-01 0.8324041942
[33,] 3.075164e-01 6.150328e-01 0.6924835962
[34,] 4.321879e-01 8.643757e-01 0.5678121358
[35,] 4.617804e-01 9.235608e-01 0.5382195948
[36,] 4.369792e-01 8.739583e-01 0.5630208358
[37,] 3.921224e-01 7.842448e-01 0.6078775761
[38,] 3.646687e-01 7.293375e-01 0.6353312506
[39,] 3.615264e-01 7.230529e-01 0.6384735570
[40,] 3.540547e-01 7.081095e-01 0.6459452568
[41,] 3.231674e-01 6.463348e-01 0.6768325761
[42,] 3.434091e-01 6.868183e-01 0.6565908605
[43,] 3.663131e-01 7.326263e-01 0.6336868660
[44,] 3.230586e-01 6.461172e-01 0.6769413753
[45,] 2.625943e-01 5.251886e-01 0.7374057190
[46,] 2.437751e-01 4.875501e-01 0.7562249283
[47,] 3.047127e-01 6.094254e-01 0.6952873250
[48,] 6.622954e-01 6.754092e-01 0.3377045780
[49,] 9.815034e-01 3.699313e-02 0.0184965667
[50,] 9.980919e-01 3.816261e-03 0.0019081305
[51,] 9.991222e-01 1.755618e-03 0.0008778089
[52,] 9.956667e-01 8.666608e-03 0.0043333038
> postscript(file="/var/www/html/rcomp/tmp/19lc31258722639.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/2h2kz1258722639.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/349zi1258722639.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/4quet1258722639.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/5xyt81258722639.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 = 61
Frequency = 1
1 2 3 4 5
-0.2424334635 -0.1335606284 0.0563671296 0.1918584700 0.1918584700
6 7 8 9 10
0.0285492173 0.0741127998 0.2285492173 0.3462948875 0.6551677226
11 12 13 14 15
0.5007313051 -0.0980692880 -0.3069421231 -0.1525057055 0.1741127998
16 17 18 19 20
0.3918584700 0.3374220524 0.2829856349 0.2829856349 0.3918584700
21 22 23 24 25
0.5007313051 0.6007313051 0.4007313051 -0.3347600353 -0.5436328704
26 27 28 29 30
-0.4347600353 -0.1625779476 0.0007313051 -0.0992686949 -0.2537051125
31 32 33 34 35
-0.2537051125 -0.1537051125 -0.0081415300 0.1096041402 -0.0182137721
36 37 38 39 40
-0.3726501896 -0.5093409370 -0.4915952668 -0.4004681019 -0.3004681019
41 42 43 44 45
-0.2549045194 -0.3004681019 -0.3371588492 -0.2649767615 -0.1016675088
46 47 48 49 50
-0.0383582562 0.0438960736 -0.2637773545 -0.3359594423 -0.3182137721
51 52 53 54 55
-0.3004681019 -0.2827224317 -0.2460316843 -0.1182137721 0.0273498104
56 57 58 59 60
0.2362226455 0.5084047332 0.6805868210 0.7261504034 0.2906590630
61
0.1729133928
> postscript(file="/var/www/html/rcomp/tmp/6rwpk1258722639.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.2424334635 NA
1 -0.1335606284 -0.2424334635
2 0.0563671296 -0.1335606284
3 0.1918584700 0.0563671296
4 0.1918584700 0.1918584700
5 0.0285492173 0.1918584700
6 0.0741127998 0.0285492173
7 0.2285492173 0.0741127998
8 0.3462948875 0.2285492173
9 0.6551677226 0.3462948875
10 0.5007313051 0.6551677226
11 -0.0980692880 0.5007313051
12 -0.3069421231 -0.0980692880
13 -0.1525057055 -0.3069421231
14 0.1741127998 -0.1525057055
15 0.3918584700 0.1741127998
16 0.3374220524 0.3918584700
17 0.2829856349 0.3374220524
18 0.2829856349 0.2829856349
19 0.3918584700 0.2829856349
20 0.5007313051 0.3918584700
21 0.6007313051 0.5007313051
22 0.4007313051 0.6007313051
23 -0.3347600353 0.4007313051
24 -0.5436328704 -0.3347600353
25 -0.4347600353 -0.5436328704
26 -0.1625779476 -0.4347600353
27 0.0007313051 -0.1625779476
28 -0.0992686949 0.0007313051
29 -0.2537051125 -0.0992686949
30 -0.2537051125 -0.2537051125
31 -0.1537051125 -0.2537051125
32 -0.0081415300 -0.1537051125
33 0.1096041402 -0.0081415300
34 -0.0182137721 0.1096041402
35 -0.3726501896 -0.0182137721
36 -0.5093409370 -0.3726501896
37 -0.4915952668 -0.5093409370
38 -0.4004681019 -0.4915952668
39 -0.3004681019 -0.4004681019
40 -0.2549045194 -0.3004681019
41 -0.3004681019 -0.2549045194
42 -0.3371588492 -0.3004681019
43 -0.2649767615 -0.3371588492
44 -0.1016675088 -0.2649767615
45 -0.0383582562 -0.1016675088
46 0.0438960736 -0.0383582562
47 -0.2637773545 0.0438960736
48 -0.3359594423 -0.2637773545
49 -0.3182137721 -0.3359594423
50 -0.3004681019 -0.3182137721
51 -0.2827224317 -0.3004681019
52 -0.2460316843 -0.2827224317
53 -0.1182137721 -0.2460316843
54 0.0273498104 -0.1182137721
55 0.2362226455 0.0273498104
56 0.5084047332 0.2362226455
57 0.6805868210 0.5084047332
58 0.7261504034 0.6805868210
59 0.2906590630 0.7261504034
60 0.1729133928 0.2906590630
61 NA 0.1729133928
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.1335606284 -0.2424334635
[2,] 0.0563671296 -0.1335606284
[3,] 0.1918584700 0.0563671296
[4,] 0.1918584700 0.1918584700
[5,] 0.0285492173 0.1918584700
[6,] 0.0741127998 0.0285492173
[7,] 0.2285492173 0.0741127998
[8,] 0.3462948875 0.2285492173
[9,] 0.6551677226 0.3462948875
[10,] 0.5007313051 0.6551677226
[11,] -0.0980692880 0.5007313051
[12,] -0.3069421231 -0.0980692880
[13,] -0.1525057055 -0.3069421231
[14,] 0.1741127998 -0.1525057055
[15,] 0.3918584700 0.1741127998
[16,] 0.3374220524 0.3918584700
[17,] 0.2829856349 0.3374220524
[18,] 0.2829856349 0.2829856349
[19,] 0.3918584700 0.2829856349
[20,] 0.5007313051 0.3918584700
[21,] 0.6007313051 0.5007313051
[22,] 0.4007313051 0.6007313051
[23,] -0.3347600353 0.4007313051
[24,] -0.5436328704 -0.3347600353
[25,] -0.4347600353 -0.5436328704
[26,] -0.1625779476 -0.4347600353
[27,] 0.0007313051 -0.1625779476
[28,] -0.0992686949 0.0007313051
[29,] -0.2537051125 -0.0992686949
[30,] -0.2537051125 -0.2537051125
[31,] -0.1537051125 -0.2537051125
[32,] -0.0081415300 -0.1537051125
[33,] 0.1096041402 -0.0081415300
[34,] -0.0182137721 0.1096041402
[35,] -0.3726501896 -0.0182137721
[36,] -0.5093409370 -0.3726501896
[37,] -0.4915952668 -0.5093409370
[38,] -0.4004681019 -0.4915952668
[39,] -0.3004681019 -0.4004681019
[40,] -0.2549045194 -0.3004681019
[41,] -0.3004681019 -0.2549045194
[42,] -0.3371588492 -0.3004681019
[43,] -0.2649767615 -0.3371588492
[44,] -0.1016675088 -0.2649767615
[45,] -0.0383582562 -0.1016675088
[46,] 0.0438960736 -0.0383582562
[47,] -0.2637773545 0.0438960736
[48,] -0.3359594423 -0.2637773545
[49,] -0.3182137721 -0.3359594423
[50,] -0.3004681019 -0.3182137721
[51,] -0.2827224317 -0.3004681019
[52,] -0.2460316843 -0.2827224317
[53,] -0.1182137721 -0.2460316843
[54,] 0.0273498104 -0.1182137721
[55,] 0.2362226455 0.0273498104
[56,] 0.5084047332 0.2362226455
[57,] 0.6805868210 0.5084047332
[58,] 0.7261504034 0.6805868210
[59,] 0.2906590630 0.7261504034
[60,] 0.1729133928 0.2906590630
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.1335606284 -0.2424334635
2 0.0563671296 -0.1335606284
3 0.1918584700 0.0563671296
4 0.1918584700 0.1918584700
5 0.0285492173 0.1918584700
6 0.0741127998 0.0285492173
7 0.2285492173 0.0741127998
8 0.3462948875 0.2285492173
9 0.6551677226 0.3462948875
10 0.5007313051 0.6551677226
11 -0.0980692880 0.5007313051
12 -0.3069421231 -0.0980692880
13 -0.1525057055 -0.3069421231
14 0.1741127998 -0.1525057055
15 0.3918584700 0.1741127998
16 0.3374220524 0.3918584700
17 0.2829856349 0.3374220524
18 0.2829856349 0.2829856349
19 0.3918584700 0.2829856349
20 0.5007313051 0.3918584700
21 0.6007313051 0.5007313051
22 0.4007313051 0.6007313051
23 -0.3347600353 0.4007313051
24 -0.5436328704 -0.3347600353
25 -0.4347600353 -0.5436328704
26 -0.1625779476 -0.4347600353
27 0.0007313051 -0.1625779476
28 -0.0992686949 0.0007313051
29 -0.2537051125 -0.0992686949
30 -0.2537051125 -0.2537051125
31 -0.1537051125 -0.2537051125
32 -0.0081415300 -0.1537051125
33 0.1096041402 -0.0081415300
34 -0.0182137721 0.1096041402
35 -0.3726501896 -0.0182137721
36 -0.5093409370 -0.3726501896
37 -0.4915952668 -0.5093409370
38 -0.4004681019 -0.4915952668
39 -0.3004681019 -0.4004681019
40 -0.2549045194 -0.3004681019
41 -0.3004681019 -0.2549045194
42 -0.3371588492 -0.3004681019
43 -0.2649767615 -0.3371588492
44 -0.1016675088 -0.2649767615
45 -0.0383582562 -0.1016675088
46 0.0438960736 -0.0383582562
47 -0.2637773545 0.0438960736
48 -0.3359594423 -0.2637773545
49 -0.3182137721 -0.3359594423
50 -0.3004681019 -0.3182137721
51 -0.2827224317 -0.3004681019
52 -0.2460316843 -0.2827224317
53 -0.1182137721 -0.2460316843
54 0.0273498104 -0.1182137721
55 0.2362226455 0.0273498104
56 0.5084047332 0.2362226455
57 0.6805868210 0.5084047332
58 0.7261504034 0.6805868210
59 0.2906590630 0.7261504034
60 0.1729133928 0.2906590630
> 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/7bz9f1258722639.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/8s5ca1258722639.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/94h1b1258722639.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/100c9k1258722639.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/119azh1258722639.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/12abs71258722639.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/13tets1258722639.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/14ujvh1258722639.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/15z4831258722639.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/16rpq21258722639.tab")
+ }
>
> system("convert tmp/19lc31258722639.ps tmp/19lc31258722639.png")
> system("convert tmp/2h2kz1258722639.ps tmp/2h2kz1258722639.png")
> system("convert tmp/349zi1258722639.ps tmp/349zi1258722639.png")
> system("convert tmp/4quet1258722639.ps tmp/4quet1258722639.png")
> system("convert tmp/5xyt81258722639.ps tmp/5xyt81258722639.png")
> system("convert tmp/6rwpk1258722639.ps tmp/6rwpk1258722639.png")
> system("convert tmp/7bz9f1258722639.ps tmp/7bz9f1258722639.png")
> system("convert tmp/8s5ca1258722639.ps tmp/8s5ca1258722639.png")
> system("convert tmp/94h1b1258722639.ps tmp/94h1b1258722639.png")
> system("convert tmp/100c9k1258722639.ps tmp/100c9k1258722639.png")
>
>
> proc.time()
user system elapsed
2.471 1.564 2.861