R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(1515,0,1510,0,1225,0,1577,0,1417,0,1224,0,1693,0,1633,0,1639,0,1914,0,1586,0,1552,0,2081,0,1500,0,1437,0,1470,0,1849,0,1387,0,1592,0,1589,0,1798,0,1935,0,1887,0,2027,0,2080,0,1556,0,1682,0,1785,0,1869,0,1781,0,2082,0,2570,1,1862,1,1936,1,1504,1,1765,1,1607,1,1577,1,1493,1,1615,1,1700,1,1335,1,1523,1,1623,1,1540,1,1637,1,1524,1,1419,1,1821,1,1593,1,1357,1,1263,1,1750,1,1405,1,1393,1,1639,1,1679,1,1551,1,1744,1,1429,1,1784,1),dim=c(2,61),dimnames=list(c('Gebouwen','Dummy'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Gebouwen','Dummy'),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 = '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
Gebouwen Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 1515 0 1 0 0 0 0 0 0 0 0 0 0 1
2 1510 0 0 1 0 0 0 0 0 0 0 0 0 2
3 1225 0 0 0 1 0 0 0 0 0 0 0 0 3
4 1577 0 0 0 0 1 0 0 0 0 0 0 0 4
5 1417 0 0 0 0 0 1 0 0 0 0 0 0 5
6 1224 0 0 0 0 0 0 1 0 0 0 0 0 6
7 1693 0 0 0 0 0 0 0 1 0 0 0 0 7
8 1633 0 0 0 0 0 0 0 0 1 0 0 0 8
9 1639 0 0 0 0 0 0 0 0 0 1 0 0 9
10 1914 0 0 0 0 0 0 0 0 0 0 1 0 10
11 1586 0 0 0 0 0 0 0 0 0 0 0 1 11
12 1552 0 0 0 0 0 0 0 0 0 0 0 0 12
13 2081 0 1 0 0 0 0 0 0 0 0 0 0 13
14 1500 0 0 1 0 0 0 0 0 0 0 0 0 14
15 1437 0 0 0 1 0 0 0 0 0 0 0 0 15
16 1470 0 0 0 0 1 0 0 0 0 0 0 0 16
17 1849 0 0 0 0 0 1 0 0 0 0 0 0 17
18 1387 0 0 0 0 0 0 1 0 0 0 0 0 18
19 1592 0 0 0 0 0 0 0 1 0 0 0 0 19
20 1589 0 0 0 0 0 0 0 0 1 0 0 0 20
21 1798 0 0 0 0 0 0 0 0 0 1 0 0 21
22 1935 0 0 0 0 0 0 0 0 0 0 1 0 22
23 1887 0 0 0 0 0 0 0 0 0 0 0 1 23
24 2027 0 0 0 0 0 0 0 0 0 0 0 0 24
25 2080 0 1 0 0 0 0 0 0 0 0 0 0 25
26 1556 0 0 1 0 0 0 0 0 0 0 0 0 26
27 1682 0 0 0 1 0 0 0 0 0 0 0 0 27
28 1785 0 0 0 0 1 0 0 0 0 0 0 0 28
29 1869 0 0 0 0 0 1 0 0 0 0 0 0 29
30 1781 0 0 0 0 0 0 1 0 0 0 0 0 30
31 2082 0 0 0 0 0 0 0 1 0 0 0 0 31
32 2570 1 0 0 0 0 0 0 0 1 0 0 0 32
33 1862 1 0 0 0 0 0 0 0 0 1 0 0 33
34 1936 1 0 0 0 0 0 0 0 0 0 1 0 34
35 1504 1 0 0 0 0 0 0 0 0 0 0 1 35
36 1765 1 0 0 0 0 0 0 0 0 0 0 0 36
37 1607 1 1 0 0 0 0 0 0 0 0 0 0 37
38 1577 1 0 1 0 0 0 0 0 0 0 0 0 38
39 1493 1 0 0 1 0 0 0 0 0 0 0 0 39
40 1615 1 0 0 0 1 0 0 0 0 0 0 0 40
41 1700 1 0 0 0 0 1 0 0 0 0 0 0 41
42 1335 1 0 0 0 0 0 1 0 0 0 0 0 42
43 1523 1 0 0 0 0 0 0 1 0 0 0 0 43
44 1623 1 0 0 0 0 0 0 0 1 0 0 0 44
45 1540 1 0 0 0 0 0 0 0 0 1 0 0 45
46 1637 1 0 0 0 0 0 0 0 0 0 1 0 46
47 1524 1 0 0 0 0 0 0 0 0 0 0 1 47
48 1419 1 0 0 0 0 0 0 0 0 0 0 0 48
49 1821 1 1 0 0 0 0 0 0 0 0 0 0 49
50 1593 1 0 1 0 0 0 0 0 0 0 0 0 50
51 1357 1 0 0 1 0 0 0 0 0 0 0 0 51
52 1263 1 0 0 0 1 0 0 0 0 0 0 0 52
53 1750 1 0 0 0 0 1 0 0 0 0 0 0 53
54 1405 1 0 0 0 0 0 1 0 0 0 0 0 54
55 1393 1 0 0 0 0 0 0 1 0 0 0 0 55
56 1639 1 0 0 0 0 0 0 0 1 0 0 0 56
57 1679 1 0 0 0 0 0 0 0 0 1 0 0 57
58 1551 1 0 0 0 0 0 0 0 0 0 1 0 58
59 1744 1 0 0 0 0 0 0 0 0 0 0 1 59
60 1429 1 0 0 0 0 0 0 0 0 0 0 0 60
61 1784 1 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Dummy M1 M2 M3 M4
1623.985 -198.804 174.955 -93.823 -205.936 -106.450
M5 M6 M7 M8 M9 M10
64.836 -229.478 -2.992 187.255 76.342 163.628
M11 t
14.314 3.714
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-296.52 -122.64 -34.21 97.04 838.72
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1623.985 118.465 13.709 <2e-16 ***
Dummy -198.804 114.367 -1.738 0.0887 .
M1 174.955 132.951 1.316 0.1946
M2 -93.823 139.616 -0.672 0.5049
M3 -205.936 139.362 -1.478 0.1462
M4 -106.450 139.183 -0.765 0.4482
M5 64.836 139.080 0.466 0.6432
M6 -229.478 139.051 -1.650 0.1055
M7 -2.992 139.098 -0.022 0.9829
M8 187.255 139.183 1.345 0.1850
M9 76.342 138.920 0.550 0.5852
M10 163.628 138.731 1.179 0.2442
M11 14.314 138.618 0.103 0.9182
t 3.714 3.236 1.148 0.2569
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 219.1 on 47 degrees of freedom
Multiple R-squared: 0.3449, Adjusted R-squared: 0.1636
F-statistic: 1.903 on 13 and 47 DF, p-value: 0.05436
> 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.64151542 0.71696916 0.358484578
[2,] 0.50183527 0.99632945 0.498164726
[3,] 0.49131461 0.98262921 0.508685395
[4,] 0.56128008 0.87743984 0.438719922
[5,] 0.45665830 0.91331661 0.543341697
[6,] 0.36116713 0.72233426 0.638832872
[7,] 0.28907438 0.57814875 0.710925625
[8,] 0.30813331 0.61626662 0.691866689
[9,] 0.21798003 0.43596006 0.782019968
[10,] 0.23061805 0.46123611 0.769381946
[11,] 0.17463219 0.34926439 0.825367807
[12,] 0.11587068 0.23174136 0.884129319
[13,] 0.09502425 0.19004851 0.904975746
[14,] 0.08788935 0.17577869 0.912110653
[15,] 0.06470364 0.12940728 0.935296360
[16,] 0.48460897 0.96921793 0.515391034
[17,] 0.77489250 0.45021500 0.225107498
[18,] 0.90174629 0.19650741 0.098253705
[19,] 0.93904307 0.12191386 0.060956928
[20,] 0.97565251 0.04869498 0.024347491
[21,] 0.98744239 0.02511523 0.012557613
[22,] 0.97390729 0.05218543 0.026092714
[23,] 0.95627110 0.08745781 0.043728903
[24,] 0.99227121 0.01545757 0.007728787
[25,] 0.97962682 0.04074637 0.020373183
[26,] 0.95394938 0.09210125 0.046050625
[27,] 0.94411251 0.11177498 0.055887490
[28,] 0.87710039 0.24579921 0.122899605
> postscript(file="/var/www/html/rcomp/tmp/109hw1227455464.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/25osf1227455464.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/3yrcw1227455464.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/4jpa41227455464.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/5zpim1227455464.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 6
-287.653846 -27.589744 -204.189744 44.610256 -290.389744 -192.789744
7 8 9 10 11 12
46.010256 -207.950641 -94.750641 89.249359 -93.150641 -116.550641
13 14 15 16 17 18
233.780128 -82.155769 -36.755769 -106.955769 97.044231 -74.355769
19 20 21 22 23 24
-99.555769 -296.516667 19.683333 65.683333 163.283333 313.883333
25 26 27 28 29 30
188.214103 -70.721795 163.678205 163.478205 72.478205 275.078205
31 32 33 34 35 36
345.878205 838.721795 237.921795 220.921795 -65.478205 206.121795
37 38 39 40 41 42
-130.547436 104.516667 128.916667 147.716667 57.716667 -16.683333
43 44 45 46 47 48
-58.883333 -152.844231 -128.644231 -122.644231 -90.044231 -184.444231
49 50 51 52 53 54
38.886538 75.950641 -51.649359 -248.849359 63.150641 8.750641
55 56 57 58 59 60
-233.449359 -181.410256 -34.210256 -253.210256 85.389744 -219.010256
61
-42.679487
> postscript(file="/var/www/html/rcomp/tmp/63yp41227455464.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 -287.653846 NA
1 -27.589744 -287.653846
2 -204.189744 -27.589744
3 44.610256 -204.189744
4 -290.389744 44.610256
5 -192.789744 -290.389744
6 46.010256 -192.789744
7 -207.950641 46.010256
8 -94.750641 -207.950641
9 89.249359 -94.750641
10 -93.150641 89.249359
11 -116.550641 -93.150641
12 233.780128 -116.550641
13 -82.155769 233.780128
14 -36.755769 -82.155769
15 -106.955769 -36.755769
16 97.044231 -106.955769
17 -74.355769 97.044231
18 -99.555769 -74.355769
19 -296.516667 -99.555769
20 19.683333 -296.516667
21 65.683333 19.683333
22 163.283333 65.683333
23 313.883333 163.283333
24 188.214103 313.883333
25 -70.721795 188.214103
26 163.678205 -70.721795
27 163.478205 163.678205
28 72.478205 163.478205
29 275.078205 72.478205
30 345.878205 275.078205
31 838.721795 345.878205
32 237.921795 838.721795
33 220.921795 237.921795
34 -65.478205 220.921795
35 206.121795 -65.478205
36 -130.547436 206.121795
37 104.516667 -130.547436
38 128.916667 104.516667
39 147.716667 128.916667
40 57.716667 147.716667
41 -16.683333 57.716667
42 -58.883333 -16.683333
43 -152.844231 -58.883333
44 -128.644231 -152.844231
45 -122.644231 -128.644231
46 -90.044231 -122.644231
47 -184.444231 -90.044231
48 38.886538 -184.444231
49 75.950641 38.886538
50 -51.649359 75.950641
51 -248.849359 -51.649359
52 63.150641 -248.849359
53 8.750641 63.150641
54 -233.449359 8.750641
55 -181.410256 -233.449359
56 -34.210256 -181.410256
57 -253.210256 -34.210256
58 85.389744 -253.210256
59 -219.010256 85.389744
60 -42.679487 -219.010256
61 NA -42.679487
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -27.589744 -287.653846
[2,] -204.189744 -27.589744
[3,] 44.610256 -204.189744
[4,] -290.389744 44.610256
[5,] -192.789744 -290.389744
[6,] 46.010256 -192.789744
[7,] -207.950641 46.010256
[8,] -94.750641 -207.950641
[9,] 89.249359 -94.750641
[10,] -93.150641 89.249359
[11,] -116.550641 -93.150641
[12,] 233.780128 -116.550641
[13,] -82.155769 233.780128
[14,] -36.755769 -82.155769
[15,] -106.955769 -36.755769
[16,] 97.044231 -106.955769
[17,] -74.355769 97.044231
[18,] -99.555769 -74.355769
[19,] -296.516667 -99.555769
[20,] 19.683333 -296.516667
[21,] 65.683333 19.683333
[22,] 163.283333 65.683333
[23,] 313.883333 163.283333
[24,] 188.214103 313.883333
[25,] -70.721795 188.214103
[26,] 163.678205 -70.721795
[27,] 163.478205 163.678205
[28,] 72.478205 163.478205
[29,] 275.078205 72.478205
[30,] 345.878205 275.078205
[31,] 838.721795 345.878205
[32,] 237.921795 838.721795
[33,] 220.921795 237.921795
[34,] -65.478205 220.921795
[35,] 206.121795 -65.478205
[36,] -130.547436 206.121795
[37,] 104.516667 -130.547436
[38,] 128.916667 104.516667
[39,] 147.716667 128.916667
[40,] 57.716667 147.716667
[41,] -16.683333 57.716667
[42,] -58.883333 -16.683333
[43,] -152.844231 -58.883333
[44,] -128.644231 -152.844231
[45,] -122.644231 -128.644231
[46,] -90.044231 -122.644231
[47,] -184.444231 -90.044231
[48,] 38.886538 -184.444231
[49,] 75.950641 38.886538
[50,] -51.649359 75.950641
[51,] -248.849359 -51.649359
[52,] 63.150641 -248.849359
[53,] 8.750641 63.150641
[54,] -233.449359 8.750641
[55,] -181.410256 -233.449359
[56,] -34.210256 -181.410256
[57,] -253.210256 -34.210256
[58,] 85.389744 -253.210256
[59,] -219.010256 85.389744
[60,] -42.679487 -219.010256
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -27.589744 -287.653846
2 -204.189744 -27.589744
3 44.610256 -204.189744
4 -290.389744 44.610256
5 -192.789744 -290.389744
6 46.010256 -192.789744
7 -207.950641 46.010256
8 -94.750641 -207.950641
9 89.249359 -94.750641
10 -93.150641 89.249359
11 -116.550641 -93.150641
12 233.780128 -116.550641
13 -82.155769 233.780128
14 -36.755769 -82.155769
15 -106.955769 -36.755769
16 97.044231 -106.955769
17 -74.355769 97.044231
18 -99.555769 -74.355769
19 -296.516667 -99.555769
20 19.683333 -296.516667
21 65.683333 19.683333
22 163.283333 65.683333
23 313.883333 163.283333
24 188.214103 313.883333
25 -70.721795 188.214103
26 163.678205 -70.721795
27 163.478205 163.678205
28 72.478205 163.478205
29 275.078205 72.478205
30 345.878205 275.078205
31 838.721795 345.878205
32 237.921795 838.721795
33 220.921795 237.921795
34 -65.478205 220.921795
35 206.121795 -65.478205
36 -130.547436 206.121795
37 104.516667 -130.547436
38 128.916667 104.516667
39 147.716667 128.916667
40 57.716667 147.716667
41 -16.683333 57.716667
42 -58.883333 -16.683333
43 -152.844231 -58.883333
44 -128.644231 -152.844231
45 -122.644231 -128.644231
46 -90.044231 -122.644231
47 -184.444231 -90.044231
48 38.886538 -184.444231
49 75.950641 38.886538
50 -51.649359 75.950641
51 -248.849359 -51.649359
52 63.150641 -248.849359
53 8.750641 63.150641
54 -233.449359 8.750641
55 -181.410256 -233.449359
56 -34.210256 -181.410256
57 -253.210256 -34.210256
58 85.389744 -253.210256
59 -219.010256 85.389744
60 -42.679487 -219.010256
> 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/7obj91227455464.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/8o6pf1227455464.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/9p7361227455464.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/10j8rp1227455464.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/11sc091227455464.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/12typp1227455464.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/131tvy1227455464.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/14b08n1227455464.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/15doqk1227455464.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/16c0w51227455464.tab")
+ }
>
> system("convert tmp/109hw1227455464.ps tmp/109hw1227455464.png")
> system("convert tmp/25osf1227455464.ps tmp/25osf1227455464.png")
> system("convert tmp/3yrcw1227455464.ps tmp/3yrcw1227455464.png")
> system("convert tmp/4jpa41227455464.ps tmp/4jpa41227455464.png")
> system("convert tmp/5zpim1227455464.ps tmp/5zpim1227455464.png")
> system("convert tmp/63yp41227455464.ps tmp/63yp41227455464.png")
> system("convert tmp/7obj91227455464.ps tmp/7obj91227455464.png")
> system("convert tmp/8o6pf1227455464.ps tmp/8o6pf1227455464.png")
> system("convert tmp/9p7361227455464.ps tmp/9p7361227455464.png")
> system("convert tmp/10j8rp1227455464.ps tmp/10j8rp1227455464.png")
>
>
> proc.time()
user system elapsed
2.463 1.603 3.012