R version 2.12.1 (2010-12-16)
Copyright (C) 2010 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(68
+ ,63
+ ,4
+ ,12
+ ,51
+ ,61
+ ,4
+ ,11
+ ,56
+ ,60
+ ,6
+ ,14
+ ,48
+ ,62
+ ,8
+ ,12
+ ,44
+ ,68
+ ,8
+ ,21
+ ,67
+ ,77
+ ,4
+ ,12
+ ,46
+ ,70
+ ,4
+ ,22
+ ,54
+ ,69
+ ,8
+ ,11
+ ,61
+ ,65
+ ,5
+ ,10
+ ,52
+ ,64
+ ,4
+ ,13
+ ,46
+ ,76
+ ,4
+ ,10
+ ,55
+ ,71
+ ,4
+ ,8
+ ,46
+ ,63
+ ,4
+ ,15
+ ,52
+ ,63
+ ,4
+ ,14
+ ,76
+ ,79
+ ,4
+ ,10
+ ,49
+ ,65
+ ,8
+ ,14
+ ,30
+ ,74
+ ,4
+ ,14
+ ,75
+ ,78
+ ,4
+ ,11
+ ,51
+ ,75
+ ,4
+ ,10
+ ,50
+ ,73
+ ,8
+ ,13
+ ,38
+ ,52
+ ,4
+ ,7
+ ,55
+ ,76
+ ,7
+ ,14
+ ,18
+ ,55
+ ,4
+ ,12
+ ,52
+ ,69
+ ,4
+ ,14
+ ,42
+ ,76
+ ,5
+ ,11
+ ,66
+ ,61
+ ,4
+ ,9
+ ,66
+ ,61
+ ,4
+ ,11
+ ,33
+ ,55
+ ,4
+ ,15
+ ,48
+ ,53
+ ,4
+ ,14
+ ,57
+ ,68
+ ,4
+ ,13
+ ,64
+ ,72
+ ,4
+ ,9
+ ,58
+ ,65
+ ,4
+ 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,9
+ ,48
+ ,50
+ ,4
+ ,18
+ ,55
+ ,54
+ ,4
+ ,16)
+ ,dim=c(4
+ ,162)
+ ,dimnames=list(c('Intrinsic'
+ ,'Extrinsic'
+ ,'Amotivation'
+ ,'Depression')
+ ,1:162))
> y <- array(NA,dim=c(4,162),dimnames=list(c('Intrinsic','Extrinsic','Amotivation','Depression'),1:162))
> 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 = '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
Depression Intrinsic Extrinsic Amotivation
1 12 68 63 4
2 11 51 61 4
3 14 56 60 6
4 12 48 62 8
5 21 44 68 8
6 12 67 77 4
7 22 46 70 4
8 11 54 69 8
9 10 61 65 5
10 13 52 64 4
11 10 46 76 4
12 8 55 71 4
13 15 46 63 4
14 14 52 63 4
15 10 76 79 4
16 14 49 65 8
17 14 30 74 4
18 11 75 78 4
19 10 51 75 4
20 13 50 73 8
21 7 38 52 4
22 14 55 76 7
23 12 18 55 4
24 14 52 69 4
25 11 42 76 5
26 9 66 61 4
27 11 66 61 4
28 15 33 55 4
29 14 48 53 4
30 13 57 68 4
31 9 64 72 4
32 15 58 65 4
33 10 59 54 15
34 11 42 55 10
35 13 39 66 4
36 8 59 64 8
37 20 37 76 4
38 12 49 64 4
39 10 80 83 4
40 10 62 71 4
41 9 52 74 7
42 14 53 70 4
43 8 58 70 6
44 14 69 67 5
45 11 63 61 4
46 13 36 62 16
47 9 38 53 5
48 11 46 71 12
49 15 56 64 6
50 11 37 72 9
51 10 51 58 9
52 14 44 59 4
53 18 58 79 5
54 14 37 49 4
55 11 65 71 4
56 12 48 64 5
57 13 53 65 4
58 9 51 63 4
59 10 39 70 4
60 15 64 62 5
61 20 51 62 4
62 12 47 65 6
63 12 64 64 4
64 14 59 65 4
65 13 54 55 18
66 11 55 75 4
67 17 72 72 6
68 12 58 64 4
69 13 59 73 4
70 14 36 67 5
71 13 62 75 4
72 15 63 71 4
73 13 50 58 5
74 10 67 67 10
75 11 70 77 5
76 19 46 58 8
77 13 46 55 8
78 17 59 75 5
79 13 73 81 4
80 9 38 54 4
81 11 62 67 4
82 10 41 56 5
83 9 56 64 4
84 12 52 69 4
85 12 54 66 8
86 13 73 75 4
87 13 60 75 5
88 12 40 61 14
89 15 41 59 8
90 22 54 68 8
91 13 42 43 4
92 15 70 61 4
93 13 51 70 6
94 15 60 67 4
95 10 49 73 7
96 11 52 72 7
97 16 57 64 4
98 11 50 59 6
99 11 47 65 4
100 10 74 72 7
101 10 47 70 4
102 16 47 54 4
103 12 59 66 8
104 11 64 73 4
105 16 55 64 4
106 19 52 61 10
107 11 44 59 8
108 16 60 63 6
109 15 51 66 4
110 24 63 68 4
111 14 49 81 4
112 15 52 72 5
113 11 48 53 4
114 15 50 61 6
115 12 67 77 4
116 10 42 54 5
117 14 44 75 7
118 13 51 70 8
119 9 47 60 5
120 15 37 63 8
121 15 51 57 10
122 14 60 70 8
123 11 38 67 5
124 8 52 44 12
125 11 65 81 4
126 11 60 69 5
127 8 70 71 4
128 10 44 67 6
129 11 50 60 4
130 13 63 66 4
131 11 50 61 7
132 20 68 69 7
133 10 32 57 10
134 15 47 65 4
135 12 67 74 5
136 14 50 56 8
137 23 57 74 11
138 14 46 69 7
139 16 67 76 4
140 11 63 68 8
141 12 36 60 6
142 10 54 72 7
143 14 36 74 5
144 12 57 57 4
145 12 70 73 8
146 11 47 58 4
147 12 51 71 8
148 13 62 62 6
149 11 60 64 4
150 19 59 58 9
151 12 52 67 5
152 17 52 76 6
153 9 69 67 4
154 12 56 78 4
155 19 62 72 4
156 18 55 62 5
157 15 52 68 6
158 14 48 71 16
159 11 51 70 6
160 9 53 61 6
161 18 48 50 4
162 16 55 54 4
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Intrinsic Extrinsic Amotivation
11.42920 -0.01388 0.03019 0.04125
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.6366 -2.0944 -0.5951 1.4640 11.2274
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.42920 2.41743 4.728 4.99e-06 ***
Intrinsic -0.01388 0.02660 -0.522 0.603
Extrinsic 0.03019 0.03615 0.835 0.405
Amotivation 0.04125 0.09764 0.423 0.673
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.187 on 158 degrees of freedom
Multiple R-squared: 0.005514, Adjusted R-squared: -0.01337
F-statistic: 0.292 on 3 and 158 DF, p-value: 0.8311
> 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.85069674 0.29860652 0.14930326
[2,] 0.83442240 0.33115519 0.16557760
[3,] 0.76184596 0.47630808 0.23815404
[4,] 0.70667400 0.58665200 0.29332600
[5,] 0.93741364 0.12517272 0.06258636
[6,] 0.95608949 0.08782102 0.04391051
[7,] 0.93113405 0.13773190 0.06886595
[8,] 0.89769230 0.20461541 0.10230770
[9,] 0.86707619 0.26584763 0.13292381
[10,] 0.81825746 0.36348507 0.18174254
[11,] 0.79424775 0.41150449 0.20575225
[12,] 0.74514081 0.50971838 0.25485919
[13,] 0.72879688 0.54240624 0.27120312
[14,] 0.66712408 0.66575184 0.33287592
[15,] 0.82517935 0.34964130 0.17482065
[16,] 0.77647136 0.44705728 0.22352864
[17,] 0.73624995 0.52750010 0.26375005
[18,] 0.69471005 0.61057990 0.30528995
[19,] 0.67483069 0.65033861 0.32516931
[20,] 0.63951713 0.72096574 0.36048287
[21,] 0.58201181 0.83597638 0.41798819
[22,] 0.55416725 0.89166549 0.44583275
[23,] 0.51842647 0.96314705 0.48157353
[24,] 0.46377008 0.92754016 0.53622992
[25,] 0.44889310 0.89778620 0.55110690
[26,] 0.44884731 0.89769462 0.55115269
[27,] 0.46868295 0.93736590 0.53131705
[28,] 0.43345120 0.86690240 0.56654880
[29,] 0.37779128 0.75558256 0.62220872
[30,] 0.41409401 0.82818802 0.58590599
[31,] 0.54909623 0.90180755 0.45090377
[32,] 0.49559160 0.99118320 0.50440840
[33,] 0.46274272 0.92548543 0.53725728
[34,] 0.43433642 0.86867284 0.56566358
[35,] 0.46964276 0.93928551 0.53035724
[36,] 0.42687104 0.85374208 0.57312896
[37,] 0.47318819 0.94637638 0.52681181
[38,] 0.46946706 0.93893413 0.53053294
[39,] 0.42540137 0.85080274 0.57459863
[40,] 0.37519384 0.75038767 0.62480616
[41,] 0.39289075 0.78578151 0.60710925
[42,] 0.36361743 0.72723485 0.63638257
[43,] 0.36079154 0.72158307 0.63920846
[44,] 0.34374569 0.68749137 0.65625431
[45,] 0.32000135 0.64000270 0.67999865
[46,] 0.28514502 0.57029003 0.71485498
[47,] 0.36182502 0.72365004 0.63817498
[48,] 0.32817968 0.65635936 0.67182032
[49,] 0.29436835 0.58873669 0.70563165
[50,] 0.25543472 0.51086944 0.74456528
[51,] 0.21903238 0.43806476 0.78096762
[52,] 0.22973455 0.45946910 0.77026545
[53,] 0.23912818 0.47825636 0.76087182
[54,] 0.24558419 0.49116838 0.75441581
[55,] 0.44946376 0.89892751 0.55053624
[56,] 0.40573558 0.81147116 0.59426442
[57,] 0.36380638 0.72761276 0.63619362
[58,] 0.33206016 0.66412032 0.66793984
[59,] 0.31237057 0.62474114 0.68762943
[60,] 0.28581957 0.57163914 0.71418043
[61,] 0.33889749 0.67779497 0.66110251
[62,] 0.29906426 0.59812852 0.70093574
[63,] 0.26054113 0.52108227 0.73945887
[64,] 0.22767894 0.45535789 0.77232106
[65,] 0.19488739 0.38977477 0.80511261
[66,] 0.18159988 0.36319976 0.81840012
[67,] 0.15338284 0.30676568 0.84661716
[68,] 0.15140615 0.30281230 0.84859385
[69,] 0.13617744 0.27235487 0.86382256
[70,] 0.22541405 0.45082811 0.77458595
[71,] 0.19287583 0.38575167 0.80712417
[72,] 0.21448332 0.42896664 0.78551668
[73,] 0.18506825 0.37013649 0.81493175
[74,] 0.19325576 0.38651152 0.80674424
[75,] 0.17270629 0.34541259 0.82729371
[76,] 0.16308710 0.32617419 0.83691290
[77,] 0.17365271 0.34730542 0.82634729
[78,] 0.14793279 0.29586557 0.85206721
[79,] 0.12616106 0.25232211 0.87383894
[80,] 0.10620895 0.21241790 0.89379105
[81,] 0.08709051 0.17418103 0.91290949
[82,] 0.07326565 0.14653131 0.92673435
[83,] 0.06512263 0.13024527 0.93487737
[84,] 0.23300923 0.46601845 0.76699077
[85,] 0.20202061 0.40404122 0.79797939
[86,] 0.19012164 0.38024327 0.80987836
[87,] 0.16044371 0.32088743 0.83955629
[88,] 0.14543299 0.29086598 0.85456701
[89,] 0.14539067 0.29078133 0.85460933
[90,] 0.13217680 0.26435359 0.86782320
[91,] 0.13199367 0.26398734 0.86800633
[92,] 0.11566131 0.23132262 0.88433869
[93,] 0.10098234 0.20196468 0.89901766
[94,] 0.10601046 0.21202092 0.89398954
[95,] 0.10274106 0.20548211 0.89725894
[96,] 0.10700856 0.21401713 0.89299144
[97,] 0.09130577 0.18261155 0.90869423
[98,] 0.08289622 0.16579245 0.91710378
[99,] 0.08200289 0.16400579 0.91799711
[100,] 0.12932637 0.25865274 0.87067363
[101,] 0.11302199 0.22604397 0.88697801
[102,] 0.10923182 0.21846365 0.89076818
[103,] 0.09679729 0.19359458 0.90320271
[104,] 0.49156015 0.98312030 0.50843985
[105,] 0.44462967 0.88925934 0.55537033
[106,] 0.41344976 0.82689953 0.58655024
[107,] 0.37203982 0.74407963 0.62796018
[108,] 0.34788349 0.69576697 0.65211651
[109,] 0.30984896 0.61969793 0.69015104
[110,] 0.28684913 0.57369827 0.71315087
[111,] 0.24651724 0.49303449 0.75348276
[112,] 0.20860853 0.41721706 0.79139147
[113,] 0.21613495 0.43226991 0.78386505
[114,] 0.19294101 0.38588202 0.80705899
[115,] 0.16957748 0.33915497 0.83042252
[116,] 0.13954021 0.27908042 0.86045979
[117,] 0.11946468 0.23892935 0.88053532
[118,] 0.18001973 0.36003945 0.81998027
[119,] 0.15744452 0.31488904 0.84255548
[120,] 0.13946080 0.27892160 0.86053920
[121,] 0.20578904 0.41157809 0.79421096
[122,] 0.19717539 0.39435078 0.80282461
[123,] 0.17176440 0.34352880 0.82823560
[124,] 0.13964026 0.27928052 0.86035974
[125,] 0.12650590 0.25301180 0.87349410
[126,] 0.20522739 0.41045479 0.79477261
[127,] 0.22671582 0.45343163 0.77328418
[128,] 0.19546707 0.39093414 0.80453293
[129,] 0.16134392 0.32268785 0.83865608
[130,] 0.12761949 0.25523897 0.87238051
[131,] 0.46328395 0.92656791 0.53671605
[132,] 0.39954803 0.79909607 0.60045197
[133,] 0.40608117 0.81216233 0.59391883
[134,] 0.36963094 0.73926188 0.63036906
[135,] 0.33480343 0.66960686 0.66519657
[136,] 0.33167761 0.66335521 0.66832239
[137,] 0.26698580 0.53397161 0.73301420
[138,] 0.22883452 0.45766905 0.77116548
[139,] 0.17871723 0.35743445 0.82128277
[140,] 0.18598697 0.37197395 0.81401303
[141,] 0.14958481 0.29916963 0.85041519
[142,] 0.10794003 0.21588007 0.89205997
[143,] 0.09728153 0.19456306 0.90271847
[144,] 0.13174505 0.26349010 0.86825495
[145,] 0.11055667 0.22111333 0.88944333
[146,] 0.09326215 0.18652430 0.90673785
[147,] 0.24049864 0.48099728 0.75950136
[148,] 0.15305425 0.30610850 0.84694575
[149,] 0.15390171 0.30780341 0.84609829
> postscript(file="/var/www/rcomp/tmp/1qa921321603121.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/www/rcomp/tmp/2p4e41321603121.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/www/rcomp/tmp/3b7od1321603121.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/www/rcomp/tmp/4f5hk1321603121.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/www/rcomp/tmp/5oyqj1321603121.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 = 162
Frequency = 1
1 2 3 4 5 6
-0.552282680 -1.727874716 1.289210266 -0.964722424 7.798616934 -0.988818610
7 8 9 10 11 12
8.931014989 -2.092766046 -2.751080691 0.195436968 -3.250122980 -4.974248659
13 14 15 16 17 18
2.142342620 1.225626629 -2.924271920 0.958589259 0.588165652 -1.907962926
19 20 21 22 23 24
-3.150529978 -0.269047365 -5.636616448 0.751041002 -1.004798796 1.044488660
25 26 27 28 29 30
-2.346899664 -3.519664693 -1.519664693 2.203411226 1.472000572 0.144081662
31 32 33 34 35 36
-3.879512307 2.248531315 -2.859295855 -1.919186823 -0.045391042 -4.872414397
37 38 39 40 41 42
6.624951006 -0.846205037 -2.989507893 -2.877083982 -4.230221680 1.028179666
43 44 45 46 47 48
-4.984925014 1.299585331 -1.561306698 -0.461322526 -3.708060120 -2.429206757
49 50 51 52 53 54
2.168451619 -2.460560400 -2.843575784 1.235339930 4.784622042 1.440071869
55 56 57 58 59 60
-1.835441977 -0.901339716 0.179127974 -3.788254039 -3.166149688 2.381130298
61 62 63 64 65 66
7.241935623 -0.986664056 -0.637995014 1.262411983 -0.082650889 -2.095007305
67 68 69 70 71 72
4.149025017 -0.721279023 0.020894691 0.841523281 0.002157372 2.136796686
73 74 75 76 77 78
0.307559590 -2.934446058 -1.988430616 6.128274886 0.218843871 3.919261357
79 80 81 82 83 84
-0.026293247 -3.696995771 -1.756325335 -2.756987100 -3.749040360 -0.955511340
85 86 87 88 89 90
-1.002197061 0.154844722 -0.066857975 -1.293102171 2.028681883 8.937423616
91 92 93 94 95 96
0.690613179 2.535857980 -0.082089691 2.215913328 -3.241674023 -2.169842357
97 98 99 100 101 102
3.264840308 -1.763884082 -1.904156035 -2.864467657 -3.055104343 3.427930242
103 104 105 106 107 108
-0.932793720 -1.909701968 3.237078972 6.038481889 -1.929676112 3.254163954
109 110 111 112 113 114
2.121176976 11.227365671 0.640570716 1.912665664 -1.527999428 2.175736595
115 116 117 118 119 120
-0.988818610 -2.682727109 0.628543313 -0.164597712 -3.794461738 1.852400564
121 122 123 124 125 126
2.145359867 0.960328301 -2.130715382 -4.530801885 -2.137338593 -1.885720005
127 128 129 130 131 132
-4.766038636 -3.088685384 -1.711565722 0.287744994 -1.865517416 7.142817319
133 134 135 136 137 138
-3.118372828 2.095843965 -0.939503636 1.244176882 9.674165619 0.837442619
139 140 141 142 143 144
3.041371051 -1.937650371 -0.988403098 -3.142081020 0.630195650 -0.523832061
145 146 147 148 149 150
-0.991434001 -1.692828404 -1.194787374 0.312114951 -1.693517687 6.267469562
151 152 153 154 155 156
-0.936386028 3.750653008 -3.659160658 -1.171695622 6.092726357 5.256204285
157 158 159 160 161 162
1.992170300 0.433538538 -2.082089691 -3.782621401 5.562569557 3.538975588
> postscript(file="/var/www/rcomp/tmp/6p3ok1321603121.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 = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.552282680 NA
1 -1.727874716 -0.552282680
2 1.289210266 -1.727874716
3 -0.964722424 1.289210266
4 7.798616934 -0.964722424
5 -0.988818610 7.798616934
6 8.931014989 -0.988818610
7 -2.092766046 8.931014989
8 -2.751080691 -2.092766046
9 0.195436968 -2.751080691
10 -3.250122980 0.195436968
11 -4.974248659 -3.250122980
12 2.142342620 -4.974248659
13 1.225626629 2.142342620
14 -2.924271920 1.225626629
15 0.958589259 -2.924271920
16 0.588165652 0.958589259
17 -1.907962926 0.588165652
18 -3.150529978 -1.907962926
19 -0.269047365 -3.150529978
20 -5.636616448 -0.269047365
21 0.751041002 -5.636616448
22 -1.004798796 0.751041002
23 1.044488660 -1.004798796
24 -2.346899664 1.044488660
25 -3.519664693 -2.346899664
26 -1.519664693 -3.519664693
27 2.203411226 -1.519664693
28 1.472000572 2.203411226
29 0.144081662 1.472000572
30 -3.879512307 0.144081662
31 2.248531315 -3.879512307
32 -2.859295855 2.248531315
33 -1.919186823 -2.859295855
34 -0.045391042 -1.919186823
35 -4.872414397 -0.045391042
36 6.624951006 -4.872414397
37 -0.846205037 6.624951006
38 -2.989507893 -0.846205037
39 -2.877083982 -2.989507893
40 -4.230221680 -2.877083982
41 1.028179666 -4.230221680
42 -4.984925014 1.028179666
43 1.299585331 -4.984925014
44 -1.561306698 1.299585331
45 -0.461322526 -1.561306698
46 -3.708060120 -0.461322526
47 -2.429206757 -3.708060120
48 2.168451619 -2.429206757
49 -2.460560400 2.168451619
50 -2.843575784 -2.460560400
51 1.235339930 -2.843575784
52 4.784622042 1.235339930
53 1.440071869 4.784622042
54 -1.835441977 1.440071869
55 -0.901339716 -1.835441977
56 0.179127974 -0.901339716
57 -3.788254039 0.179127974
58 -3.166149688 -3.788254039
59 2.381130298 -3.166149688
60 7.241935623 2.381130298
61 -0.986664056 7.241935623
62 -0.637995014 -0.986664056
63 1.262411983 -0.637995014
64 -0.082650889 1.262411983
65 -2.095007305 -0.082650889
66 4.149025017 -2.095007305
67 -0.721279023 4.149025017
68 0.020894691 -0.721279023
69 0.841523281 0.020894691
70 0.002157372 0.841523281
71 2.136796686 0.002157372
72 0.307559590 2.136796686
73 -2.934446058 0.307559590
74 -1.988430616 -2.934446058
75 6.128274886 -1.988430616
76 0.218843871 6.128274886
77 3.919261357 0.218843871
78 -0.026293247 3.919261357
79 -3.696995771 -0.026293247
80 -1.756325335 -3.696995771
81 -2.756987100 -1.756325335
82 -3.749040360 -2.756987100
83 -0.955511340 -3.749040360
84 -1.002197061 -0.955511340
85 0.154844722 -1.002197061
86 -0.066857975 0.154844722
87 -1.293102171 -0.066857975
88 2.028681883 -1.293102171
89 8.937423616 2.028681883
90 0.690613179 8.937423616
91 2.535857980 0.690613179
92 -0.082089691 2.535857980
93 2.215913328 -0.082089691
94 -3.241674023 2.215913328
95 -2.169842357 -3.241674023
96 3.264840308 -2.169842357
97 -1.763884082 3.264840308
98 -1.904156035 -1.763884082
99 -2.864467657 -1.904156035
100 -3.055104343 -2.864467657
101 3.427930242 -3.055104343
102 -0.932793720 3.427930242
103 -1.909701968 -0.932793720
104 3.237078972 -1.909701968
105 6.038481889 3.237078972
106 -1.929676112 6.038481889
107 3.254163954 -1.929676112
108 2.121176976 3.254163954
109 11.227365671 2.121176976
110 0.640570716 11.227365671
111 1.912665664 0.640570716
112 -1.527999428 1.912665664
113 2.175736595 -1.527999428
114 -0.988818610 2.175736595
115 -2.682727109 -0.988818610
116 0.628543313 -2.682727109
117 -0.164597712 0.628543313
118 -3.794461738 -0.164597712
119 1.852400564 -3.794461738
120 2.145359867 1.852400564
121 0.960328301 2.145359867
122 -2.130715382 0.960328301
123 -4.530801885 -2.130715382
124 -2.137338593 -4.530801885
125 -1.885720005 -2.137338593
126 -4.766038636 -1.885720005
127 -3.088685384 -4.766038636
128 -1.711565722 -3.088685384
129 0.287744994 -1.711565722
130 -1.865517416 0.287744994
131 7.142817319 -1.865517416
132 -3.118372828 7.142817319
133 2.095843965 -3.118372828
134 -0.939503636 2.095843965
135 1.244176882 -0.939503636
136 9.674165619 1.244176882
137 0.837442619 9.674165619
138 3.041371051 0.837442619
139 -1.937650371 3.041371051
140 -0.988403098 -1.937650371
141 -3.142081020 -0.988403098
142 0.630195650 -3.142081020
143 -0.523832061 0.630195650
144 -0.991434001 -0.523832061
145 -1.692828404 -0.991434001
146 -1.194787374 -1.692828404
147 0.312114951 -1.194787374
148 -1.693517687 0.312114951
149 6.267469562 -1.693517687
150 -0.936386028 6.267469562
151 3.750653008 -0.936386028
152 -3.659160658 3.750653008
153 -1.171695622 -3.659160658
154 6.092726357 -1.171695622
155 5.256204285 6.092726357
156 1.992170300 5.256204285
157 0.433538538 1.992170300
158 -2.082089691 0.433538538
159 -3.782621401 -2.082089691
160 5.562569557 -3.782621401
161 3.538975588 5.562569557
162 NA 3.538975588
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.727874716 -0.552282680
[2,] 1.289210266 -1.727874716
[3,] -0.964722424 1.289210266
[4,] 7.798616934 -0.964722424
[5,] -0.988818610 7.798616934
[6,] 8.931014989 -0.988818610
[7,] -2.092766046 8.931014989
[8,] -2.751080691 -2.092766046
[9,] 0.195436968 -2.751080691
[10,] -3.250122980 0.195436968
[11,] -4.974248659 -3.250122980
[12,] 2.142342620 -4.974248659
[13,] 1.225626629 2.142342620
[14,] -2.924271920 1.225626629
[15,] 0.958589259 -2.924271920
[16,] 0.588165652 0.958589259
[17,] -1.907962926 0.588165652
[18,] -3.150529978 -1.907962926
[19,] -0.269047365 -3.150529978
[20,] -5.636616448 -0.269047365
[21,] 0.751041002 -5.636616448
[22,] -1.004798796 0.751041002
[23,] 1.044488660 -1.004798796
[24,] -2.346899664 1.044488660
[25,] -3.519664693 -2.346899664
[26,] -1.519664693 -3.519664693
[27,] 2.203411226 -1.519664693
[28,] 1.472000572 2.203411226
[29,] 0.144081662 1.472000572
[30,] -3.879512307 0.144081662
[31,] 2.248531315 -3.879512307
[32,] -2.859295855 2.248531315
[33,] -1.919186823 -2.859295855
[34,] -0.045391042 -1.919186823
[35,] -4.872414397 -0.045391042
[36,] 6.624951006 -4.872414397
[37,] -0.846205037 6.624951006
[38,] -2.989507893 -0.846205037
[39,] -2.877083982 -2.989507893
[40,] -4.230221680 -2.877083982
[41,] 1.028179666 -4.230221680
[42,] -4.984925014 1.028179666
[43,] 1.299585331 -4.984925014
[44,] -1.561306698 1.299585331
[45,] -0.461322526 -1.561306698
[46,] -3.708060120 -0.461322526
[47,] -2.429206757 -3.708060120
[48,] 2.168451619 -2.429206757
[49,] -2.460560400 2.168451619
[50,] -2.843575784 -2.460560400
[51,] 1.235339930 -2.843575784
[52,] 4.784622042 1.235339930
[53,] 1.440071869 4.784622042
[54,] -1.835441977 1.440071869
[55,] -0.901339716 -1.835441977
[56,] 0.179127974 -0.901339716
[57,] -3.788254039 0.179127974
[58,] -3.166149688 -3.788254039
[59,] 2.381130298 -3.166149688
[60,] 7.241935623 2.381130298
[61,] -0.986664056 7.241935623
[62,] -0.637995014 -0.986664056
[63,] 1.262411983 -0.637995014
[64,] -0.082650889 1.262411983
[65,] -2.095007305 -0.082650889
[66,] 4.149025017 -2.095007305
[67,] -0.721279023 4.149025017
[68,] 0.020894691 -0.721279023
[69,] 0.841523281 0.020894691
[70,] 0.002157372 0.841523281
[71,] 2.136796686 0.002157372
[72,] 0.307559590 2.136796686
[73,] -2.934446058 0.307559590
[74,] -1.988430616 -2.934446058
[75,] 6.128274886 -1.988430616
[76,] 0.218843871 6.128274886
[77,] 3.919261357 0.218843871
[78,] -0.026293247 3.919261357
[79,] -3.696995771 -0.026293247
[80,] -1.756325335 -3.696995771
[81,] -2.756987100 -1.756325335
[82,] -3.749040360 -2.756987100
[83,] -0.955511340 -3.749040360
[84,] -1.002197061 -0.955511340
[85,] 0.154844722 -1.002197061
[86,] -0.066857975 0.154844722
[87,] -1.293102171 -0.066857975
[88,] 2.028681883 -1.293102171
[89,] 8.937423616 2.028681883
[90,] 0.690613179 8.937423616
[91,] 2.535857980 0.690613179
[92,] -0.082089691 2.535857980
[93,] 2.215913328 -0.082089691
[94,] -3.241674023 2.215913328
[95,] -2.169842357 -3.241674023
[96,] 3.264840308 -2.169842357
[97,] -1.763884082 3.264840308
[98,] -1.904156035 -1.763884082
[99,] -2.864467657 -1.904156035
[100,] -3.055104343 -2.864467657
[101,] 3.427930242 -3.055104343
[102,] -0.932793720 3.427930242
[103,] -1.909701968 -0.932793720
[104,] 3.237078972 -1.909701968
[105,] 6.038481889 3.237078972
[106,] -1.929676112 6.038481889
[107,] 3.254163954 -1.929676112
[108,] 2.121176976 3.254163954
[109,] 11.227365671 2.121176976
[110,] 0.640570716 11.227365671
[111,] 1.912665664 0.640570716
[112,] -1.527999428 1.912665664
[113,] 2.175736595 -1.527999428
[114,] -0.988818610 2.175736595
[115,] -2.682727109 -0.988818610
[116,] 0.628543313 -2.682727109
[117,] -0.164597712 0.628543313
[118,] -3.794461738 -0.164597712
[119,] 1.852400564 -3.794461738
[120,] 2.145359867 1.852400564
[121,] 0.960328301 2.145359867
[122,] -2.130715382 0.960328301
[123,] -4.530801885 -2.130715382
[124,] -2.137338593 -4.530801885
[125,] -1.885720005 -2.137338593
[126,] -4.766038636 -1.885720005
[127,] -3.088685384 -4.766038636
[128,] -1.711565722 -3.088685384
[129,] 0.287744994 -1.711565722
[130,] -1.865517416 0.287744994
[131,] 7.142817319 -1.865517416
[132,] -3.118372828 7.142817319
[133,] 2.095843965 -3.118372828
[134,] -0.939503636 2.095843965
[135,] 1.244176882 -0.939503636
[136,] 9.674165619 1.244176882
[137,] 0.837442619 9.674165619
[138,] 3.041371051 0.837442619
[139,] -1.937650371 3.041371051
[140,] -0.988403098 -1.937650371
[141,] -3.142081020 -0.988403098
[142,] 0.630195650 -3.142081020
[143,] -0.523832061 0.630195650
[144,] -0.991434001 -0.523832061
[145,] -1.692828404 -0.991434001
[146,] -1.194787374 -1.692828404
[147,] 0.312114951 -1.194787374
[148,] -1.693517687 0.312114951
[149,] 6.267469562 -1.693517687
[150,] -0.936386028 6.267469562
[151,] 3.750653008 -0.936386028
[152,] -3.659160658 3.750653008
[153,] -1.171695622 -3.659160658
[154,] 6.092726357 -1.171695622
[155,] 5.256204285 6.092726357
[156,] 1.992170300 5.256204285
[157,] 0.433538538 1.992170300
[158,] -2.082089691 0.433538538
[159,] -3.782621401 -2.082089691
[160,] 5.562569557 -3.782621401
[161,] 3.538975588 5.562569557
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.727874716 -0.552282680
2 1.289210266 -1.727874716
3 -0.964722424 1.289210266
4 7.798616934 -0.964722424
5 -0.988818610 7.798616934
6 8.931014989 -0.988818610
7 -2.092766046 8.931014989
8 -2.751080691 -2.092766046
9 0.195436968 -2.751080691
10 -3.250122980 0.195436968
11 -4.974248659 -3.250122980
12 2.142342620 -4.974248659
13 1.225626629 2.142342620
14 -2.924271920 1.225626629
15 0.958589259 -2.924271920
16 0.588165652 0.958589259
17 -1.907962926 0.588165652
18 -3.150529978 -1.907962926
19 -0.269047365 -3.150529978
20 -5.636616448 -0.269047365
21 0.751041002 -5.636616448
22 -1.004798796 0.751041002
23 1.044488660 -1.004798796
24 -2.346899664 1.044488660
25 -3.519664693 -2.346899664
26 -1.519664693 -3.519664693
27 2.203411226 -1.519664693
28 1.472000572 2.203411226
29 0.144081662 1.472000572
30 -3.879512307 0.144081662
31 2.248531315 -3.879512307
32 -2.859295855 2.248531315
33 -1.919186823 -2.859295855
34 -0.045391042 -1.919186823
35 -4.872414397 -0.045391042
36 6.624951006 -4.872414397
37 -0.846205037 6.624951006
38 -2.989507893 -0.846205037
39 -2.877083982 -2.989507893
40 -4.230221680 -2.877083982
41 1.028179666 -4.230221680
42 -4.984925014 1.028179666
43 1.299585331 -4.984925014
44 -1.561306698 1.299585331
45 -0.461322526 -1.561306698
46 -3.708060120 -0.461322526
47 -2.429206757 -3.708060120
48 2.168451619 -2.429206757
49 -2.460560400 2.168451619
50 -2.843575784 -2.460560400
51 1.235339930 -2.843575784
52 4.784622042 1.235339930
53 1.440071869 4.784622042
54 -1.835441977 1.440071869
55 -0.901339716 -1.835441977
56 0.179127974 -0.901339716
57 -3.788254039 0.179127974
58 -3.166149688 -3.788254039
59 2.381130298 -3.166149688
60 7.241935623 2.381130298
61 -0.986664056 7.241935623
62 -0.637995014 -0.986664056
63 1.262411983 -0.637995014
64 -0.082650889 1.262411983
65 -2.095007305 -0.082650889
66 4.149025017 -2.095007305
67 -0.721279023 4.149025017
68 0.020894691 -0.721279023
69 0.841523281 0.020894691
70 0.002157372 0.841523281
71 2.136796686 0.002157372
72 0.307559590 2.136796686
73 -2.934446058 0.307559590
74 -1.988430616 -2.934446058
75 6.128274886 -1.988430616
76 0.218843871 6.128274886
77 3.919261357 0.218843871
78 -0.026293247 3.919261357
79 -3.696995771 -0.026293247
80 -1.756325335 -3.696995771
81 -2.756987100 -1.756325335
82 -3.749040360 -2.756987100
83 -0.955511340 -3.749040360
84 -1.002197061 -0.955511340
85 0.154844722 -1.002197061
86 -0.066857975 0.154844722
87 -1.293102171 -0.066857975
88 2.028681883 -1.293102171
89 8.937423616 2.028681883
90 0.690613179 8.937423616
91 2.535857980 0.690613179
92 -0.082089691 2.535857980
93 2.215913328 -0.082089691
94 -3.241674023 2.215913328
95 -2.169842357 -3.241674023
96 3.264840308 -2.169842357
97 -1.763884082 3.264840308
98 -1.904156035 -1.763884082
99 -2.864467657 -1.904156035
100 -3.055104343 -2.864467657
101 3.427930242 -3.055104343
102 -0.932793720 3.427930242
103 -1.909701968 -0.932793720
104 3.237078972 -1.909701968
105 6.038481889 3.237078972
106 -1.929676112 6.038481889
107 3.254163954 -1.929676112
108 2.121176976 3.254163954
109 11.227365671 2.121176976
110 0.640570716 11.227365671
111 1.912665664 0.640570716
112 -1.527999428 1.912665664
113 2.175736595 -1.527999428
114 -0.988818610 2.175736595
115 -2.682727109 -0.988818610
116 0.628543313 -2.682727109
117 -0.164597712 0.628543313
118 -3.794461738 -0.164597712
119 1.852400564 -3.794461738
120 2.145359867 1.852400564
121 0.960328301 2.145359867
122 -2.130715382 0.960328301
123 -4.530801885 -2.130715382
124 -2.137338593 -4.530801885
125 -1.885720005 -2.137338593
126 -4.766038636 -1.885720005
127 -3.088685384 -4.766038636
128 -1.711565722 -3.088685384
129 0.287744994 -1.711565722
130 -1.865517416 0.287744994
131 7.142817319 -1.865517416
132 -3.118372828 7.142817319
133 2.095843965 -3.118372828
134 -0.939503636 2.095843965
135 1.244176882 -0.939503636
136 9.674165619 1.244176882
137 0.837442619 9.674165619
138 3.041371051 0.837442619
139 -1.937650371 3.041371051
140 -0.988403098 -1.937650371
141 -3.142081020 -0.988403098
142 0.630195650 -3.142081020
143 -0.523832061 0.630195650
144 -0.991434001 -0.523832061
145 -1.692828404 -0.991434001
146 -1.194787374 -1.692828404
147 0.312114951 -1.194787374
148 -1.693517687 0.312114951
149 6.267469562 -1.693517687
150 -0.936386028 6.267469562
151 3.750653008 -0.936386028
152 -3.659160658 3.750653008
153 -1.171695622 -3.659160658
154 6.092726357 -1.171695622
155 5.256204285 6.092726357
156 1.992170300 5.256204285
157 0.433538538 1.992170300
158 -2.082089691 0.433538538
159 -3.782621401 -2.082089691
160 5.562569557 -3.782621401
161 3.538975588 5.562569557
> 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/rcomp/tmp/7mw9h1321603121.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/www/rcomp/tmp/8af401321603121.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/www/rcomp/tmp/9qd2g1321603121.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/www/rcomp/tmp/10hgkt1321603121.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11o9731321603121.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/rcomp/tmp/12foo31321603121.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/rcomp/tmp/13nfnc1321603121.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/rcomp/tmp/14icw41321603121.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/rcomp/tmp/1596lj1321603121.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/rcomp/tmp/16lpjb1321603121.tab")
+ }
>
> try(system("convert tmp/1qa921321603121.ps tmp/1qa921321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/2p4e41321603121.ps tmp/2p4e41321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/3b7od1321603121.ps tmp/3b7od1321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/4f5hk1321603121.ps tmp/4f5hk1321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/5oyqj1321603121.ps tmp/5oyqj1321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/6p3ok1321603121.ps tmp/6p3ok1321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mw9h1321603121.ps tmp/7mw9h1321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/8af401321603121.ps tmp/8af401321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/9qd2g1321603121.ps tmp/9qd2g1321603121.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hgkt1321603121.ps tmp/10hgkt1321603121.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.868 0.600 6.559