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
+ ,3
+ ,2
+ ,3
+ ,3
+ ,7
+ ,8
+ ,5
+ ,6
+ ,0
+ ,7
+ ,2
+ ,12
+ ,6
+ ,6
+ ,0
+ ,6
+ ,3
+ ,7
+ ,6
+ ,6
+ ,6
+ ,6
+ ,8
+ ,10
+ ,7
+ ,8
+ ,5
+ ,5
+ ,7
+ ,9
+ ,3
+ ,1
+ ,0
+ ,7
+ ,7
+ ,16
+ ,8
+ ,9
+ ,8
+ ,8
+ ,9
+ ,7
+ ,4
+ ,4
+ ,0
+ ,2
+ ,2
+ ,14
+ ,7
+ ,7
+ ,0
+ ,4
+ ,4
+ ,6
+ ,4
+ ,4
+ ,9
+ ,9
+ ,4
+ ,16
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,11
+ ,6
+ ,5
+ ,6
+ ,6
+ ,4
+ ,17
+ ,7
+ ,7
+ ,5
+ ,5
+ ,9
+ ,12
+ ,4
+ ,5
+ ,4
+ ,4
+ ,8
+ ,7
+ ,6
+ ,6
+ ,0
+ ,2
+ ,7
+ ,13
+ ,5
+ ,5
+ ,0
+ ,4
+ ,4
+ ,9
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,15
+ ,9
+ ,9
+ ,6
+ ,6
+ ,8
+ ,7
+ ,4
+ ,4
+ ,0
+ ,4
+ ,4
+ ,9
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,7
+ ,2
+ ,5
+ ,5
+ ,5
+ ,2
+ ,14
+ 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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
Sport Schoolprestaties Goingout Relation Family Coach t
1 3 14 2 3 3 7 1
2 5 8 6 0 7 2 2
3 6 12 6 0 6 3 3
4 6 7 6 6 6 8 4
5 7 10 8 5 5 7 5
6 3 9 1 0 7 7 6
7 8 16 9 8 8 9 7
8 4 7 4 0 2 2 8
9 7 14 7 0 4 4 9
10 4 6 4 9 9 4 10
11 6 16 6 6 6 6 11
12 6 11 5 6 6 4 12
13 7 17 7 5 5 9 13
14 4 12 5 4 4 8 14
15 6 7 6 0 2 7 15
16 5 13 5 0 4 4 16
17 0 9 2 2 2 2 17
18 9 15 9 6 6 8 18
19 4 7 4 0 4 4 19
20 4 9 4 4 4 4 20
21 2 7 5 5 5 2 21
22 7 14 7 7 7 9 22
23 5 15 5 5 5 3 23
24 9 7 9 4 4 4 24
25 6 13 6 6 6 6 25
26 6 17 6 6 6 6 26
27 7 15 3 0 7 7 27
28 3 14 3 1 2 2 28
29 6 14 5 0 6 6 29
30 6 8 5 4 4 4 30
31 4 8 4 4 4 2 31
32 7 12 7 7 7 9 32
33 7 14 6 7 7 7 33
34 7 8 7 0 4 4 34
35 4 11 4 4 4 4 35
36 5 16 5 5 5 7 36
37 6 11 6 0 6 6 37
38 5 8 5 5 5 5 38
39 6 14 0 1 6 6 39
40 6 16 6 2 2 2 40
41 6 14 5 0 6 2 41
42 3 5 3 9 9 7 42
43 3 8 3 3 3 3 43
44 3 10 3 0 4 4 44
45 6 8 7 6 6 6 45
46 7 13 7 1 5 5 46
47 5 15 1 5 5 7 47
48 5 6 5 0 4 4 48
49 5 12 5 0 2 2 49
50 6 14 6 0 6 6 50
51 6 5 2 6 6 9 51
52 6 15 6 7 7 8 52
53 5 11 5 0 5 5 53
54 4 8 2 4 4 4 54
55 7 13 7 5 5 2 55
56 5 14 5 1 5 9 56
57 3 12 3 4 4 4 57
58 6 16 6 9 9 6 58
59 2 10 2 2 2 2 59
60 8 15 8 8 8 8 60
61 3 8 5 3 3 3 61
62 0 16 2 1 6 3 62
63 6 19 6 0 6 7 63
64 8 14 2 6 6 2 64
65 4 7 1 0 5 9 65
66 5 13 5 0 5 5 66
67 6 15 6 6 6 4 67
68 5 7 2 2 2 2 68
69 6 13 6 1 6 6 69
70 2 4 2 5 5 5 70
71 6 14 6 5 5 5 71
72 5 13 5 5 5 9 72
73 5 11 0 5 5 2 73
74 6 14 2 6 6 6 74
75 4 12 4 6 6 6 75
76 6 15 1 0 9 6 76
77 5 14 5 0 5 5 77
78 5 13 5 1 5 3 78
79 4 7 2 7 7 2 79
80 2 5 2 2 2 2 80
81 7 7 7 4 4 4 81
82 5 13 5 0 6 8 82
83 6 13 2 5 5 5 83
84 5 11 5 5 5 9 84
85 3 6 3 3 3 2 85
86 6 12 6 0 6 6 86
87 4 8 1 4 4 4 87
88 5 11 5 9 9 5 88
89 7 12 7 0 8 8 89
90 4 9 2 4 4 3 90
91 6 12 6 2 2 2 91
92 8 13 8 7 7 7 92
93 7 16 7 7 7 7 93
94 6 16 6 6 6 9 94
95 7 11 7 0 5 5 95
96 4 8 4 5 5 5 96
97 0 4 5 6 6 2 97
98 3 7 2 0 3 3 98
99 5 14 5 5 5 5 99
100 6 11 2 9 9 2 100
101 5 17 5 0 7 7 101
102 7 15 7 7 7 7 102
103 6 14 5 1 6 6 103
104 8 5 8 3 3 3 104
105 7 4 2 7 7 3 105
106 8 19 8 8 8 2 106
107 3 11 3 0 3 3 107
108 8 15 2 5 5 5 108
109 3 10 3 3 3 3 109
110 4 9 5 0 4 4 110
111 2 12 2 5 5 5 111
112 7 15 2 7 7 7 112
113 6 7 6 0 6 6 113
114 2 13 2 0 7 7 114
115 7 14 7 0 9 2 115
116 6 14 6 6 6 6 116
117 6 14 2 0 6 9 117
118 6 8 2 6 6 4 118
119 6 15 5 6 6 6 119
120 6 15 6 2 2 2 120
121 4 9 4 5 5 2 121
122 5 16 5 0 5 5 122
123 7 9 7 4 4 4 123
124 6 15 6 0 7 7 124
125 6 15 6 6 6 6 125
126 5 6 5 5 5 7 126
127 8 8 2 8 8 8 127
128 6 15 6 6 6 6 128
129 0 10 3 5 5 3 129
130 4 9 2 0 4 4 130
131 8 14 8 8 8 8 131
132 6 12 6 0 6 9 132
133 4 8 4 9 9 2 133
134 6 11 6 5 5 5 134
135 2 13 5 0 6 6 135
136 4 9 4 0 4 4 136
137 6 15 2 0 6 6 137
138 3 13 3 3 3 3 138
139 6 15 6 6 6 6 139
140 5 14 5 0 5 5 140
141 4 16 4 4 4 8 141
142 6 12 6 6 6 6 142
143 1 14 1 0 5 5 143
144 4 10 5 4 4 3 144
145 4 10 2 7 7 2 145
146 6 4 6 0 6 6 146
147 5 8 5 5 5 5 147
148 9 17 2 6 6 6 148
149 6 16 6 6 6 6 149
150 8 12 8 8 8 9 150
151 7 12 7 2 2 4 151
152 7 15 7 7 7 7 152
153 0 9 9 0 4 4 153
154 6 13 2 0 6 7 154
155 6 14 6 5 5 5 155
156 5 11 5 0 2 2 156
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Schoolprestaties Goingout Relation
0.8608072 0.0940010 0.3511947 0.0700473
Family Coach t
0.1550685 0.1203996 -0.0007138
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.8602 -0.6727 -0.0275 0.8040 3.8713
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.8608072 0.5568904 1.546 0.1243
Schoolprestaties 0.0940010 0.0374443 2.510 0.0131 *
Goingout 0.3511947 0.0601972 5.834 3.25e-08 ***
Relation 0.0700473 0.0465097 1.506 0.1342
Family 0.1550685 0.0860917 1.801 0.0737 .
Coach 0.1203996 0.0641044 1.878 0.0623 .
t -0.0007138 0.0026876 -0.266 0.7909
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.497 on 149 degrees of freedom
Multiple R-squared: 0.3826, Adjusted R-squared: 0.3577
F-statistic: 15.39 on 6 and 149 DF, p-value: 1.101e-13
> 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,] 2.138175e-02 0.0427634901 0.9786183
[2,] 4.541182e-03 0.0090823640 0.9954588
[3,] 6.592911e-03 0.0131858213 0.9934071
[4,] 2.806287e-03 0.0056125733 0.9971937
[5,] 1.482900e-02 0.0296580097 0.9851710
[6,] 7.325859e-03 0.0146517176 0.9926741
[7,] 3.160718e-03 0.0063214365 0.9968393
[8,] 3.086381e-02 0.0617276171 0.9691362
[9,] 2.126112e-02 0.0425222313 0.9787389
[10,] 1.109192e-02 0.0221838398 0.9889081
[11,] 6.145269e-03 0.0122905390 0.9938547
[12,] 1.678617e-02 0.0335723395 0.9832138
[13,] 9.349298e-03 0.0186985955 0.9906507
[14,] 6.629670e-03 0.0132593409 0.9933703
[15,] 1.324367e-02 0.0264873487 0.9867563
[16,] 7.789474e-03 0.0155789474 0.9922105
[17,] 4.430940e-03 0.0088618807 0.9955691
[18,] 8.247462e-03 0.0164949236 0.9917525
[19,] 4.936431e-03 0.0098728615 0.9950636
[20,] 3.506627e-03 0.0070132536 0.9964934
[21,] 3.788835e-03 0.0075776706 0.9962112
[22,] 2.255177e-03 0.0045103536 0.9977448
[23,] 1.622125e-03 0.0032442491 0.9983779
[24,] 9.528814e-04 0.0019057627 0.9990471
[25,] 6.179724e-04 0.0012359448 0.9993820
[26,] 3.533707e-04 0.0007067414 0.9996466
[27,] 2.707132e-04 0.0005414264 0.9997293
[28,] 2.982537e-04 0.0005965074 0.9997017
[29,] 1.608785e-04 0.0003217570 0.9998391
[30,] 2.091865e-03 0.0041837309 0.9979081
[31,] 1.372487e-03 0.0027449737 0.9986275
[32,] 8.835603e-04 0.0017671205 0.9991164
[33,] 1.129340e-03 0.0022586807 0.9988707
[34,] 7.169963e-04 0.0014339926 0.9992830
[35,] 8.072668e-04 0.0016145336 0.9991927
[36,] 5.364492e-04 0.0010728985 0.9994636
[37,] 3.691951e-04 0.0007383902 0.9996308
[38,] 4.393497e-04 0.0008786993 0.9995607
[39,] 2.765873e-04 0.0005531747 0.9997234
[40,] 1.700682e-04 0.0003401365 0.9998299
[41,] 1.904182e-04 0.0003808363 0.9998096
[42,] 3.692753e-04 0.0007385506 0.9996307
[43,] 3.271607e-04 0.0006543215 0.9996728
[44,] 2.701057e-04 0.0005402113 0.9997299
[45,] 1.898193e-04 0.0003796385 0.9998102
[46,] 1.523683e-04 0.0003047365 0.9998476
[47,] 2.376244e-04 0.0004752488 0.9997624
[48,] 2.178515e-04 0.0004357029 0.9997821
[49,] 1.681601e-04 0.0003363203 0.9998318
[50,] 1.283960e-04 0.0002567921 0.9998716
[51,] 7.657657e-05 0.0001531531 0.9999234
[52,] 9.164928e-05 0.0001832986 0.9999084
[53,] 3.395163e-03 0.0067903270 0.9966048
[54,] 2.734650e-03 0.0054693000 0.9972653
[55,] 5.055111e-02 0.1011022289 0.9494489
[56,] 3.932975e-02 0.0786594966 0.9606703
[57,] 3.104034e-02 0.0620806889 0.9689597
[58,] 2.353623e-02 0.0470724678 0.9764638
[59,] 3.311036e-02 0.0662207238 0.9668896
[60,] 2.560813e-02 0.0512162529 0.9743919
[61,] 2.729021e-02 0.0545804258 0.9727098
[62,] 2.050713e-02 0.0410142547 0.9794929
[63,] 1.843144e-02 0.0368628772 0.9815686
[64,] 2.689069e-02 0.0537813717 0.9731093
[65,] 2.528443e-02 0.0505688661 0.9747156
[66,] 2.596146e-02 0.0519229111 0.9740385
[67,] 2.381134e-02 0.0476226898 0.9761887
[68,] 1.882225e-02 0.0376444988 0.9811778
[69,] 1.420035e-02 0.0284006910 0.9857997
[70,] 1.053627e-02 0.0210725416 0.9894637
[71,] 8.472429e-03 0.0169448583 0.9915276
[72,] 8.173188e-03 0.0163463769 0.9918268
[73,] 6.858685e-03 0.0137173698 0.9931413
[74,] 7.037514e-03 0.0140750284 0.9929625
[75,] 6.060362e-03 0.0121207242 0.9939396
[76,] 4.495813e-03 0.0089916253 0.9955042
[77,] 3.208956e-03 0.0064179129 0.9967910
[78,] 2.401203e-03 0.0048024063 0.9975988
[79,] 2.281015e-03 0.0045620295 0.9977190
[80,] 1.599015e-03 0.0031980295 0.9984010
[81,] 1.098532e-03 0.0021970646 0.9989015
[82,] 9.214432e-04 0.0018428864 0.9990786
[83,] 6.406084e-04 0.0012812167 0.9993594
[84,] 4.301127e-04 0.0008602253 0.9995699
[85,] 3.638634e-04 0.0007277267 0.9996361
[86,] 3.196723e-04 0.0006393446 0.9996803
[87,] 2.441062e-04 0.0004882125 0.9997559
[88,] 8.420789e-03 0.0168415782 0.9915792
[89,] 6.082992e-03 0.0121659849 0.9939170
[90,] 4.886558e-03 0.0097731153 0.9951134
[91,] 4.458161e-03 0.0089163223 0.9955418
[92,] 3.923186e-03 0.0078463719 0.9960768
[93,] 2.911944e-03 0.0058238872 0.9970881
[94,] 1.994818e-03 0.0039896363 0.9980052
[95,] 4.316648e-03 0.0086332962 0.9956834
[96,] 1.068764e-02 0.0213752866 0.9893124
[97,] 8.062011e-03 0.0161240219 0.9919380
[98,] 6.208943e-03 0.0124178861 0.9937911
[99,] 1.775993e-02 0.0355198579 0.9822401
[100,] 1.420557e-02 0.0284111441 0.9857944
[101,] 1.079154e-02 0.0215830883 0.9892085
[102,] 2.019786e-02 0.0403957296 0.9798021
[103,] 1.812464e-02 0.0362492802 0.9818754
[104,] 1.485214e-02 0.0297042844 0.9851479
[105,] 3.230728e-02 0.0646145675 0.9676927
[106,] 4.978369e-02 0.0995673734 0.9502163
[107,] 3.808426e-02 0.0761685156 0.9619157
[108,] 3.000117e-02 0.0600023414 0.9699988
[109,] 2.931166e-02 0.0586233236 0.9706883
[110,] 2.138821e-02 0.0427764106 0.9786118
[111,] 2.405190e-02 0.0481038016 0.9759481
[112,] 1.804773e-02 0.0360954632 0.9819523
[113,] 1.435941e-02 0.0287188221 0.9856406
[114,] 2.685817e-02 0.0537163491 0.9731418
[115,] 2.621112e-02 0.0524222489 0.9737889
[116,] 2.030797e-02 0.0406159432 0.9796920
[117,] 1.491109e-02 0.0298221844 0.9850889
[118,] 1.594764e-02 0.0318952705 0.9840524
[119,] 1.196089e-02 0.0239217783 0.9880391
[120,] 7.083095e-02 0.1416618978 0.9291691
[121,] 5.361728e-02 0.1072345594 0.9463827
[122,] 4.570740e-02 0.0914148053 0.9542926
[123,] 3.664031e-02 0.0732806111 0.9633597
[124,] 2.611010e-02 0.0522201930 0.9738899
[125,] 2.258034e-02 0.0451606854 0.9774197
[126,] 2.816226e-02 0.0563245250 0.9718377
[127,] 2.052660e-02 0.0410531929 0.9794734
[128,] 2.772477e-02 0.0554495417 0.9722752
[129,] 1.845154e-02 0.0369030795 0.9815485
[130,] 1.254352e-02 0.0250870325 0.9874565
[131,] 6.997880e-02 0.1399576053 0.9300212
[132,] 1.522278e-01 0.3044555927 0.8477722
[133,] 1.104333e-01 0.2208666963 0.8895667
[134,] 2.754846e-01 0.5509691017 0.7245154
[135,] 2.219048e-01 0.4438095242 0.7780952
[136,] 1.401095e-01 0.2802190403 0.8598905
[137,] 8.056128e-01 0.3887744461 0.1943872
> postscript(file="/var/wessaorg/rcomp/tmp/1kz9q1321989367.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/23nzi1321989367.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/3ag9r1321989367.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/4rqdo1321989367.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/5402a1321989367.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.396641562 -0.044834608 0.614543951 0.062981067 0.424817707 -0.982005095
7 8 9 10 11 12
-0.405102073 0.531180719 1.269367053 -1.330094812 -0.537232595 0.525480162
13 14 15 16 17 18
-0.117083896 -1.598460281 1.231789499 0.070753750 -3.088102682 1.267381313
19 20 21 22 23 24
-0.011904196 -0.479381584 -2.626177054 -0.278888605 -0.497157280 2.955501876
25 26 27 28 29 30
-0.245237044 -0.620527353 1.766588148 -0.831403938 0.435095321 1.270562221
31 32 33 34 35 36
-0.136730096 -0.083749071 0.320956583 1.851216904 -0.656677357 -1.063477974
37 38 39 40 41 42
0.371613655 -0.069243137 2.128159119 0.865527618 0.925258762 -2.223257895
43 44 45 46 47 48
-0.672254232 -0.924868764 -0.112151675 1.044261473 0.443153152 0.751600868
49 50 51 52 53 54
0.739244700 0.098889366 1.568908616 -0.879882782 0.009696461 0.341276375
55 56 57 58 59 60
1.131694945 -0.821811045 -1.383781147 -1.179033583 -1.152126177 0.198322040
61 62 63 64 65 66
-1.361796152 -4.384617251 -0.482236560 3.574975502 0.317445947 -0.169026812
67 68 69 70 71 72
-0.162462336 2.136300621 0.136404363 -1.616814921 0.039109825 -0.996579131
73 74 75 76 77 78
1.790907483 1.100514571 -1.413159077 1.314214006 -0.255176572 0.010290134
79 80 81 82 83 84
0.018573109 -0.667132343 1.698575082 -0.673874108 1.546454703 -0.800012096
85 86 87 88 89 90
-0.333875074 0.312586413 0.716024855 -1.216021672 0.412596780 0.393369986
91 92 93 94 95 96
1.277932952 0.754679447 -0.175415133 -0.839190133 1.337284553 -0.676650896
97 98 99 100 101 102
-4.515044727 0.022339605 -0.589710447 1.207326303 -1.070985775 -0.074990364
103 104 105 106 107 108
0.417865578 2.897314020 3.198734057 0.577548156 -0.698435414 3.376296435
109 110 111 112 113 114
-0.813148730 -0.486149647 -2.339559270 1.688120712 0.801862749 -2.632118817
115 116 117 118 119 120
0.810481440 -0.274286766 1.190290678 1.936724898 -0.014951815 1.016628671
121 122 123 124 125 126
-0.391609322 -0.411059830 1.540550572 -0.217762199 -0.361864026 -0.059230284
127 128 129 130 131 132
3.011318710 -0.359722775 -4.249105228 0.581709505 0.342999338 -0.015779892
133 134 135 136 137 138
-1.189506316 0.366079149 -3.395246115 -0.116397421 1.471763499 -1.074453011
139 140 141 142 143 144
-0.351871520 -0.210210292 -1.532623316 -0.067727224 -2.803290184 -0.715672646
145 146 147 148 149 150
-0.216322404 1.107419559 0.008555664 3.871329062 -0.438735030 0.424163017
151 152 153 154 155 156
1.728764048 -0.039302840 -5.860237234 1.551499678 0.099064865 0.909617016
> postscript(file="/var/wessaorg/rcomp/tmp/6f0mt1321989367.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.396641562 NA
1 -0.044834608 -1.396641562
2 0.614543951 -0.044834608
3 0.062981067 0.614543951
4 0.424817707 0.062981067
5 -0.982005095 0.424817707
6 -0.405102073 -0.982005095
7 0.531180719 -0.405102073
8 1.269367053 0.531180719
9 -1.330094812 1.269367053
10 -0.537232595 -1.330094812
11 0.525480162 -0.537232595
12 -0.117083896 0.525480162
13 -1.598460281 -0.117083896
14 1.231789499 -1.598460281
15 0.070753750 1.231789499
16 -3.088102682 0.070753750
17 1.267381313 -3.088102682
18 -0.011904196 1.267381313
19 -0.479381584 -0.011904196
20 -2.626177054 -0.479381584
21 -0.278888605 -2.626177054
22 -0.497157280 -0.278888605
23 2.955501876 -0.497157280
24 -0.245237044 2.955501876
25 -0.620527353 -0.245237044
26 1.766588148 -0.620527353
27 -0.831403938 1.766588148
28 0.435095321 -0.831403938
29 1.270562221 0.435095321
30 -0.136730096 1.270562221
31 -0.083749071 -0.136730096
32 0.320956583 -0.083749071
33 1.851216904 0.320956583
34 -0.656677357 1.851216904
35 -1.063477974 -0.656677357
36 0.371613655 -1.063477974
37 -0.069243137 0.371613655
38 2.128159119 -0.069243137
39 0.865527618 2.128159119
40 0.925258762 0.865527618
41 -2.223257895 0.925258762
42 -0.672254232 -2.223257895
43 -0.924868764 -0.672254232
44 -0.112151675 -0.924868764
45 1.044261473 -0.112151675
46 0.443153152 1.044261473
47 0.751600868 0.443153152
48 0.739244700 0.751600868
49 0.098889366 0.739244700
50 1.568908616 0.098889366
51 -0.879882782 1.568908616
52 0.009696461 -0.879882782
53 0.341276375 0.009696461
54 1.131694945 0.341276375
55 -0.821811045 1.131694945
56 -1.383781147 -0.821811045
57 -1.179033583 -1.383781147
58 -1.152126177 -1.179033583
59 0.198322040 -1.152126177
60 -1.361796152 0.198322040
61 -4.384617251 -1.361796152
62 -0.482236560 -4.384617251
63 3.574975502 -0.482236560
64 0.317445947 3.574975502
65 -0.169026812 0.317445947
66 -0.162462336 -0.169026812
67 2.136300621 -0.162462336
68 0.136404363 2.136300621
69 -1.616814921 0.136404363
70 0.039109825 -1.616814921
71 -0.996579131 0.039109825
72 1.790907483 -0.996579131
73 1.100514571 1.790907483
74 -1.413159077 1.100514571
75 1.314214006 -1.413159077
76 -0.255176572 1.314214006
77 0.010290134 -0.255176572
78 0.018573109 0.010290134
79 -0.667132343 0.018573109
80 1.698575082 -0.667132343
81 -0.673874108 1.698575082
82 1.546454703 -0.673874108
83 -0.800012096 1.546454703
84 -0.333875074 -0.800012096
85 0.312586413 -0.333875074
86 0.716024855 0.312586413
87 -1.216021672 0.716024855
88 0.412596780 -1.216021672
89 0.393369986 0.412596780
90 1.277932952 0.393369986
91 0.754679447 1.277932952
92 -0.175415133 0.754679447
93 -0.839190133 -0.175415133
94 1.337284553 -0.839190133
95 -0.676650896 1.337284553
96 -4.515044727 -0.676650896
97 0.022339605 -4.515044727
98 -0.589710447 0.022339605
99 1.207326303 -0.589710447
100 -1.070985775 1.207326303
101 -0.074990364 -1.070985775
102 0.417865578 -0.074990364
103 2.897314020 0.417865578
104 3.198734057 2.897314020
105 0.577548156 3.198734057
106 -0.698435414 0.577548156
107 3.376296435 -0.698435414
108 -0.813148730 3.376296435
109 -0.486149647 -0.813148730
110 -2.339559270 -0.486149647
111 1.688120712 -2.339559270
112 0.801862749 1.688120712
113 -2.632118817 0.801862749
114 0.810481440 -2.632118817
115 -0.274286766 0.810481440
116 1.190290678 -0.274286766
117 1.936724898 1.190290678
118 -0.014951815 1.936724898
119 1.016628671 -0.014951815
120 -0.391609322 1.016628671
121 -0.411059830 -0.391609322
122 1.540550572 -0.411059830
123 -0.217762199 1.540550572
124 -0.361864026 -0.217762199
125 -0.059230284 -0.361864026
126 3.011318710 -0.059230284
127 -0.359722775 3.011318710
128 -4.249105228 -0.359722775
129 0.581709505 -4.249105228
130 0.342999338 0.581709505
131 -0.015779892 0.342999338
132 -1.189506316 -0.015779892
133 0.366079149 -1.189506316
134 -3.395246115 0.366079149
135 -0.116397421 -3.395246115
136 1.471763499 -0.116397421
137 -1.074453011 1.471763499
138 -0.351871520 -1.074453011
139 -0.210210292 -0.351871520
140 -1.532623316 -0.210210292
141 -0.067727224 -1.532623316
142 -2.803290184 -0.067727224
143 -0.715672646 -2.803290184
144 -0.216322404 -0.715672646
145 1.107419559 -0.216322404
146 0.008555664 1.107419559
147 3.871329062 0.008555664
148 -0.438735030 3.871329062
149 0.424163017 -0.438735030
150 1.728764048 0.424163017
151 -0.039302840 1.728764048
152 -5.860237234 -0.039302840
153 1.551499678 -5.860237234
154 0.099064865 1.551499678
155 0.909617016 0.099064865
156 NA 0.909617016
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.044834608 -1.396641562
[2,] 0.614543951 -0.044834608
[3,] 0.062981067 0.614543951
[4,] 0.424817707 0.062981067
[5,] -0.982005095 0.424817707
[6,] -0.405102073 -0.982005095
[7,] 0.531180719 -0.405102073
[8,] 1.269367053 0.531180719
[9,] -1.330094812 1.269367053
[10,] -0.537232595 -1.330094812
[11,] 0.525480162 -0.537232595
[12,] -0.117083896 0.525480162
[13,] -1.598460281 -0.117083896
[14,] 1.231789499 -1.598460281
[15,] 0.070753750 1.231789499
[16,] -3.088102682 0.070753750
[17,] 1.267381313 -3.088102682
[18,] -0.011904196 1.267381313
[19,] -0.479381584 -0.011904196
[20,] -2.626177054 -0.479381584
[21,] -0.278888605 -2.626177054
[22,] -0.497157280 -0.278888605
[23,] 2.955501876 -0.497157280
[24,] -0.245237044 2.955501876
[25,] -0.620527353 -0.245237044
[26,] 1.766588148 -0.620527353
[27,] -0.831403938 1.766588148
[28,] 0.435095321 -0.831403938
[29,] 1.270562221 0.435095321
[30,] -0.136730096 1.270562221
[31,] -0.083749071 -0.136730096
[32,] 0.320956583 -0.083749071
[33,] 1.851216904 0.320956583
[34,] -0.656677357 1.851216904
[35,] -1.063477974 -0.656677357
[36,] 0.371613655 -1.063477974
[37,] -0.069243137 0.371613655
[38,] 2.128159119 -0.069243137
[39,] 0.865527618 2.128159119
[40,] 0.925258762 0.865527618
[41,] -2.223257895 0.925258762
[42,] -0.672254232 -2.223257895
[43,] -0.924868764 -0.672254232
[44,] -0.112151675 -0.924868764
[45,] 1.044261473 -0.112151675
[46,] 0.443153152 1.044261473
[47,] 0.751600868 0.443153152
[48,] 0.739244700 0.751600868
[49,] 0.098889366 0.739244700
[50,] 1.568908616 0.098889366
[51,] -0.879882782 1.568908616
[52,] 0.009696461 -0.879882782
[53,] 0.341276375 0.009696461
[54,] 1.131694945 0.341276375
[55,] -0.821811045 1.131694945
[56,] -1.383781147 -0.821811045
[57,] -1.179033583 -1.383781147
[58,] -1.152126177 -1.179033583
[59,] 0.198322040 -1.152126177
[60,] -1.361796152 0.198322040
[61,] -4.384617251 -1.361796152
[62,] -0.482236560 -4.384617251
[63,] 3.574975502 -0.482236560
[64,] 0.317445947 3.574975502
[65,] -0.169026812 0.317445947
[66,] -0.162462336 -0.169026812
[67,] 2.136300621 -0.162462336
[68,] 0.136404363 2.136300621
[69,] -1.616814921 0.136404363
[70,] 0.039109825 -1.616814921
[71,] -0.996579131 0.039109825
[72,] 1.790907483 -0.996579131
[73,] 1.100514571 1.790907483
[74,] -1.413159077 1.100514571
[75,] 1.314214006 -1.413159077
[76,] -0.255176572 1.314214006
[77,] 0.010290134 -0.255176572
[78,] 0.018573109 0.010290134
[79,] -0.667132343 0.018573109
[80,] 1.698575082 -0.667132343
[81,] -0.673874108 1.698575082
[82,] 1.546454703 -0.673874108
[83,] -0.800012096 1.546454703
[84,] -0.333875074 -0.800012096
[85,] 0.312586413 -0.333875074
[86,] 0.716024855 0.312586413
[87,] -1.216021672 0.716024855
[88,] 0.412596780 -1.216021672
[89,] 0.393369986 0.412596780
[90,] 1.277932952 0.393369986
[91,] 0.754679447 1.277932952
[92,] -0.175415133 0.754679447
[93,] -0.839190133 -0.175415133
[94,] 1.337284553 -0.839190133
[95,] -0.676650896 1.337284553
[96,] -4.515044727 -0.676650896
[97,] 0.022339605 -4.515044727
[98,] -0.589710447 0.022339605
[99,] 1.207326303 -0.589710447
[100,] -1.070985775 1.207326303
[101,] -0.074990364 -1.070985775
[102,] 0.417865578 -0.074990364
[103,] 2.897314020 0.417865578
[104,] 3.198734057 2.897314020
[105,] 0.577548156 3.198734057
[106,] -0.698435414 0.577548156
[107,] 3.376296435 -0.698435414
[108,] -0.813148730 3.376296435
[109,] -0.486149647 -0.813148730
[110,] -2.339559270 -0.486149647
[111,] 1.688120712 -2.339559270
[112,] 0.801862749 1.688120712
[113,] -2.632118817 0.801862749
[114,] 0.810481440 -2.632118817
[115,] -0.274286766 0.810481440
[116,] 1.190290678 -0.274286766
[117,] 1.936724898 1.190290678
[118,] -0.014951815 1.936724898
[119,] 1.016628671 -0.014951815
[120,] -0.391609322 1.016628671
[121,] -0.411059830 -0.391609322
[122,] 1.540550572 -0.411059830
[123,] -0.217762199 1.540550572
[124,] -0.361864026 -0.217762199
[125,] -0.059230284 -0.361864026
[126,] 3.011318710 -0.059230284
[127,] -0.359722775 3.011318710
[128,] -4.249105228 -0.359722775
[129,] 0.581709505 -4.249105228
[130,] 0.342999338 0.581709505
[131,] -0.015779892 0.342999338
[132,] -1.189506316 -0.015779892
[133,] 0.366079149 -1.189506316
[134,] -3.395246115 0.366079149
[135,] -0.116397421 -3.395246115
[136,] 1.471763499 -0.116397421
[137,] -1.074453011 1.471763499
[138,] -0.351871520 -1.074453011
[139,] -0.210210292 -0.351871520
[140,] -1.532623316 -0.210210292
[141,] -0.067727224 -1.532623316
[142,] -2.803290184 -0.067727224
[143,] -0.715672646 -2.803290184
[144,] -0.216322404 -0.715672646
[145,] 1.107419559 -0.216322404
[146,] 0.008555664 1.107419559
[147,] 3.871329062 0.008555664
[148,] -0.438735030 3.871329062
[149,] 0.424163017 -0.438735030
[150,] 1.728764048 0.424163017
[151,] -0.039302840 1.728764048
[152,] -5.860237234 -0.039302840
[153,] 1.551499678 -5.860237234
[154,] 0.099064865 1.551499678
[155,] 0.909617016 0.099064865
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.044834608 -1.396641562
2 0.614543951 -0.044834608
3 0.062981067 0.614543951
4 0.424817707 0.062981067
5 -0.982005095 0.424817707
6 -0.405102073 -0.982005095
7 0.531180719 -0.405102073
8 1.269367053 0.531180719
9 -1.330094812 1.269367053
10 -0.537232595 -1.330094812
11 0.525480162 -0.537232595
12 -0.117083896 0.525480162
13 -1.598460281 -0.117083896
14 1.231789499 -1.598460281
15 0.070753750 1.231789499
16 -3.088102682 0.070753750
17 1.267381313 -3.088102682
18 -0.011904196 1.267381313
19 -0.479381584 -0.011904196
20 -2.626177054 -0.479381584
21 -0.278888605 -2.626177054
22 -0.497157280 -0.278888605
23 2.955501876 -0.497157280
24 -0.245237044 2.955501876
25 -0.620527353 -0.245237044
26 1.766588148 -0.620527353
27 -0.831403938 1.766588148
28 0.435095321 -0.831403938
29 1.270562221 0.435095321
30 -0.136730096 1.270562221
31 -0.083749071 -0.136730096
32 0.320956583 -0.083749071
33 1.851216904 0.320956583
34 -0.656677357 1.851216904
35 -1.063477974 -0.656677357
36 0.371613655 -1.063477974
37 -0.069243137 0.371613655
38 2.128159119 -0.069243137
39 0.865527618 2.128159119
40 0.925258762 0.865527618
41 -2.223257895 0.925258762
42 -0.672254232 -2.223257895
43 -0.924868764 -0.672254232
44 -0.112151675 -0.924868764
45 1.044261473 -0.112151675
46 0.443153152 1.044261473
47 0.751600868 0.443153152
48 0.739244700 0.751600868
49 0.098889366 0.739244700
50 1.568908616 0.098889366
51 -0.879882782 1.568908616
52 0.009696461 -0.879882782
53 0.341276375 0.009696461
54 1.131694945 0.341276375
55 -0.821811045 1.131694945
56 -1.383781147 -0.821811045
57 -1.179033583 -1.383781147
58 -1.152126177 -1.179033583
59 0.198322040 -1.152126177
60 -1.361796152 0.198322040
61 -4.384617251 -1.361796152
62 -0.482236560 -4.384617251
63 3.574975502 -0.482236560
64 0.317445947 3.574975502
65 -0.169026812 0.317445947
66 -0.162462336 -0.169026812
67 2.136300621 -0.162462336
68 0.136404363 2.136300621
69 -1.616814921 0.136404363
70 0.039109825 -1.616814921
71 -0.996579131 0.039109825
72 1.790907483 -0.996579131
73 1.100514571 1.790907483
74 -1.413159077 1.100514571
75 1.314214006 -1.413159077
76 -0.255176572 1.314214006
77 0.010290134 -0.255176572
78 0.018573109 0.010290134
79 -0.667132343 0.018573109
80 1.698575082 -0.667132343
81 -0.673874108 1.698575082
82 1.546454703 -0.673874108
83 -0.800012096 1.546454703
84 -0.333875074 -0.800012096
85 0.312586413 -0.333875074
86 0.716024855 0.312586413
87 -1.216021672 0.716024855
88 0.412596780 -1.216021672
89 0.393369986 0.412596780
90 1.277932952 0.393369986
91 0.754679447 1.277932952
92 -0.175415133 0.754679447
93 -0.839190133 -0.175415133
94 1.337284553 -0.839190133
95 -0.676650896 1.337284553
96 -4.515044727 -0.676650896
97 0.022339605 -4.515044727
98 -0.589710447 0.022339605
99 1.207326303 -0.589710447
100 -1.070985775 1.207326303
101 -0.074990364 -1.070985775
102 0.417865578 -0.074990364
103 2.897314020 0.417865578
104 3.198734057 2.897314020
105 0.577548156 3.198734057
106 -0.698435414 0.577548156
107 3.376296435 -0.698435414
108 -0.813148730 3.376296435
109 -0.486149647 -0.813148730
110 -2.339559270 -0.486149647
111 1.688120712 -2.339559270
112 0.801862749 1.688120712
113 -2.632118817 0.801862749
114 0.810481440 -2.632118817
115 -0.274286766 0.810481440
116 1.190290678 -0.274286766
117 1.936724898 1.190290678
118 -0.014951815 1.936724898
119 1.016628671 -0.014951815
120 -0.391609322 1.016628671
121 -0.411059830 -0.391609322
122 1.540550572 -0.411059830
123 -0.217762199 1.540550572
124 -0.361864026 -0.217762199
125 -0.059230284 -0.361864026
126 3.011318710 -0.059230284
127 -0.359722775 3.011318710
128 -4.249105228 -0.359722775
129 0.581709505 -4.249105228
130 0.342999338 0.581709505
131 -0.015779892 0.342999338
132 -1.189506316 -0.015779892
133 0.366079149 -1.189506316
134 -3.395246115 0.366079149
135 -0.116397421 -3.395246115
136 1.471763499 -0.116397421
137 -1.074453011 1.471763499
138 -0.351871520 -1.074453011
139 -0.210210292 -0.351871520
140 -1.532623316 -0.210210292
141 -0.067727224 -1.532623316
142 -2.803290184 -0.067727224
143 -0.715672646 -2.803290184
144 -0.216322404 -0.715672646
145 1.107419559 -0.216322404
146 0.008555664 1.107419559
147 3.871329062 0.008555664
148 -0.438735030 3.871329062
149 0.424163017 -0.438735030
150 1.728764048 0.424163017
151 -0.039302840 1.728764048
152 -5.860237234 -0.039302840
153 1.551499678 -5.860237234
154 0.099064865 1.551499678
155 0.909617016 0.099064865
> 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/7vsgf1321989367.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/8enxz1321989367.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/9n7pr1321989367.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/10up951321989367.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/116iwx1321989367.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/129ame1321989367.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/13apop1321989367.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/14pajl1321989367.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/15300i1321989367.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/16nyhb1321989367.tab")
+ }
>
> try(system("convert tmp/1kz9q1321989367.ps tmp/1kz9q1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/23nzi1321989367.ps tmp/23nzi1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ag9r1321989367.ps tmp/3ag9r1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/4rqdo1321989367.ps tmp/4rqdo1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/5402a1321989367.ps tmp/5402a1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/6f0mt1321989367.ps tmp/6f0mt1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/7vsgf1321989367.ps tmp/7vsgf1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/8enxz1321989367.ps tmp/8enxz1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/9n7pr1321989367.ps tmp/9n7pr1321989367.png",intern=TRUE))
character(0)
> try(system("convert tmp/10up951321989367.ps tmp/10up951321989367.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.867 0.501 5.560