R version 2.12.0 (2010-10-15)
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(6
+ ,2
+ ,1
+ ,1
+ ,3
+ ,73
+ ,62
+ ,66
+ ,4
+ ,1
+ ,1
+ ,1
+ ,1
+ ,58
+ ,54
+ ,54
+ ,5
+ ,1
+ ,1
+ ,1
+ ,3
+ ,68
+ ,41
+ ,82
+ ,4
+ ,1
+ ,1
+ ,1
+ ,3
+ ,62
+ ,49
+ ,61
+ ,4
+ ,1
+ ,1
+ ,2
+ ,3
+ ,65
+ ,49
+ ,65
+ ,6
+ ,1
+ ,1
+ ,1
+ ,3
+ ,81
+ ,72
+ ,77
+ ,6
+ ,1
+ ,1
+ ,1
+ ,1
+ ,73
+ ,78
+ ,66
+ ,4
+ ,2
+ ,1
+ ,4
+ ,3
+ ,64
+ ,58
+ ,66
+ ,4
+ ,1
+ ,1
+ ,1
+ ,3
+ ,68
+ ,58
+ ,66
+ ,6
+ ,1
+ ,1
+ ,1
+ ,1
+ ,51
+ ,23
+ ,48
+ ,4
+ ,1
+ ,1
+ ,1
+ ,1
+ ,68
+ ,39
+ ,57
+ ,6
+ ,1
+ ,1
+ ,1
+ ,3
+ ,61
+ ,63
+ ,80
+ ,5
+ ,1
+ ,1
+ ,1
+ ,1
+ ,69
+ ,46
+ ,60
+ ,4
+ ,1
+ ,1
+ ,3
+ ,3
+ ,73
+ ,58
+ ,70
+ ,6
+ ,2
+ ,1
+ ,1
+ ,3
+ ,61
+ ,39
+ ,85
+ ,3
+ ,2
+ ,1
+ ,1
+ ,1
+ ,62
+ ,44
+ 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,68
+ ,8
+ ,1
+ ,1
+ ,1
+ ,3
+ ,51
+ ,67
+ ,68
+ ,4
+ ,1
+ ,1
+ ,1
+ ,3
+ ,66
+ ,40
+ ,69)
+ ,dim=c(8
+ ,146)
+ ,dimnames=list(c('Celebrity'
+ ,'Gender'
+ ,'Age'
+ ,'Raised'
+ ,'Marital'
+ ,'NV'
+ ,'ANX'
+ ,'GR')
+ ,1:146))
> y <- array(NA,dim=c(8,146),dimnames=list(c('Celebrity','Gender','Age','Raised','Marital','NV','ANX','GR'),1:146))
> 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
> 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
Celebrity Gender Age Raised Marital NV ANX GR
1 6 2 1 1 3 73 62 66
2 4 1 1 1 1 58 54 54
3 5 1 1 1 3 68 41 82
4 4 1 1 1 3 62 49 61
5 4 1 1 2 3 65 49 65
6 6 1 1 1 3 81 72 77
7 6 1 1 1 1 73 78 66
8 4 2 1 4 3 64 58 66
9 4 1 1 1 3 68 58 66
10 6 1 1 1 1 51 23 48
11 4 1 1 1 1 68 39 57
12 6 1 1 1 3 61 63 80
13 5 1 1 1 1 69 46 60
14 4 1 1 3 3 73 58 70
15 6 2 1 1 3 61 39 85
16 3 2 1 1 1 62 44 59
17 5 1 1 1 1 63 49 72
18 6 1 1 6 1 69 57 70
19 4 2 1 1 3 47 76 74
20 6 2 1 1 1 66 63 70
21 2 1 1 1 3 58 18 51
22 7 2 1 1 3 63 40 70
23 5 1 1 1 1 69 59 71
24 2 2 1 1 3 59 62 72
25 4 1 1 1 1 59 70 50
26 4 2 1 1 4 63 65 69
27 6 2 1 1 3 65 56 73
28 6 1 1 1 3 65 45 66
29 5 2 1 1 3 71 57 73
30 6 1 1 4 3 60 50 58
31 6 2 1 1 1 81 40 78
32 4 1 1 1 3 67 58 83
33 6 2 1 1 3 66 49 76
34 6 1 1 1 3 62 49 77
35 6 1 1 1 3 63 27 79
36 2 2 1 1 1 73 51 71
37 4 2 1 1 3 55 75 79
38 5 1 1 1 1 59 65 60
39 3 1 1 1 2 64 47 73
40 7 2 1 1 3 63 49 70
41 5 1 1 1 1 64 65 42
42 3 1 1 1 1 73 61 74
43 8 1 1 1 3 54 46 68
44 8 1 1 1 3 76 69 83
45 5 2 1 2 1 74 55 62
46 6 2 1 1 3 63 78 79
47 3 2 1 1 3 73 58 61
48 5 2 1 1 3 67 34 86
49 4 2 1 2 3 68 67 64
50 5 1 1 4 3 66 45 75
51 5 2 1 1 1 62 68 59
52 6 2 1 4 3 71 49 82
53 5 1 1 1 2 63 19 61
54 6 1 1 1 1 75 72 69
55 6 1 1 2 2 77 59 60
56 4 2 1 3 3 62 46 59
57 8 1 1 1 3 74 56 81
58 6 2 1 2 1 67 45 65
59 4 2 1 1 3 56 53 60
60 6 2 1 1 1 60 67 60
61 5 2 1 1 3 58 73 45
62 5 1 1 1 3 65 46 75
63 6 2 1 1 3 49 70 84
64 6 1 1 1 3 61 38 77
65 6 2 1 1 3 66 54 64
66 6 2 1 1 3 64 46 54
67 6 2 1 1 1 65 46 72
68 6 1 1 1 3 46 45 56
69 7 2 1 1 3 65 47 67
70 4 2 1 1 3 81 25 81
71 4 1 1 1 1 72 63 73
72 3 2 1 1 1 65 46 67
73 6 2 1 1 3 74 69 72
74 5 1 1 1 3 59 43 69
75 5 1 1 1 1 69 49 71
76 3 2 1 2 3 58 39 77
77 5 1 1 1 1 71 65 63
78 4 2 1 1 3 79 54 49
79 3 2 1 1 3 68 50 74
80 7 1 1 1 3 66 42 76
81 4 2 1 1 3 62 45 65
82 4 1 1 1 3 69 50 65
83 5 2 1 2 7 63 55 69
84 6 1 1 1 1 62 38 71
85 2 1 1 1 3 61 40 68
86 2 2 1 1 1 65 51 49
87 6 1 1 1 3 64 49 86
88 4 2 1 1 1 56 39 63
89 5 2 1 1 3 56 57 77
90 6 1 1 1 3 48 30 52
91 7 1 1 1 1 74 51 73
92 8 1 1 1 1 69 48 63
93 6 1 1 4 3 62 56 54
94 6 1 1 1 2 73 66 56
95 3 1 1 1 1 64 72 54
96 7 1 1 1 1 57 28 61
97 3 1 1 1 2 57 52 70
98 6 2 1 1 2 60 53 68
99 4 2 1 1 1 61 70 63
100 4 1 1 1 2 72 63 76
101 6 1 1 1 3 57 46 69
102 6 1 1 2 3 51 45 71
103 6 1 2 1 2 63 68 39
104 4 1 1 1 3 54 54 54
105 7 1 2 1 1 72 60 64
106 5 1 1 1 3 62 50 70
107 7 1 1 1 2 68 66 76
108 4 1 1 1 3 62 56 71
109 6 2 1 1 2 63 54 73
110 6 1 1 1 3 77 72 81
111 6 1 1 1 1 57 34 50
112 5 1 1 1 1 57 39 42
113 5 1 1 1 3 61 66 66
114 6 1 1 1 3 65 27 77
115 7 1 1 1 3 63 63 62
116 4 2 1 1 1 66 65 66
117 4 1 1 1 3 68 63 69
118 8 1 1 1 3 72 49 72
119 6 1 1 1 1 68 42 67
120 3 1 1 1 1 59 51 59
121 4 1 1 4 3 56 50 66
122 5 1 1 1 1 62 64 68
123 5 2 1 1 3 72 68 72
124 6 2 1 1 3 68 66 73
125 8 1 1 1 3 67 59 69
126 2 1 1 2 1 54 32 57
127 4 2 1 1 1 69 62 55
128 7 1 1 2 3 61 52 72
129 5 1 1 1 3 55 34 68
130 6 2 1 1 3 75 63 83
131 6 1 1 1 3 55 48 74
132 4 1 1 1 3 49 53 72
133 5 2 1 1 3 54 39 66
134 6 1 1 1 3 66 51 61
135 6 1 1 1 3 73 60 86
136 6 2 1 1 2 63 70 81
137 6 2 1 4 3 61 40 79
138 5 1 1 1 3 74 61 73
139 5 2 1 5 3 81 35 59
140 6 1 1 1 1 62 39 64
141 4 1 1 1 2 64 31 75
142 6 1 1 1 3 62 36 68
143 3 1 1 1 1 85 51 84
144 6 1 1 1 1 74 55 68
145 8 1 1 1 3 51 67 68
146 4 1 1 1 3 66 40 69
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Gender Age Raised Marital NV
1.439208 -0.478162 1.682261 0.004236 0.132215 0.003067
ANX GR
0.005397 0.027562
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.3214 -0.9064 0.1179 0.8747 3.0132
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.439208 1.626275 0.885 0.3777
Gender -0.478162 0.238367 -2.006 0.0468 *
Age 1.682261 1.006219 1.672 0.0968 .
Raised 0.004236 0.133859 0.032 0.9748
Marital 0.132215 0.124442 1.062 0.2899
NV 0.003067 0.016603 0.185 0.8537
ANX 0.005397 0.009252 0.583 0.5606
GR 0.027562 0.013187 2.090 0.0384 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.363 on 138 degrees of freedom
Multiple R-squared: 0.09047, Adjusted R-squared: 0.04433
F-statistic: 1.961 on 7 and 138 DF, p-value: 0.06469
> 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.5794060 0.8411879 0.42059397
[2,] 0.4235066 0.8470133 0.57649336
[3,] 0.2813242 0.5626485 0.71867576
[4,] 0.1947141 0.3894283 0.80528587
[5,] 0.1333692 0.2667384 0.86663079
[6,] 0.3255405 0.6510809 0.67445953
[7,] 0.2390143 0.4780285 0.76098573
[8,] 0.2488780 0.4977560 0.75112200
[9,] 0.2031710 0.4063420 0.79682902
[10,] 0.1594489 0.3188978 0.84055110
[11,] 0.1635525 0.3271051 0.83644746
[12,] 0.3069314 0.6138628 0.69306861
[13,] 0.2546008 0.5092016 0.74539921
[14,] 0.4895824 0.9791647 0.51041763
[15,] 0.4202294 0.8404588 0.57977059
[16,] 0.3570869 0.7141738 0.64291312
[17,] 0.3334746 0.6669491 0.66652543
[18,] 0.3482393 0.6964786 0.65176072
[19,] 0.2869885 0.5739770 0.71301149
[20,] 0.3520420 0.7040840 0.64795802
[21,] 0.3030444 0.6060887 0.69695564
[22,] 0.3203860 0.6407720 0.67961399
[23,] 0.2882932 0.5765864 0.71170679
[24,] 0.2591643 0.5183285 0.74083573
[25,] 0.2170651 0.4341302 0.78293490
[26,] 0.4703790 0.9407580 0.52962102
[27,] 0.4388618 0.8777236 0.56113822
[28,] 0.3882276 0.7764551 0.61177244
[29,] 0.4835711 0.9671421 0.51642894
[30,] 0.5758729 0.8482541 0.42412707
[31,] 0.5462018 0.9075964 0.45379818
[32,] 0.6302397 0.7395206 0.36976032
[33,] 0.7933806 0.4132387 0.20661937
[34,] 0.8521064 0.2957871 0.14789355
[35,] 0.8216573 0.3566855 0.17834273
[36,] 0.7957657 0.4084687 0.20423435
[37,] 0.8100519 0.3798962 0.18994810
[38,] 0.7750938 0.4498124 0.22490621
[39,] 0.7465609 0.5068782 0.25343910
[40,] 0.7099477 0.5801046 0.29005230
[41,] 0.6727190 0.6545619 0.32728096
[42,] 0.6329900 0.7340200 0.36700998
[43,] 0.5836565 0.8326870 0.41634349
[44,] 0.5489494 0.9021012 0.45105062
[45,] 0.5230063 0.9539873 0.47699365
[46,] 0.4793494 0.9586988 0.52065059
[47,] 0.5537189 0.8925622 0.44628111
[48,] 0.5548424 0.8903153 0.44515764
[49,] 0.5130156 0.9739689 0.48698445
[50,] 0.5231248 0.9537505 0.47687524
[51,] 0.4942044 0.9884088 0.50579561
[52,] 0.4500097 0.9000195 0.54999027
[53,] 0.4103756 0.8207512 0.58962439
[54,] 0.3685082 0.7370164 0.63149181
[55,] 0.3568721 0.7137442 0.64312790
[56,] 0.3661445 0.7322889 0.63385555
[57,] 0.3556347 0.7112694 0.64436532
[58,] 0.3408182 0.6816364 0.65918181
[59,] 0.4058011 0.8116021 0.59419894
[60,] 0.3938133 0.7876265 0.60618675
[61,] 0.3906366 0.7812732 0.60936341
[62,] 0.4046419 0.8092838 0.59535808
[63,] 0.3762381 0.7524762 0.62376192
[64,] 0.3326237 0.6652473 0.66737634
[65,] 0.2897059 0.5794119 0.71029406
[66,] 0.3390972 0.6781945 0.66090276
[67,] 0.2948118 0.5896236 0.70518819
[68,] 0.2575202 0.5150404 0.74247979
[69,] 0.3071504 0.6143009 0.69284957
[70,] 0.3082700 0.6165400 0.69173000
[71,] 0.2793484 0.5586968 0.72065162
[72,] 0.2754926 0.5509852 0.72450738
[73,] 0.2463340 0.4926680 0.75366599
[74,] 0.2242481 0.4484962 0.77575188
[75,] 0.4501623 0.9003245 0.54983775
[76,] 0.5379835 0.9240330 0.46201651
[77,] 0.4877668 0.9755336 0.51223319
[78,] 0.4452746 0.8905493 0.55472536
[79,] 0.3983053 0.7966106 0.60169468
[80,] 0.3763284 0.7526568 0.62367160
[81,] 0.4083359 0.8166718 0.59166412
[82,] 0.6147107 0.7705787 0.38528934
[83,] 0.5957541 0.8084919 0.40424594
[84,] 0.5721511 0.8556978 0.42784891
[85,] 0.5856226 0.8287547 0.41437737
[86,] 0.6825663 0.6348673 0.31743367
[87,] 0.7522658 0.4954684 0.24773419
[88,] 0.7317486 0.5365027 0.26825135
[89,] 0.6953482 0.6093035 0.30465176
[90,] 0.7031573 0.5936853 0.29684266
[91,] 0.6603483 0.6793035 0.33965174
[92,] 0.6183903 0.7632194 0.38160971
[93,] 0.5783738 0.8432523 0.42162617
[94,] 0.5862969 0.8274063 0.41370314
[95,] 0.5298526 0.9402947 0.47014736
[96,] 0.4861789 0.9723577 0.51382114
[97,] 0.5040163 0.9919674 0.49598369
[98,] 0.5409350 0.9181300 0.45906502
[99,] 0.5104317 0.9791365 0.48956826
[100,] 0.4513587 0.9027173 0.54864134
[101,] 0.4750364 0.9500728 0.52496360
[102,] 0.4386600 0.8773199 0.56134003
[103,] 0.4100938 0.8201876 0.58990621
[104,] 0.3608722 0.7217443 0.63912784
[105,] 0.3422209 0.6844418 0.65777909
[106,] 0.2929764 0.5859527 0.70702364
[107,] 0.3719745 0.7439489 0.62802555
[108,] 0.4701719 0.9403437 0.52982814
[109,] 0.5298164 0.9403673 0.47018364
[110,] 0.5394092 0.9211816 0.46059079
[111,] 0.6407893 0.7184214 0.35921072
[112,] 0.5731242 0.8537516 0.42687582
[113,] 0.5475418 0.9049164 0.45245822
[114,] 0.4747651 0.9495303 0.52523487
[115,] 0.5392931 0.9214138 0.46070690
[116,] 0.7429756 0.5140487 0.25702437
[117,] 0.7859891 0.4280218 0.21401092
[118,] 0.7589604 0.4820791 0.24103956
[119,] 0.6720782 0.6558437 0.32792184
[120,] 0.6193289 0.7613423 0.38067115
[121,] 0.5195960 0.9608080 0.48040400
[122,] 0.9168025 0.1663950 0.08319752
[123,] 0.8438356 0.3123288 0.15616442
[124,] 0.7287986 0.5424029 0.27120145
[125,] 0.7822872 0.4354255 0.21771277
> postscript(file="/var/www/rcomp/tmp/1ru4k1292331732.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/2ru4k1292331732.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/3ru4k1292331732.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/4k33n1292331732.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/5k33n1292331732.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 = 146
Frequency = 1
1 2 3 4 5 6
1.05638020 -0.73742775 -0.73409375 -1.18007195 -1.30375621 0.19653144
7 8 9 10 11 12
0.75629378 -0.90713566 -1.38485740 1.61672362 -0.76982670 0.22376223
13 14 15 16 17 18
0.10664102 -1.51891190 0.69364653 -1.35537176 -0.22188868 0.75047482
19 20 21 22 23 24
-1.15992940 1.22663515 -2.72487491 2.09554122 -0.26670087 -3.06605100
25 26 27 28 29 30
-0.71660215 -1.14404027 0.92036760 0.69450668 -0.10343206 0.89064209
31 32 33 34 35 36
1.08426923 -1.85033979 0.87239530 0.37894031 0.43948685 -2.75763050
37 38 39 40 41 42
-1.31687762 0.03476621 -2.37393793 2.04696696 0.51554199 -2.37244870
43 44 45 46 47 48
2.66772402 2.06268789 0.46153339 0.64239427 -1.78422257 -0.32533202
49 50 51 52 53 54
-0.90438267 -0.56932420 0.51509686 0.67898127 0.11098990 0.69985725
55 56 57 58 59 60
0.87549073 -0.63906759 2.19410836 1.45428920 -0.67753467 1.49906644
61 62 63 64 65 66
0.62181435 -0.55894606 0.59070194 0.44137594 1.17615040 1.50107903
67 68 69 70 71 72
1.26633016 1.02839866 2.13431227 -1.18188829 -1.35261416 -1.59586117
73 74 75 76 77 78
0.85016273 -0.35898172 -0.21272947 -2.08089441 -0.08472402 -0.45029572
79 80 81 82 83 84
-2.08401255 1.43201368 -0.79056873 -1.31718563 -0.49094907 0.86810868
85 86 87 88 89 90
-3.32136273 -2.12673567 0.12475054 -0.42023047 -0.16767270 1.21346853
91 92 93 94 95 96
1.70601735 3.01316154 0.96237201 0.96446209 -1.85297880 2.21303286
97 98 99 100 101 102
-2.29676883 1.22191783 -0.60287727 -1.56751408 0.63096103 0.59540116
103 104 105 106 107 108
-0.22937236 -0.98958883 0.22937236 -0.43352470 1.42856285 -1.49346927
109 110 111 112 113 114
1.06951076 0.09855285 1.48382908 0.67733725 -0.40656493 0.48847615
115 116 117 118 119 120
1.71373926 -0.67391220 -1.49452831 2.48607812 0.93836454 -1.86211208
121 122 123 124 125 126
-1.31758344 -0.18953177 -0.13830596 0.85719493 2.53012734 -2.69334358
127 128 129 130 131 132
-0.36374296 1.49938858 -0.27057737 0.57629941 0.48849226 -1.46496746
133 134 135 136 137 138
0.23878907 0.79686542 0.03777821 0.76266264 0.84091160 -0.61238348
139 140 141 142 143 144
0.35355419 1.05564368 -1.34270715 0.69715874 -2.63089966 0.82223746
145 146
2.56358533 -1.36425990
> postscript(file="/var/www/rcomp/tmp/6k33n1292331732.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 = 146
Frequency = 1
lag(myerror, k = 1) myerror
0 1.05638020 NA
1 -0.73742775 1.05638020
2 -0.73409375 -0.73742775
3 -1.18007195 -0.73409375
4 -1.30375621 -1.18007195
5 0.19653144 -1.30375621
6 0.75629378 0.19653144
7 -0.90713566 0.75629378
8 -1.38485740 -0.90713566
9 1.61672362 -1.38485740
10 -0.76982670 1.61672362
11 0.22376223 -0.76982670
12 0.10664102 0.22376223
13 -1.51891190 0.10664102
14 0.69364653 -1.51891190
15 -1.35537176 0.69364653
16 -0.22188868 -1.35537176
17 0.75047482 -0.22188868
18 -1.15992940 0.75047482
19 1.22663515 -1.15992940
20 -2.72487491 1.22663515
21 2.09554122 -2.72487491
22 -0.26670087 2.09554122
23 -3.06605100 -0.26670087
24 -0.71660215 -3.06605100
25 -1.14404027 -0.71660215
26 0.92036760 -1.14404027
27 0.69450668 0.92036760
28 -0.10343206 0.69450668
29 0.89064209 -0.10343206
30 1.08426923 0.89064209
31 -1.85033979 1.08426923
32 0.87239530 -1.85033979
33 0.37894031 0.87239530
34 0.43948685 0.37894031
35 -2.75763050 0.43948685
36 -1.31687762 -2.75763050
37 0.03476621 -1.31687762
38 -2.37393793 0.03476621
39 2.04696696 -2.37393793
40 0.51554199 2.04696696
41 -2.37244870 0.51554199
42 2.66772402 -2.37244870
43 2.06268789 2.66772402
44 0.46153339 2.06268789
45 0.64239427 0.46153339
46 -1.78422257 0.64239427
47 -0.32533202 -1.78422257
48 -0.90438267 -0.32533202
49 -0.56932420 -0.90438267
50 0.51509686 -0.56932420
51 0.67898127 0.51509686
52 0.11098990 0.67898127
53 0.69985725 0.11098990
54 0.87549073 0.69985725
55 -0.63906759 0.87549073
56 2.19410836 -0.63906759
57 1.45428920 2.19410836
58 -0.67753467 1.45428920
59 1.49906644 -0.67753467
60 0.62181435 1.49906644
61 -0.55894606 0.62181435
62 0.59070194 -0.55894606
63 0.44137594 0.59070194
64 1.17615040 0.44137594
65 1.50107903 1.17615040
66 1.26633016 1.50107903
67 1.02839866 1.26633016
68 2.13431227 1.02839866
69 -1.18188829 2.13431227
70 -1.35261416 -1.18188829
71 -1.59586117 -1.35261416
72 0.85016273 -1.59586117
73 -0.35898172 0.85016273
74 -0.21272947 -0.35898172
75 -2.08089441 -0.21272947
76 -0.08472402 -2.08089441
77 -0.45029572 -0.08472402
78 -2.08401255 -0.45029572
79 1.43201368 -2.08401255
80 -0.79056873 1.43201368
81 -1.31718563 -0.79056873
82 -0.49094907 -1.31718563
83 0.86810868 -0.49094907
84 -3.32136273 0.86810868
85 -2.12673567 -3.32136273
86 0.12475054 -2.12673567
87 -0.42023047 0.12475054
88 -0.16767270 -0.42023047
89 1.21346853 -0.16767270
90 1.70601735 1.21346853
91 3.01316154 1.70601735
92 0.96237201 3.01316154
93 0.96446209 0.96237201
94 -1.85297880 0.96446209
95 2.21303286 -1.85297880
96 -2.29676883 2.21303286
97 1.22191783 -2.29676883
98 -0.60287727 1.22191783
99 -1.56751408 -0.60287727
100 0.63096103 -1.56751408
101 0.59540116 0.63096103
102 -0.22937236 0.59540116
103 -0.98958883 -0.22937236
104 0.22937236 -0.98958883
105 -0.43352470 0.22937236
106 1.42856285 -0.43352470
107 -1.49346927 1.42856285
108 1.06951076 -1.49346927
109 0.09855285 1.06951076
110 1.48382908 0.09855285
111 0.67733725 1.48382908
112 -0.40656493 0.67733725
113 0.48847615 -0.40656493
114 1.71373926 0.48847615
115 -0.67391220 1.71373926
116 -1.49452831 -0.67391220
117 2.48607812 -1.49452831
118 0.93836454 2.48607812
119 -1.86211208 0.93836454
120 -1.31758344 -1.86211208
121 -0.18953177 -1.31758344
122 -0.13830596 -0.18953177
123 0.85719493 -0.13830596
124 2.53012734 0.85719493
125 -2.69334358 2.53012734
126 -0.36374296 -2.69334358
127 1.49938858 -0.36374296
128 -0.27057737 1.49938858
129 0.57629941 -0.27057737
130 0.48849226 0.57629941
131 -1.46496746 0.48849226
132 0.23878907 -1.46496746
133 0.79686542 0.23878907
134 0.03777821 0.79686542
135 0.76266264 0.03777821
136 0.84091160 0.76266264
137 -0.61238348 0.84091160
138 0.35355419 -0.61238348
139 1.05564368 0.35355419
140 -1.34270715 1.05564368
141 0.69715874 -1.34270715
142 -2.63089966 0.69715874
143 0.82223746 -2.63089966
144 2.56358533 0.82223746
145 -1.36425990 2.56358533
146 NA -1.36425990
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.73742775 1.05638020
[2,] -0.73409375 -0.73742775
[3,] -1.18007195 -0.73409375
[4,] -1.30375621 -1.18007195
[5,] 0.19653144 -1.30375621
[6,] 0.75629378 0.19653144
[7,] -0.90713566 0.75629378
[8,] -1.38485740 -0.90713566
[9,] 1.61672362 -1.38485740
[10,] -0.76982670 1.61672362
[11,] 0.22376223 -0.76982670
[12,] 0.10664102 0.22376223
[13,] -1.51891190 0.10664102
[14,] 0.69364653 -1.51891190
[15,] -1.35537176 0.69364653
[16,] -0.22188868 -1.35537176
[17,] 0.75047482 -0.22188868
[18,] -1.15992940 0.75047482
[19,] 1.22663515 -1.15992940
[20,] -2.72487491 1.22663515
[21,] 2.09554122 -2.72487491
[22,] -0.26670087 2.09554122
[23,] -3.06605100 -0.26670087
[24,] -0.71660215 -3.06605100
[25,] -1.14404027 -0.71660215
[26,] 0.92036760 -1.14404027
[27,] 0.69450668 0.92036760
[28,] -0.10343206 0.69450668
[29,] 0.89064209 -0.10343206
[30,] 1.08426923 0.89064209
[31,] -1.85033979 1.08426923
[32,] 0.87239530 -1.85033979
[33,] 0.37894031 0.87239530
[34,] 0.43948685 0.37894031
[35,] -2.75763050 0.43948685
[36,] -1.31687762 -2.75763050
[37,] 0.03476621 -1.31687762
[38,] -2.37393793 0.03476621
[39,] 2.04696696 -2.37393793
[40,] 0.51554199 2.04696696
[41,] -2.37244870 0.51554199
[42,] 2.66772402 -2.37244870
[43,] 2.06268789 2.66772402
[44,] 0.46153339 2.06268789
[45,] 0.64239427 0.46153339
[46,] -1.78422257 0.64239427
[47,] -0.32533202 -1.78422257
[48,] -0.90438267 -0.32533202
[49,] -0.56932420 -0.90438267
[50,] 0.51509686 -0.56932420
[51,] 0.67898127 0.51509686
[52,] 0.11098990 0.67898127
[53,] 0.69985725 0.11098990
[54,] 0.87549073 0.69985725
[55,] -0.63906759 0.87549073
[56,] 2.19410836 -0.63906759
[57,] 1.45428920 2.19410836
[58,] -0.67753467 1.45428920
[59,] 1.49906644 -0.67753467
[60,] 0.62181435 1.49906644
[61,] -0.55894606 0.62181435
[62,] 0.59070194 -0.55894606
[63,] 0.44137594 0.59070194
[64,] 1.17615040 0.44137594
[65,] 1.50107903 1.17615040
[66,] 1.26633016 1.50107903
[67,] 1.02839866 1.26633016
[68,] 2.13431227 1.02839866
[69,] -1.18188829 2.13431227
[70,] -1.35261416 -1.18188829
[71,] -1.59586117 -1.35261416
[72,] 0.85016273 -1.59586117
[73,] -0.35898172 0.85016273
[74,] -0.21272947 -0.35898172
[75,] -2.08089441 -0.21272947
[76,] -0.08472402 -2.08089441
[77,] -0.45029572 -0.08472402
[78,] -2.08401255 -0.45029572
[79,] 1.43201368 -2.08401255
[80,] -0.79056873 1.43201368
[81,] -1.31718563 -0.79056873
[82,] -0.49094907 -1.31718563
[83,] 0.86810868 -0.49094907
[84,] -3.32136273 0.86810868
[85,] -2.12673567 -3.32136273
[86,] 0.12475054 -2.12673567
[87,] -0.42023047 0.12475054
[88,] -0.16767270 -0.42023047
[89,] 1.21346853 -0.16767270
[90,] 1.70601735 1.21346853
[91,] 3.01316154 1.70601735
[92,] 0.96237201 3.01316154
[93,] 0.96446209 0.96237201
[94,] -1.85297880 0.96446209
[95,] 2.21303286 -1.85297880
[96,] -2.29676883 2.21303286
[97,] 1.22191783 -2.29676883
[98,] -0.60287727 1.22191783
[99,] -1.56751408 -0.60287727
[100,] 0.63096103 -1.56751408
[101,] 0.59540116 0.63096103
[102,] -0.22937236 0.59540116
[103,] -0.98958883 -0.22937236
[104,] 0.22937236 -0.98958883
[105,] -0.43352470 0.22937236
[106,] 1.42856285 -0.43352470
[107,] -1.49346927 1.42856285
[108,] 1.06951076 -1.49346927
[109,] 0.09855285 1.06951076
[110,] 1.48382908 0.09855285
[111,] 0.67733725 1.48382908
[112,] -0.40656493 0.67733725
[113,] 0.48847615 -0.40656493
[114,] 1.71373926 0.48847615
[115,] -0.67391220 1.71373926
[116,] -1.49452831 -0.67391220
[117,] 2.48607812 -1.49452831
[118,] 0.93836454 2.48607812
[119,] -1.86211208 0.93836454
[120,] -1.31758344 -1.86211208
[121,] -0.18953177 -1.31758344
[122,] -0.13830596 -0.18953177
[123,] 0.85719493 -0.13830596
[124,] 2.53012734 0.85719493
[125,] -2.69334358 2.53012734
[126,] -0.36374296 -2.69334358
[127,] 1.49938858 -0.36374296
[128,] -0.27057737 1.49938858
[129,] 0.57629941 -0.27057737
[130,] 0.48849226 0.57629941
[131,] -1.46496746 0.48849226
[132,] 0.23878907 -1.46496746
[133,] 0.79686542 0.23878907
[134,] 0.03777821 0.79686542
[135,] 0.76266264 0.03777821
[136,] 0.84091160 0.76266264
[137,] -0.61238348 0.84091160
[138,] 0.35355419 -0.61238348
[139,] 1.05564368 0.35355419
[140,] -1.34270715 1.05564368
[141,] 0.69715874 -1.34270715
[142,] -2.63089966 0.69715874
[143,] 0.82223746 -2.63089966
[144,] 2.56358533 0.82223746
[145,] -1.36425990 2.56358533
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.73742775 1.05638020
2 -0.73409375 -0.73742775
3 -1.18007195 -0.73409375
4 -1.30375621 -1.18007195
5 0.19653144 -1.30375621
6 0.75629378 0.19653144
7 -0.90713566 0.75629378
8 -1.38485740 -0.90713566
9 1.61672362 -1.38485740
10 -0.76982670 1.61672362
11 0.22376223 -0.76982670
12 0.10664102 0.22376223
13 -1.51891190 0.10664102
14 0.69364653 -1.51891190
15 -1.35537176 0.69364653
16 -0.22188868 -1.35537176
17 0.75047482 -0.22188868
18 -1.15992940 0.75047482
19 1.22663515 -1.15992940
20 -2.72487491 1.22663515
21 2.09554122 -2.72487491
22 -0.26670087 2.09554122
23 -3.06605100 -0.26670087
24 -0.71660215 -3.06605100
25 -1.14404027 -0.71660215
26 0.92036760 -1.14404027
27 0.69450668 0.92036760
28 -0.10343206 0.69450668
29 0.89064209 -0.10343206
30 1.08426923 0.89064209
31 -1.85033979 1.08426923
32 0.87239530 -1.85033979
33 0.37894031 0.87239530
34 0.43948685 0.37894031
35 -2.75763050 0.43948685
36 -1.31687762 -2.75763050
37 0.03476621 -1.31687762
38 -2.37393793 0.03476621
39 2.04696696 -2.37393793
40 0.51554199 2.04696696
41 -2.37244870 0.51554199
42 2.66772402 -2.37244870
43 2.06268789 2.66772402
44 0.46153339 2.06268789
45 0.64239427 0.46153339
46 -1.78422257 0.64239427
47 -0.32533202 -1.78422257
48 -0.90438267 -0.32533202
49 -0.56932420 -0.90438267
50 0.51509686 -0.56932420
51 0.67898127 0.51509686
52 0.11098990 0.67898127
53 0.69985725 0.11098990
54 0.87549073 0.69985725
55 -0.63906759 0.87549073
56 2.19410836 -0.63906759
57 1.45428920 2.19410836
58 -0.67753467 1.45428920
59 1.49906644 -0.67753467
60 0.62181435 1.49906644
61 -0.55894606 0.62181435
62 0.59070194 -0.55894606
63 0.44137594 0.59070194
64 1.17615040 0.44137594
65 1.50107903 1.17615040
66 1.26633016 1.50107903
67 1.02839866 1.26633016
68 2.13431227 1.02839866
69 -1.18188829 2.13431227
70 -1.35261416 -1.18188829
71 -1.59586117 -1.35261416
72 0.85016273 -1.59586117
73 -0.35898172 0.85016273
74 -0.21272947 -0.35898172
75 -2.08089441 -0.21272947
76 -0.08472402 -2.08089441
77 -0.45029572 -0.08472402
78 -2.08401255 -0.45029572
79 1.43201368 -2.08401255
80 -0.79056873 1.43201368
81 -1.31718563 -0.79056873
82 -0.49094907 -1.31718563
83 0.86810868 -0.49094907
84 -3.32136273 0.86810868
85 -2.12673567 -3.32136273
86 0.12475054 -2.12673567
87 -0.42023047 0.12475054
88 -0.16767270 -0.42023047
89 1.21346853 -0.16767270
90 1.70601735 1.21346853
91 3.01316154 1.70601735
92 0.96237201 3.01316154
93 0.96446209 0.96237201
94 -1.85297880 0.96446209
95 2.21303286 -1.85297880
96 -2.29676883 2.21303286
97 1.22191783 -2.29676883
98 -0.60287727 1.22191783
99 -1.56751408 -0.60287727
100 0.63096103 -1.56751408
101 0.59540116 0.63096103
102 -0.22937236 0.59540116
103 -0.98958883 -0.22937236
104 0.22937236 -0.98958883
105 -0.43352470 0.22937236
106 1.42856285 -0.43352470
107 -1.49346927 1.42856285
108 1.06951076 -1.49346927
109 0.09855285 1.06951076
110 1.48382908 0.09855285
111 0.67733725 1.48382908
112 -0.40656493 0.67733725
113 0.48847615 -0.40656493
114 1.71373926 0.48847615
115 -0.67391220 1.71373926
116 -1.49452831 -0.67391220
117 2.48607812 -1.49452831
118 0.93836454 2.48607812
119 -1.86211208 0.93836454
120 -1.31758344 -1.86211208
121 -0.18953177 -1.31758344
122 -0.13830596 -0.18953177
123 0.85719493 -0.13830596
124 2.53012734 0.85719493
125 -2.69334358 2.53012734
126 -0.36374296 -2.69334358
127 1.49938858 -0.36374296
128 -0.27057737 1.49938858
129 0.57629941 -0.27057737
130 0.48849226 0.57629941
131 -1.46496746 0.48849226
132 0.23878907 -1.46496746
133 0.79686542 0.23878907
134 0.03777821 0.79686542
135 0.76266264 0.03777821
136 0.84091160 0.76266264
137 -0.61238348 0.84091160
138 0.35355419 -0.61238348
139 1.05564368 0.35355419
140 -1.34270715 1.05564368
141 0.69715874 -1.34270715
142 -2.63089966 0.69715874
143 0.82223746 -2.63089966
144 2.56358533 0.82223746
145 -1.36425990 2.56358533
> 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/7cck81292331732.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/8n3jt1292331732.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/9n3jt1292331732.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/10gd1e1292331732.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/11jdz21292331732.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/12nwyq1292331732.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/13i5vy1292331732.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/144ou41292331732.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/15p6sa1292331732.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/163hut1292331733.tab")
+ }
>
> try(system("convert tmp/1ru4k1292331732.ps tmp/1ru4k1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ru4k1292331732.ps tmp/2ru4k1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ru4k1292331732.ps tmp/3ru4k1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/4k33n1292331732.ps tmp/4k33n1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/5k33n1292331732.ps tmp/5k33n1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/6k33n1292331732.ps tmp/6k33n1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/7cck81292331732.ps tmp/7cck81292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/8n3jt1292331732.ps tmp/8n3jt1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/9n3jt1292331732.ps tmp/9n3jt1292331732.png",intern=TRUE))
character(0)
> try(system("convert tmp/10gd1e1292331732.ps tmp/10gd1e1292331732.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.63 1.61 6.24