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(11
+ ,7
+ ,3
+ ,2
+ ,3
+ ,7
+ ,6
+ ,11
+ ,7
+ ,5
+ ,6
+ ,0
+ ,7
+ ,7
+ ,11
+ ,6
+ ,6
+ ,6
+ ,0
+ ,8
+ ,8
+ ,11
+ ,6
+ ,6
+ ,6
+ ,6
+ ,9
+ ,8
+ ,11
+ ,8
+ ,7
+ ,8
+ ,5
+ ,5
+ ,9
+ ,11
+ ,8
+ ,3
+ ,1
+ ,0
+ ,7
+ ,8
+ ,11
+ ,8
+ ,2
+ ,9
+ ,8
+ ,8
+ ,8
+ ,11
+ ,5
+ ,4
+ ,4
+ ,0
+ ,7
+ ,7
+ ,11
+ ,4
+ ,7
+ ,7
+ ,0
+ ,8
+ ,7
+ ,11
+ ,9
+ ,4
+ ,4
+ ,9
+ ,8
+ ,4
+ ,11
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,11
+ ,6
+ ,6
+ ,5
+ ,6
+ ,4
+ ,7
+ ,11
+ ,5
+ ,7
+ ,7
+ ,5
+ ,8
+ ,5
+ ,11
+ ,6
+ ,4
+ ,5
+ ,4
+ ,8
+ ,8
+ ,11
+ ,2
+ ,6
+ ,6
+ ,0
+ ,7
+ ,5
+ ,11
+ ,4
+ ,5
+ ,5
+ ,0
+ ,9
+ ,4
+ ,11
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,9
+ ,11
+ ,6
+ ,9
+ ,9
+ ,6
+ ,8
+ ,8
+ ,11
+ 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
+ ,4
+ ,4
+ ,4
+ ,4
+ ,9
+ ,8
+ ,12
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,12
+ ,5
+ ,1
+ ,1
+ ,0
+ ,9
+ ,6
+ ,12
+ ,4
+ ,4
+ ,5
+ ,4
+ ,3
+ ,6
+ ,12
+ ,7
+ ,4
+ ,2
+ ,7
+ ,7
+ ,7
+ ,12
+ ,6
+ ,6
+ ,6
+ ,0
+ ,6
+ ,7
+ ,12
+ ,7
+ ,5
+ ,5
+ ,5
+ ,5
+ ,9
+ ,12
+ ,6
+ ,9
+ ,2
+ ,6
+ ,6
+ ,6
+ ,12
+ ,6
+ ,6
+ ,6
+ ,6
+ ,9
+ ,6
+ ,12
+ ,8
+ ,8
+ ,8
+ ,8
+ ,8
+ ,6
+ ,12
+ ,7
+ ,7
+ ,7
+ ,2
+ ,7
+ ,4
+ ,12
+ ,7
+ ,7
+ ,7
+ ,7
+ ,7
+ ,7
+ ,12
+ ,4
+ ,0
+ ,9
+ ,0
+ ,4
+ ,8
+ ,12
+ ,6
+ ,2
+ ,2
+ ,0
+ ,8
+ ,7
+ ,12
+ ,5
+ ,6
+ ,6
+ ,5
+ ,5
+ ,9
+ ,12
+ ,2
+ ,5
+ ,5
+ ,0
+ ,9
+ ,6)
+ ,dim=c(7
+ ,156)
+ ,dimnames=list(c('Maand'
+ ,'Schoolprestaties'
+ ,'Sport'
+ ,'GoingOut'
+ ,'Relation'
+ ,'Friends'
+ ,'Job')
+ ,1:156))
> y <- array(NA,dim=c(7,156),dimnames=list(c('Maand','Schoolprestaties','Sport','GoingOut','Relation','Friends','Job'),1:156))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> 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
Schoolprestaties Maand Sport GoingOut Relation Friends Job t
1 7 11 3 2 3 7 6 1
2 7 11 5 6 0 7 7 2
3 6 11 6 6 0 8 8 3
4 6 11 6 6 6 9 8 4
5 8 11 7 8 5 5 9 5
6 8 11 3 1 0 7 8 6
7 8 11 2 9 8 8 8 7
8 5 11 4 4 0 7 7 8
9 4 11 7 7 0 8 7 9
10 9 11 4 4 9 8 4 10
11 6 11 6 6 6 6 6 11
12 6 11 6 5 6 4 7 12
13 5 11 7 7 5 8 5 13
14 6 11 4 5 4 8 8 14
15 2 11 6 6 0 7 5 15
16 4 11 5 5 0 9 4 16
17 2 11 0 2 2 2 9 17
18 6 11 9 9 6 8 8 18
19 7 11 4 4 0 8 4 19
20 8 11 2 4 4 4 6 20
21 5 11 2 5 5 5 6 21
22 7 11 7 7 7 7 7 22
23 5 11 5 5 5 8 3 23
24 4 11 9 9 4 4 4 24
25 6 11 6 6 6 6 6 25
26 6 11 6 6 6 6 6 26
27 7 11 7 3 0 9 7 27
28 7 11 3 3 1 7 5 28
29 8 11 6 5 0 6 8 29
30 4 11 6 5 4 4 6 30
31 4 11 4 4 4 8 4 31
32 7 11 7 7 7 3 9 32
33 7 11 7 6 7 7 7 33
34 4 11 2 7 0 4 4 34
35 7 11 4 4 4 7 6 35
36 5 11 5 5 5 8 8 36
37 6 11 6 6 0 6 6 37
38 5 11 5 5 5 5 5 38
39 6 11 6 0 1 6 6 39
40 7 11 6 6 2 9 6 40
41 6 11 6 5 0 8 4 41
42 9 11 3 3 9 7 7 42
43 7 11 3 3 3 3 9 43
44 4 11 3 3 0 4 8 44
45 6 11 6 7 6 6 6 45
46 5 11 7 7 1 8 6 46
47 5 11 5 1 5 5 5 47
48 4 11 5 5 0 7 7 48
49 7 11 5 5 0 7 5 49
50 6 11 6 6 0 9 8 50
51 6 11 2 2 6 6 6 51
52 7 11 6 6 7 8 8 52
53 5 11 5 5 0 5 5 53
54 4 11 4 2 4 4 4 54
55 5 11 7 7 5 8 5 55
56 5 11 5 5 1 9 6 56
57 4 12 3 3 4 4 4 57
58 9 12 6 6 9 8 6 58
59 8 12 2 2 2 2 9 59
60 8 12 8 8 8 8 7 60
61 3 12 3 5 3 7 3 61
62 6 12 0 2 1 7 6 62
63 6 12 2 6 0 6 6 63
64 6 12 8 2 6 6 6 64
65 5 12 4 1 0 5 5 65
66 5 12 5 5 0 8 5 66
67 6 12 6 6 6 4 5 67
68 7 12 5 2 2 9 9 68
69 6 12 6 6 1 6 8 69
70 5 12 2 2 5 5 5 70
71 5 12 6 6 5 5 6 71
72 7 12 2 5 5 7 7 72
73 5 12 5 0 5 8 5 73
74 6 12 6 2 6 9 6 74
75 6 12 4 4 6 6 6 75
76 9 12 6 1 0 6 6 76
77 8 12 5 5 0 5 6 77
78 5 12 5 5 1 3 9 78
79 7 12 4 2 7 7 7 79
80 7 12 2 2 2 9 9 80
81 4 12 7 7 4 7 4 81
82 6 12 5 5 0 8 8 82
83 5 12 6 2 5 5 5 83
84 5 12 5 5 5 5 8 84
85 3 12 3 3 3 8 9 85
86 6 12 6 6 0 6 6 86
87 4 12 4 1 4 9 4 87
88 9 12 5 5 9 5 7 88
89 8 12 7 7 0 8 8 89
90 4 12 4 2 4 8 9 90
91 2 12 6 6 2 7 9 91
92 7 12 8 8 7 7 7 92
93 7 12 7 7 7 8 8 93
94 6 12 6 6 6 4 4 94
95 5 12 7 7 0 5 6 95
96 8 12 4 4 5 9 7 96
97 6 12 0 5 6 6 6 97
98 3 12 3 2 0 7 7 98
99 5 12 5 5 5 5 5 99
100 9 12 6 2 9 2 9 100
101 7 12 5 5 0 7 7 101
102 7 12 7 7 7 7 7 102
103 6 12 6 5 1 6 6 103
104 3 12 8 8 3 8 6 104
105 7 12 7 2 7 9 9 105
106 8 12 8 8 8 8 9 106
107 3 12 3 3 0 3 8 107
108 5 12 8 2 5 5 8 108
109 8 12 3 3 3 7 3 109
110 7 12 4 5 0 8 6 110
111 5 12 2 2 5 5 5 111
112 7 12 7 2 7 9 7 112
113 6 12 6 6 0 6 6 113
114 7 12 2 2 0 7 7 114
115 9 12 7 7 0 7 7 115
116 6 12 6 6 6 6 6 116
117 6 12 6 2 0 3 8 117
118 6 12 6 2 6 9 9 118
119 6 12 6 5 6 6 6 119
120 2 12 6 6 2 2 9 120
121 5 12 4 4 5 5 5 121
122 5 12 2 5 0 5 6 122
123 4 12 7 7 4 9 4 123
124 7 12 6 6 0 7 7 124
125 6 12 6 6 6 6 6 125
126 5 12 5 5 5 8 8 126
127 8 12 8 2 8 8 8 127
128 7 12 6 6 6 6 9 128
129 5 12 0 3 5 3 8 129
130 4 12 4 2 0 7 4 130
131 8 12 8 8 8 9 6 131
132 6 12 6 6 0 7 6 132
133 9 12 4 4 9 4 7 133
134 5 12 6 6 5 5 9 134
135 6 12 2 5 0 6 8 135
136 4 12 4 4 0 4 4 136
137 6 12 2 2 0 6 6 137
138 3 12 3 3 3 7 9 138
139 6 12 6 6 6 6 6 139
140 5 12 5 5 0 5 5 140
141 4 12 4 4 4 9 8 141
142 6 12 6 6 6 6 6 142
143 5 12 1 1 0 9 6 143
144 4 12 4 5 4 3 6 144
145 7 12 4 2 7 7 7 145
146 6 12 6 6 0 6 7 146
147 7 12 5 5 5 5 9 147
148 6 12 9 2 6 6 6 148
149 6 12 6 6 6 9 6 149
150 8 12 8 8 8 8 6 150
151 7 12 7 7 2 7 4 151
152 7 12 7 7 7 7 7 152
153 4 12 0 9 0 4 8 153
154 6 12 2 2 0 8 7 154
155 5 12 6 6 5 5 9 155
156 2 12 5 5 0 9 6 156
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Maand Sport GoingOut Relation Friends
-0.635810 0.384537 0.051560 -0.023449 0.167531 0.117834
Job t
0.154860 -0.006159
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.1405 -0.9250 0.0328 0.9134 3.6240
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.635810 5.097830 -0.125 0.90091
Maand 0.384537 0.458197 0.839 0.40269
Sport 0.051560 0.071786 0.718 0.47374
GoingOut -0.023449 0.065672 -0.357 0.72155
Relation 0.167531 0.043424 3.858 0.00017 ***
Friends 0.117834 0.068863 1.711 0.08915 .
Job 0.154860 0.077927 1.987 0.04874 *
t -0.006159 0.004840 -1.272 0.20520
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.506 on 148 degrees of freedom
Multiple R-squared: 0.1627, Adjusted R-squared: 0.1231
F-statistic: 4.108 on 7 and 148 DF, p-value: 0.0003757
> 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.65214761 0.69570478 0.34785239
[2,] 0.58004075 0.83991850 0.41995925
[3,] 0.43671467 0.87342933 0.56328533
[4,] 0.31097658 0.62195317 0.68902342
[5,] 0.31995820 0.63991640 0.68004180
[6,] 0.27164899 0.54329798 0.72835101
[7,] 0.48225547 0.96451094 0.51774453
[8,] 0.44767535 0.89535070 0.55232465
[9,] 0.78592548 0.42814903 0.21407452
[10,] 0.91474405 0.17051191 0.08525595
[11,] 0.88280694 0.23438612 0.11719306
[12,] 0.86322733 0.27354534 0.13677267
[13,] 0.82768003 0.34463993 0.17231997
[14,] 0.78734765 0.42530469 0.21265235
[15,] 0.73963928 0.52072144 0.26036072
[16,] 0.68693785 0.62612429 0.31306215
[17,] 0.70452711 0.59094579 0.29547289
[18,] 0.72670079 0.54659842 0.27329921
[19,] 0.83008767 0.33982466 0.16991233
[20,] 0.81968747 0.36062506 0.18031253
[21,] 0.84153057 0.31693885 0.15846943
[22,] 0.81241958 0.37516085 0.18758042
[23,] 0.76793805 0.46412390 0.23206195
[24,] 0.73660154 0.52679692 0.26339846
[25,] 0.69734629 0.60530742 0.30265371
[26,] 0.72499305 0.55001390 0.27500695
[27,] 0.70673271 0.58653458 0.29326729
[28,] 0.66205326 0.67589347 0.33794674
[29,] 0.60935649 0.78128702 0.39064351
[30,] 0.58222205 0.83555589 0.41777795
[31,] 0.54639673 0.90720653 0.45360327
[32,] 0.54749244 0.90501511 0.45250756
[33,] 0.51740358 0.96519285 0.48259642
[34,] 0.50929253 0.98141494 0.49070747
[35,] 0.45455856 0.90911712 0.54544144
[36,] 0.40564049 0.81128097 0.59435951
[37,] 0.38067178 0.76134357 0.61932822
[38,] 0.37307860 0.74615720 0.62692140
[39,] 0.41682888 0.83365776 0.58317112
[40,] 0.36875991 0.73751982 0.63124009
[41,] 0.33170321 0.66340642 0.66829679
[42,] 0.29118601 0.58237201 0.70881399
[43,] 0.25585863 0.51171726 0.74414137
[44,] 0.23242438 0.46484875 0.76757562
[45,] 0.20446552 0.40893105 0.79553448
[46,] 0.17712637 0.35425273 0.82287363
[47,] 0.15643810 0.31287620 0.84356190
[48,] 0.17839841 0.35679682 0.82160159
[49,] 0.20259971 0.40519941 0.79740029
[50,] 0.17238594 0.34477187 0.82761406
[51,] 0.24076052 0.48152104 0.75923948
[52,] 0.20733529 0.41467058 0.79266471
[53,] 0.18343474 0.36686948 0.81656526
[54,] 0.16359083 0.32718165 0.83640917
[55,] 0.13538181 0.27076363 0.86461819
[56,] 0.11272951 0.22545901 0.88727049
[57,] 0.09278050 0.18556100 0.90721950
[58,] 0.08024252 0.16048503 0.91975748
[59,] 0.06370041 0.12740083 0.93629959
[60,] 0.05489406 0.10978812 0.94510594
[61,] 0.04784915 0.09569831 0.95215085
[62,] 0.03876766 0.07753531 0.96123234
[63,] 0.03947105 0.07894209 0.96052895
[64,] 0.03346983 0.06693967 0.96653017
[65,] 0.02566326 0.05132651 0.97433674
[66,] 0.08455994 0.16911989 0.91544006
[67,] 0.14564909 0.29129818 0.85435091
[68,] 0.12745571 0.25491142 0.87254429
[69,] 0.10604193 0.21208386 0.89395807
[70,] 0.09878782 0.19757563 0.90121218
[71,] 0.10768215 0.21536429 0.89231785
[72,] 0.09077200 0.18154401 0.90922800
[73,] 0.07924063 0.15848126 0.92075937
[74,] 0.07381010 0.14762020 0.92618990
[75,] 0.16434732 0.32869465 0.83565268
[76,] 0.14538916 0.29077833 0.85461084
[77,] 0.16907997 0.33815994 0.83092003
[78,] 0.20872684 0.41745369 0.79127316
[79,] 0.26513026 0.53026052 0.73486974
[80,] 0.33026153 0.66052307 0.66973847
[81,] 0.59171014 0.81657973 0.40828986
[82,] 0.54903927 0.90192146 0.45096073
[83,] 0.50177420 0.99645161 0.49822580
[84,] 0.46177100 0.92354200 0.53822900
[85,] 0.41565364 0.83130729 0.58434636
[86,] 0.41508186 0.83016372 0.58491814
[87,] 0.36809043 0.73618085 0.63190957
[88,] 0.43317163 0.86634327 0.56682837
[89,] 0.41197590 0.82395180 0.58802410
[90,] 0.47593341 0.95186683 0.52406659
[91,] 0.47772237 0.95544473 0.52227763
[92,] 0.42952152 0.85904304 0.57047848
[93,] 0.38717723 0.77435445 0.61282277
[94,] 0.58441867 0.83116266 0.41558133
[95,] 0.53394001 0.93211998 0.46605999
[96,] 0.49041779 0.98083558 0.50958221
[97,] 0.51861252 0.96277497 0.48138748
[98,] 0.51054303 0.97891395 0.48945697
[99,] 0.58575409 0.82849182 0.41424591
[100,] 0.58064141 0.83871719 0.41935859
[101,] 0.53730578 0.92538845 0.46269422
[102,] 0.48334762 0.96669523 0.51665238
[103,] 0.43756634 0.87513269 0.56243366
[104,] 0.46156812 0.92313625 0.53843188
[105,] 0.72544624 0.54910753 0.27455376
[106,] 0.67560660 0.64878680 0.32439340
[107,] 0.67292350 0.65415300 0.32707650
[108,] 0.62499076 0.75001848 0.37500924
[109,] 0.56783739 0.86432522 0.43216261
[110,] 0.75763749 0.48472502 0.24236251
[111,] 0.72801829 0.54396342 0.27198171
[112,] 0.67505591 0.64988818 0.32494409
[113,] 0.75328981 0.49342038 0.24671019
[114,] 0.77537050 0.44925899 0.22462950
[115,] 0.73693300 0.52613400 0.26306700
[116,] 0.72844325 0.54311350 0.27155675
[117,] 0.68835400 0.62329201 0.31164600
[118,] 0.63526371 0.72947257 0.36473629
[119,] 0.58925649 0.82148703 0.41074351
[120,] 0.56874268 0.86251463 0.43125732
[121,] 0.50613377 0.98773245 0.49386623
[122,] 0.46959148 0.93918296 0.53040852
[123,] 0.51737651 0.96524699 0.48262349
[124,] 0.45124603 0.90249206 0.54875397
[125,] 0.47934527 0.95869054 0.52065473
[126,] 0.43832693 0.87665387 0.56167307
[127,] 0.43448812 0.86897624 0.56551188
[128,] 0.45102889 0.90205779 0.54897111
[129,] 0.36138117 0.72276235 0.63861883
[130,] 0.27235649 0.54471299 0.72764351
[131,] 0.34331364 0.68662728 0.65668636
[132,] 0.27633609 0.55267218 0.72366391
[133,] 0.19224564 0.38449127 0.80775436
[134,] 0.27968254 0.55936509 0.72031746
[135,] 0.20344610 0.40689221 0.79655390
> postscript(file="/var/www/rcomp/tmp/170am1324494755.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/2pi4m1324494755.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/3u52c1324494755.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/4h37w1324494755.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/5fwm61324494755.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 = 156
Frequency = 1
1 2 3 4 5 6
1.04768603 1.39225380 0.07415896 -1.04269925 1.44280495 2.24790415
7 8 9 10 11 12
1.03513891 -0.56613006 -1.76213736 2.28515885 -0.33636379 -0.27284584
13 14 15 16 17 18
-1.26543394 -0.44854230 -3.26951819 -1.31605639 -3.40696736 -0.92297026
19 20 21 22 23 24
1.84836570 2.44913891 -0.80661729 0.26305107 -0.83790157 -1.46017903
25 26 27 28 29 30
-0.25013640 -0.24397730 1.13709542 1.72735195 2.44651428 -1.67206106
31 32 33 34 35 36
-1.74784731 0.48625827 0.30735191 -0.41444396 1.08490330 -1.53213273
37 38 39 40 41 42
0.82895610 -0.70173287 0.53304823 1.15887031 0.90419503 2.16361515
43 44 45 46 47 48
1.33657376 -1.11764959 -0.10350516 -0.54692135 -0.74009799 -1.34787689
49 50 51 52 53 54
1.96800198 0.24580262 0.02244338 0.20324096 0.22830637 -1.18175055
55 56 57 58 59 60
-1.00675177 -0.54694276 -1.47280140 1.83031677 2.36405724 0.79908403
61 62 63 64 65 66
-2.43237805 0.52859488 0.81079543 -0.59138610 -0.12455885 -0.42966478
67 68 69 70 71 72
0.01453619 0.43997100 0.16425949 -0.80484675 -1.06599074 0.73243143
73 74 75 76 77 78
-1.34145011 -0.78017699 -0.27049729 3.56737725 2.83672741 -0.55355572
79 80 81 82 83 84
0.26701616 0.66856035 -1.79092821 0.20430114 -0.93101867 -1.26753143
85 86 87 88 89 90
-3.37845151 0.74621450 -1.97565697 2.24184265 2.19119323 -2.59019587
91 92 93 94 95 96
-4.14046477 0.28153975 0.04311577 0.33569176 -0.10863041 1.51801246
97 98 99 100 101 102
0.09469235 -2.39168704 -0.71056528 2.23762624 1.59401791 0.37124155
103 104 105 106 107 108
0.65993939 -2.93740296 -0.27291519 0.77268282 -1.99632980 -1.34474097
109 110 111 112 113 114
2.81636021 1.73803575 -0.55232368 0.07991828 0.91251018 1.75841860
115 116 117 118 119 120
3.62402369 -0.07419583 0.88713178 -0.97375630 -0.07916778 -3.37268091
121 122 123 124 125 126
-0.54695429 0.26856703 -1.76791404 1.70756639 -0.01876393 -1.36235125
127 128 129 130 131 132
0.91618827 0.53513369 -0.54380222 -0.78157625 1.27340597 0.91169907
133 134 135 136 137 138
2.66494691 -1.14254716 0.92108155 -0.34422116 1.17277176 -2.93418525
139 140 141 142 143 144
0.06746345 0.37961055 -2.19215741 0.08594075 -0.11566483 -1.13350711
145 146 147 148 149 150
0.67351671 0.96090057 0.96563193 -0.12558182 -0.22444754 1.50826285
151 152 153 154 155 156
1.97526983 0.67919651 -0.53546956 0.88694857 -1.01320608 -3.14803974
> postscript(file="/var/www/rcomp/tmp/6nvdb1324494755.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 = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 1.04768603 NA
1 1.39225380 1.04768603
2 0.07415896 1.39225380
3 -1.04269925 0.07415896
4 1.44280495 -1.04269925
5 2.24790415 1.44280495
6 1.03513891 2.24790415
7 -0.56613006 1.03513891
8 -1.76213736 -0.56613006
9 2.28515885 -1.76213736
10 -0.33636379 2.28515885
11 -0.27284584 -0.33636379
12 -1.26543394 -0.27284584
13 -0.44854230 -1.26543394
14 -3.26951819 -0.44854230
15 -1.31605639 -3.26951819
16 -3.40696736 -1.31605639
17 -0.92297026 -3.40696736
18 1.84836570 -0.92297026
19 2.44913891 1.84836570
20 -0.80661729 2.44913891
21 0.26305107 -0.80661729
22 -0.83790157 0.26305107
23 -1.46017903 -0.83790157
24 -0.25013640 -1.46017903
25 -0.24397730 -0.25013640
26 1.13709542 -0.24397730
27 1.72735195 1.13709542
28 2.44651428 1.72735195
29 -1.67206106 2.44651428
30 -1.74784731 -1.67206106
31 0.48625827 -1.74784731
32 0.30735191 0.48625827
33 -0.41444396 0.30735191
34 1.08490330 -0.41444396
35 -1.53213273 1.08490330
36 0.82895610 -1.53213273
37 -0.70173287 0.82895610
38 0.53304823 -0.70173287
39 1.15887031 0.53304823
40 0.90419503 1.15887031
41 2.16361515 0.90419503
42 1.33657376 2.16361515
43 -1.11764959 1.33657376
44 -0.10350516 -1.11764959
45 -0.54692135 -0.10350516
46 -0.74009799 -0.54692135
47 -1.34787689 -0.74009799
48 1.96800198 -1.34787689
49 0.24580262 1.96800198
50 0.02244338 0.24580262
51 0.20324096 0.02244338
52 0.22830637 0.20324096
53 -1.18175055 0.22830637
54 -1.00675177 -1.18175055
55 -0.54694276 -1.00675177
56 -1.47280140 -0.54694276
57 1.83031677 -1.47280140
58 2.36405724 1.83031677
59 0.79908403 2.36405724
60 -2.43237805 0.79908403
61 0.52859488 -2.43237805
62 0.81079543 0.52859488
63 -0.59138610 0.81079543
64 -0.12455885 -0.59138610
65 -0.42966478 -0.12455885
66 0.01453619 -0.42966478
67 0.43997100 0.01453619
68 0.16425949 0.43997100
69 -0.80484675 0.16425949
70 -1.06599074 -0.80484675
71 0.73243143 -1.06599074
72 -1.34145011 0.73243143
73 -0.78017699 -1.34145011
74 -0.27049729 -0.78017699
75 3.56737725 -0.27049729
76 2.83672741 3.56737725
77 -0.55355572 2.83672741
78 0.26701616 -0.55355572
79 0.66856035 0.26701616
80 -1.79092821 0.66856035
81 0.20430114 -1.79092821
82 -0.93101867 0.20430114
83 -1.26753143 -0.93101867
84 -3.37845151 -1.26753143
85 0.74621450 -3.37845151
86 -1.97565697 0.74621450
87 2.24184265 -1.97565697
88 2.19119323 2.24184265
89 -2.59019587 2.19119323
90 -4.14046477 -2.59019587
91 0.28153975 -4.14046477
92 0.04311577 0.28153975
93 0.33569176 0.04311577
94 -0.10863041 0.33569176
95 1.51801246 -0.10863041
96 0.09469235 1.51801246
97 -2.39168704 0.09469235
98 -0.71056528 -2.39168704
99 2.23762624 -0.71056528
100 1.59401791 2.23762624
101 0.37124155 1.59401791
102 0.65993939 0.37124155
103 -2.93740296 0.65993939
104 -0.27291519 -2.93740296
105 0.77268282 -0.27291519
106 -1.99632980 0.77268282
107 -1.34474097 -1.99632980
108 2.81636021 -1.34474097
109 1.73803575 2.81636021
110 -0.55232368 1.73803575
111 0.07991828 -0.55232368
112 0.91251018 0.07991828
113 1.75841860 0.91251018
114 3.62402369 1.75841860
115 -0.07419583 3.62402369
116 0.88713178 -0.07419583
117 -0.97375630 0.88713178
118 -0.07916778 -0.97375630
119 -3.37268091 -0.07916778
120 -0.54695429 -3.37268091
121 0.26856703 -0.54695429
122 -1.76791404 0.26856703
123 1.70756639 -1.76791404
124 -0.01876393 1.70756639
125 -1.36235125 -0.01876393
126 0.91618827 -1.36235125
127 0.53513369 0.91618827
128 -0.54380222 0.53513369
129 -0.78157625 -0.54380222
130 1.27340597 -0.78157625
131 0.91169907 1.27340597
132 2.66494691 0.91169907
133 -1.14254716 2.66494691
134 0.92108155 -1.14254716
135 -0.34422116 0.92108155
136 1.17277176 -0.34422116
137 -2.93418525 1.17277176
138 0.06746345 -2.93418525
139 0.37961055 0.06746345
140 -2.19215741 0.37961055
141 0.08594075 -2.19215741
142 -0.11566483 0.08594075
143 -1.13350711 -0.11566483
144 0.67351671 -1.13350711
145 0.96090057 0.67351671
146 0.96563193 0.96090057
147 -0.12558182 0.96563193
148 -0.22444754 -0.12558182
149 1.50826285 -0.22444754
150 1.97526983 1.50826285
151 0.67919651 1.97526983
152 -0.53546956 0.67919651
153 0.88694857 -0.53546956
154 -1.01320608 0.88694857
155 -3.14803974 -1.01320608
156 NA -3.14803974
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.39225380 1.04768603
[2,] 0.07415896 1.39225380
[3,] -1.04269925 0.07415896
[4,] 1.44280495 -1.04269925
[5,] 2.24790415 1.44280495
[6,] 1.03513891 2.24790415
[7,] -0.56613006 1.03513891
[8,] -1.76213736 -0.56613006
[9,] 2.28515885 -1.76213736
[10,] -0.33636379 2.28515885
[11,] -0.27284584 -0.33636379
[12,] -1.26543394 -0.27284584
[13,] -0.44854230 -1.26543394
[14,] -3.26951819 -0.44854230
[15,] -1.31605639 -3.26951819
[16,] -3.40696736 -1.31605639
[17,] -0.92297026 -3.40696736
[18,] 1.84836570 -0.92297026
[19,] 2.44913891 1.84836570
[20,] -0.80661729 2.44913891
[21,] 0.26305107 -0.80661729
[22,] -0.83790157 0.26305107
[23,] -1.46017903 -0.83790157
[24,] -0.25013640 -1.46017903
[25,] -0.24397730 -0.25013640
[26,] 1.13709542 -0.24397730
[27,] 1.72735195 1.13709542
[28,] 2.44651428 1.72735195
[29,] -1.67206106 2.44651428
[30,] -1.74784731 -1.67206106
[31,] 0.48625827 -1.74784731
[32,] 0.30735191 0.48625827
[33,] -0.41444396 0.30735191
[34,] 1.08490330 -0.41444396
[35,] -1.53213273 1.08490330
[36,] 0.82895610 -1.53213273
[37,] -0.70173287 0.82895610
[38,] 0.53304823 -0.70173287
[39,] 1.15887031 0.53304823
[40,] 0.90419503 1.15887031
[41,] 2.16361515 0.90419503
[42,] 1.33657376 2.16361515
[43,] -1.11764959 1.33657376
[44,] -0.10350516 -1.11764959
[45,] -0.54692135 -0.10350516
[46,] -0.74009799 -0.54692135
[47,] -1.34787689 -0.74009799
[48,] 1.96800198 -1.34787689
[49,] 0.24580262 1.96800198
[50,] 0.02244338 0.24580262
[51,] 0.20324096 0.02244338
[52,] 0.22830637 0.20324096
[53,] -1.18175055 0.22830637
[54,] -1.00675177 -1.18175055
[55,] -0.54694276 -1.00675177
[56,] -1.47280140 -0.54694276
[57,] 1.83031677 -1.47280140
[58,] 2.36405724 1.83031677
[59,] 0.79908403 2.36405724
[60,] -2.43237805 0.79908403
[61,] 0.52859488 -2.43237805
[62,] 0.81079543 0.52859488
[63,] -0.59138610 0.81079543
[64,] -0.12455885 -0.59138610
[65,] -0.42966478 -0.12455885
[66,] 0.01453619 -0.42966478
[67,] 0.43997100 0.01453619
[68,] 0.16425949 0.43997100
[69,] -0.80484675 0.16425949
[70,] -1.06599074 -0.80484675
[71,] 0.73243143 -1.06599074
[72,] -1.34145011 0.73243143
[73,] -0.78017699 -1.34145011
[74,] -0.27049729 -0.78017699
[75,] 3.56737725 -0.27049729
[76,] 2.83672741 3.56737725
[77,] -0.55355572 2.83672741
[78,] 0.26701616 -0.55355572
[79,] 0.66856035 0.26701616
[80,] -1.79092821 0.66856035
[81,] 0.20430114 -1.79092821
[82,] -0.93101867 0.20430114
[83,] -1.26753143 -0.93101867
[84,] -3.37845151 -1.26753143
[85,] 0.74621450 -3.37845151
[86,] -1.97565697 0.74621450
[87,] 2.24184265 -1.97565697
[88,] 2.19119323 2.24184265
[89,] -2.59019587 2.19119323
[90,] -4.14046477 -2.59019587
[91,] 0.28153975 -4.14046477
[92,] 0.04311577 0.28153975
[93,] 0.33569176 0.04311577
[94,] -0.10863041 0.33569176
[95,] 1.51801246 -0.10863041
[96,] 0.09469235 1.51801246
[97,] -2.39168704 0.09469235
[98,] -0.71056528 -2.39168704
[99,] 2.23762624 -0.71056528
[100,] 1.59401791 2.23762624
[101,] 0.37124155 1.59401791
[102,] 0.65993939 0.37124155
[103,] -2.93740296 0.65993939
[104,] -0.27291519 -2.93740296
[105,] 0.77268282 -0.27291519
[106,] -1.99632980 0.77268282
[107,] -1.34474097 -1.99632980
[108,] 2.81636021 -1.34474097
[109,] 1.73803575 2.81636021
[110,] -0.55232368 1.73803575
[111,] 0.07991828 -0.55232368
[112,] 0.91251018 0.07991828
[113,] 1.75841860 0.91251018
[114,] 3.62402369 1.75841860
[115,] -0.07419583 3.62402369
[116,] 0.88713178 -0.07419583
[117,] -0.97375630 0.88713178
[118,] -0.07916778 -0.97375630
[119,] -3.37268091 -0.07916778
[120,] -0.54695429 -3.37268091
[121,] 0.26856703 -0.54695429
[122,] -1.76791404 0.26856703
[123,] 1.70756639 -1.76791404
[124,] -0.01876393 1.70756639
[125,] -1.36235125 -0.01876393
[126,] 0.91618827 -1.36235125
[127,] 0.53513369 0.91618827
[128,] -0.54380222 0.53513369
[129,] -0.78157625 -0.54380222
[130,] 1.27340597 -0.78157625
[131,] 0.91169907 1.27340597
[132,] 2.66494691 0.91169907
[133,] -1.14254716 2.66494691
[134,] 0.92108155 -1.14254716
[135,] -0.34422116 0.92108155
[136,] 1.17277176 -0.34422116
[137,] -2.93418525 1.17277176
[138,] 0.06746345 -2.93418525
[139,] 0.37961055 0.06746345
[140,] -2.19215741 0.37961055
[141,] 0.08594075 -2.19215741
[142,] -0.11566483 0.08594075
[143,] -1.13350711 -0.11566483
[144,] 0.67351671 -1.13350711
[145,] 0.96090057 0.67351671
[146,] 0.96563193 0.96090057
[147,] -0.12558182 0.96563193
[148,] -0.22444754 -0.12558182
[149,] 1.50826285 -0.22444754
[150,] 1.97526983 1.50826285
[151,] 0.67919651 1.97526983
[152,] -0.53546956 0.67919651
[153,] 0.88694857 -0.53546956
[154,] -1.01320608 0.88694857
[155,] -3.14803974 -1.01320608
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.39225380 1.04768603
2 0.07415896 1.39225380
3 -1.04269925 0.07415896
4 1.44280495 -1.04269925
5 2.24790415 1.44280495
6 1.03513891 2.24790415
7 -0.56613006 1.03513891
8 -1.76213736 -0.56613006
9 2.28515885 -1.76213736
10 -0.33636379 2.28515885
11 -0.27284584 -0.33636379
12 -1.26543394 -0.27284584
13 -0.44854230 -1.26543394
14 -3.26951819 -0.44854230
15 -1.31605639 -3.26951819
16 -3.40696736 -1.31605639
17 -0.92297026 -3.40696736
18 1.84836570 -0.92297026
19 2.44913891 1.84836570
20 -0.80661729 2.44913891
21 0.26305107 -0.80661729
22 -0.83790157 0.26305107
23 -1.46017903 -0.83790157
24 -0.25013640 -1.46017903
25 -0.24397730 -0.25013640
26 1.13709542 -0.24397730
27 1.72735195 1.13709542
28 2.44651428 1.72735195
29 -1.67206106 2.44651428
30 -1.74784731 -1.67206106
31 0.48625827 -1.74784731
32 0.30735191 0.48625827
33 -0.41444396 0.30735191
34 1.08490330 -0.41444396
35 -1.53213273 1.08490330
36 0.82895610 -1.53213273
37 -0.70173287 0.82895610
38 0.53304823 -0.70173287
39 1.15887031 0.53304823
40 0.90419503 1.15887031
41 2.16361515 0.90419503
42 1.33657376 2.16361515
43 -1.11764959 1.33657376
44 -0.10350516 -1.11764959
45 -0.54692135 -0.10350516
46 -0.74009799 -0.54692135
47 -1.34787689 -0.74009799
48 1.96800198 -1.34787689
49 0.24580262 1.96800198
50 0.02244338 0.24580262
51 0.20324096 0.02244338
52 0.22830637 0.20324096
53 -1.18175055 0.22830637
54 -1.00675177 -1.18175055
55 -0.54694276 -1.00675177
56 -1.47280140 -0.54694276
57 1.83031677 -1.47280140
58 2.36405724 1.83031677
59 0.79908403 2.36405724
60 -2.43237805 0.79908403
61 0.52859488 -2.43237805
62 0.81079543 0.52859488
63 -0.59138610 0.81079543
64 -0.12455885 -0.59138610
65 -0.42966478 -0.12455885
66 0.01453619 -0.42966478
67 0.43997100 0.01453619
68 0.16425949 0.43997100
69 -0.80484675 0.16425949
70 -1.06599074 -0.80484675
71 0.73243143 -1.06599074
72 -1.34145011 0.73243143
73 -0.78017699 -1.34145011
74 -0.27049729 -0.78017699
75 3.56737725 -0.27049729
76 2.83672741 3.56737725
77 -0.55355572 2.83672741
78 0.26701616 -0.55355572
79 0.66856035 0.26701616
80 -1.79092821 0.66856035
81 0.20430114 -1.79092821
82 -0.93101867 0.20430114
83 -1.26753143 -0.93101867
84 -3.37845151 -1.26753143
85 0.74621450 -3.37845151
86 -1.97565697 0.74621450
87 2.24184265 -1.97565697
88 2.19119323 2.24184265
89 -2.59019587 2.19119323
90 -4.14046477 -2.59019587
91 0.28153975 -4.14046477
92 0.04311577 0.28153975
93 0.33569176 0.04311577
94 -0.10863041 0.33569176
95 1.51801246 -0.10863041
96 0.09469235 1.51801246
97 -2.39168704 0.09469235
98 -0.71056528 -2.39168704
99 2.23762624 -0.71056528
100 1.59401791 2.23762624
101 0.37124155 1.59401791
102 0.65993939 0.37124155
103 -2.93740296 0.65993939
104 -0.27291519 -2.93740296
105 0.77268282 -0.27291519
106 -1.99632980 0.77268282
107 -1.34474097 -1.99632980
108 2.81636021 -1.34474097
109 1.73803575 2.81636021
110 -0.55232368 1.73803575
111 0.07991828 -0.55232368
112 0.91251018 0.07991828
113 1.75841860 0.91251018
114 3.62402369 1.75841860
115 -0.07419583 3.62402369
116 0.88713178 -0.07419583
117 -0.97375630 0.88713178
118 -0.07916778 -0.97375630
119 -3.37268091 -0.07916778
120 -0.54695429 -3.37268091
121 0.26856703 -0.54695429
122 -1.76791404 0.26856703
123 1.70756639 -1.76791404
124 -0.01876393 1.70756639
125 -1.36235125 -0.01876393
126 0.91618827 -1.36235125
127 0.53513369 0.91618827
128 -0.54380222 0.53513369
129 -0.78157625 -0.54380222
130 1.27340597 -0.78157625
131 0.91169907 1.27340597
132 2.66494691 0.91169907
133 -1.14254716 2.66494691
134 0.92108155 -1.14254716
135 -0.34422116 0.92108155
136 1.17277176 -0.34422116
137 -2.93418525 1.17277176
138 0.06746345 -2.93418525
139 0.37961055 0.06746345
140 -2.19215741 0.37961055
141 0.08594075 -2.19215741
142 -0.11566483 0.08594075
143 -1.13350711 -0.11566483
144 0.67351671 -1.13350711
145 0.96090057 0.67351671
146 0.96563193 0.96090057
147 -0.12558182 0.96563193
148 -0.22444754 -0.12558182
149 1.50826285 -0.22444754
150 1.97526983 1.50826285
151 0.67919651 1.97526983
152 -0.53546956 0.67919651
153 0.88694857 -0.53546956
154 -1.01320608 0.88694857
155 -3.14803974 -1.01320608
> 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/71jag1324494755.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/8urf11324494755.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/9rpoh1324494755.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/108s321324494755.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/11y6ff1324494755.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/12ambp1324494755.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/13ixv61324494755.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/14t9hu1324494755.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/15ssbm1324494755.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/16jqnb1324494755.tab")
+ }
>
> try(system("convert tmp/170am1324494755.ps tmp/170am1324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/2pi4m1324494755.ps tmp/2pi4m1324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/3u52c1324494755.ps tmp/3u52c1324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/4h37w1324494755.ps tmp/4h37w1324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/5fwm61324494755.ps tmp/5fwm61324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/6nvdb1324494755.ps tmp/6nvdb1324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/71jag1324494755.ps tmp/71jag1324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/8urf11324494755.ps tmp/8urf11324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/9rpoh1324494755.ps tmp/9rpoh1324494755.png",intern=TRUE))
character(0)
> try(system("convert tmp/108s321324494755.ps tmp/108s321324494755.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.440 0.360 5.793