R version 2.13.0 (2011-04-13)
Copyright (C) 2011 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(14
+ ,2
+ ,3
+ ,3
+ ,3
+ ,6
+ ,8
+ ,6
+ ,0
+ ,7
+ ,7
+ ,7
+ ,12
+ ,6
+ ,0
+ ,6
+ ,8
+ ,8
+ ,7
+ ,6
+ ,6
+ ,6
+ ,9
+ ,8
+ ,10
+ ,8
+ ,5
+ ,5
+ ,5
+ ,9
+ ,9
+ ,1
+ ,0
+ ,7
+ ,7
+ ,8
+ ,16
+ ,9
+ ,8
+ ,8
+ ,8
+ ,8
+ ,7
+ ,4
+ ,0
+ ,2
+ ,3
+ ,7
+ ,14
+ ,7
+ ,0
+ ,4
+ ,8
+ ,7
+ ,6
+ ,4
+ ,9
+ ,9
+ ,4
+ ,4
+ ,16
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,11
+ ,5
+ ,6
+ ,6
+ ,4
+ ,7
+ ,17
+ ,7
+ ,5
+ ,5
+ ,8
+ ,5
+ ,12
+ ,5
+ ,4
+ ,4
+ ,8
+ ,8
+ ,7
+ ,6
+ ,0
+ ,2
+ ,2
+ ,5
+ ,13
+ ,5
+ ,0
+ ,4
+ ,9
+ ,4
+ ,9
+ ,2
+ ,2
+ ,2
+ ,2
+ ,9
+ ,15
+ ,9
+ ,6
+ ,6
+ ,8
+ ,8
+ ,7
+ ,4
+ ,0
+ ,4
+ ,8
+ ,4
+ ,9
+ ,4
+ ,4
+ ,4
+ ,4
+ ,6
+ ,7
+ ,5
+ ,5
+ ,5
+ ,5
+ ,6
+ ,14
+ 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ies'
> par1 = '1'
> 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 Goingout Relation Family Friends Job t
1 14 2 3 3 3 6 1
2 8 6 0 7 7 7 2
3 12 6 0 6 8 8 3
4 7 6 6 6 9 8 4
5 10 8 5 5 5 9 5
6 9 1 0 7 7 8 6
7 16 9 8 8 8 8 7
8 7 4 0 2 3 7 8
9 14 7 0 4 8 7 9
10 6 4 9 9 4 4 10
11 16 6 6 6 6 6 11
12 11 5 6 6 4 7 12
13 17 7 5 5 8 5 13
14 12 5 4 4 8 8 14
15 7 6 0 2 2 5 15
16 13 5 0 4 9 4 16
17 9 2 2 2 2 9 17
18 15 9 6 6 8 8 18
19 7 4 0 4 8 4 19
20 9 4 4 4 4 6 20
21 7 5 5 5 5 6 21
22 14 7 7 7 7 7 22
23 15 5 5 5 3 3 23
24 7 9 4 4 4 4 24
25 13 6 6 6 6 6 25
26 17 6 6 6 6 6 26
27 15 3 0 7 9 7 27
28 14 3 1 2 2 5 28
29 14 5 0 6 6 8 29
30 8 5 4 4 4 6 30
31 8 4 4 4 8 4 31
32 12 7 7 7 3 9 32
33 14 6 7 7 7 7 33
34 8 7 0 4 4 4 34
35 11 4 4 4 4 6 35
36 16 5 5 5 8 8 36
37 11 6 0 6 6 6 37
38 8 5 5 5 5 5 38
39 14 0 1 6 6 6 39
40 16 6 2 2 9 6 40
41 14 5 0 6 4 4 41
42 5 3 9 9 7 7 42
43 8 3 3 3 3 9 43
44 10 3 0 4 4 8 44
45 8 7 6 6 6 6 45
46 13 7 1 5 8 6 46
47 15 1 5 5 5 5 47
48 6 5 0 4 4 7 48
49 12 5 0 2 2 5 49
50 14 6 0 6 9 8 50
51 5 2 6 6 6 6 51
52 15 6 7 7 8 8 52
53 11 5 0 5 5 5 53
54 8 2 4 4 4 4 54
55 13 7 5 5 5 5 55
56 14 5 1 5 9 6 56
57 12 3 4 4 4 4 57
58 16 6 9 9 8 6 58
59 10 2 2 2 2 9 59
60 15 8 8 8 8 7 60
61 8 5 3 3 3 3 61
62 16 2 1 6 3 6 62
63 19 6 0 6 6 6 63
64 14 2 6 6 6 6 64
65 7 1 0 5 5 5 65
66 13 5 0 5 5 5 66
67 15 6 6 6 4 5 67
68 7 2 2 2 9 9 68
69 13 6 1 6 6 8 69
70 4 2 5 5 5 5 70
71 14 6 5 5 5 6 71
72 13 5 5 5 3 7 72
73 11 0 5 5 8 5 73
74 14 2 6 6 9 6 74
75 12 4 6 6 6 6 75
76 15 1 0 9 6 6 76
77 14 5 0 5 5 6 77
78 13 5 1 5 3 9 78
79 7 2 7 7 4 7 79
80 5 2 2 2 9 9 80
81 7 7 4 4 4 4 81
82 13 5 0 6 8 8 82
83 13 2 5 5 5 5 83
84 11 5 5 5 5 8 84
85 6 3 3 3 8 9 85
86 12 6 0 6 6 6 86
87 8 1 4 4 9 4 87
88 11 5 9 9 5 7 88
89 12 7 0 8 8 8 89
90 9 2 4 4 3 9 90
91 12 6 2 2 2 9 91
92 13 8 7 7 7 7 92
93 16 7 7 7 7 8 93
94 16 6 6 6 4 4 94
95 11 7 0 5 5 6 95
96 8 4 5 5 9 7 96
97 4 5 6 6 6 6 97
98 7 2 0 3 3 7 98
99 14 5 5 5 5 5 99
100 11 2 9 9 2 9 100
101 17 5 0 7 7 7 101
102 15 7 7 7 7 7 102
103 14 5 1 6 6 6 103
104 5 8 3 3 8 6 104
105 4 2 7 7 9 9 105
106 19 8 8 8 8 9 106
107 11 3 0 3 3 8 107
108 15 2 5 5 5 8 108
109 10 3 3 3 3 3 109
110 9 5 0 4 4 6 110
111 12 2 5 5 5 5 111
112 15 2 7 7 9 7 112
113 7 6 0 6 6 6 113
114 13 2 0 7 7 7 114
115 14 7 0 9 7 7 115
116 14 6 6 6 6 6 116
117 14 2 0 6 3 8 117
118 8 2 6 6 9 9 118
119 15 5 6 6 6 6 119
120 15 6 2 2 2 9 120
121 9 4 5 5 5 5 121
122 16 5 0 5 5 6 122
123 9 7 4 4 9 4 123
124 15 6 0 7 7 7 124
125 15 6 6 6 6 6 125
126 6 5 5 5 8 8 126
127 8 2 8 8 8 8 127
128 15 6 6 6 6 9 128
129 10 3 5 5 3 8 129
130 9 2 0 4 4 4 130
131 14 8 8 8 9 6 131
132 12 6 0 6 6 6 132
133 8 4 9 9 4 7 133
134 11 6 5 5 5 9 134
135 13 5 0 6 6 8 135
136 9 4 0 4 4 4 136
137 15 2 0 6 6 6 137
138 13 3 3 3 3 9 138
139 15 6 6 6 6 6 139
140 14 5 0 5 5 5 140
141 16 4 4 4 9 8 141
142 12 6 6 6 6 6 142
143 14 1 0 5 9 6 143
144 10 5 4 4 3 6 144
145 10 2 7 7 7 7 145
146 4 6 0 6 6 7 146
147 8 5 5 5 5 9 147
148 17 2 6 6 6 6 148
149 16 6 6 6 9 6 149
150 12 8 8 8 8 6 150
151 12 7 2 2 4 4 151
152 15 7 7 7 7 7 152
153 9 9 0 4 4 8 153
154 13 2 0 6 8 7 154
155 14 6 5 5 5 9 155
156 11 5 0 2 9 6 156
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Goingout Relation Family Friends Job
7.094770 0.318908 -0.124223 0.524420 0.062418 -0.013376
t
0.004759
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.1304 -2.3301 0.5571 2.4368 6.2512
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.094770 1.524217 4.655 7.12e-06 ***
Goingout 0.318908 0.131488 2.425 0.01649 *
Relation -0.124223 0.103833 -1.196 0.23345
Family 0.524420 0.184181 2.847 0.00503 **
Friends 0.062418 0.138570 0.450 0.65305
Job -0.013376 0.174313 -0.077 0.93894
t 0.004759 0.006037 0.788 0.43173
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.356 on 149 degrees of freedom
Multiple R-squared: 0.1129, Adjusted R-squared: 0.07722
F-statistic: 3.162 on 6 and 149 DF, p-value: 0.006004
> 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.9471933 0.10561335 0.05280667
[2,] 0.9569045 0.08619107 0.04309554
[3,] 0.9206979 0.15860422 0.07930211
[4,] 0.8824925 0.23501494 0.11750747
[5,] 0.8317874 0.33642527 0.16821264
[6,] 0.8336377 0.33272467 0.16636233
[7,] 0.7723372 0.45532567 0.22766283
[8,] 0.7024497 0.59510069 0.29755035
[9,] 0.6325403 0.73491941 0.36745970
[10,] 0.6829099 0.63418025 0.31709012
[11,] 0.6082753 0.78344945 0.39172472
[12,] 0.5917435 0.81651296 0.40825648
[13,] 0.5567150 0.88657000 0.44328500
[14,] 0.6467210 0.70655796 0.35327898
[15,] 0.7056134 0.58877315 0.29438658
[16,] 0.6551071 0.68978586 0.34489293
[17,] 0.7217081 0.55658370 0.27829185
[18,] 0.7086695 0.58266101 0.29133050
[19,] 0.7334036 0.53319281 0.26659640
[20,] 0.6886347 0.62273066 0.31136533
[21,] 0.7125176 0.57496478 0.28748239
[22,] 0.7562363 0.48752731 0.24376366
[23,] 0.7083192 0.58336153 0.29168077
[24,] 0.6560955 0.68780908 0.34390454
[25,] 0.6420518 0.71589631 0.35794816
[26,] 0.5854020 0.82919597 0.41459799
[27,] 0.5639563 0.87208735 0.43604367
[28,] 0.5112568 0.97748632 0.48874316
[29,] 0.5248227 0.95035469 0.47517734
[30,] 0.5033379 0.99332424 0.49666212
[31,] 0.5029330 0.99413407 0.49706704
[32,] 0.4950232 0.99004632 0.50497684
[33,] 0.7352439 0.52951226 0.26475613
[34,] 0.7198731 0.56025375 0.28012688
[35,] 0.6752801 0.64943977 0.32471989
[36,] 0.7040339 0.59193228 0.29596614
[37,] 0.6568998 0.68620031 0.34310016
[38,] 0.6931009 0.61379829 0.30689914
[39,] 0.7412660 0.51746796 0.25873398
[40,] 0.7145015 0.57099706 0.28549853
[41,] 0.6727292 0.65454169 0.32727085
[42,] 0.7674943 0.46501139 0.23250569
[43,] 0.7459303 0.50813938 0.25406969
[44,] 0.7056164 0.58876712 0.29438356
[45,] 0.6767979 0.64640429 0.32320214
[46,] 0.6367180 0.72656400 0.36328200
[47,] 0.5993524 0.80129520 0.40064760
[48,] 0.5621686 0.87566276 0.43783138
[49,] 0.5463336 0.90733273 0.45366637
[50,] 0.4993607 0.99872135 0.50063932
[51,] 0.4565071 0.91301418 0.54349291
[52,] 0.4350661 0.87013211 0.56493395
[53,] 0.5092440 0.98151210 0.49075605
[54,] 0.6172190 0.76556207 0.38278104
[55,] 0.6002774 0.79944524 0.39972262
[56,] 0.6197038 0.76059247 0.38029624
[57,] 0.5771881 0.84562389 0.42281194
[58,] 0.5650772 0.86984564 0.43492282
[59,] 0.5900209 0.81995822 0.40997911
[60,] 0.5456257 0.90874867 0.45437433
[61,] 0.6700345 0.65993094 0.32996547
[62,] 0.6451900 0.70962001 0.35481000
[63,] 0.6112897 0.77742068 0.38871034
[64,] 0.5694280 0.86114405 0.43057202
[65,] 0.5604697 0.87906067 0.43953033
[66,] 0.5169670 0.96606595 0.48303297
[67,] 0.4910588 0.98211761 0.50894120
[68,] 0.4644254 0.92885072 0.53557464
[69,] 0.4265667 0.85313333 0.57343334
[70,] 0.4494975 0.89899499 0.55050250
[71,] 0.4907604 0.98152087 0.50923956
[72,] 0.5303852 0.93922963 0.46961482
[73,] 0.4908055 0.98161095 0.50919453
[74,] 0.4721876 0.94437523 0.52781238
[75,] 0.4262270 0.85245404 0.57377298
[76,] 0.4373959 0.87479176 0.56260412
[77,] 0.3954111 0.79082217 0.60458892
[78,] 0.3619062 0.72381248 0.63809376
[79,] 0.3310527 0.66210544 0.66894728
[80,] 0.3051892 0.61037846 0.69481077
[81,] 0.2673109 0.53462183 0.73268909
[82,] 0.2395415 0.47908309 0.76045845
[83,] 0.2040820 0.40816406 0.79591797
[84,] 0.2036236 0.40724720 0.79637640
[85,] 0.2190893 0.43817852 0.78091074
[86,] 0.1908729 0.38174577 0.80912712
[87,] 0.1827099 0.36541981 0.81729010
[88,] 0.3339195 0.66783910 0.66608045
[89,] 0.3259331 0.65186617 0.67406692
[90,] 0.3061534 0.61230681 0.69384659
[91,] 0.2712629 0.54252582 0.72873709
[92,] 0.2911227 0.58224533 0.70887733
[93,] 0.2709263 0.54185269 0.72907366
[94,] 0.2452076 0.49041511 0.75479245
[95,] 0.3517612 0.70352235 0.64823883
[96,] 0.5913300 0.81733996 0.40866998
[97,] 0.6734630 0.65307394 0.32653697
[98,] 0.6272684 0.74546324 0.37273162
[99,] 0.6425550 0.71489003 0.35744502
[100,] 0.5948255 0.81034905 0.40517452
[101,] 0.5720035 0.85599300 0.42799650
[102,] 0.5231725 0.95365509 0.47682755
[103,] 0.5124170 0.97516607 0.48758303
[104,] 0.6062962 0.78740755 0.39370378
[105,] 0.5535825 0.89283497 0.44641748
[106,] 0.5020681 0.99586377 0.49793188
[107,] 0.4630008 0.92600155 0.53699923
[108,] 0.4387115 0.87742309 0.56128846
[109,] 0.4592310 0.91846197 0.54076902
[110,] 0.4481186 0.89623729 0.55188136
[111,] 0.4895175 0.97903492 0.51048254
[112,] 0.4541141 0.90822827 0.54588586
[113,] 0.5124042 0.97519154 0.48759577
[114,] 0.5275719 0.94485617 0.47242809
[115,] 0.5381268 0.92374634 0.46187317
[116,] 0.5405388 0.91892238 0.45946119
[117,] 0.7177433 0.56451341 0.28225671
[118,] 0.8286593 0.34268139 0.17134070
[119,] 0.8088730 0.38225408 0.19112704
[120,] 0.7620835 0.47583292 0.23791646
[121,] 0.7453191 0.50936173 0.25468086
[122,] 0.6830555 0.63388893 0.31694447
[123,] 0.6214287 0.75714262 0.37857131
[124,] 0.6676436 0.66471274 0.33235637
[125,] 0.6069331 0.78613373 0.39306687
[126,] 0.5633897 0.87322056 0.43661028
[127,] 0.5487238 0.90255239 0.45127620
[128,] 0.5404336 0.91913287 0.45956644
[129,] 0.4829439 0.96588789 0.51705606
[130,] 0.4321147 0.86422948 0.56788526
[131,] 0.5559360 0.88812809 0.44406405
[132,] 0.6158259 0.76834824 0.38417412
[133,] 0.5371301 0.92573983 0.46286992
[134,] 0.7853922 0.42921553 0.21460776
[135,] 0.6852532 0.62949359 0.31474679
[136,] 0.6628561 0.67428785 0.33714393
[137,] 0.5674292 0.86514168 0.43257084
> postscript(file="/var/wessaorg/rcomp/tmp/1vk421321988951.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/wessaorg/rcomp/tmp/2s7mq1321988951.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/wessaorg/rcomp/tmp/3iquy1321988951.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/wessaorg/rcomp/tmp/4ynp71321988951.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/wessaorg/rcomp/tmp/5nk211321988951.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
4.95506552 -5.03196986 -0.56135030 -4.88319056 -1.86252001 -2.44309132
7 8 9 10 11 12
2.40783149 -2.55093553 2.12665199 -6.21593768 4.24399706 -0.30364243
13 14 15 16 17 18
5.17755686 1.25093928 -3.18639915 1.62860758 0.38166378 2.15587661
19 20 21 22 23 24
-4.00434410 -1.23578837 -4.02207071 1.42349986 4.05311843 -4.87611584
25 26 27 28 29 30
1.17736966 5.17261056 2.68094021 4.83267862 1.75865658 -2.60228713
31 32 33 34 35 36
-2.56456217 -0.34766745 1.69005752 -3.78278245 0.69282513 4.74604147
37 38 39 40 41 42
-1.62507623 -3.11635153 3.40307492 5.51952003 1.77287859 -7.19644631
43 44 45 46 47 48
-1.52359605 -0.50123788 -4.23672010 0.53699156 5.11644762 -5.17146594
49 50 51 52 53 54
1.97069922 1.15255414 -5.67073589 2.55059289 -0.80885194 -1.78653450
55 56 57 58 59 60
1.16492825 2.06479823 1.88028044 2.69489081 1.18178158 1.46113083
61 62 63 64 65 66
-2.32733214 4.84305368 6.25118717 3.26739582 -3.59033009 1.12927976
67 68 69 70 71 72
3.08894706 -2.29797534 0.37360761 -6.31191944 2.42106654 1.87342705
73 74 75 76 77 78
1.12436520 3.03255124 0.57723019 2.21059650 2.09030579 1.37473357
79 80 81 82 83 84
-4.06597644 -4.35508454 -4.50956901 0.38158857 2.62621226 -0.29514174
85 86 87 88 89 90
-4.03556755 -0.85827213 -1.93676634 -1.92834471 -2.33838144 -0.82856360
91 92 93 94 95 96
1.75385934 -0.22854490 3.09897989 3.94707523 -1.63317354 -3.29639075
97 98 99 100 101 102
-7.84637777 -2.86585939 2.59334337 -0.81472479 3.81578701 2.04277187
103 104 105 106 107 108
1.50395372 -6.76065764 -7.47505009 5.26896449 0.78577708 4.54736315
109 110 111 112 113 114
0.08204659 -2.47990626 1.49295746 3.46488396 -5.98676783 0.71064200
115 116 117 118 119 120
-0.93749670 1.74429157 2.48383266 -3.13672077 3.04892203 4.61584544
121 122 123 124 125 126
-2.19244906 3.87614629 -3.02154051 1.38741995 2.70145967 -5.68227752
127 128 129 130 131 132
-3.93090616 2.72731076 -0.74664999 -1.64511722 0.04744075 -1.07719072
133 134 135 136 137 138
-4.76117858 -0.83862837 0.25419199 -2.31148735 3.17464483 3.02428946
139 140 141 142 143 144
2.63483227 1.77710636 4.90302350 -0.37944503 2.80216480 -1.08240666
145 146 147 148 149 150
-1.56733062 -9.13044199 -3.58158891 5.86763142 3.39998769 -1.98056429
151 152 153 154 155 156
0.95768922 1.80481687 -3.93342634 0.98228054 2.06143053 0.03792663
> postscript(file="/var/wessaorg/rcomp/tmp/69b4h1321988951.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 4.95506552 NA
1 -5.03196986 4.95506552
2 -0.56135030 -5.03196986
3 -4.88319056 -0.56135030
4 -1.86252001 -4.88319056
5 -2.44309132 -1.86252001
6 2.40783149 -2.44309132
7 -2.55093553 2.40783149
8 2.12665199 -2.55093553
9 -6.21593768 2.12665199
10 4.24399706 -6.21593768
11 -0.30364243 4.24399706
12 5.17755686 -0.30364243
13 1.25093928 5.17755686
14 -3.18639915 1.25093928
15 1.62860758 -3.18639915
16 0.38166378 1.62860758
17 2.15587661 0.38166378
18 -4.00434410 2.15587661
19 -1.23578837 -4.00434410
20 -4.02207071 -1.23578837
21 1.42349986 -4.02207071
22 4.05311843 1.42349986
23 -4.87611584 4.05311843
24 1.17736966 -4.87611584
25 5.17261056 1.17736966
26 2.68094021 5.17261056
27 4.83267862 2.68094021
28 1.75865658 4.83267862
29 -2.60228713 1.75865658
30 -2.56456217 -2.60228713
31 -0.34766745 -2.56456217
32 1.69005752 -0.34766745
33 -3.78278245 1.69005752
34 0.69282513 -3.78278245
35 4.74604147 0.69282513
36 -1.62507623 4.74604147
37 -3.11635153 -1.62507623
38 3.40307492 -3.11635153
39 5.51952003 3.40307492
40 1.77287859 5.51952003
41 -7.19644631 1.77287859
42 -1.52359605 -7.19644631
43 -0.50123788 -1.52359605
44 -4.23672010 -0.50123788
45 0.53699156 -4.23672010
46 5.11644762 0.53699156
47 -5.17146594 5.11644762
48 1.97069922 -5.17146594
49 1.15255414 1.97069922
50 -5.67073589 1.15255414
51 2.55059289 -5.67073589
52 -0.80885194 2.55059289
53 -1.78653450 -0.80885194
54 1.16492825 -1.78653450
55 2.06479823 1.16492825
56 1.88028044 2.06479823
57 2.69489081 1.88028044
58 1.18178158 2.69489081
59 1.46113083 1.18178158
60 -2.32733214 1.46113083
61 4.84305368 -2.32733214
62 6.25118717 4.84305368
63 3.26739582 6.25118717
64 -3.59033009 3.26739582
65 1.12927976 -3.59033009
66 3.08894706 1.12927976
67 -2.29797534 3.08894706
68 0.37360761 -2.29797534
69 -6.31191944 0.37360761
70 2.42106654 -6.31191944
71 1.87342705 2.42106654
72 1.12436520 1.87342705
73 3.03255124 1.12436520
74 0.57723019 3.03255124
75 2.21059650 0.57723019
76 2.09030579 2.21059650
77 1.37473357 2.09030579
78 -4.06597644 1.37473357
79 -4.35508454 -4.06597644
80 -4.50956901 -4.35508454
81 0.38158857 -4.50956901
82 2.62621226 0.38158857
83 -0.29514174 2.62621226
84 -4.03556755 -0.29514174
85 -0.85827213 -4.03556755
86 -1.93676634 -0.85827213
87 -1.92834471 -1.93676634
88 -2.33838144 -1.92834471
89 -0.82856360 -2.33838144
90 1.75385934 -0.82856360
91 -0.22854490 1.75385934
92 3.09897989 -0.22854490
93 3.94707523 3.09897989
94 -1.63317354 3.94707523
95 -3.29639075 -1.63317354
96 -7.84637777 -3.29639075
97 -2.86585939 -7.84637777
98 2.59334337 -2.86585939
99 -0.81472479 2.59334337
100 3.81578701 -0.81472479
101 2.04277187 3.81578701
102 1.50395372 2.04277187
103 -6.76065764 1.50395372
104 -7.47505009 -6.76065764
105 5.26896449 -7.47505009
106 0.78577708 5.26896449
107 4.54736315 0.78577708
108 0.08204659 4.54736315
109 -2.47990626 0.08204659
110 1.49295746 -2.47990626
111 3.46488396 1.49295746
112 -5.98676783 3.46488396
113 0.71064200 -5.98676783
114 -0.93749670 0.71064200
115 1.74429157 -0.93749670
116 2.48383266 1.74429157
117 -3.13672077 2.48383266
118 3.04892203 -3.13672077
119 4.61584544 3.04892203
120 -2.19244906 4.61584544
121 3.87614629 -2.19244906
122 -3.02154051 3.87614629
123 1.38741995 -3.02154051
124 2.70145967 1.38741995
125 -5.68227752 2.70145967
126 -3.93090616 -5.68227752
127 2.72731076 -3.93090616
128 -0.74664999 2.72731076
129 -1.64511722 -0.74664999
130 0.04744075 -1.64511722
131 -1.07719072 0.04744075
132 -4.76117858 -1.07719072
133 -0.83862837 -4.76117858
134 0.25419199 -0.83862837
135 -2.31148735 0.25419199
136 3.17464483 -2.31148735
137 3.02428946 3.17464483
138 2.63483227 3.02428946
139 1.77710636 2.63483227
140 4.90302350 1.77710636
141 -0.37944503 4.90302350
142 2.80216480 -0.37944503
143 -1.08240666 2.80216480
144 -1.56733062 -1.08240666
145 -9.13044199 -1.56733062
146 -3.58158891 -9.13044199
147 5.86763142 -3.58158891
148 3.39998769 5.86763142
149 -1.98056429 3.39998769
150 0.95768922 -1.98056429
151 1.80481687 0.95768922
152 -3.93342634 1.80481687
153 0.98228054 -3.93342634
154 2.06143053 0.98228054
155 0.03792663 2.06143053
156 NA 0.03792663
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -5.03196986 4.95506552
[2,] -0.56135030 -5.03196986
[3,] -4.88319056 -0.56135030
[4,] -1.86252001 -4.88319056
[5,] -2.44309132 -1.86252001
[6,] 2.40783149 -2.44309132
[7,] -2.55093553 2.40783149
[8,] 2.12665199 -2.55093553
[9,] -6.21593768 2.12665199
[10,] 4.24399706 -6.21593768
[11,] -0.30364243 4.24399706
[12,] 5.17755686 -0.30364243
[13,] 1.25093928 5.17755686
[14,] -3.18639915 1.25093928
[15,] 1.62860758 -3.18639915
[16,] 0.38166378 1.62860758
[17,] 2.15587661 0.38166378
[18,] -4.00434410 2.15587661
[19,] -1.23578837 -4.00434410
[20,] -4.02207071 -1.23578837
[21,] 1.42349986 -4.02207071
[22,] 4.05311843 1.42349986
[23,] -4.87611584 4.05311843
[24,] 1.17736966 -4.87611584
[25,] 5.17261056 1.17736966
[26,] 2.68094021 5.17261056
[27,] 4.83267862 2.68094021
[28,] 1.75865658 4.83267862
[29,] -2.60228713 1.75865658
[30,] -2.56456217 -2.60228713
[31,] -0.34766745 -2.56456217
[32,] 1.69005752 -0.34766745
[33,] -3.78278245 1.69005752
[34,] 0.69282513 -3.78278245
[35,] 4.74604147 0.69282513
[36,] -1.62507623 4.74604147
[37,] -3.11635153 -1.62507623
[38,] 3.40307492 -3.11635153
[39,] 5.51952003 3.40307492
[40,] 1.77287859 5.51952003
[41,] -7.19644631 1.77287859
[42,] -1.52359605 -7.19644631
[43,] -0.50123788 -1.52359605
[44,] -4.23672010 -0.50123788
[45,] 0.53699156 -4.23672010
[46,] 5.11644762 0.53699156
[47,] -5.17146594 5.11644762
[48,] 1.97069922 -5.17146594
[49,] 1.15255414 1.97069922
[50,] -5.67073589 1.15255414
[51,] 2.55059289 -5.67073589
[52,] -0.80885194 2.55059289
[53,] -1.78653450 -0.80885194
[54,] 1.16492825 -1.78653450
[55,] 2.06479823 1.16492825
[56,] 1.88028044 2.06479823
[57,] 2.69489081 1.88028044
[58,] 1.18178158 2.69489081
[59,] 1.46113083 1.18178158
[60,] -2.32733214 1.46113083
[61,] 4.84305368 -2.32733214
[62,] 6.25118717 4.84305368
[63,] 3.26739582 6.25118717
[64,] -3.59033009 3.26739582
[65,] 1.12927976 -3.59033009
[66,] 3.08894706 1.12927976
[67,] -2.29797534 3.08894706
[68,] 0.37360761 -2.29797534
[69,] -6.31191944 0.37360761
[70,] 2.42106654 -6.31191944
[71,] 1.87342705 2.42106654
[72,] 1.12436520 1.87342705
[73,] 3.03255124 1.12436520
[74,] 0.57723019 3.03255124
[75,] 2.21059650 0.57723019
[76,] 2.09030579 2.21059650
[77,] 1.37473357 2.09030579
[78,] -4.06597644 1.37473357
[79,] -4.35508454 -4.06597644
[80,] -4.50956901 -4.35508454
[81,] 0.38158857 -4.50956901
[82,] 2.62621226 0.38158857
[83,] -0.29514174 2.62621226
[84,] -4.03556755 -0.29514174
[85,] -0.85827213 -4.03556755
[86,] -1.93676634 -0.85827213
[87,] -1.92834471 -1.93676634
[88,] -2.33838144 -1.92834471
[89,] -0.82856360 -2.33838144
[90,] 1.75385934 -0.82856360
[91,] -0.22854490 1.75385934
[92,] 3.09897989 -0.22854490
[93,] 3.94707523 3.09897989
[94,] -1.63317354 3.94707523
[95,] -3.29639075 -1.63317354
[96,] -7.84637777 -3.29639075
[97,] -2.86585939 -7.84637777
[98,] 2.59334337 -2.86585939
[99,] -0.81472479 2.59334337
[100,] 3.81578701 -0.81472479
[101,] 2.04277187 3.81578701
[102,] 1.50395372 2.04277187
[103,] -6.76065764 1.50395372
[104,] -7.47505009 -6.76065764
[105,] 5.26896449 -7.47505009
[106,] 0.78577708 5.26896449
[107,] 4.54736315 0.78577708
[108,] 0.08204659 4.54736315
[109,] -2.47990626 0.08204659
[110,] 1.49295746 -2.47990626
[111,] 3.46488396 1.49295746
[112,] -5.98676783 3.46488396
[113,] 0.71064200 -5.98676783
[114,] -0.93749670 0.71064200
[115,] 1.74429157 -0.93749670
[116,] 2.48383266 1.74429157
[117,] -3.13672077 2.48383266
[118,] 3.04892203 -3.13672077
[119,] 4.61584544 3.04892203
[120,] -2.19244906 4.61584544
[121,] 3.87614629 -2.19244906
[122,] -3.02154051 3.87614629
[123,] 1.38741995 -3.02154051
[124,] 2.70145967 1.38741995
[125,] -5.68227752 2.70145967
[126,] -3.93090616 -5.68227752
[127,] 2.72731076 -3.93090616
[128,] -0.74664999 2.72731076
[129,] -1.64511722 -0.74664999
[130,] 0.04744075 -1.64511722
[131,] -1.07719072 0.04744075
[132,] -4.76117858 -1.07719072
[133,] -0.83862837 -4.76117858
[134,] 0.25419199 -0.83862837
[135,] -2.31148735 0.25419199
[136,] 3.17464483 -2.31148735
[137,] 3.02428946 3.17464483
[138,] 2.63483227 3.02428946
[139,] 1.77710636 2.63483227
[140,] 4.90302350 1.77710636
[141,] -0.37944503 4.90302350
[142,] 2.80216480 -0.37944503
[143,] -1.08240666 2.80216480
[144,] -1.56733062 -1.08240666
[145,] -9.13044199 -1.56733062
[146,] -3.58158891 -9.13044199
[147,] 5.86763142 -3.58158891
[148,] 3.39998769 5.86763142
[149,] -1.98056429 3.39998769
[150,] 0.95768922 -1.98056429
[151,] 1.80481687 0.95768922
[152,] -3.93342634 1.80481687
[153,] 0.98228054 -3.93342634
[154,] 2.06143053 0.98228054
[155,] 0.03792663 2.06143053
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -5.03196986 4.95506552
2 -0.56135030 -5.03196986
3 -4.88319056 -0.56135030
4 -1.86252001 -4.88319056
5 -2.44309132 -1.86252001
6 2.40783149 -2.44309132
7 -2.55093553 2.40783149
8 2.12665199 -2.55093553
9 -6.21593768 2.12665199
10 4.24399706 -6.21593768
11 -0.30364243 4.24399706
12 5.17755686 -0.30364243
13 1.25093928 5.17755686
14 -3.18639915 1.25093928
15 1.62860758 -3.18639915
16 0.38166378 1.62860758
17 2.15587661 0.38166378
18 -4.00434410 2.15587661
19 -1.23578837 -4.00434410
20 -4.02207071 -1.23578837
21 1.42349986 -4.02207071
22 4.05311843 1.42349986
23 -4.87611584 4.05311843
24 1.17736966 -4.87611584
25 5.17261056 1.17736966
26 2.68094021 5.17261056
27 4.83267862 2.68094021
28 1.75865658 4.83267862
29 -2.60228713 1.75865658
30 -2.56456217 -2.60228713
31 -0.34766745 -2.56456217
32 1.69005752 -0.34766745
33 -3.78278245 1.69005752
34 0.69282513 -3.78278245
35 4.74604147 0.69282513
36 -1.62507623 4.74604147
37 -3.11635153 -1.62507623
38 3.40307492 -3.11635153
39 5.51952003 3.40307492
40 1.77287859 5.51952003
41 -7.19644631 1.77287859
42 -1.52359605 -7.19644631
43 -0.50123788 -1.52359605
44 -4.23672010 -0.50123788
45 0.53699156 -4.23672010
46 5.11644762 0.53699156
47 -5.17146594 5.11644762
48 1.97069922 -5.17146594
49 1.15255414 1.97069922
50 -5.67073589 1.15255414
51 2.55059289 -5.67073589
52 -0.80885194 2.55059289
53 -1.78653450 -0.80885194
54 1.16492825 -1.78653450
55 2.06479823 1.16492825
56 1.88028044 2.06479823
57 2.69489081 1.88028044
58 1.18178158 2.69489081
59 1.46113083 1.18178158
60 -2.32733214 1.46113083
61 4.84305368 -2.32733214
62 6.25118717 4.84305368
63 3.26739582 6.25118717
64 -3.59033009 3.26739582
65 1.12927976 -3.59033009
66 3.08894706 1.12927976
67 -2.29797534 3.08894706
68 0.37360761 -2.29797534
69 -6.31191944 0.37360761
70 2.42106654 -6.31191944
71 1.87342705 2.42106654
72 1.12436520 1.87342705
73 3.03255124 1.12436520
74 0.57723019 3.03255124
75 2.21059650 0.57723019
76 2.09030579 2.21059650
77 1.37473357 2.09030579
78 -4.06597644 1.37473357
79 -4.35508454 -4.06597644
80 -4.50956901 -4.35508454
81 0.38158857 -4.50956901
82 2.62621226 0.38158857
83 -0.29514174 2.62621226
84 -4.03556755 -0.29514174
85 -0.85827213 -4.03556755
86 -1.93676634 -0.85827213
87 -1.92834471 -1.93676634
88 -2.33838144 -1.92834471
89 -0.82856360 -2.33838144
90 1.75385934 -0.82856360
91 -0.22854490 1.75385934
92 3.09897989 -0.22854490
93 3.94707523 3.09897989
94 -1.63317354 3.94707523
95 -3.29639075 -1.63317354
96 -7.84637777 -3.29639075
97 -2.86585939 -7.84637777
98 2.59334337 -2.86585939
99 -0.81472479 2.59334337
100 3.81578701 -0.81472479
101 2.04277187 3.81578701
102 1.50395372 2.04277187
103 -6.76065764 1.50395372
104 -7.47505009 -6.76065764
105 5.26896449 -7.47505009
106 0.78577708 5.26896449
107 4.54736315 0.78577708
108 0.08204659 4.54736315
109 -2.47990626 0.08204659
110 1.49295746 -2.47990626
111 3.46488396 1.49295746
112 -5.98676783 3.46488396
113 0.71064200 -5.98676783
114 -0.93749670 0.71064200
115 1.74429157 -0.93749670
116 2.48383266 1.74429157
117 -3.13672077 2.48383266
118 3.04892203 -3.13672077
119 4.61584544 3.04892203
120 -2.19244906 4.61584544
121 3.87614629 -2.19244906
122 -3.02154051 3.87614629
123 1.38741995 -3.02154051
124 2.70145967 1.38741995
125 -5.68227752 2.70145967
126 -3.93090616 -5.68227752
127 2.72731076 -3.93090616
128 -0.74664999 2.72731076
129 -1.64511722 -0.74664999
130 0.04744075 -1.64511722
131 -1.07719072 0.04744075
132 -4.76117858 -1.07719072
133 -0.83862837 -4.76117858
134 0.25419199 -0.83862837
135 -2.31148735 0.25419199
136 3.17464483 -2.31148735
137 3.02428946 3.17464483
138 2.63483227 3.02428946
139 1.77710636 2.63483227
140 4.90302350 1.77710636
141 -0.37944503 4.90302350
142 2.80216480 -0.37944503
143 -1.08240666 2.80216480
144 -1.56733062 -1.08240666
145 -9.13044199 -1.56733062
146 -3.58158891 -9.13044199
147 5.86763142 -3.58158891
148 3.39998769 5.86763142
149 -1.98056429 3.39998769
150 0.95768922 -1.98056429
151 1.80481687 0.95768922
152 -3.93342634 1.80481687
153 0.98228054 -3.93342634
154 2.06143053 0.98228054
155 0.03792663 2.06143053
> 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/wessaorg/rcomp/tmp/7qf7x1321988951.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/wessaorg/rcomp/tmp/88ec31321988951.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/wessaorg/rcomp/tmp/9yg6r1321988951.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/wessaorg/rcomp/tmp/10nth61321988951.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11jc4i1321988951.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/wessaorg/rcomp/tmp/12zupn1321988951.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/wessaorg/rcomp/tmp/13frpo1321988951.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/wessaorg/rcomp/tmp/143t5u1321988951.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/wessaorg/rcomp/tmp/158drh1321988951.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/wessaorg/rcomp/tmp/16r3lq1321988951.tab")
+ }
>
> try(system("convert tmp/1vk421321988951.ps tmp/1vk421321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/2s7mq1321988951.ps tmp/2s7mq1321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/3iquy1321988951.ps tmp/3iquy1321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ynp71321988951.ps tmp/4ynp71321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/5nk211321988951.ps tmp/5nk211321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/69b4h1321988951.ps tmp/69b4h1321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/7qf7x1321988951.ps tmp/7qf7x1321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/88ec31321988951.ps tmp/88ec31321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/9yg6r1321988951.ps tmp/9yg6r1321988951.png",intern=TRUE))
character(0)
> try(system("convert tmp/10nth61321988951.ps tmp/10nth61321988951.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.876 0.550 5.465