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(0.7461,0.527,0.7775,0.472,0.7790,0,0.7744,0.052,0.7905,0.313,0.7719,0.364,0.7811,0.363,0.7557,-0.155,0.7637,0.052,0.7595,0.568,0.7471,0.668,0.7615,1.378,0.7487,0.252,0.7389,-0.402,0.7337,-0.05,0.7510,0.555,0.7382,0.05,0.7159,0.15,0.7542,0.45,0.7636,0.299,0.7433,0.199,0.7658,0.496,0.7627,0.444,0.7480,-0.393,0.7692,-0.444,0.7850,0.198,0.7913,0.494,0.7720,0.133,0.7880,0.388,0.8070,0.484,0.8268,0.278,0.8244,0.369,0.8487,0.165,0.8572,0.155,0.8214,0.087,0.8827,0.414,0.9216,0.36,0.8865,0.975,0.8816,0.27,0.8884,0.359,0.9466,0.169,0.9180,0.381,0.9337,0.154,0.9559,0.486,0.9626,0.925,0.9434,0.728,0.8639,-0.014,0.7996,0.046,0.6680,-0.819,0.6572,-1.674,0.6928,-0.788,0.6438,0.279,0.6454,0.396,0.6873,-0.141,0.7265,-0.019,0.7912,0.099,0.8114,0.742,0.8281,0.005,0.8393,0.448),dim=c(2,59),dimnames=list(c('USDOLLAR','AMERIKAANSE_INFLATIE'),1:59))
> y <- array(NA,dim=c(2,59),dimnames=list(c('USDOLLAR','AMERIKAANSE_INFLATIE'),1:59))
> 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
USDOLLAR AMERIKAANSE_INFLATIE
1 0.7461 0.527
2 0.7775 0.472
3 0.7790 0.000
4 0.7744 0.052
5 0.7905 0.313
6 0.7719 0.364
7 0.7811 0.363
8 0.7557 -0.155
9 0.7637 0.052
10 0.7595 0.568
11 0.7471 0.668
12 0.7615 1.378
13 0.7487 0.252
14 0.7389 -0.402
15 0.7337 -0.050
16 0.7510 0.555
17 0.7382 0.050
18 0.7159 0.150
19 0.7542 0.450
20 0.7636 0.299
21 0.7433 0.199
22 0.7658 0.496
23 0.7627 0.444
24 0.7480 -0.393
25 0.7692 -0.444
26 0.7850 0.198
27 0.7913 0.494
28 0.7720 0.133
29 0.7880 0.388
30 0.8070 0.484
31 0.8268 0.278
32 0.8244 0.369
33 0.8487 0.165
34 0.8572 0.155
35 0.8214 0.087
36 0.8827 0.414
37 0.9216 0.360
38 0.8865 0.975
39 0.8816 0.270
40 0.8884 0.359
41 0.9466 0.169
42 0.9180 0.381
43 0.9337 0.154
44 0.9559 0.486
45 0.9626 0.925
46 0.9434 0.728
47 0.8639 -0.014
48 0.7996 0.046
49 0.6680 -0.819
50 0.6572 -1.674
51 0.6928 -0.788
52 0.6438 0.279
53 0.6454 0.396
54 0.6873 -0.141
55 0.7265 -0.019
56 0.7912 0.099
57 0.8114 0.742
58 0.8281 0.005
59 0.8393 0.448
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) AMERIKAANSE_INFLATIE
0.77801 0.07345
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.16170 -0.04787 -0.01050 0.03693 0.15617
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.77801 0.01022 76.134 < 2e-16 ***
AMERIKAANSE_INFLATIE 0.07345 0.02055 3.574 0.000723 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.07071 on 57 degrees of freedom
Multiple R-squared: 0.1831, Adjusted R-squared: 0.1688
F-statistic: 12.78 on 1 and 57 DF, p-value: 0.0007232
> 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.656890e-02 3.313779e-02 0.9834311
[2,] 3.098745e-03 6.197489e-03 0.9969013
[3,] 6.563509e-04 1.312702e-03 0.9993436
[4,] 3.561626e-04 7.123253e-04 0.9996438
[5,] 7.341697e-05 1.468339e-04 0.9999266
[6,] 1.833385e-05 3.666770e-05 0.9999817
[7,] 7.959253e-06 1.591851e-05 0.9999920
[8,] 2.283302e-06 4.566604e-06 0.9999977
[9,] 1.050262e-06 2.100524e-06 0.9999989
[10,] 9.889259e-07 1.977852e-06 0.9999990
[11,] 8.116872e-07 1.623374e-06 0.9999992
[12,] 2.801082e-07 5.602165e-07 0.9999997
[13,] 1.342420e-07 2.684841e-07 0.9999999
[14,] 4.292100e-07 8.584200e-07 0.9999996
[15,] 1.406004e-07 2.812009e-07 0.9999999
[16,] 4.130461e-08 8.260923e-08 1.0000000
[17,] 1.539095e-08 3.078190e-08 1.0000000
[18,] 5.266331e-09 1.053266e-08 1.0000000
[19,] 1.758171e-09 3.516341e-09 1.0000000
[20,] 3.978106e-10 7.956213e-10 1.0000000
[21,] 1.465266e-10 2.930532e-10 1.0000000
[22,] 1.051723e-10 2.103445e-10 1.0000000
[23,] 1.087822e-10 2.175644e-10 1.0000000
[24,] 3.517928e-11 7.035856e-11 1.0000000
[25,] 2.506278e-11 5.012556e-11 1.0000000
[26,] 6.492057e-11 1.298411e-10 1.0000000
[27,] 7.260396e-10 1.452079e-09 1.0000000
[28,] 2.474792e-09 4.949584e-09 1.0000000
[29,] 3.694460e-08 7.388919e-08 1.0000000
[30,] 3.389405e-07 6.778810e-07 0.9999997
[31,] 2.925583e-07 5.851165e-07 0.9999997
[32,] 3.082969e-06 6.165938e-06 0.9999969
[33,] 9.164710e-05 1.832942e-04 0.9999084
[34,] 1.360955e-04 2.721910e-04 0.9998639
[35,] 2.375916e-04 4.751831e-04 0.9997624
[36,] 3.725317e-04 7.450635e-04 0.9996275
[37,] 4.049193e-03 8.098386e-03 0.9959508
[38,] 8.011383e-03 1.602277e-02 0.9919886
[39,] 2.916975e-02 5.833949e-02 0.9708303
[40,] 8.686324e-02 1.737265e-01 0.9131368
[41,] 1.569682e-01 3.139363e-01 0.8430318
[42,] 3.047278e-01 6.094556e-01 0.6952722
[43,] 4.367084e-01 8.734169e-01 0.5632916
[44,] 3.967957e-01 7.935913e-01 0.6032043
[45,] 3.230127e-01 6.460254e-01 0.6769873
[46,] 2.310562e-01 4.621125e-01 0.7689438
[47,] 1.544764e-01 3.089528e-01 0.8455236
[48,] 2.878304e-01 5.756608e-01 0.7121696
[49,] 7.233776e-01 5.532449e-01 0.2766224
[50,] 7.641416e-01 4.717168e-01 0.2358584
> postscript(file="/var/www/html/rcomp/tmp/1cako1258645063.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/21xhl1258645063.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/3cu2g1258645064.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/4khmq1258645064.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/5112p1258645064.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 = 59
Frequency = 1
1 2 3 4 5
-0.0706216793 -0.0351817758 0.0009879417 -0.0074316034 -0.0105027820
6 7 8 9 10
-0.0328488743 -0.0235754215 -0.0109268756 -0.0181316034 -0.0602332438
11 12 13 14 15
-0.0799785229 -0.1177300048 -0.0478221617 -0.0095840362 -0.0406394187
16 17 18 19 20
-0.0677783575 -0.0434846978 -0.0731299770 -0.0568658144 -0.0363744429
21 22 23 24 25
-0.0493291638 -0.0486446428 -0.0479250976 -0.0011451113 0.0238009811
26 27 28 29 30
-0.0075557110 -0.0229977372 -0.0157812795 -0.0185117413 -0.0065632093
31 32 33 34 35
0.0283680657 0.0192838617 0.0585682312 0.0678027591 0.0369975489
36 37 38 39 40
0.0742784861 0.1171449368 0.0368714702 0.0837556881 0.0840183896
41 42 43 44 45
0.1561744200 0.1120024282 0.1443762119 0.1421898851 0.1166441097
46 47 48 49 50
0.1119143096 0.0869162808 0.0182091133 -0.0498542222 0.0021479144
51 52 53 54 55
-0.0273312587 -0.1547053871 -0.1616993636 -0.0803552147 -0.0501164552
56 57 58 59
0.0059161154 -0.0211140295 0.0497206778 0.0283810912
> postscript(file="/var/www/html/rcomp/tmp/6089y1258645064.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 = 59
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.0706216793 NA
1 -0.0351817758 -0.0706216793
2 0.0009879417 -0.0351817758
3 -0.0074316034 0.0009879417
4 -0.0105027820 -0.0074316034
5 -0.0328488743 -0.0105027820
6 -0.0235754215 -0.0328488743
7 -0.0109268756 -0.0235754215
8 -0.0181316034 -0.0109268756
9 -0.0602332438 -0.0181316034
10 -0.0799785229 -0.0602332438
11 -0.1177300048 -0.0799785229
12 -0.0478221617 -0.1177300048
13 -0.0095840362 -0.0478221617
14 -0.0406394187 -0.0095840362
15 -0.0677783575 -0.0406394187
16 -0.0434846978 -0.0677783575
17 -0.0731299770 -0.0434846978
18 -0.0568658144 -0.0731299770
19 -0.0363744429 -0.0568658144
20 -0.0493291638 -0.0363744429
21 -0.0486446428 -0.0493291638
22 -0.0479250976 -0.0486446428
23 -0.0011451113 -0.0479250976
24 0.0238009811 -0.0011451113
25 -0.0075557110 0.0238009811
26 -0.0229977372 -0.0075557110
27 -0.0157812795 -0.0229977372
28 -0.0185117413 -0.0157812795
29 -0.0065632093 -0.0185117413
30 0.0283680657 -0.0065632093
31 0.0192838617 0.0283680657
32 0.0585682312 0.0192838617
33 0.0678027591 0.0585682312
34 0.0369975489 0.0678027591
35 0.0742784861 0.0369975489
36 0.1171449368 0.0742784861
37 0.0368714702 0.1171449368
38 0.0837556881 0.0368714702
39 0.0840183896 0.0837556881
40 0.1561744200 0.0840183896
41 0.1120024282 0.1561744200
42 0.1443762119 0.1120024282
43 0.1421898851 0.1443762119
44 0.1166441097 0.1421898851
45 0.1119143096 0.1166441097
46 0.0869162808 0.1119143096
47 0.0182091133 0.0869162808
48 -0.0498542222 0.0182091133
49 0.0021479144 -0.0498542222
50 -0.0273312587 0.0021479144
51 -0.1547053871 -0.0273312587
52 -0.1616993636 -0.1547053871
53 -0.0803552147 -0.1616993636
54 -0.0501164552 -0.0803552147
55 0.0059161154 -0.0501164552
56 -0.0211140295 0.0059161154
57 0.0497206778 -0.0211140295
58 0.0283810912 0.0497206778
59 NA 0.0283810912
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.0351817758 -0.0706216793
[2,] 0.0009879417 -0.0351817758
[3,] -0.0074316034 0.0009879417
[4,] -0.0105027820 -0.0074316034
[5,] -0.0328488743 -0.0105027820
[6,] -0.0235754215 -0.0328488743
[7,] -0.0109268756 -0.0235754215
[8,] -0.0181316034 -0.0109268756
[9,] -0.0602332438 -0.0181316034
[10,] -0.0799785229 -0.0602332438
[11,] -0.1177300048 -0.0799785229
[12,] -0.0478221617 -0.1177300048
[13,] -0.0095840362 -0.0478221617
[14,] -0.0406394187 -0.0095840362
[15,] -0.0677783575 -0.0406394187
[16,] -0.0434846978 -0.0677783575
[17,] -0.0731299770 -0.0434846978
[18,] -0.0568658144 -0.0731299770
[19,] -0.0363744429 -0.0568658144
[20,] -0.0493291638 -0.0363744429
[21,] -0.0486446428 -0.0493291638
[22,] -0.0479250976 -0.0486446428
[23,] -0.0011451113 -0.0479250976
[24,] 0.0238009811 -0.0011451113
[25,] -0.0075557110 0.0238009811
[26,] -0.0229977372 -0.0075557110
[27,] -0.0157812795 -0.0229977372
[28,] -0.0185117413 -0.0157812795
[29,] -0.0065632093 -0.0185117413
[30,] 0.0283680657 -0.0065632093
[31,] 0.0192838617 0.0283680657
[32,] 0.0585682312 0.0192838617
[33,] 0.0678027591 0.0585682312
[34,] 0.0369975489 0.0678027591
[35,] 0.0742784861 0.0369975489
[36,] 0.1171449368 0.0742784861
[37,] 0.0368714702 0.1171449368
[38,] 0.0837556881 0.0368714702
[39,] 0.0840183896 0.0837556881
[40,] 0.1561744200 0.0840183896
[41,] 0.1120024282 0.1561744200
[42,] 0.1443762119 0.1120024282
[43,] 0.1421898851 0.1443762119
[44,] 0.1166441097 0.1421898851
[45,] 0.1119143096 0.1166441097
[46,] 0.0869162808 0.1119143096
[47,] 0.0182091133 0.0869162808
[48,] -0.0498542222 0.0182091133
[49,] 0.0021479144 -0.0498542222
[50,] -0.0273312587 0.0021479144
[51,] -0.1547053871 -0.0273312587
[52,] -0.1616993636 -0.1547053871
[53,] -0.0803552147 -0.1616993636
[54,] -0.0501164552 -0.0803552147
[55,] 0.0059161154 -0.0501164552
[56,] -0.0211140295 0.0059161154
[57,] 0.0497206778 -0.0211140295
[58,] 0.0283810912 0.0497206778
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.0351817758 -0.0706216793
2 0.0009879417 -0.0351817758
3 -0.0074316034 0.0009879417
4 -0.0105027820 -0.0074316034
5 -0.0328488743 -0.0105027820
6 -0.0235754215 -0.0328488743
7 -0.0109268756 -0.0235754215
8 -0.0181316034 -0.0109268756
9 -0.0602332438 -0.0181316034
10 -0.0799785229 -0.0602332438
11 -0.1177300048 -0.0799785229
12 -0.0478221617 -0.1177300048
13 -0.0095840362 -0.0478221617
14 -0.0406394187 -0.0095840362
15 -0.0677783575 -0.0406394187
16 -0.0434846978 -0.0677783575
17 -0.0731299770 -0.0434846978
18 -0.0568658144 -0.0731299770
19 -0.0363744429 -0.0568658144
20 -0.0493291638 -0.0363744429
21 -0.0486446428 -0.0493291638
22 -0.0479250976 -0.0486446428
23 -0.0011451113 -0.0479250976
24 0.0238009811 -0.0011451113
25 -0.0075557110 0.0238009811
26 -0.0229977372 -0.0075557110
27 -0.0157812795 -0.0229977372
28 -0.0185117413 -0.0157812795
29 -0.0065632093 -0.0185117413
30 0.0283680657 -0.0065632093
31 0.0192838617 0.0283680657
32 0.0585682312 0.0192838617
33 0.0678027591 0.0585682312
34 0.0369975489 0.0678027591
35 0.0742784861 0.0369975489
36 0.1171449368 0.0742784861
37 0.0368714702 0.1171449368
38 0.0837556881 0.0368714702
39 0.0840183896 0.0837556881
40 0.1561744200 0.0840183896
41 0.1120024282 0.1561744200
42 0.1443762119 0.1120024282
43 0.1421898851 0.1443762119
44 0.1166441097 0.1421898851
45 0.1119143096 0.1166441097
46 0.0869162808 0.1119143096
47 0.0182091133 0.0869162808
48 -0.0498542222 0.0182091133
49 0.0021479144 -0.0498542222
50 -0.0273312587 0.0021479144
51 -0.1547053871 -0.0273312587
52 -0.1616993636 -0.1547053871
53 -0.0803552147 -0.1616993636
54 -0.0501164552 -0.0803552147
55 0.0059161154 -0.0501164552
56 -0.0211140295 0.0059161154
57 0.0497206778 -0.0211140295
58 0.0283810912 0.0497206778
> 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/7apca1258645064.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/8pbs51258645064.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/9w5mw1258645064.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/1099mf1258645064.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/112wbp1258645064.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/12hdrn1258645064.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/13quxh1258645064.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/14r40s1258645064.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/15i9ay1258645064.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/16lrfl1258645064.tab")
+ }
>
> system("convert tmp/1cako1258645063.ps tmp/1cako1258645063.png")
> system("convert tmp/21xhl1258645063.ps tmp/21xhl1258645063.png")
> system("convert tmp/3cu2g1258645064.ps tmp/3cu2g1258645064.png")
> system("convert tmp/4khmq1258645064.ps tmp/4khmq1258645064.png")
> system("convert tmp/5112p1258645064.ps tmp/5112p1258645064.png")
> system("convert tmp/6089y1258645064.ps tmp/6089y1258645064.png")
> system("convert tmp/7apca1258645064.ps tmp/7apca1258645064.png")
> system("convert tmp/8pbs51258645064.ps tmp/8pbs51258645064.png")
> system("convert tmp/9w5mw1258645064.ps tmp/9w5mw1258645064.png")
> system("convert tmp/1099mf1258645064.ps tmp/1099mf1258645064.png")
>
>
> proc.time()
user system elapsed
2.477 1.574 2.871