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(12
+ ,13
+ ,12
+ ,53
+ ,41
+ ,38
+ ,11
+ ,16
+ ,11
+ ,86
+ ,39
+ ,32
+ ,14
+ ,19
+ ,15
+ ,66
+ ,30
+ ,35
+ ,12
+ ,15
+ ,6
+ ,67
+ ,31
+ ,33
+ ,21
+ ,14
+ ,13
+ ,76
+ ,34
+ ,37
+ ,12
+ ,13
+ ,10
+ ,78
+ ,35
+ ,29
+ ,22
+ ,19
+ ,12
+ ,53
+ ,39
+ ,31
+ ,11
+ ,15
+ ,14
+ ,80
+ ,34
+ ,36
+ ,10
+ ,14
+ ,12
+ ,74
+ ,36
+ ,35
+ ,13
+ ,15
+ ,6
+ ,76
+ ,37
+ ,38
+ ,10
+ ,16
+ ,10
+ ,79
+ ,38
+ ,31
+ ,8
+ ,16
+ ,12
+ ,54
+ ,36
+ ,34
+ ,15
+ ,16
+ ,12
+ ,67
+ ,38
+ ,35
+ ,14
+ ,16
+ ,11
+ ,54
+ ,39
+ ,38
+ ,10
+ ,17
+ ,15
+ ,87
+ ,33
+ ,37
+ ,14
+ ,15
+ ,12
+ ,58
+ ,32
+ ,33
+ ,14
+ ,15
+ ,10
+ ,75
+ ,36
+ ,32
+ ,11
+ ,20
+ ,12
+ ,88
+ ,38
+ ,38
+ ,10
+ ,18
+ ,11
+ ,64
+ ,39
+ ,38
+ ,13
+ ,16
+ ,12
+ ,57
+ ,32
+ ,32
+ ,7
+ ,16
+ ,11
+ ,66
+ ,32
+ ,33
+ ,14
+ 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PCC'
+ ,'PBS'
+ ,'ATC'
+ ,'ATS')
+ ,1:162))
> y <- array(NA,dim=c(6,162),dimnames=list(c('CESDS','PCL','PCC','PBS','ATC','ATS'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
CESDS PCL PCC PBS ATC ATS
1 12 13 12 53 41 38
2 11 16 11 86 39 32
3 14 19 15 66 30 35
4 12 15 6 67 31 33
5 21 14 13 76 34 37
6 12 13 10 78 35 29
7 22 19 12 53 39 31
8 11 15 14 80 34 36
9 10 14 12 74 36 35
10 13 15 6 76 37 38
11 10 16 10 79 38 31
12 8 16 12 54 36 34
13 15 16 12 67 38 35
14 14 16 11 54 39 38
15 10 17 15 87 33 37
16 14 15 12 58 32 33
17 14 15 10 75 36 32
18 11 20 12 88 38 38
19 10 18 11 64 39 38
20 13 16 12 57 32 32
21 7 16 11 66 32 33
22 14 16 12 68 31 31
23 12 19 13 54 39 38
24 14 16 11 56 37 39
25 11 17 9 86 39 32
26 9 17 13 80 41 32
27 11 16 10 76 36 35
28 15 15 14 69 33 37
29 14 16 12 78 33 33
30 13 14 10 67 34 33
31 9 15 12 80 31 28
32 15 12 8 54 27 32
33 10 14 10 71 37 31
34 11 16 12 84 34 37
35 13 14 12 74 34 30
36 8 7 7 71 32 33
37 20 10 6 63 29 31
38 12 14 12 71 36 33
39 10 16 10 76 29 31
40 10 16 10 69 35 33
41 9 16 10 74 37 32
42 14 14 12 75 34 33
43 8 20 15 54 38 32
44 14 14 10 52 35 33
45 11 14 10 69 38 28
46 13 11 12 68 37 35
47 9 14 13 65 38 39
48 11 15 11 75 33 34
49 15 16 11 74 36 38
50 11 14 12 75 38 32
51 10 16 14 72 32 38
52 14 14 10 67 32 30
53 18 12 12 63 32 33
54 14 16 13 62 34 38
55 11 9 5 63 32 32
56 12 14 6 76 37 32
57 13 16 12 74 39 34
58 9 16 12 67 29 34
59 10 15 11 73 37 36
60 15 16 10 70 35 34
61 20 12 7 53 30 28
62 12 16 12 77 38 34
63 12 16 14 77 34 35
64 14 14 11 52 31 35
65 13 16 12 54 34 31
66 11 17 13 80 35 37
67 17 18 14 66 36 35
68 12 18 11 73 30 27
69 13 12 12 63 39 40
70 14 16 12 69 35 37
71 13 10 8 67 38 36
72 15 14 11 54 31 38
73 13 18 14 81 34 39
74 10 18 14 69 38 41
75 11 16 12 84 34 27
76 19 17 9 80 39 30
77 13 16 13 70 37 37
78 17 16 11 69 34 31
79 13 13 12 77 28 31
80 9 16 12 54 37 27
81 11 16 12 79 33 36
82 10 20 12 30 37 38
83 9 16 12 71 35 37
84 12 15 12 73 37 33
85 12 15 11 72 32 34
86 13 16 10 77 33 31
87 13 14 9 75 38 39
88 12 16 12 69 33 34
89 15 16 12 54 29 32
90 22 15 12 70 33 33
91 13 12 9 73 31 36
92 15 17 15 54 36 32
93 13 16 12 77 35 41
94 15 15 12 82 32 28
95 10 13 12 80 29 30
96 11 16 10 80 39 36
97 16 16 13 69 37 35
98 11 16 9 78 35 31
99 11 16 12 81 37 34
100 10 14 10 76 32 36
101 10 16 14 76 38 36
102 16 16 11 73 37 35
103 12 20 15 85 36 37
104 11 15 11 66 32 28
105 16 16 11 79 33 39
106 19 13 12 68 40 32
107 11 17 12 76 38 35
108 16 16 12 71 41 39
109 15 16 11 54 36 35
110 24 12 7 46 43 42
111 14 16 12 82 30 34
112 15 16 14 74 31 33
113 11 17 11 88 32 41
114 15 13 11 38 32 33
115 12 12 10 76 37 34
116 10 18 13 86 37 32
117 14 14 13 54 33 40
118 13 14 8 70 34 40
119 9 13 11 69 33 35
120 15 16 12 90 38 36
121 15 13 11 54 33 37
122 14 16 13 76 31 27
123 11 13 12 89 38 39
124 8 16 14 76 37 38
125 11 15 13 73 33 31
126 11 16 15 79 31 33
127 8 15 10 90 39 32
128 10 17 11 74 44 39
129 11 15 9 81 33 36
130 13 12 11 72 35 33
131 11 16 10 71 32 33
132 20 10 11 66 28 32
133 10 16 8 77 40 37
134 15 12 11 65 27 30
135 12 14 12 74 37 38
136 14 15 12 82 32 29
137 23 13 9 54 28 22
138 14 15 11 63 34 35
139 16 11 10 54 30 35
140 11 12 8 64 35 34
141 12 8 9 69 31 35
142 10 16 8 54 32 34
143 14 15 9 84 30 34
144 12 17 15 86 30 35
145 12 16 11 77 31 23
146 11 10 8 89 40 31
147 12 18 13 76 32 27
148 13 13 12 60 36 36
149 11 16 12 75 32 31
150 19 13 9 73 35 32
151 12 10 7 85 38 39
152 17 15 13 79 42 37
153 9 16 9 71 34 38
154 12 16 6 72 35 39
155 19 14 8 69 35 34
156 18 10 8 78 33 31
157 15 17 15 54 36 32
158 14 13 6 69 32 37
159 11 15 9 81 33 36
160 9 16 11 84 34 32
161 18 12 8 84 32 35
162 16 13 8 69 34 36
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) PCL PCC PBS ATC ATS
25.34791 -0.26471 -0.02403 -0.07520 -0.03625 -0.04788
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.2474 -1.7001 -0.5843 1.3381 9.0258
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 25.34791 3.39138 7.474 5.22e-12 ***
PCL -0.26471 0.12875 -2.056 0.041452 *
PCC -0.02403 0.13264 -0.181 0.856493
PBS -0.07520 0.02228 -3.375 0.000933 ***
ATC -0.03625 0.07762 -0.467 0.641111
ATS -0.04788 0.07204 -0.665 0.507293
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.009 on 156 degrees of freedom
Multiple R-squared: 0.1247, Adjusted R-squared: 0.09668
F-statistic: 4.446 on 5 and 156 DF, p-value: 0.0008172
> 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.9953433 0.009313479 0.004656740
[2,] 0.9894052 0.021189512 0.010594756
[3,] 0.9847077 0.030584646 0.015292323
[4,] 0.9969786 0.006042751 0.003021376
[5,] 0.9942890 0.011421994 0.005710997
[6,] 0.9893447 0.021310513 0.010655256
[7,] 0.9871944 0.025611199 0.012805599
[8,] 0.9783875 0.043224983 0.021612492
[9,] 0.9681224 0.063755192 0.031877596
[10,] 0.9561203 0.087759483 0.043879742
[11,] 0.9543077 0.091384563 0.045692281
[12,] 0.9367747 0.126450630 0.063225315
[13,] 0.9712314 0.057537241 0.028768621
[14,] 0.9592723 0.081455303 0.040727652
[15,] 0.9463809 0.107238156 0.053619078
[16,] 0.9275879 0.144824129 0.072412064
[17,] 0.9023331 0.195333779 0.097666889
[18,] 0.8990470 0.201905949 0.100952974
[19,] 0.8696553 0.260689434 0.130344717
[20,] 0.8500169 0.299966266 0.149983133
[21,] 0.8234220 0.353155968 0.176577984
[22,] 0.7804793 0.439041450 0.219520725
[23,] 0.7803140 0.439372043 0.219686022
[24,] 0.7379879 0.524024157 0.262012078
[25,] 0.7162155 0.567569027 0.283784514
[26,] 0.6657055 0.668589084 0.334294542
[27,] 0.6147211 0.770557721 0.385278861
[28,] 0.6838487 0.632302648 0.316151324
[29,] 0.8360515 0.327897063 0.163948531
[30,] 0.8010870 0.397825965 0.198912983
[31,] 0.7910292 0.417941577 0.208970788
[32,] 0.7792815 0.441437029 0.220718514
[33,] 0.7752463 0.449507325 0.224753662
[34,] 0.7473370 0.505326048 0.252663024
[35,] 0.8056816 0.388636763 0.194318381
[36,] 0.7689317 0.462136592 0.231068296
[37,] 0.7424039 0.515192198 0.257596099
[38,] 0.7022676 0.595464783 0.297732392
[39,] 0.7313614 0.537277278 0.268638639
[40,] 0.6968197 0.606360509 0.303180254
[41,] 0.6911315 0.617736980 0.308868490
[42,] 0.6563043 0.687391483 0.343695741
[43,] 0.6421105 0.715778929 0.357889464
[44,] 0.6006804 0.798639137 0.399319568
[45,] 0.6453666 0.709266860 0.354633430
[46,] 0.6015350 0.796929978 0.398464989
[47,] 0.6292102 0.741579596 0.370789798
[48,] 0.5902426 0.819514779 0.409757389
[49,] 0.5523208 0.895358435 0.447679217
[50,] 0.5932344 0.813531155 0.406765578
[51,] 0.5749383 0.850123308 0.425061654
[52,] 0.5612481 0.877503844 0.438751922
[53,] 0.6332251 0.733549777 0.366774888
[54,] 0.5901302 0.819739550 0.409869775
[55,] 0.5437960 0.912408001 0.456204001
[56,] 0.4986513 0.997302699 0.501348651
[57,] 0.4577694 0.915538781 0.542230609
[58,] 0.4116667 0.823333482 0.588333259
[59,] 0.4777681 0.955536145 0.522231928
[60,] 0.4326594 0.865318845 0.567340577
[61,] 0.3911525 0.782305018 0.608847491
[62,] 0.3571123 0.714224618 0.642887691
[63,] 0.3279664 0.655932756 0.672033622
[64,] 0.2880308 0.576061641 0.711969179
[65,] 0.2670449 0.534089830 0.732955085
[66,] 0.2430873 0.486174546 0.756912727
[67,] 0.2124634 0.424926766 0.787536617
[68,] 0.4115807 0.823161419 0.588419290
[69,] 0.3694101 0.738820289 0.630589856
[70,] 0.4059932 0.811986393 0.594006803
[71,] 0.3636521 0.727304173 0.636347913
[72,] 0.4568797 0.913759334 0.543120333
[73,] 0.4154077 0.830815440 0.584592280
[74,] 0.4816614 0.963322894 0.518338553
[75,] 0.4987996 0.997599269 0.501200365
[76,] 0.4587088 0.917417583 0.541291208
[77,] 0.4177919 0.835583782 0.582208109
[78,] 0.3742785 0.748557096 0.625721452
[79,] 0.3327812 0.665562417 0.667218792
[80,] 0.2959406 0.591881293 0.704059354
[81,] 0.2599709 0.519941742 0.740029129
[82,] 0.6000139 0.799972109 0.399986055
[83,] 0.5563593 0.887281395 0.443640697
[84,] 0.5190082 0.961983617 0.480991809
[85,] 0.4808357 0.961671418 0.519164291
[86,] 0.4656103 0.931220691 0.534389655
[87,] 0.4688541 0.937708162 0.531145919
[88,] 0.4258331 0.851666221 0.574166890
[89,] 0.4326704 0.865340899 0.567329551
[90,] 0.3971137 0.794227461 0.602886269
[91,] 0.3558063 0.711612570 0.644193715
[92,] 0.3493270 0.698654079 0.650672961
[93,] 0.3275844 0.655168715 0.672415642
[94,] 0.3414498 0.682899600 0.658550200
[95,] 0.3191911 0.638382226 0.680808887
[96,] 0.3209907 0.641981385 0.679009307
[97,] 0.3760682 0.752136417 0.623931792
[98,] 0.4581362 0.916272379 0.541863811
[99,] 0.4130146 0.826029270 0.586985365
[100,] 0.4460578 0.892115512 0.553942244
[101,] 0.4030694 0.806138867 0.596930567
[102,] 0.7923063 0.415387307 0.207693654
[103,] 0.7700264 0.459947199 0.229973600
[104,] 0.7593731 0.481253744 0.240626872
[105,] 0.7261626 0.547674852 0.273837426
[106,] 0.6902890 0.619421955 0.309710978
[107,] 0.6561385 0.687723018 0.343861509
[108,] 0.6083574 0.783285294 0.391642647
[109,] 0.5598847 0.880230509 0.440115254
[110,] 0.5112428 0.977514319 0.488757159
[111,] 0.5884803 0.823039303 0.411519651
[112,] 0.6743362 0.651327654 0.325663827
[113,] 0.6238204 0.752359161 0.376179580
[114,] 0.5767052 0.846589580 0.423294790
[115,] 0.5233533 0.953293452 0.476646726
[116,] 0.5213416 0.957316847 0.478658423
[117,] 0.4974995 0.994998960 0.502500520
[118,] 0.4496988 0.899397526 0.550301237
[119,] 0.4696423 0.939284664 0.530357668
[120,] 0.4173628 0.834725678 0.582637161
[121,] 0.3647468 0.729493534 0.635253233
[122,] 0.3265897 0.653179367 0.673410316
[123,] 0.2925094 0.585018772 0.707490614
[124,] 0.3262355 0.652470927 0.673764537
[125,] 0.2893633 0.578726698 0.710636651
[126,] 0.2401842 0.480368447 0.759815776
[127,] 0.1937808 0.387561526 0.806219237
[128,] 0.1549252 0.309850309 0.845074845
[129,] 0.3190267 0.638053397 0.680973302
[130,] 0.2610221 0.522044184 0.738977908
[131,] 0.2164077 0.432815327 0.783592337
[132,] 0.2219393 0.443878699 0.778060651
[133,] 0.2902440 0.580488078 0.709755961
[134,] 0.3388848 0.677769592 0.661115204
[135,] 0.2914410 0.582882039 0.708558980
[136,] 0.2419333 0.483866505 0.758066748
[137,] 0.1961756 0.392351253 0.803824373
[138,] 0.5518532 0.896293530 0.448146765
[139,] 0.4730984 0.946196847 0.526901576
[140,] 0.4322195 0.864439078 0.567780461
[141,] 0.3511304 0.702260868 0.648869566
[142,] 0.2792918 0.558583626 0.720708187
[143,] 0.5989370 0.802125926 0.401062963
[144,] 0.4853087 0.970617460 0.514691270
[145,] 0.4634821 0.926964150 0.536517925
> postscript(file="/var/wessaorg/rcomp/tmp/1q70n1322170108.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/22fj01322170108.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/3beuk1322170108.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/4cb9g1322170108.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/5le731322170108.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 162
Frequency = 1
1 2 3 4 5 6
-2.32698837 -0.43497388 1.76855571 -1.49081086 8.38975014 -1.14338539
7 8 9 10 11 12
8.85362435 -1.06858151 -2.80792551 0.64291008 -2.06954595 -5.83043151
13 14 15 16 17 18
2.26758176 0.44580569 -0.97709970 0.01277979 1.34030510 1.04929180
19 20 21 22 23 24
-2.27275413 -0.84558998 -6.14491946 0.89750657 -0.71201648 0.57157918
25 26 27 28 29 30
-0.21831828 -2.50091986 -1.17615686 2.11581496 1.81778857 -0.55065323
31 32 33 34 35 36
-3.60840096 -0.40740341 -3.23683493 -0.50324075 -0.11981137 -7.24738847
37 38 39 40 41 42
4.71657943 -1.12928411 -2.62143439 -2.83457833 -3.43393540 1.09901830
43 44 45 46 47 48
-4.72276351 -0.64243494 -2.49461347 -1.01701117 -4.19671016 -1.64867743
49 50 51 52 53 54
2.84109216 -1.80384352 -2.38224735 0.23321246 3.59466645 0.91420978
55 56 57 58 59 60
-4.41551906 -0.90905294 0.78237589 -4.10657542 -2.55831661 2.28849979
61 62 63 64 65 66
4.41062522 -0.02827056 -0.07735597 -0.66767096 -1.04656582 -0.47906191
67 68 69 70 71 72
4.69734191 -0.44884796 -0.81642869 1.40497754 -1.36889813 0.62636106
73 74 75 76 77 78
1.94437324 -1.71728941 -0.98199852 7.23471608 0.57671324 4.05744300
79 80 81 82 83 84
-0.32855785 -5.12930846 -0.96338175 -4.34869780 -3.44461777 -0.67791757
85 86 87 88 89 90
-0.91053796 0.59878191 0.45920778 -0.81115677 0.82004252 8.95146144
91 92 93 94 95 96
-0.61801538 1.41060444 1.19809942 2.57825722 -3.11457310 -0.71871123
97 98 99 100 101 102
3.40575934 -1.27753515 -0.76371466 -2.80271176 -1.95966859 3.65851597
103 104 105 106 107 108
1.77538114 -2.64900670 4.15621920 5.47753868 -0.79088877 3.86865472
109 110 111 112 113 114
1.19341789 9.02576503 2.05771327 2.49252497 0.15724674 -1.04471024
115 116 117 118 119 120
-1.24661258 -0.93001138 -0.15732765 -0.03796851 -4.58143245 4.04511151
121 122 123 124 125 126
0.38628390 1.33164862 -0.68058858 -3.90017052 -1.89465670 -1.10743692
127 128 129 130 131 132
-3.42289923 -1.55629580 -1.14976456 -0.64377834 -1.79293411 5.07394066
133 134 135 136 137 138
-1.90824177 0.39614999 -0.62804469 1.62613300 7.43882704 0.53302367
139 140 141 142 143 144
0.62832879 -3.26960048 -3.02553398 -4.07155098 1.87133046 0.74318593
145 146 147 148 149 150
-0.83270491 -1.88131842 -0.10268118 -1.07759095 -1.53982351 5.60020382
151 152 153 154 155 156
-0.89565494 5.17009345 -3.50507462 -0.41782215 5.63582797 4.03768135
157 158 159 160 161 162
1.41060444 0.35793371 -1.14976456 -2.76664602 5.17356176 2.43061768
> postscript(file="/var/wessaorg/rcomp/tmp/6l4hc1322170108.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -2.32698837 NA
1 -0.43497388 -2.32698837
2 1.76855571 -0.43497388
3 -1.49081086 1.76855571
4 8.38975014 -1.49081086
5 -1.14338539 8.38975014
6 8.85362435 -1.14338539
7 -1.06858151 8.85362435
8 -2.80792551 -1.06858151
9 0.64291008 -2.80792551
10 -2.06954595 0.64291008
11 -5.83043151 -2.06954595
12 2.26758176 -5.83043151
13 0.44580569 2.26758176
14 -0.97709970 0.44580569
15 0.01277979 -0.97709970
16 1.34030510 0.01277979
17 1.04929180 1.34030510
18 -2.27275413 1.04929180
19 -0.84558998 -2.27275413
20 -6.14491946 -0.84558998
21 0.89750657 -6.14491946
22 -0.71201648 0.89750657
23 0.57157918 -0.71201648
24 -0.21831828 0.57157918
25 -2.50091986 -0.21831828
26 -1.17615686 -2.50091986
27 2.11581496 -1.17615686
28 1.81778857 2.11581496
29 -0.55065323 1.81778857
30 -3.60840096 -0.55065323
31 -0.40740341 -3.60840096
32 -3.23683493 -0.40740341
33 -0.50324075 -3.23683493
34 -0.11981137 -0.50324075
35 -7.24738847 -0.11981137
36 4.71657943 -7.24738847
37 -1.12928411 4.71657943
38 -2.62143439 -1.12928411
39 -2.83457833 -2.62143439
40 -3.43393540 -2.83457833
41 1.09901830 -3.43393540
42 -4.72276351 1.09901830
43 -0.64243494 -4.72276351
44 -2.49461347 -0.64243494
45 -1.01701117 -2.49461347
46 -4.19671016 -1.01701117
47 -1.64867743 -4.19671016
48 2.84109216 -1.64867743
49 -1.80384352 2.84109216
50 -2.38224735 -1.80384352
51 0.23321246 -2.38224735
52 3.59466645 0.23321246
53 0.91420978 3.59466645
54 -4.41551906 0.91420978
55 -0.90905294 -4.41551906
56 0.78237589 -0.90905294
57 -4.10657542 0.78237589
58 -2.55831661 -4.10657542
59 2.28849979 -2.55831661
60 4.41062522 2.28849979
61 -0.02827056 4.41062522
62 -0.07735597 -0.02827056
63 -0.66767096 -0.07735597
64 -1.04656582 -0.66767096
65 -0.47906191 -1.04656582
66 4.69734191 -0.47906191
67 -0.44884796 4.69734191
68 -0.81642869 -0.44884796
69 1.40497754 -0.81642869
70 -1.36889813 1.40497754
71 0.62636106 -1.36889813
72 1.94437324 0.62636106
73 -1.71728941 1.94437324
74 -0.98199852 -1.71728941
75 7.23471608 -0.98199852
76 0.57671324 7.23471608
77 4.05744300 0.57671324
78 -0.32855785 4.05744300
79 -5.12930846 -0.32855785
80 -0.96338175 -5.12930846
81 -4.34869780 -0.96338175
82 -3.44461777 -4.34869780
83 -0.67791757 -3.44461777
84 -0.91053796 -0.67791757
85 0.59878191 -0.91053796
86 0.45920778 0.59878191
87 -0.81115677 0.45920778
88 0.82004252 -0.81115677
89 8.95146144 0.82004252
90 -0.61801538 8.95146144
91 1.41060444 -0.61801538
92 1.19809942 1.41060444
93 2.57825722 1.19809942
94 -3.11457310 2.57825722
95 -0.71871123 -3.11457310
96 3.40575934 -0.71871123
97 -1.27753515 3.40575934
98 -0.76371466 -1.27753515
99 -2.80271176 -0.76371466
100 -1.95966859 -2.80271176
101 3.65851597 -1.95966859
102 1.77538114 3.65851597
103 -2.64900670 1.77538114
104 4.15621920 -2.64900670
105 5.47753868 4.15621920
106 -0.79088877 5.47753868
107 3.86865472 -0.79088877
108 1.19341789 3.86865472
109 9.02576503 1.19341789
110 2.05771327 9.02576503
111 2.49252497 2.05771327
112 0.15724674 2.49252497
113 -1.04471024 0.15724674
114 -1.24661258 -1.04471024
115 -0.93001138 -1.24661258
116 -0.15732765 -0.93001138
117 -0.03796851 -0.15732765
118 -4.58143245 -0.03796851
119 4.04511151 -4.58143245
120 0.38628390 4.04511151
121 1.33164862 0.38628390
122 -0.68058858 1.33164862
123 -3.90017052 -0.68058858
124 -1.89465670 -3.90017052
125 -1.10743692 -1.89465670
126 -3.42289923 -1.10743692
127 -1.55629580 -3.42289923
128 -1.14976456 -1.55629580
129 -0.64377834 -1.14976456
130 -1.79293411 -0.64377834
131 5.07394066 -1.79293411
132 -1.90824177 5.07394066
133 0.39614999 -1.90824177
134 -0.62804469 0.39614999
135 1.62613300 -0.62804469
136 7.43882704 1.62613300
137 0.53302367 7.43882704
138 0.62832879 0.53302367
139 -3.26960048 0.62832879
140 -3.02553398 -3.26960048
141 -4.07155098 -3.02553398
142 1.87133046 -4.07155098
143 0.74318593 1.87133046
144 -0.83270491 0.74318593
145 -1.88131842 -0.83270491
146 -0.10268118 -1.88131842
147 -1.07759095 -0.10268118
148 -1.53982351 -1.07759095
149 5.60020382 -1.53982351
150 -0.89565494 5.60020382
151 5.17009345 -0.89565494
152 -3.50507462 5.17009345
153 -0.41782215 -3.50507462
154 5.63582797 -0.41782215
155 4.03768135 5.63582797
156 1.41060444 4.03768135
157 0.35793371 1.41060444
158 -1.14976456 0.35793371
159 -2.76664602 -1.14976456
160 5.17356176 -2.76664602
161 2.43061768 5.17356176
162 NA 2.43061768
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.43497388 -2.32698837
[2,] 1.76855571 -0.43497388
[3,] -1.49081086 1.76855571
[4,] 8.38975014 -1.49081086
[5,] -1.14338539 8.38975014
[6,] 8.85362435 -1.14338539
[7,] -1.06858151 8.85362435
[8,] -2.80792551 -1.06858151
[9,] 0.64291008 -2.80792551
[10,] -2.06954595 0.64291008
[11,] -5.83043151 -2.06954595
[12,] 2.26758176 -5.83043151
[13,] 0.44580569 2.26758176
[14,] -0.97709970 0.44580569
[15,] 0.01277979 -0.97709970
[16,] 1.34030510 0.01277979
[17,] 1.04929180 1.34030510
[18,] -2.27275413 1.04929180
[19,] -0.84558998 -2.27275413
[20,] -6.14491946 -0.84558998
[21,] 0.89750657 -6.14491946
[22,] -0.71201648 0.89750657
[23,] 0.57157918 -0.71201648
[24,] -0.21831828 0.57157918
[25,] -2.50091986 -0.21831828
[26,] -1.17615686 -2.50091986
[27,] 2.11581496 -1.17615686
[28,] 1.81778857 2.11581496
[29,] -0.55065323 1.81778857
[30,] -3.60840096 -0.55065323
[31,] -0.40740341 -3.60840096
[32,] -3.23683493 -0.40740341
[33,] -0.50324075 -3.23683493
[34,] -0.11981137 -0.50324075
[35,] -7.24738847 -0.11981137
[36,] 4.71657943 -7.24738847
[37,] -1.12928411 4.71657943
[38,] -2.62143439 -1.12928411
[39,] -2.83457833 -2.62143439
[40,] -3.43393540 -2.83457833
[41,] 1.09901830 -3.43393540
[42,] -4.72276351 1.09901830
[43,] -0.64243494 -4.72276351
[44,] -2.49461347 -0.64243494
[45,] -1.01701117 -2.49461347
[46,] -4.19671016 -1.01701117
[47,] -1.64867743 -4.19671016
[48,] 2.84109216 -1.64867743
[49,] -1.80384352 2.84109216
[50,] -2.38224735 -1.80384352
[51,] 0.23321246 -2.38224735
[52,] 3.59466645 0.23321246
[53,] 0.91420978 3.59466645
[54,] -4.41551906 0.91420978
[55,] -0.90905294 -4.41551906
[56,] 0.78237589 -0.90905294
[57,] -4.10657542 0.78237589
[58,] -2.55831661 -4.10657542
[59,] 2.28849979 -2.55831661
[60,] 4.41062522 2.28849979
[61,] -0.02827056 4.41062522
[62,] -0.07735597 -0.02827056
[63,] -0.66767096 -0.07735597
[64,] -1.04656582 -0.66767096
[65,] -0.47906191 -1.04656582
[66,] 4.69734191 -0.47906191
[67,] -0.44884796 4.69734191
[68,] -0.81642869 -0.44884796
[69,] 1.40497754 -0.81642869
[70,] -1.36889813 1.40497754
[71,] 0.62636106 -1.36889813
[72,] 1.94437324 0.62636106
[73,] -1.71728941 1.94437324
[74,] -0.98199852 -1.71728941
[75,] 7.23471608 -0.98199852
[76,] 0.57671324 7.23471608
[77,] 4.05744300 0.57671324
[78,] -0.32855785 4.05744300
[79,] -5.12930846 -0.32855785
[80,] -0.96338175 -5.12930846
[81,] -4.34869780 -0.96338175
[82,] -3.44461777 -4.34869780
[83,] -0.67791757 -3.44461777
[84,] -0.91053796 -0.67791757
[85,] 0.59878191 -0.91053796
[86,] 0.45920778 0.59878191
[87,] -0.81115677 0.45920778
[88,] 0.82004252 -0.81115677
[89,] 8.95146144 0.82004252
[90,] -0.61801538 8.95146144
[91,] 1.41060444 -0.61801538
[92,] 1.19809942 1.41060444
[93,] 2.57825722 1.19809942
[94,] -3.11457310 2.57825722
[95,] -0.71871123 -3.11457310
[96,] 3.40575934 -0.71871123
[97,] -1.27753515 3.40575934
[98,] -0.76371466 -1.27753515
[99,] -2.80271176 -0.76371466
[100,] -1.95966859 -2.80271176
[101,] 3.65851597 -1.95966859
[102,] 1.77538114 3.65851597
[103,] -2.64900670 1.77538114
[104,] 4.15621920 -2.64900670
[105,] 5.47753868 4.15621920
[106,] -0.79088877 5.47753868
[107,] 3.86865472 -0.79088877
[108,] 1.19341789 3.86865472
[109,] 9.02576503 1.19341789
[110,] 2.05771327 9.02576503
[111,] 2.49252497 2.05771327
[112,] 0.15724674 2.49252497
[113,] -1.04471024 0.15724674
[114,] -1.24661258 -1.04471024
[115,] -0.93001138 -1.24661258
[116,] -0.15732765 -0.93001138
[117,] -0.03796851 -0.15732765
[118,] -4.58143245 -0.03796851
[119,] 4.04511151 -4.58143245
[120,] 0.38628390 4.04511151
[121,] 1.33164862 0.38628390
[122,] -0.68058858 1.33164862
[123,] -3.90017052 -0.68058858
[124,] -1.89465670 -3.90017052
[125,] -1.10743692 -1.89465670
[126,] -3.42289923 -1.10743692
[127,] -1.55629580 -3.42289923
[128,] -1.14976456 -1.55629580
[129,] -0.64377834 -1.14976456
[130,] -1.79293411 -0.64377834
[131,] 5.07394066 -1.79293411
[132,] -1.90824177 5.07394066
[133,] 0.39614999 -1.90824177
[134,] -0.62804469 0.39614999
[135,] 1.62613300 -0.62804469
[136,] 7.43882704 1.62613300
[137,] 0.53302367 7.43882704
[138,] 0.62832879 0.53302367
[139,] -3.26960048 0.62832879
[140,] -3.02553398 -3.26960048
[141,] -4.07155098 -3.02553398
[142,] 1.87133046 -4.07155098
[143,] 0.74318593 1.87133046
[144,] -0.83270491 0.74318593
[145,] -1.88131842 -0.83270491
[146,] -0.10268118 -1.88131842
[147,] -1.07759095 -0.10268118
[148,] -1.53982351 -1.07759095
[149,] 5.60020382 -1.53982351
[150,] -0.89565494 5.60020382
[151,] 5.17009345 -0.89565494
[152,] -3.50507462 5.17009345
[153,] -0.41782215 -3.50507462
[154,] 5.63582797 -0.41782215
[155,] 4.03768135 5.63582797
[156,] 1.41060444 4.03768135
[157,] 0.35793371 1.41060444
[158,] -1.14976456 0.35793371
[159,] -2.76664602 -1.14976456
[160,] 5.17356176 -2.76664602
[161,] 2.43061768 5.17356176
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.43497388 -2.32698837
2 1.76855571 -0.43497388
3 -1.49081086 1.76855571
4 8.38975014 -1.49081086
5 -1.14338539 8.38975014
6 8.85362435 -1.14338539
7 -1.06858151 8.85362435
8 -2.80792551 -1.06858151
9 0.64291008 -2.80792551
10 -2.06954595 0.64291008
11 -5.83043151 -2.06954595
12 2.26758176 -5.83043151
13 0.44580569 2.26758176
14 -0.97709970 0.44580569
15 0.01277979 -0.97709970
16 1.34030510 0.01277979
17 1.04929180 1.34030510
18 -2.27275413 1.04929180
19 -0.84558998 -2.27275413
20 -6.14491946 -0.84558998
21 0.89750657 -6.14491946
22 -0.71201648 0.89750657
23 0.57157918 -0.71201648
24 -0.21831828 0.57157918
25 -2.50091986 -0.21831828
26 -1.17615686 -2.50091986
27 2.11581496 -1.17615686
28 1.81778857 2.11581496
29 -0.55065323 1.81778857
30 -3.60840096 -0.55065323
31 -0.40740341 -3.60840096
32 -3.23683493 -0.40740341
33 -0.50324075 -3.23683493
34 -0.11981137 -0.50324075
35 -7.24738847 -0.11981137
36 4.71657943 -7.24738847
37 -1.12928411 4.71657943
38 -2.62143439 -1.12928411
39 -2.83457833 -2.62143439
40 -3.43393540 -2.83457833
41 1.09901830 -3.43393540
42 -4.72276351 1.09901830
43 -0.64243494 -4.72276351
44 -2.49461347 -0.64243494
45 -1.01701117 -2.49461347
46 -4.19671016 -1.01701117
47 -1.64867743 -4.19671016
48 2.84109216 -1.64867743
49 -1.80384352 2.84109216
50 -2.38224735 -1.80384352
51 0.23321246 -2.38224735
52 3.59466645 0.23321246
53 0.91420978 3.59466645
54 -4.41551906 0.91420978
55 -0.90905294 -4.41551906
56 0.78237589 -0.90905294
57 -4.10657542 0.78237589
58 -2.55831661 -4.10657542
59 2.28849979 -2.55831661
60 4.41062522 2.28849979
61 -0.02827056 4.41062522
62 -0.07735597 -0.02827056
63 -0.66767096 -0.07735597
64 -1.04656582 -0.66767096
65 -0.47906191 -1.04656582
66 4.69734191 -0.47906191
67 -0.44884796 4.69734191
68 -0.81642869 -0.44884796
69 1.40497754 -0.81642869
70 -1.36889813 1.40497754
71 0.62636106 -1.36889813
72 1.94437324 0.62636106
73 -1.71728941 1.94437324
74 -0.98199852 -1.71728941
75 7.23471608 -0.98199852
76 0.57671324 7.23471608
77 4.05744300 0.57671324
78 -0.32855785 4.05744300
79 -5.12930846 -0.32855785
80 -0.96338175 -5.12930846
81 -4.34869780 -0.96338175
82 -3.44461777 -4.34869780
83 -0.67791757 -3.44461777
84 -0.91053796 -0.67791757
85 0.59878191 -0.91053796
86 0.45920778 0.59878191
87 -0.81115677 0.45920778
88 0.82004252 -0.81115677
89 8.95146144 0.82004252
90 -0.61801538 8.95146144
91 1.41060444 -0.61801538
92 1.19809942 1.41060444
93 2.57825722 1.19809942
94 -3.11457310 2.57825722
95 -0.71871123 -3.11457310
96 3.40575934 -0.71871123
97 -1.27753515 3.40575934
98 -0.76371466 -1.27753515
99 -2.80271176 -0.76371466
100 -1.95966859 -2.80271176
101 3.65851597 -1.95966859
102 1.77538114 3.65851597
103 -2.64900670 1.77538114
104 4.15621920 -2.64900670
105 5.47753868 4.15621920
106 -0.79088877 5.47753868
107 3.86865472 -0.79088877
108 1.19341789 3.86865472
109 9.02576503 1.19341789
110 2.05771327 9.02576503
111 2.49252497 2.05771327
112 0.15724674 2.49252497
113 -1.04471024 0.15724674
114 -1.24661258 -1.04471024
115 -0.93001138 -1.24661258
116 -0.15732765 -0.93001138
117 -0.03796851 -0.15732765
118 -4.58143245 -0.03796851
119 4.04511151 -4.58143245
120 0.38628390 4.04511151
121 1.33164862 0.38628390
122 -0.68058858 1.33164862
123 -3.90017052 -0.68058858
124 -1.89465670 -3.90017052
125 -1.10743692 -1.89465670
126 -3.42289923 -1.10743692
127 -1.55629580 -3.42289923
128 -1.14976456 -1.55629580
129 -0.64377834 -1.14976456
130 -1.79293411 -0.64377834
131 5.07394066 -1.79293411
132 -1.90824177 5.07394066
133 0.39614999 -1.90824177
134 -0.62804469 0.39614999
135 1.62613300 -0.62804469
136 7.43882704 1.62613300
137 0.53302367 7.43882704
138 0.62832879 0.53302367
139 -3.26960048 0.62832879
140 -3.02553398 -3.26960048
141 -4.07155098 -3.02553398
142 1.87133046 -4.07155098
143 0.74318593 1.87133046
144 -0.83270491 0.74318593
145 -1.88131842 -0.83270491
146 -0.10268118 -1.88131842
147 -1.07759095 -0.10268118
148 -1.53982351 -1.07759095
149 5.60020382 -1.53982351
150 -0.89565494 5.60020382
151 5.17009345 -0.89565494
152 -3.50507462 5.17009345
153 -0.41782215 -3.50507462
154 5.63582797 -0.41782215
155 4.03768135 5.63582797
156 1.41060444 4.03768135
157 0.35793371 1.41060444
158 -1.14976456 0.35793371
159 -2.76664602 -1.14976456
160 5.17356176 -2.76664602
161 2.43061768 5.17356176
> 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/7wqip1322170108.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/84rwv1322170108.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/9zxj11322170108.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/10c22n1322170108.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/11hx8t1322170108.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/128iat1322170108.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/13wixi1322170108.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/14neuj1322170108.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/154c891322170108.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/1644431322170108.tab")
+ }
>
> try(system("convert tmp/1q70n1322170108.ps tmp/1q70n1322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/22fj01322170108.ps tmp/22fj01322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/3beuk1322170108.ps tmp/3beuk1322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/4cb9g1322170108.ps tmp/4cb9g1322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/5le731322170108.ps tmp/5le731322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/6l4hc1322170108.ps tmp/6l4hc1322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/7wqip1322170108.ps tmp/7wqip1322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/84rwv1322170108.ps tmp/84rwv1322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/9zxj11322170108.ps tmp/9zxj11322170108.png",intern=TRUE))
character(0)
> try(system("convert tmp/10c22n1322170108.ps tmp/10c22n1322170108.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.975 0.523 5.577