R version 2.7.0 (2008-04-22)
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(15107,0,15024,0,12083,0,15761,0,16943,0,15070,0,13660,0,14769,0,14725,0,15998,0,15371,0,14957,0,15470,0,15102,0,11704,0,16284,0,16727,0,14969,0,14861,0,14583,0,15306,0,17904,0,16379,0,15420,0,17871,0,15913,0,13867,0,17823,0,17872,0,17422,0,16705,0,15991,0,16584,0,19124,0,17839,0,17209,0,18587,0,16258,0,15142,0,19202,0,17747,0,19090,0,18040,0,17516,0,17752,0,21073,0,17170,0,19440,0,19795,0,17575,0,16165,0,19465,1,19932,1,19961,1,17343,1,18924,1,18574,1,21351,1,18595,1,19823,1,20844,1,19640,1,17735,1,19814,1,22239,1,20682,1,17819,1,21872,1,22117,1,21866,1),dim=c(2,70),dimnames=list(c('y','D'),1:70))
> y <- array(NA,dim=c(2,70),dimnames=list(c('y','D'),1:70))
> 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 D
1 15107 0
2 15024 0
3 12083 0
4 15761 0
5 16943 0
6 15070 0
7 13660 0
8 14769 0
9 14725 0
10 15998 0
11 15371 0
12 14957 0
13 15470 0
14 15102 0
15 11704 0
16 16284 0
17 16727 0
18 14969 0
19 14861 0
20 14583 0
21 15306 0
22 17904 0
23 16379 0
24 15420 0
25 17871 0
26 15913 0
27 13867 0
28 17823 0
29 17872 0
30 17422 0
31 16705 0
32 15991 0
33 16584 0
34 19124 0
35 17839 0
36 17209 0
37 18587 0
38 16258 0
39 15142 0
40 19202 0
41 17747 0
42 19090 0
43 18040 0
44 17516 0
45 17752 0
46 21073 0
47 17170 0
48 19440 0
49 19795 0
50 17575 0
51 16165 0
52 19465 1
53 19932 1
54 19961 1
55 17343 1
56 18924 1
57 18574 1
58 21351 1
59 18595 1
60 19823 1
61 20844 1
62 19640 1
63 17735 1
64 19814 1
65 22239 1
66 20682 1
67 17819 1
68 21872 1
69 22117 1
70 21866 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) D
16450 3476
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4746.0 -1340.0 -107.6 1355.3 4623.0
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 16450.0 250.6 65.635 < 2e-16 ***
D 3476.1 481.1 7.226 5.55e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1790 on 68 degrees of freedom
Multiple R-squared: 0.4343, Adjusted R-squared: 0.426
F-statistic: 52.21 on 1 and 68 DF, p-value: 5.549e-10
> 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.74904313 0.5019137 0.2509569
[2,] 0.60977001 0.7804600 0.3902300
[3,] 0.55594576 0.8881085 0.4440542
[4,] 0.43479708 0.8695942 0.5652029
[5,] 0.32887734 0.6577547 0.6711227
[6,] 0.27590077 0.5518015 0.7240992
[7,] 0.20088038 0.4017608 0.7991196
[8,] 0.14136769 0.2827354 0.8586323
[9,] 0.09874893 0.1974979 0.9012511
[10,] 0.06621855 0.1324371 0.9337815
[11,] 0.35316551 0.7063310 0.6468345
[12,] 0.33726766 0.6745353 0.6627323
[13,] 0.34731926 0.6946385 0.6526807
[14,] 0.30309150 0.6061830 0.6969085
[15,] 0.27036403 0.5407281 0.7296360
[16,] 0.25901044 0.5180209 0.7409896
[17,] 0.23023720 0.4604744 0.7697628
[18,] 0.36017789 0.7203558 0.6398221
[19,] 0.33567082 0.6713416 0.6643292
[20,] 0.30907204 0.6181441 0.6909280
[21,] 0.39205851 0.7841170 0.6079415
[22,] 0.35872071 0.7174414 0.6412793
[23,] 0.50220719 0.9955856 0.4977928
[24,] 0.55998263 0.8800347 0.4400174
[25,] 0.60160493 0.7967901 0.3983951
[26,] 0.59819740 0.8036052 0.4018026
[27,] 0.56860187 0.8627963 0.4313981
[28,] 0.55291695 0.8941661 0.4470831
[29,] 0.52848155 0.9430369 0.4715185
[30,] 0.65446077 0.6910785 0.3455392
[31,] 0.64561548 0.7087690 0.3543845
[32,] 0.61349818 0.7730036 0.3865018
[33,] 0.63968446 0.7206311 0.3603155
[34,] 0.62186576 0.7562685 0.3781342
[35,] 0.71042532 0.5791494 0.2895747
[36,] 0.75967388 0.4806522 0.2403261
[37,] 0.73260379 0.5347924 0.2673962
[38,] 0.75438800 0.4912240 0.2456120
[39,] 0.72348978 0.5530204 0.2765102
[40,] 0.68548150 0.6290370 0.3145185
[41,] 0.64595703 0.7080859 0.3540430
[42,] 0.83833963 0.3233207 0.1616604
[43,] 0.80330408 0.3933918 0.1966959
[44,] 0.81784101 0.3643180 0.1821590
[45,] 0.88021317 0.2395737 0.1197868
[46,] 0.85178111 0.2964378 0.1482189
[47,] 0.79884638 0.4023072 0.2011536
[48,] 0.73862498 0.5227500 0.2613750
[49,] 0.66503457 0.6699309 0.3349654
[50,] 0.58267045 0.8346591 0.4173295
[51,] 0.67784613 0.6443077 0.3221539
[52,] 0.62820276 0.7435945 0.3717972
[53,] 0.61006417 0.7798717 0.3899358
[54,] 0.56206329 0.8758734 0.4379367
[55,] 0.54525637 0.9094873 0.4547436
[56,] 0.44927003 0.8985401 0.5507300
[57,] 0.35253204 0.7050641 0.6474680
[58,] 0.26538155 0.5307631 0.7346184
[59,] 0.41788270 0.8357654 0.5821173
[60,] 0.33230954 0.6646191 0.6676905
[61,] 0.26267497 0.5253499 0.7373250
> postscript(file="/var/www/html/rcomp/tmp/1zrwl1228662773.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/2wu3e1228662773.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/3734b1228662773.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/46pe71228662773.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/5wwfa1228662773.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 = 70
Frequency = 1
1 2 3 4 5 6
-1342.980392 -1425.980392 -4366.980392 -688.980392 493.019608 -1379.980392
7 8 9 10 11 12
-2789.980392 -1680.980392 -1724.980392 -451.980392 -1078.980392 -1492.980392
13 14 15 16 17 18
-979.980392 -1347.980392 -4745.980392 -165.980392 277.019608 -1480.980392
19 20 21 22 23 24
-1588.980392 -1866.980392 -1143.980392 1454.019608 -70.980392 -1029.980392
25 26 27 28 29 30
1421.019608 -536.980392 -2582.980392 1373.019608 1422.019608 972.019608
31 32 33 34 35 36
255.019608 -458.980392 134.019608 2674.019608 1389.019608 759.019608
37 38 39 40 41 42
2137.019608 -191.980392 -1307.980392 2752.019608 1297.019608 2640.019608
43 44 45 46 47 48
1590.019608 1066.019608 1302.019608 4623.019608 720.019608 2990.019608
49 50 51 52 53 54
3345.019608 1125.019608 -284.980392 -461.105263 5.894737 34.894737
55 56 57 58 59 60
-2583.105263 -1002.105263 -1352.105263 1424.894737 -1331.105263 -103.105263
61 62 63 64 65 66
917.894737 -286.105263 -2191.105263 -112.105263 2312.894737 755.894737
67 68 69 70
-2107.105263 1945.894737 2190.894737 1939.894737
> postscript(file="/var/www/html/rcomp/tmp/6ivgz1228662773.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 = 70
Frequency = 1
lag(myerror, k = 1) myerror
0 -1342.980392 NA
1 -1425.980392 -1342.980392
2 -4366.980392 -1425.980392
3 -688.980392 -4366.980392
4 493.019608 -688.980392
5 -1379.980392 493.019608
6 -2789.980392 -1379.980392
7 -1680.980392 -2789.980392
8 -1724.980392 -1680.980392
9 -451.980392 -1724.980392
10 -1078.980392 -451.980392
11 -1492.980392 -1078.980392
12 -979.980392 -1492.980392
13 -1347.980392 -979.980392
14 -4745.980392 -1347.980392
15 -165.980392 -4745.980392
16 277.019608 -165.980392
17 -1480.980392 277.019608
18 -1588.980392 -1480.980392
19 -1866.980392 -1588.980392
20 -1143.980392 -1866.980392
21 1454.019608 -1143.980392
22 -70.980392 1454.019608
23 -1029.980392 -70.980392
24 1421.019608 -1029.980392
25 -536.980392 1421.019608
26 -2582.980392 -536.980392
27 1373.019608 -2582.980392
28 1422.019608 1373.019608
29 972.019608 1422.019608
30 255.019608 972.019608
31 -458.980392 255.019608
32 134.019608 -458.980392
33 2674.019608 134.019608
34 1389.019608 2674.019608
35 759.019608 1389.019608
36 2137.019608 759.019608
37 -191.980392 2137.019608
38 -1307.980392 -191.980392
39 2752.019608 -1307.980392
40 1297.019608 2752.019608
41 2640.019608 1297.019608
42 1590.019608 2640.019608
43 1066.019608 1590.019608
44 1302.019608 1066.019608
45 4623.019608 1302.019608
46 720.019608 4623.019608
47 2990.019608 720.019608
48 3345.019608 2990.019608
49 1125.019608 3345.019608
50 -284.980392 1125.019608
51 -461.105263 -284.980392
52 5.894737 -461.105263
53 34.894737 5.894737
54 -2583.105263 34.894737
55 -1002.105263 -2583.105263
56 -1352.105263 -1002.105263
57 1424.894737 -1352.105263
58 -1331.105263 1424.894737
59 -103.105263 -1331.105263
60 917.894737 -103.105263
61 -286.105263 917.894737
62 -2191.105263 -286.105263
63 -112.105263 -2191.105263
64 2312.894737 -112.105263
65 755.894737 2312.894737
66 -2107.105263 755.894737
67 1945.894737 -2107.105263
68 2190.894737 1945.894737
69 1939.894737 2190.894737
70 NA 1939.894737
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1425.980392 -1342.980392
[2,] -4366.980392 -1425.980392
[3,] -688.980392 -4366.980392
[4,] 493.019608 -688.980392
[5,] -1379.980392 493.019608
[6,] -2789.980392 -1379.980392
[7,] -1680.980392 -2789.980392
[8,] -1724.980392 -1680.980392
[9,] -451.980392 -1724.980392
[10,] -1078.980392 -451.980392
[11,] -1492.980392 -1078.980392
[12,] -979.980392 -1492.980392
[13,] -1347.980392 -979.980392
[14,] -4745.980392 -1347.980392
[15,] -165.980392 -4745.980392
[16,] 277.019608 -165.980392
[17,] -1480.980392 277.019608
[18,] -1588.980392 -1480.980392
[19,] -1866.980392 -1588.980392
[20,] -1143.980392 -1866.980392
[21,] 1454.019608 -1143.980392
[22,] -70.980392 1454.019608
[23,] -1029.980392 -70.980392
[24,] 1421.019608 -1029.980392
[25,] -536.980392 1421.019608
[26,] -2582.980392 -536.980392
[27,] 1373.019608 -2582.980392
[28,] 1422.019608 1373.019608
[29,] 972.019608 1422.019608
[30,] 255.019608 972.019608
[31,] -458.980392 255.019608
[32,] 134.019608 -458.980392
[33,] 2674.019608 134.019608
[34,] 1389.019608 2674.019608
[35,] 759.019608 1389.019608
[36,] 2137.019608 759.019608
[37,] -191.980392 2137.019608
[38,] -1307.980392 -191.980392
[39,] 2752.019608 -1307.980392
[40,] 1297.019608 2752.019608
[41,] 2640.019608 1297.019608
[42,] 1590.019608 2640.019608
[43,] 1066.019608 1590.019608
[44,] 1302.019608 1066.019608
[45,] 4623.019608 1302.019608
[46,] 720.019608 4623.019608
[47,] 2990.019608 720.019608
[48,] 3345.019608 2990.019608
[49,] 1125.019608 3345.019608
[50,] -284.980392 1125.019608
[51,] -461.105263 -284.980392
[52,] 5.894737 -461.105263
[53,] 34.894737 5.894737
[54,] -2583.105263 34.894737
[55,] -1002.105263 -2583.105263
[56,] -1352.105263 -1002.105263
[57,] 1424.894737 -1352.105263
[58,] -1331.105263 1424.894737
[59,] -103.105263 -1331.105263
[60,] 917.894737 -103.105263
[61,] -286.105263 917.894737
[62,] -2191.105263 -286.105263
[63,] -112.105263 -2191.105263
[64,] 2312.894737 -112.105263
[65,] 755.894737 2312.894737
[66,] -2107.105263 755.894737
[67,] 1945.894737 -2107.105263
[68,] 2190.894737 1945.894737
[69,] 1939.894737 2190.894737
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1425.980392 -1342.980392
2 -4366.980392 -1425.980392
3 -688.980392 -4366.980392
4 493.019608 -688.980392
5 -1379.980392 493.019608
6 -2789.980392 -1379.980392
7 -1680.980392 -2789.980392
8 -1724.980392 -1680.980392
9 -451.980392 -1724.980392
10 -1078.980392 -451.980392
11 -1492.980392 -1078.980392
12 -979.980392 -1492.980392
13 -1347.980392 -979.980392
14 -4745.980392 -1347.980392
15 -165.980392 -4745.980392
16 277.019608 -165.980392
17 -1480.980392 277.019608
18 -1588.980392 -1480.980392
19 -1866.980392 -1588.980392
20 -1143.980392 -1866.980392
21 1454.019608 -1143.980392
22 -70.980392 1454.019608
23 -1029.980392 -70.980392
24 1421.019608 -1029.980392
25 -536.980392 1421.019608
26 -2582.980392 -536.980392
27 1373.019608 -2582.980392
28 1422.019608 1373.019608
29 972.019608 1422.019608
30 255.019608 972.019608
31 -458.980392 255.019608
32 134.019608 -458.980392
33 2674.019608 134.019608
34 1389.019608 2674.019608
35 759.019608 1389.019608
36 2137.019608 759.019608
37 -191.980392 2137.019608
38 -1307.980392 -191.980392
39 2752.019608 -1307.980392
40 1297.019608 2752.019608
41 2640.019608 1297.019608
42 1590.019608 2640.019608
43 1066.019608 1590.019608
44 1302.019608 1066.019608
45 4623.019608 1302.019608
46 720.019608 4623.019608
47 2990.019608 720.019608
48 3345.019608 2990.019608
49 1125.019608 3345.019608
50 -284.980392 1125.019608
51 -461.105263 -284.980392
52 5.894737 -461.105263
53 34.894737 5.894737
54 -2583.105263 34.894737
55 -1002.105263 -2583.105263
56 -1352.105263 -1002.105263
57 1424.894737 -1352.105263
58 -1331.105263 1424.894737
59 -103.105263 -1331.105263
60 917.894737 -103.105263
61 -286.105263 917.894737
62 -2191.105263 -286.105263
63 -112.105263 -2191.105263
64 2312.894737 -112.105263
65 755.894737 2312.894737
66 -2107.105263 755.894737
67 1945.894737 -2107.105263
68 2190.894737 1945.894737
69 1939.894737 2190.894737
> 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/7xf5d1228662773.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/8yt371228662773.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/9g8zr1228662773.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/10glx51228662773.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/1131121228662773.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/12shxb1228662773.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/13e13s1228662773.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/143tcq1228662773.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/15ybrw1228662773.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/16y84n1228662773.tab")
+ }
>
> system("convert tmp/1zrwl1228662773.ps tmp/1zrwl1228662773.png")
> system("convert tmp/2wu3e1228662773.ps tmp/2wu3e1228662773.png")
> system("convert tmp/3734b1228662773.ps tmp/3734b1228662773.png")
> system("convert tmp/46pe71228662773.ps tmp/46pe71228662773.png")
> system("convert tmp/5wwfa1228662773.ps tmp/5wwfa1228662773.png")
> system("convert tmp/6ivgz1228662773.ps tmp/6ivgz1228662773.png")
> system("convert tmp/7xf5d1228662773.ps tmp/7xf5d1228662773.png")
> system("convert tmp/8yt371228662773.ps tmp/8yt371228662773.png")
> system("convert tmp/9g8zr1228662773.ps tmp/9g8zr1228662773.png")
> system("convert tmp/10glx51228662773.ps tmp/10glx51228662773.png")
>
>
> proc.time()
user system elapsed
5.238 2.764 5.599