R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(416.25,1111.92,398.35,1131.13,400.00,1144.94,427.25,1113.89,391.25,1107.30,397.20,1120.68,394.80,1140.84,391.50,1101.72,407.65,1104.24,418.10,1114.58,429.10,1130.20,452.85,1173.78,427.75,1211.92,420.90,1181.27,433.45,1203.60,427.15,1180.59,427.90,1156.85,415.35,1191.50,432.60,1191.33,431.65,1234.18,439.60,1220.33,466.10,1228.81,459.50,1207.01,499.75,1249.48,530.00,1248.29,568.25,1280.08,564.25,1280.66,587.00,1302.88,661.00,1310.61,625.00,1270.05,622.95,1270.06,637.25,1278.53,621.05,1303.80,600.60,1335.83,614.10,1377.76,648.75,1400.63,639.75,1418.03,660.20,1437.90,670.40,1406.80,658.25,1420.83,673.60,1482.37,666.50,1530.63,654.75,1504.66,665.75,1455.18,672.00,1473.96,742.50,1527.29,790.25,1545.79,784.25,1479.63,846.75,1467.97,914.75,1378.60,988.50,1330.45,887.75,1326.41,853.00,1385.97,888.25,1399.62,937.50,1276.69,912.50,1269.42,822.25,1287.83,880.00,1164.17,729.50,968.67,778.00,888.61),dim=c(2,60),dimnames=list(c('Gold','S&P500'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Gold','S&P500'),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 = '2'
> #'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
S&P500 Gold
1 1111.92 416.25
2 1131.13 398.35
3 1144.94 400.00
4 1113.89 427.25
5 1107.30 391.25
6 1120.68 397.20
7 1140.84 394.80
8 1101.72 391.50
9 1104.24 407.65
10 1114.58 418.10
11 1130.20 429.10
12 1173.78 452.85
13 1211.92 427.75
14 1181.27 420.90
15 1203.60 433.45
16 1180.59 427.15
17 1156.85 427.90
18 1191.50 415.35
19 1191.33 432.60
20 1234.18 431.65
21 1220.33 439.60
22 1228.81 466.10
23 1207.01 459.50
24 1249.48 499.75
25 1248.29 530.00
26 1280.08 568.25
27 1280.66 564.25
28 1302.88 587.00
29 1310.61 661.00
30 1270.05 625.00
31 1270.06 622.95
32 1278.53 637.25
33 1303.80 621.05
34 1335.83 600.60
35 1377.76 614.10
36 1400.63 648.75
37 1418.03 639.75
38 1437.90 660.20
39 1406.80 670.40
40 1420.83 658.25
41 1482.37 673.60
42 1530.63 666.50
43 1504.66 654.75
44 1455.18 665.75
45 1473.96 672.00
46 1527.29 742.50
47 1545.79 790.25
48 1479.63 784.25
49 1467.97 846.75
50 1378.60 914.75
51 1330.45 988.50
52 1326.41 887.75
53 1385.97 853.00
54 1399.62 888.25
55 1276.69 937.50
56 1269.42 912.50
57 1287.83 822.25
58 1164.17 880.00
59 968.67 729.50
60 888.61 778.00
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Gold
1019.3147 0.4221
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-459.0667 -66.6043 -0.8866 70.0892 230.0129
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.019e+03 5.759e+01 17.699 < 2e-16 ***
Gold 4.221e-01 9.171e-02 4.602 2.32e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 123.7 on 58 degrees of freedom
Multiple R-squared: 0.2675, Adjusted R-squared: 0.2549
F-statistic: 21.18 on 1 and 58 DF, p-value: 2.323e-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,] 3.547768e-03 7.095535e-03 0.9964522
[2,] 4.070098e-04 8.140197e-04 0.9995930
[3,] 6.827543e-05 1.365509e-04 0.9999317
[4,] 2.511685e-05 5.023370e-05 0.9999749
[5,] 4.780824e-06 9.561649e-06 0.9999952
[6,] 5.947799e-07 1.189560e-06 0.9999994
[7,] 1.053875e-07 2.107750e-07 0.9999999
[8,] 1.445523e-07 2.891047e-07 0.9999999
[9,] 2.299807e-06 4.599614e-06 0.9999977
[10,] 1.237265e-06 2.474530e-06 0.9999988
[11,] 7.832105e-07 1.566421e-06 0.9999992
[12,] 2.440873e-07 4.881746e-07 0.9999998
[13,] 5.852776e-08 1.170555e-07 0.9999999
[14,] 4.257363e-08 8.514726e-08 1.0000000
[15,] 1.349883e-08 2.699765e-08 1.0000000
[16,] 2.000664e-08 4.001328e-08 1.0000000
[17,] 7.996074e-09 1.599215e-08 1.0000000
[18,] 2.028902e-09 4.057805e-09 1.0000000
[19,] 6.021663e-10 1.204333e-09 1.0000000
[20,] 1.927851e-10 3.855702e-10 1.0000000
[21,] 1.328417e-10 2.656834e-10 1.0000000
[22,] 5.617310e-11 1.123462e-10 1.0000000
[23,] 1.638373e-11 3.276747e-11 1.0000000
[24,] 4.119730e-12 8.239461e-12 1.0000000
[25,] 3.950341e-12 7.900681e-12 1.0000000
[26,] 3.106303e-12 6.212607e-12 1.0000000
[27,] 1.704980e-12 3.409960e-12 1.0000000
[28,] 8.042995e-13 1.608599e-12 1.0000000
[29,] 2.291459e-13 4.582917e-13 1.0000000
[30,] 1.592765e-13 3.185531e-13 1.0000000
[31,] 3.048506e-13 6.097012e-13 1.0000000
[32,] 2.703852e-13 5.407704e-13 1.0000000
[33,] 4.441420e-13 8.882841e-13 1.0000000
[34,] 4.849260e-13 9.698519e-13 1.0000000
[35,] 1.371365e-13 2.742731e-13 1.0000000
[36,] 5.894403e-14 1.178881e-13 1.0000000
[37,] 1.208119e-13 2.416238e-13 1.0000000
[38,] 2.281906e-12 4.563811e-12 1.0000000
[39,] 8.223683e-12 1.644737e-11 1.0000000
[40,] 4.243300e-12 8.486600e-12 1.0000000
[41,] 4.858672e-12 9.717344e-12 1.0000000
[42,] 2.558920e-11 5.117840e-11 1.0000000
[43,] 7.404240e-10 1.480848e-09 1.0000000
[44,] 1.271651e-07 2.543302e-07 0.9999999
[45,] 2.289550e-05 4.579100e-05 0.9999771
[46,] 6.021008e-04 1.204202e-03 0.9993979
[47,] 1.122300e-02 2.244600e-02 0.9887770
[48,] 1.248407e-02 2.496814e-02 0.9875159
[49,] 3.875827e-02 7.751654e-02 0.9612417
[50,] 8.817714e-02 1.763543e-01 0.9118229
[51,] 7.356722e-02 1.471344e-01 0.9264328
> postscript(file="/var/www/html/rcomp/tmp/1j1ts1259329967.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/28ua81259329967.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/39lxk1259329967.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/4bl511259329967.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/5x1bc1259329967.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 = 60
Frequency = 1
1 2 3 4 5 6
-83.076785 -56.311927 -43.198324 -85.749435 -77.145307 -66.276559
7 8 9 10 11 12
-45.103617 -82.830822 -87.127076 -81.197594 -70.220244 -36.664148
13 14 15 16 17 18
12.069536 -15.689359 1.343799 -19.007229 -43.063773 -3.116931
19 20 21 22 23 24
-10.567451 32.683505 15.478135 12.773569 -6.240841 19.241280
25 26 27 28 29 30
5.283992 20.930232 23.198468 35.816623 12.314250 -13.051622
31 32 33 34 35 36
-12.176401 -9.741846 22.365511 63.026620 99.258822 107.504474
37 38 39 40 41 42
128.703006 139.941897 104.536894 123.694912 178.756305 230.012925
43 44 45 46 47 48
209.002119 154.879469 171.021600 194.596433 192.943111 129.315465
49 50 51 52 53 54
91.276771 -26.793248 -106.070107 -67.587652 6.638902 5.411319
55 56 57 58 59 60
-138.305092 -135.023615 -78.522781 -226.556694 -358.536799 -459.066665
> postscript(file="/var/www/html/rcomp/tmp/6khz51259329967.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -83.076785 NA
1 -56.311927 -83.076785
2 -43.198324 -56.311927
3 -85.749435 -43.198324
4 -77.145307 -85.749435
5 -66.276559 -77.145307
6 -45.103617 -66.276559
7 -82.830822 -45.103617
8 -87.127076 -82.830822
9 -81.197594 -87.127076
10 -70.220244 -81.197594
11 -36.664148 -70.220244
12 12.069536 -36.664148
13 -15.689359 12.069536
14 1.343799 -15.689359
15 -19.007229 1.343799
16 -43.063773 -19.007229
17 -3.116931 -43.063773
18 -10.567451 -3.116931
19 32.683505 -10.567451
20 15.478135 32.683505
21 12.773569 15.478135
22 -6.240841 12.773569
23 19.241280 -6.240841
24 5.283992 19.241280
25 20.930232 5.283992
26 23.198468 20.930232
27 35.816623 23.198468
28 12.314250 35.816623
29 -13.051622 12.314250
30 -12.176401 -13.051622
31 -9.741846 -12.176401
32 22.365511 -9.741846
33 63.026620 22.365511
34 99.258822 63.026620
35 107.504474 99.258822
36 128.703006 107.504474
37 139.941897 128.703006
38 104.536894 139.941897
39 123.694912 104.536894
40 178.756305 123.694912
41 230.012925 178.756305
42 209.002119 230.012925
43 154.879469 209.002119
44 171.021600 154.879469
45 194.596433 171.021600
46 192.943111 194.596433
47 129.315465 192.943111
48 91.276771 129.315465
49 -26.793248 91.276771
50 -106.070107 -26.793248
51 -67.587652 -106.070107
52 6.638902 -67.587652
53 5.411319 6.638902
54 -138.305092 5.411319
55 -135.023615 -138.305092
56 -78.522781 -135.023615
57 -226.556694 -78.522781
58 -358.536799 -226.556694
59 -459.066665 -358.536799
60 NA -459.066665
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -56.311927 -83.076785
[2,] -43.198324 -56.311927
[3,] -85.749435 -43.198324
[4,] -77.145307 -85.749435
[5,] -66.276559 -77.145307
[6,] -45.103617 -66.276559
[7,] -82.830822 -45.103617
[8,] -87.127076 -82.830822
[9,] -81.197594 -87.127076
[10,] -70.220244 -81.197594
[11,] -36.664148 -70.220244
[12,] 12.069536 -36.664148
[13,] -15.689359 12.069536
[14,] 1.343799 -15.689359
[15,] -19.007229 1.343799
[16,] -43.063773 -19.007229
[17,] -3.116931 -43.063773
[18,] -10.567451 -3.116931
[19,] 32.683505 -10.567451
[20,] 15.478135 32.683505
[21,] 12.773569 15.478135
[22,] -6.240841 12.773569
[23,] 19.241280 -6.240841
[24,] 5.283992 19.241280
[25,] 20.930232 5.283992
[26,] 23.198468 20.930232
[27,] 35.816623 23.198468
[28,] 12.314250 35.816623
[29,] -13.051622 12.314250
[30,] -12.176401 -13.051622
[31,] -9.741846 -12.176401
[32,] 22.365511 -9.741846
[33,] 63.026620 22.365511
[34,] 99.258822 63.026620
[35,] 107.504474 99.258822
[36,] 128.703006 107.504474
[37,] 139.941897 128.703006
[38,] 104.536894 139.941897
[39,] 123.694912 104.536894
[40,] 178.756305 123.694912
[41,] 230.012925 178.756305
[42,] 209.002119 230.012925
[43,] 154.879469 209.002119
[44,] 171.021600 154.879469
[45,] 194.596433 171.021600
[46,] 192.943111 194.596433
[47,] 129.315465 192.943111
[48,] 91.276771 129.315465
[49,] -26.793248 91.276771
[50,] -106.070107 -26.793248
[51,] -67.587652 -106.070107
[52,] 6.638902 -67.587652
[53,] 5.411319 6.638902
[54,] -138.305092 5.411319
[55,] -135.023615 -138.305092
[56,] -78.522781 -135.023615
[57,] -226.556694 -78.522781
[58,] -358.536799 -226.556694
[59,] -459.066665 -358.536799
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -56.311927 -83.076785
2 -43.198324 -56.311927
3 -85.749435 -43.198324
4 -77.145307 -85.749435
5 -66.276559 -77.145307
6 -45.103617 -66.276559
7 -82.830822 -45.103617
8 -87.127076 -82.830822
9 -81.197594 -87.127076
10 -70.220244 -81.197594
11 -36.664148 -70.220244
12 12.069536 -36.664148
13 -15.689359 12.069536
14 1.343799 -15.689359
15 -19.007229 1.343799
16 -43.063773 -19.007229
17 -3.116931 -43.063773
18 -10.567451 -3.116931
19 32.683505 -10.567451
20 15.478135 32.683505
21 12.773569 15.478135
22 -6.240841 12.773569
23 19.241280 -6.240841
24 5.283992 19.241280
25 20.930232 5.283992
26 23.198468 20.930232
27 35.816623 23.198468
28 12.314250 35.816623
29 -13.051622 12.314250
30 -12.176401 -13.051622
31 -9.741846 -12.176401
32 22.365511 -9.741846
33 63.026620 22.365511
34 99.258822 63.026620
35 107.504474 99.258822
36 128.703006 107.504474
37 139.941897 128.703006
38 104.536894 139.941897
39 123.694912 104.536894
40 178.756305 123.694912
41 230.012925 178.756305
42 209.002119 230.012925
43 154.879469 209.002119
44 171.021600 154.879469
45 194.596433 171.021600
46 192.943111 194.596433
47 129.315465 192.943111
48 91.276771 129.315465
49 -26.793248 91.276771
50 -106.070107 -26.793248
51 -67.587652 -106.070107
52 6.638902 -67.587652
53 5.411319 6.638902
54 -138.305092 5.411319
55 -135.023615 -138.305092
56 -78.522781 -135.023615
57 -226.556694 -78.522781
58 -358.536799 -226.556694
59 -459.066665 -358.536799
> 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/789cw1259329967.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/86c5m1259329967.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/98vfx1259329967.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/10z5qq1259329967.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/117rk41259329967.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/12hhrc1259329967.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/13h29x1259329967.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/14i5o81259329967.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/15l7p11259329967.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/16n73x1259329967.tab")
+ }
>
> system("convert tmp/1j1ts1259329967.ps tmp/1j1ts1259329967.png")
> system("convert tmp/28ua81259329967.ps tmp/28ua81259329967.png")
> system("convert tmp/39lxk1259329967.ps tmp/39lxk1259329967.png")
> system("convert tmp/4bl511259329967.ps tmp/4bl511259329967.png")
> system("convert tmp/5x1bc1259329967.ps tmp/5x1bc1259329967.png")
> system("convert tmp/6khz51259329967.ps tmp/6khz51259329967.png")
> system("convert tmp/789cw1259329967.ps tmp/789cw1259329967.png")
> system("convert tmp/86c5m1259329967.ps tmp/86c5m1259329967.png")
> system("convert tmp/98vfx1259329967.ps tmp/98vfx1259329967.png")
> system("convert tmp/10z5qq1259329967.ps tmp/10z5qq1259329967.png")
>
>
> proc.time()
user system elapsed
2.512 1.587 3.176