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(9,1167,333,70,9,669,223,44,9,1053,371,35,9,1939,873,119,9,678,186,30,9,321,111,23,10,2667,1277,46,10,345,102,39,10,1367,580,58,10,1158,420,51,11,1385,521,65,11,1155,358,40,9,1120,435,41,9,1703,690,76,9,1189,393,31,10,3083,1149,82,10,1357,486,36,10,1892,767,62,11,883,338,28,11,1627,485,38,11,1412,465,70,11,1900,816,76,9,777,265,33,9,904,307,40,9,2115,850,126,10,1858,704,56,10,1781,693,63,10,1286,387,46,10,1035,406,35,10,1557,573,108,11,1527,595,34,11,1220,394,54,11,1368,521,35,9,564,172,23,9,1990,835,46,9,1557,669,49,10,2057,749,56,10,1111,368,38,11,686,216,19,10,2011,772,29,10,2232,1084,26,9,1032,445,52,9,1166,451,54,9,1020,300,45,10,1735,836,56,10,3623,1417,596,10,918,330,57,10,1579,477,55,11,2790,1028,99,11,1496,646,51,10,1108,342,21,10,496,218,20,10,1750,591,58,10,744,255,21,10,1101,434,66,9,1612,654,47,9,1805,478,55,9,2460,753,158,9,1653,689,46,9,1234,470,45),dim=c(4,60),dimnames=list(c('Month','Pageviews','CourseCompView','CompendiumView_PR'),1:60))
> y <- array(NA,dim=c(4,60),dimnames=list(c('Month','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 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '4'
> 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
CompendiumView_PR Month Pageviews CourseCompView t
1 70 9 1167 333 1
2 44 9 669 223 2
3 35 9 1053 371 3
4 119 9 1939 873 4
5 30 9 678 186 5
6 23 9 321 111 6
7 46 10 2667 1277 7
8 39 10 345 102 8
9 58 10 1367 580 9
10 51 10 1158 420 10
11 65 11 1385 521 11
12 40 11 1155 358 12
13 41 9 1120 435 13
14 76 9 1703 690 14
15 31 9 1189 393 15
16 82 10 3083 1149 16
17 36 10 1357 486 17
18 62 10 1892 767 18
19 28 11 883 338 19
20 38 11 1627 485 20
21 70 11 1412 465 21
22 76 11 1900 816 22
23 33 9 777 265 23
24 40 9 904 307 24
25 126 9 2115 850 25
26 56 10 1858 704 26
27 63 10 1781 693 27
28 46 10 1286 387 28
29 35 10 1035 406 29
30 108 10 1557 573 30
31 34 11 1527 595 31
32 54 11 1220 394 32
33 35 11 1368 521 33
34 23 9 564 172 34
35 46 9 1990 835 35
36 49 9 1557 669 36
37 56 10 2057 749 37
38 38 10 1111 368 38
39 19 11 686 216 39
40 29 10 2011 772 40
41 26 10 2232 1084 41
42 52 9 1032 445 42
43 54 9 1166 451 43
44 45 9 1020 300 44
45 56 10 1735 836 45
46 596 10 3623 1417 46
47 57 10 918 330 47
48 55 10 1579 477 48
49 99 11 2790 1028 49
50 51 11 1496 646 50
51 21 10 1108 342 51
52 20 10 496 218 52
53 58 10 1750 591 53
54 21 10 744 255 54
55 66 10 1101 434 55
56 47 9 1612 654 56
57 55 9 1805 478 57
58 158 9 2460 753 58
59 46 9 1653 689 59
60 45 9 1234 470 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Month Pageviews CourseCompView t
34.75637 -8.32541 0.11549 -0.10763 -0.01622
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-101.64 -24.00 -0.39 13.88 379.32
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 34.75637 105.81355 0.328 0.7438
Month -8.32541 10.77070 -0.773 0.4429
Pageviews 0.11549 0.04372 2.642 0.0107 *
CourseCompView -0.10763 0.09990 -1.077 0.2860
t -0.01622 0.46818 -0.035 0.9725
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 61.32 on 55 degrees of freedom
Multiple R-squared: 0.3776, Adjusted R-squared: 0.3324
F-statistic: 8.344 on 4 and 55 DF, p-value: 2.468e-05
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 1.952537e-01 3.905074e-01 0.804746307
[2,] 9.569254e-02 1.913851e-01 0.904307455
[3,] 3.993590e-02 7.987180e-02 0.960064102
[4,] 1.759371e-02 3.518741e-02 0.982406295
[5,] 6.963874e-03 1.392775e-02 0.993036126
[6,] 2.436447e-03 4.872895e-03 0.997563553
[7,] 8.994146e-04 1.798829e-03 0.999100585
[8,] 4.047485e-04 8.094969e-04 0.999595252
[9,] 1.930116e-04 3.860233e-04 0.999806988
[10,] 6.075621e-05 1.215124e-04 0.999939244
[11,] 1.982721e-05 3.965443e-05 0.999980173
[12,] 5.712548e-06 1.142510e-05 0.999994287
[13,] 1.734198e-06 3.468396e-06 0.999998266
[14,] 1.301432e-06 2.602864e-06 0.999998699
[15,] 5.743908e-07 1.148782e-06 0.999999426
[16,] 1.590776e-07 3.181553e-07 0.999999841
[17,] 4.376601e-08 8.753201e-08 0.999999956
[18,] 2.397943e-07 4.795886e-07 0.999999760
[19,] 8.181772e-08 1.636354e-07 0.999999918
[20,] 2.321038e-08 4.642075e-08 0.999999977
[21,] 6.101669e-09 1.220334e-08 0.999999994
[22,] 1.682185e-09 3.364369e-09 0.999999998
[23,] 4.741346e-09 9.482692e-09 0.999999995
[24,] 1.866065e-09 3.732129e-09 0.999999998
[25,] 5.213211e-10 1.042642e-09 0.999999999
[26,] 1.532811e-10 3.065622e-10 1.000000000
[27,] 6.481994e-11 1.296399e-10 1.000000000
[28,] 4.262348e-11 8.524696e-11 1.000000000
[29,] 1.087630e-11 2.175260e-11 1.000000000
[30,] 5.288733e-12 1.057747e-11 1.000000000
[31,] 1.157140e-12 2.314280e-12 1.000000000
[32,] 3.116591e-13 6.233182e-13 1.000000000
[33,] 7.759236e-13 1.551847e-12 1.000000000
[34,] 2.573725e-11 5.147451e-11 1.000000000
[35,] 9.752552e-12 1.950510e-11 1.000000000
[36,] 3.795790e-12 7.591579e-12 1.000000000
[37,] 1.143361e-12 2.286723e-12 1.000000000
[38,] 4.461626e-10 8.923251e-10 1.000000000
[39,] 9.976428e-01 4.714422e-03 0.002357211
[40,] 9.975552e-01 4.889611e-03 0.002444806
[41,] 9.941272e-01 1.174559e-02 0.005872795
[42,] 9.870577e-01 2.588462e-02 0.012942308
[43,] 9.697007e-01 6.059863e-02 0.030299317
[44,] 9.280883e-01 1.438234e-01 0.071911724
[45,] 8.910134e-01 2.179732e-01 0.108986622
> postscript(file="/var/wessaorg/rcomp/tmp/1vb601321898773.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/2ba2w1321898773.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/3pkvy1321898773.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/4ox221321898773.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/5t9yr1321898773.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
11.2489559 30.9412450 -6.4628104 29.2556202 11.9683421 38.1431895
7 8 9 10 11 12
-75.9676879 58.7606076 11.1891736 11.1231257 18.1182864 2.1546875
13 14 15 16 17 18
-1.1505746 -6.0215791 -23.6073178 -101.6422684 -19.6429346 -25.1720881
19 20 21 22 23 24
19.5294278 -40.5592406 14.1351754 1.5678858 12.3289572 9.1979909
25 26 27 28 29 30
13.7942698 -33.8960189 -19.1708224 -11.9195280 8.1299657 38.8329420
31 32 33 34 35 36
-20.9929305 12.8465725 -9.5615846 17.0979263 -53.2214838 -18.0631565
37 38 39 40 41 42
-51.8573387 -1.5912003 20.4753547 -71.0206957 -65.9490982 21.5592295
43 44 45 46 47 48
8.7453181 0.3719232 -5.1759141 379.3222830 35.7548829 -26.7479799
49 50 51 52 53 54
-54.9652908 5.3843109 -20.8321587 35.5194252 -31.1467033 11.8920626
55 56 57 58 59 60
34.9426595 -27.7052354 -60.9209215 -3.9548216 -29.6248632 -5.7875491
> postscript(file="/var/wessaorg/rcomp/tmp/670gk1321898773.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 11.2489559 NA
1 30.9412450 11.2489559
2 -6.4628104 30.9412450
3 29.2556202 -6.4628104
4 11.9683421 29.2556202
5 38.1431895 11.9683421
6 -75.9676879 38.1431895
7 58.7606076 -75.9676879
8 11.1891736 58.7606076
9 11.1231257 11.1891736
10 18.1182864 11.1231257
11 2.1546875 18.1182864
12 -1.1505746 2.1546875
13 -6.0215791 -1.1505746
14 -23.6073178 -6.0215791
15 -101.6422684 -23.6073178
16 -19.6429346 -101.6422684
17 -25.1720881 -19.6429346
18 19.5294278 -25.1720881
19 -40.5592406 19.5294278
20 14.1351754 -40.5592406
21 1.5678858 14.1351754
22 12.3289572 1.5678858
23 9.1979909 12.3289572
24 13.7942698 9.1979909
25 -33.8960189 13.7942698
26 -19.1708224 -33.8960189
27 -11.9195280 -19.1708224
28 8.1299657 -11.9195280
29 38.8329420 8.1299657
30 -20.9929305 38.8329420
31 12.8465725 -20.9929305
32 -9.5615846 12.8465725
33 17.0979263 -9.5615846
34 -53.2214838 17.0979263
35 -18.0631565 -53.2214838
36 -51.8573387 -18.0631565
37 -1.5912003 -51.8573387
38 20.4753547 -1.5912003
39 -71.0206957 20.4753547
40 -65.9490982 -71.0206957
41 21.5592295 -65.9490982
42 8.7453181 21.5592295
43 0.3719232 8.7453181
44 -5.1759141 0.3719232
45 379.3222830 -5.1759141
46 35.7548829 379.3222830
47 -26.7479799 35.7548829
48 -54.9652908 -26.7479799
49 5.3843109 -54.9652908
50 -20.8321587 5.3843109
51 35.5194252 -20.8321587
52 -31.1467033 35.5194252
53 11.8920626 -31.1467033
54 34.9426595 11.8920626
55 -27.7052354 34.9426595
56 -60.9209215 -27.7052354
57 -3.9548216 -60.9209215
58 -29.6248632 -3.9548216
59 -5.7875491 -29.6248632
60 NA -5.7875491
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 30.9412450 11.2489559
[2,] -6.4628104 30.9412450
[3,] 29.2556202 -6.4628104
[4,] 11.9683421 29.2556202
[5,] 38.1431895 11.9683421
[6,] -75.9676879 38.1431895
[7,] 58.7606076 -75.9676879
[8,] 11.1891736 58.7606076
[9,] 11.1231257 11.1891736
[10,] 18.1182864 11.1231257
[11,] 2.1546875 18.1182864
[12,] -1.1505746 2.1546875
[13,] -6.0215791 -1.1505746
[14,] -23.6073178 -6.0215791
[15,] -101.6422684 -23.6073178
[16,] -19.6429346 -101.6422684
[17,] -25.1720881 -19.6429346
[18,] 19.5294278 -25.1720881
[19,] -40.5592406 19.5294278
[20,] 14.1351754 -40.5592406
[21,] 1.5678858 14.1351754
[22,] 12.3289572 1.5678858
[23,] 9.1979909 12.3289572
[24,] 13.7942698 9.1979909
[25,] -33.8960189 13.7942698
[26,] -19.1708224 -33.8960189
[27,] -11.9195280 -19.1708224
[28,] 8.1299657 -11.9195280
[29,] 38.8329420 8.1299657
[30,] -20.9929305 38.8329420
[31,] 12.8465725 -20.9929305
[32,] -9.5615846 12.8465725
[33,] 17.0979263 -9.5615846
[34,] -53.2214838 17.0979263
[35,] -18.0631565 -53.2214838
[36,] -51.8573387 -18.0631565
[37,] -1.5912003 -51.8573387
[38,] 20.4753547 -1.5912003
[39,] -71.0206957 20.4753547
[40,] -65.9490982 -71.0206957
[41,] 21.5592295 -65.9490982
[42,] 8.7453181 21.5592295
[43,] 0.3719232 8.7453181
[44,] -5.1759141 0.3719232
[45,] 379.3222830 -5.1759141
[46,] 35.7548829 379.3222830
[47,] -26.7479799 35.7548829
[48,] -54.9652908 -26.7479799
[49,] 5.3843109 -54.9652908
[50,] -20.8321587 5.3843109
[51,] 35.5194252 -20.8321587
[52,] -31.1467033 35.5194252
[53,] 11.8920626 -31.1467033
[54,] 34.9426595 11.8920626
[55,] -27.7052354 34.9426595
[56,] -60.9209215 -27.7052354
[57,] -3.9548216 -60.9209215
[58,] -29.6248632 -3.9548216
[59,] -5.7875491 -29.6248632
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 30.9412450 11.2489559
2 -6.4628104 30.9412450
3 29.2556202 -6.4628104
4 11.9683421 29.2556202
5 38.1431895 11.9683421
6 -75.9676879 38.1431895
7 58.7606076 -75.9676879
8 11.1891736 58.7606076
9 11.1231257 11.1891736
10 18.1182864 11.1231257
11 2.1546875 18.1182864
12 -1.1505746 2.1546875
13 -6.0215791 -1.1505746
14 -23.6073178 -6.0215791
15 -101.6422684 -23.6073178
16 -19.6429346 -101.6422684
17 -25.1720881 -19.6429346
18 19.5294278 -25.1720881
19 -40.5592406 19.5294278
20 14.1351754 -40.5592406
21 1.5678858 14.1351754
22 12.3289572 1.5678858
23 9.1979909 12.3289572
24 13.7942698 9.1979909
25 -33.8960189 13.7942698
26 -19.1708224 -33.8960189
27 -11.9195280 -19.1708224
28 8.1299657 -11.9195280
29 38.8329420 8.1299657
30 -20.9929305 38.8329420
31 12.8465725 -20.9929305
32 -9.5615846 12.8465725
33 17.0979263 -9.5615846
34 -53.2214838 17.0979263
35 -18.0631565 -53.2214838
36 -51.8573387 -18.0631565
37 -1.5912003 -51.8573387
38 20.4753547 -1.5912003
39 -71.0206957 20.4753547
40 -65.9490982 -71.0206957
41 21.5592295 -65.9490982
42 8.7453181 21.5592295
43 0.3719232 8.7453181
44 -5.1759141 0.3719232
45 379.3222830 -5.1759141
46 35.7548829 379.3222830
47 -26.7479799 35.7548829
48 -54.9652908 -26.7479799
49 5.3843109 -54.9652908
50 -20.8321587 5.3843109
51 35.5194252 -20.8321587
52 -31.1467033 35.5194252
53 11.8920626 -31.1467033
54 34.9426595 11.8920626
55 -27.7052354 34.9426595
56 -60.9209215 -27.7052354
57 -3.9548216 -60.9209215
58 -29.6248632 -3.9548216
59 -5.7875491 -29.6248632
> 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/76yka1321898773.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/8kaef1321898773.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/9lkfw1321898773.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/10vitl1321898773.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/113okr1321898774.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/12mnuf1321898774.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/13ws641321898774.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/14snoz1321898774.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/15m9961321898774.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/16jom51321898774.tab")
+ }
>
> try(system("convert tmp/1vb601321898773.ps tmp/1vb601321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ba2w1321898773.ps tmp/2ba2w1321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/3pkvy1321898773.ps tmp/3pkvy1321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ox221321898773.ps tmp/4ox221321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/5t9yr1321898773.ps tmp/5t9yr1321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/670gk1321898773.ps tmp/670gk1321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/76yka1321898773.ps tmp/76yka1321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/8kaef1321898773.ps tmp/8kaef1321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/9lkfw1321898773.ps tmp/9lkfw1321898773.png",intern=TRUE))
character(0)
> try(system("convert tmp/10vitl1321898773.ps tmp/10vitl1321898773.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.111 0.450 3.607