R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(1167,333,70,669,223,44,1053,371,35,1939,873,119,678,186,30,321,111,23,2667,1277,46,345,102,39,1367,580,58,1158,420,51,1385,521,65,1155,358,40,1120,435,41,1703,690,76,1189,393,31,3083,1149,82,1357,486,36,1892,767,62,883,338,28,1627,485,38,1412,465,70,1900,816,76,777,265,33,904,307,40,2115,850,126,1858,704,56,1781,693,63,1286,387,46,1035,406,35,1557,573,108,1527,595,34,1220,394,54,1368,521,35,564,172,23,1990,835,46,1557,669,49,2057,749,56,1111,368,38,686,216,19,2011,772,29,2232,1084,26,1032,445,52,1166,451,54,1020,300,45,1735,836,56,3623,1417,596,918,330,57,1579,477,55,2790,1028,99,1496,646,51,1108,342,21,496,218,20,1750,591,58,744,255,21,1101,434,66,1612,654,47,1805,478,55,2460,753,158,1653,689,46,1234,470,45),dim=c(3,60),dimnames=list(c('Pageviews','CourseCompView','CompendiumView_PR'),1:60))
> y <- array(NA,dim=c(3,60),dimnames=list(c('Pageviews','CourseCompView','CompendiumView_PR'),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 = 'Do not include Seasonal Dummies'
> par1 = '1'
> library(lattice)
> library(lmtest)
Loading required package: zoo
> 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
Pageviews CourseCompView CompendiumView_PR
1 1167 333 70
2 669 223 44
3 1053 371 35
4 1939 873 119
5 678 186 30
6 321 111 23
7 2667 1277 46
8 345 102 39
9 1367 580 58
10 1158 420 51
11 1385 521 65
12 1155 358 40
13 1120 435 41
14 1703 690 76
15 1189 393 31
16 3083 1149 82
17 1357 486 36
18 1892 767 62
19 883 338 28
20 1627 485 38
21 1412 465 70
22 1900 816 76
23 777 265 33
24 904 307 40
25 2115 850 126
26 1858 704 56
27 1781 693 63
28 1286 387 46
29 1035 406 35
30 1557 573 108
31 1527 595 34
32 1220 394 54
33 1368 521 35
34 564 172 23
35 1990 835 46
36 1557 669 49
37 2057 749 56
38 1111 368 38
39 686 216 19
40 2011 772 29
41 2232 1084 26
42 1032 445 52
43 1166 451 54
44 1020 300 45
45 1735 836 56
46 3623 1417 596
47 918 330 57
48 1579 477 55
49 2790 1028 99
50 1496 646 51
51 1108 342 21
52 496 218 20
53 1750 591 58
54 744 255 21
55 1101 434 66
56 1612 654 47
57 1805 478 55
58 2460 753 158
59 1653 689 46
60 1234 470 45
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) CourseCompView CompendiumView_PR
262.942 2.065 0.981
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-309.43 -101.95 -29.62 91.11 500.91
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 262.94170 51.09779 5.146 3.42e-06 ***
CourseCompView 2.06526 0.09833 21.003 < 2e-16 ***
CompendiumView_PR 0.98098 0.36773 2.668 0.00993 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 178.3 on 57 degrees of freedom
Multiple R-squared: 0.9265, Adjusted R-squared: 0.924
F-statistic: 359.5 on 2 and 57 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,] 0.516609158 0.966781683 0.4833908
[2,] 0.392372214 0.784744428 0.6076278
[3,] 0.343299487 0.686598973 0.6567005
[4,] 0.232215606 0.464431211 0.7677844
[5,] 0.161727712 0.323455425 0.8382723
[6,] 0.112722221 0.225444443 0.8872778
[7,] 0.137857963 0.275715925 0.8621420
[8,] 0.086465972 0.172931945 0.9135340
[9,] 0.054773907 0.109547814 0.9452261
[10,] 0.052285771 0.104571542 0.9477142
[11,] 0.446747613 0.893495225 0.5532524
[12,] 0.377158266 0.754316532 0.6228417
[13,] 0.295588342 0.591176685 0.7044117
[14,] 0.238708875 0.477417750 0.7612911
[15,] 0.439657581 0.879315162 0.5603424
[16,] 0.398872042 0.797744084 0.6011280
[17,] 0.352125094 0.704250188 0.6478749
[18,] 0.286632664 0.573265328 0.7133673
[19,] 0.223054241 0.446108481 0.7769458
[20,] 0.167988770 0.335977539 0.8320112
[21,] 0.133761469 0.267522937 0.8662385
[22,] 0.096333009 0.192666018 0.9036670
[23,] 0.097809711 0.195619423 0.9021903
[24,] 0.076211293 0.152422586 0.9237887
[25,] 0.051853792 0.103707584 0.9481462
[26,] 0.034107167 0.068214334 0.9658928
[27,] 0.024561666 0.049123333 0.9754383
[28,] 0.015246240 0.030492481 0.9847538
[29,] 0.010082724 0.020165448 0.9899173
[30,] 0.006030220 0.012060441 0.9939698
[31,] 0.004689773 0.009379546 0.9953102
[32,] 0.005107926 0.010215852 0.9948921
[33,] 0.002972004 0.005944009 0.9970280
[34,] 0.001660162 0.003320325 0.9983398
[35,] 0.001178632 0.002357264 0.9988214
[36,] 0.003253128 0.006506256 0.9967469
[37,] 0.003702552 0.007405105 0.9962974
[38,] 0.002290975 0.004581950 0.9977090
[39,] 0.001362974 0.002725948 0.9986370
[40,] 0.009177605 0.018355210 0.9908224
[41,] 0.063876298 0.127752596 0.9361237
[42,] 0.054382817 0.108765634 0.9456172
[43,] 0.076673786 0.153347572 0.9233262
[44,] 0.079676792 0.159353583 0.9203232
[45,] 0.076193394 0.152386789 0.9238066
[46,] 0.073576657 0.147153313 0.9264233
[47,] 0.065291633 0.130583265 0.9347084
[48,] 0.050660399 0.101320798 0.9493396
[49,] 0.023598017 0.047196034 0.9764020
> postscript(file="/var/wessaorg/rcomp/tmp/1868q1321896265.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2qd7b1321896265.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/3y3eh1321896265.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4jamb1321896265.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/5pt5w1321896265.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5 6
147.658328 -97.657673 -10.487407 -243.650019 1.490617 -193.748034
7 8 9 10 11 12
-278.403920 -166.856305 -150.689242 -22.380772 -17.705718 113.456097
13 14 15 16 17 18
-81.549917 -59.525433 84.000772 366.634261 55.026690 -15.816810
19 20 21 22 23 24
-105.466988 325.129998 120.043976 -122.748224 -65.607869 -32.215630
25 26 27 28 29 30
-27.015865 86.180440 25.031472 178.677695 -100.771515 4.718788
31 32 33 34 35 36
1.875275 90.373067 -5.276443 -76.728908 -42.558893 -135.668620
37 38 39 40 41 42
192.243729 50.765447 -41.676455 125.229092 -295.189176 -200.993254
43 44 45 46 47 48
-81.346767 93.336312 -309.433912 -151.077072 -82.393205 276.975491
49 50 51 52 53 54
306.854160 -151.129587 118.138802 -236.787952 209.592896 -66.183557
55 56 57 58 59 60
-123.009053 -47.727765 500.910231 486.923152 -78.030898 -43.757929
> postscript(file="/var/wessaorg/rcomp/tmp/6y3n31321896265.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 147.658328 NA
1 -97.657673 147.658328
2 -10.487407 -97.657673
3 -243.650019 -10.487407
4 1.490617 -243.650019
5 -193.748034 1.490617
6 -278.403920 -193.748034
7 -166.856305 -278.403920
8 -150.689242 -166.856305
9 -22.380772 -150.689242
10 -17.705718 -22.380772
11 113.456097 -17.705718
12 -81.549917 113.456097
13 -59.525433 -81.549917
14 84.000772 -59.525433
15 366.634261 84.000772
16 55.026690 366.634261
17 -15.816810 55.026690
18 -105.466988 -15.816810
19 325.129998 -105.466988
20 120.043976 325.129998
21 -122.748224 120.043976
22 -65.607869 -122.748224
23 -32.215630 -65.607869
24 -27.015865 -32.215630
25 86.180440 -27.015865
26 25.031472 86.180440
27 178.677695 25.031472
28 -100.771515 178.677695
29 4.718788 -100.771515
30 1.875275 4.718788
31 90.373067 1.875275
32 -5.276443 90.373067
33 -76.728908 -5.276443
34 -42.558893 -76.728908
35 -135.668620 -42.558893
36 192.243729 -135.668620
37 50.765447 192.243729
38 -41.676455 50.765447
39 125.229092 -41.676455
40 -295.189176 125.229092
41 -200.993254 -295.189176
42 -81.346767 -200.993254
43 93.336312 -81.346767
44 -309.433912 93.336312
45 -151.077072 -309.433912
46 -82.393205 -151.077072
47 276.975491 -82.393205
48 306.854160 276.975491
49 -151.129587 306.854160
50 118.138802 -151.129587
51 -236.787952 118.138802
52 209.592896 -236.787952
53 -66.183557 209.592896
54 -123.009053 -66.183557
55 -47.727765 -123.009053
56 500.910231 -47.727765
57 486.923152 500.910231
58 -78.030898 486.923152
59 -43.757929 -78.030898
60 NA -43.757929
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -97.657673 147.658328
[2,] -10.487407 -97.657673
[3,] -243.650019 -10.487407
[4,] 1.490617 -243.650019
[5,] -193.748034 1.490617
[6,] -278.403920 -193.748034
[7,] -166.856305 -278.403920
[8,] -150.689242 -166.856305
[9,] -22.380772 -150.689242
[10,] -17.705718 -22.380772
[11,] 113.456097 -17.705718
[12,] -81.549917 113.456097
[13,] -59.525433 -81.549917
[14,] 84.000772 -59.525433
[15,] 366.634261 84.000772
[16,] 55.026690 366.634261
[17,] -15.816810 55.026690
[18,] -105.466988 -15.816810
[19,] 325.129998 -105.466988
[20,] 120.043976 325.129998
[21,] -122.748224 120.043976
[22,] -65.607869 -122.748224
[23,] -32.215630 -65.607869
[24,] -27.015865 -32.215630
[25,] 86.180440 -27.015865
[26,] 25.031472 86.180440
[27,] 178.677695 25.031472
[28,] -100.771515 178.677695
[29,] 4.718788 -100.771515
[30,] 1.875275 4.718788
[31,] 90.373067 1.875275
[32,] -5.276443 90.373067
[33,] -76.728908 -5.276443
[34,] -42.558893 -76.728908
[35,] -135.668620 -42.558893
[36,] 192.243729 -135.668620
[37,] 50.765447 192.243729
[38,] -41.676455 50.765447
[39,] 125.229092 -41.676455
[40,] -295.189176 125.229092
[41,] -200.993254 -295.189176
[42,] -81.346767 -200.993254
[43,] 93.336312 -81.346767
[44,] -309.433912 93.336312
[45,] -151.077072 -309.433912
[46,] -82.393205 -151.077072
[47,] 276.975491 -82.393205
[48,] 306.854160 276.975491
[49,] -151.129587 306.854160
[50,] 118.138802 -151.129587
[51,] -236.787952 118.138802
[52,] 209.592896 -236.787952
[53,] -66.183557 209.592896
[54,] -123.009053 -66.183557
[55,] -47.727765 -123.009053
[56,] 500.910231 -47.727765
[57,] 486.923152 500.910231
[58,] -78.030898 486.923152
[59,] -43.757929 -78.030898
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -97.657673 147.658328
2 -10.487407 -97.657673
3 -243.650019 -10.487407
4 1.490617 -243.650019
5 -193.748034 1.490617
6 -278.403920 -193.748034
7 -166.856305 -278.403920
8 -150.689242 -166.856305
9 -22.380772 -150.689242
10 -17.705718 -22.380772
11 113.456097 -17.705718
12 -81.549917 113.456097
13 -59.525433 -81.549917
14 84.000772 -59.525433
15 366.634261 84.000772
16 55.026690 366.634261
17 -15.816810 55.026690
18 -105.466988 -15.816810
19 325.129998 -105.466988
20 120.043976 325.129998
21 -122.748224 120.043976
22 -65.607869 -122.748224
23 -32.215630 -65.607869
24 -27.015865 -32.215630
25 86.180440 -27.015865
26 25.031472 86.180440
27 178.677695 25.031472
28 -100.771515 178.677695
29 4.718788 -100.771515
30 1.875275 4.718788
31 90.373067 1.875275
32 -5.276443 90.373067
33 -76.728908 -5.276443
34 -42.558893 -76.728908
35 -135.668620 -42.558893
36 192.243729 -135.668620
37 50.765447 192.243729
38 -41.676455 50.765447
39 125.229092 -41.676455
40 -295.189176 125.229092
41 -200.993254 -295.189176
42 -81.346767 -200.993254
43 93.336312 -81.346767
44 -309.433912 93.336312
45 -151.077072 -309.433912
46 -82.393205 -151.077072
47 276.975491 -82.393205
48 306.854160 276.975491
49 -151.129587 306.854160
50 118.138802 -151.129587
51 -236.787952 118.138802
52 209.592896 -236.787952
53 -66.183557 209.592896
54 -123.009053 -66.183557
55 -47.727765 -123.009053
56 500.910231 -47.727765
57 486.923152 500.910231
58 -78.030898 486.923152
59 -43.757929 -78.030898
> 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/wessaorg/rcomp/tmp/7b1ec1321896266.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/8u8831321896266.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9fht51321896266.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/10v0gt1321896266.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/113van1321896266.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/wessaorg/rcomp/tmp/125xyv1321896266.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/wessaorg/rcomp/tmp/13r4rp1321896266.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/wessaorg/rcomp/tmp/148fsj1321896266.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/wessaorg/rcomp/tmp/15g6va1321896266.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/wessaorg/rcomp/tmp/16f4ev1321896266.tab")
+ }
>
> try(system("convert tmp/1868q1321896265.ps tmp/1868q1321896265.png",intern=TRUE))
character(0)
> try(system("convert tmp/2qd7b1321896265.ps tmp/2qd7b1321896265.png",intern=TRUE))
character(0)
> try(system("convert tmp/3y3eh1321896265.ps tmp/3y3eh1321896265.png",intern=TRUE))
character(0)
> try(system("convert tmp/4jamb1321896265.ps tmp/4jamb1321896265.png",intern=TRUE))
character(0)
> try(system("convert tmp/5pt5w1321896265.ps tmp/5pt5w1321896265.png",intern=TRUE))
character(0)
> try(system("convert tmp/6y3n31321896265.ps tmp/6y3n31321896265.png",intern=TRUE))
character(0)
> try(system("convert tmp/7b1ec1321896266.ps tmp/7b1ec1321896266.png",intern=TRUE))
character(0)
> try(system("convert tmp/8u8831321896266.ps tmp/8u8831321896266.png",intern=TRUE))
character(0)
> try(system("convert tmp/9fht51321896266.ps tmp/9fht51321896266.png",intern=TRUE))
character(0)
> try(system("convert tmp/10v0gt1321896266.ps tmp/10v0gt1321896266.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.102 0.562 3.713