R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-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(41
+ ,38
+ ,13
+ ,12
+ ,14
+ ,12
+ ,53
+ ,39
+ ,32
+ ,16
+ ,11
+ ,18
+ ,11
+ ,86
+ ,30
+ ,35
+ ,19
+ ,15
+ ,11
+ ,14
+ ,66
+ ,31
+ ,33
+ ,15
+ ,6
+ ,12
+ ,12
+ ,67
+ ,34
+ ,37
+ ,14
+ ,13
+ ,16
+ ,21
+ ,76
+ ,35
+ ,29
+ ,13
+ ,10
+ ,18
+ ,12
+ ,78
+ ,39
+ ,31
+ ,19
+ ,12
+ ,14
+ ,22
+ ,53
+ ,34
+ ,36
+ ,15
+ ,14
+ ,14
+ ,11
+ ,80
+ ,36
+ ,35
+ ,14
+ ,12
+ ,15
+ ,10
+ ,74
+ ,37
+ ,38
+ ,15
+ ,6
+ ,15
+ ,13
+ ,76
+ ,38
+ ,31
+ ,16
+ ,10
+ ,17
+ ,10
+ ,79
+ ,36
+ ,34
+ ,16
+ ,12
+ ,19
+ ,8
+ ,54
+ ,38
+ ,35
+ ,16
+ ,12
+ ,10
+ ,15
+ ,67
+ ,39
+ ,38
+ ,16
+ ,11
+ ,16
+ ,14
+ ,54
+ ,33
+ ,37
+ ,17
+ ,15
+ ,18
+ ,10
+ ,87
+ ,32
+ ,33
+ ,15
+ ,12
+ ,14
+ ,14
+ ,58
+ ,36
+ ,32
+ ,15
+ ,10
+ ,14
+ ,14
+ ,75
+ ,38
+ ,38
+ ,20
+ ,12
+ ,17
+ ,11
+ ,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onging')
+ ,1:162))
> y <- array(NA,dim=c(7,162),dimnames=list(c('Connected','Separate','Learning','Software','Happiness','Depression','Belonging'),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 = '4'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> 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
Software Connected Separate Learning Happiness Depression Belonging
1 12 41 38 13 14 12 53
2 11 39 32 16 18 11 86
3 15 30 35 19 11 14 66
4 6 31 33 15 12 12 67
5 13 34 37 14 16 21 76
6 10 35 29 13 18 12 78
7 12 39 31 19 14 22 53
8 14 34 36 15 14 11 80
9 12 36 35 14 15 10 74
10 6 37 38 15 15 13 76
11 10 38 31 16 17 10 79
12 12 36 34 16 19 8 54
13 12 38 35 16 10 15 67
14 11 39 38 16 16 14 54
15 15 33 37 17 18 10 87
16 12 32 33 15 14 14 58
17 10 36 32 15 14 14 75
18 12 38 38 20 17 11 88
19 11 39 38 18 14 10 64
20 12 32 32 16 16 13 57
21 11 32 33 16 18 7 66
22 12 31 31 16 11 14 68
23 13 39 38 19 14 12 54
24 11 37 39 16 12 14 56
25 9 39 32 17 17 11 86
26 13 41 32 17 9 9 80
27 10 36 35 16 16 11 76
28 14 33 37 15 14 15 69
29 12 33 33 16 15 14 78
30 10 34 33 14 11 13 67
31 12 31 28 15 16 9 80
32 8 27 32 12 13 15 54
33 10 37 31 14 17 10 71
34 12 34 37 16 15 11 84
35 12 34 30 14 14 13 74
36 7 32 33 7 16 8 71
37 6 29 31 10 9 20 63
38 12 36 33 14 15 12 71
39 10 29 31 16 17 10 76
40 10 35 33 16 13 10 69
41 10 37 32 16 15 9 74
42 12 34 33 14 16 14 75
43 15 38 32 20 16 8 54
44 10 35 33 14 12 14 52
45 10 38 28 14 12 11 69
46 12 37 35 11 11 13 68
47 13 38 39 14 15 9 65
48 11 33 34 15 15 11 75
49 11 36 38 16 17 15 74
50 12 38 32 14 13 11 75
51 14 32 38 16 16 10 72
52 10 32 30 14 14 14 67
53 12 32 33 12 11 18 63
54 13 34 38 16 12 14 62
55 5 32 32 9 12 11 63
56 6 37 32 14 15 12 76
57 12 39 34 16 16 13 74
58 12 29 34 16 15 9 67
59 11 37 36 15 12 10 73
60 10 35 34 16 12 15 70
61 7 30 28 12 8 20 53
62 12 38 34 16 13 12 77
63 14 34 35 16 11 12 77
64 11 31 35 14 14 14 52
65 12 34 31 16 15 13 54
66 13 35 37 17 10 11 80
67 14 36 35 18 11 17 66
68 11 30 27 18 12 12 73
69 12 39 40 12 15 13 63
70 12 35 37 16 15 14 69
71 8 38 36 10 14 13 67
72 11 31 38 14 16 15 54
73 14 34 39 18 15 13 81
74 14 38 41 18 15 10 69
75 12 34 27 16 13 11 84
76 9 39 30 17 12 19 80
77 13 37 37 16 17 13 70
78 11 34 31 16 13 17 69
79 12 28 31 13 15 13 77
80 12 37 27 16 13 9 54
81 12 33 36 16 15 11 79
82 12 37 38 20 16 10 30
83 12 35 37 16 15 9 71
84 12 37 33 15 16 12 73
85 11 32 34 15 15 12 72
86 10 33 31 16 14 13 77
87 9 38 39 14 15 13 75
88 12 33 34 16 14 12 69
89 12 29 32 16 13 15 54
90 12 33 33 15 7 22 70
91 9 31 36 12 17 13 73
92 15 36 32 17 13 15 54
93 12 35 41 16 15 13 77
94 12 32 28 15 14 15 82
95 12 29 30 13 13 10 80
96 10 39 36 16 16 11 80
97 13 37 35 16 12 16 69
98 9 35 31 16 14 11 78
99 12 37 34 16 17 11 81
100 10 32 36 14 15 10 76
101 14 38 36 16 17 10 76
102 11 37 35 16 12 16 73
103 15 36 37 20 16 12 85
104 11 32 28 15 11 11 66
105 11 33 39 16 15 16 79
106 12 40 32 13 9 19 68
107 12 38 35 17 16 11 76
108 12 41 39 16 15 16 71
109 11 36 35 16 10 15 54
110 7 43 42 12 10 24 46
111 12 30 34 16 15 14 82
112 14 31 33 16 11 15 74
113 11 32 41 17 13 11 88
114 11 32 33 13 14 15 38
115 10 37 34 12 18 12 76
116 13 37 32 18 16 10 86
117 13 33 40 14 14 14 54
118 8 34 40 14 14 13 70
119 11 33 35 13 14 9 69
120 12 38 36 16 14 15 90
121 11 33 37 13 12 15 54
122 13 31 27 16 14 14 76
123 12 38 39 13 15 11 89
124 14 37 38 16 15 8 76
125 13 33 31 15 15 11 73
126 15 31 33 16 13 11 79
127 10 39 32 15 17 8 90
128 11 44 39 17 17 10 74
129 9 33 36 15 19 11 81
130 11 35 33 12 15 13 72
131 10 32 33 16 13 11 71
132 11 28 32 10 9 20 66
133 8 40 37 16 15 10 77
134 11 27 30 12 15 15 65
135 12 37 38 14 15 12 74
136 12 32 29 15 16 14 82
137 9 28 22 13 11 23 54
138 11 34 35 15 14 14 63
139 10 30 35 11 11 16 54
140 8 35 34 12 15 11 64
141 9 31 35 8 13 12 69
142 8 32 34 16 15 10 54
143 9 30 34 15 16 14 84
144 15 30 35 17 14 12 86
145 11 31 23 16 15 12 77
146 8 40 31 10 16 11 89
147 13 32 27 18 16 12 76
148 12 36 36 13 11 13 60
149 12 32 31 16 12 11 75
150 9 35 32 13 9 19 73
151 7 38 39 10 16 12 85
152 13 42 37 15 13 17 79
153 9 34 38 16 16 9 71
154 6 35 39 16 12 12 72
155 8 35 34 14 9 19 69
156 8 33 31 10 13 18 78
157 15 36 32 17 13 15 54
158 6 32 37 13 14 14 69
159 9 33 36 15 19 11 81
160 11 34 32 16 13 9 84
161 8 32 35 12 12 18 84
162 8 34 36 13 13 16 69
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Connected Separate Learning Happiness Depression
4.536742 -0.047566 0.033265 0.529087 -0.040261 -0.023069
Belonging
-0.000217
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.8591 -0.9791 0.2434 1.3513 3.1690
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.536742 2.552828 1.777 0.0775 .
Connected -0.047566 0.046846 -1.015 0.3115
Separate 0.033265 0.043892 0.758 0.4497
Learning 0.529087 0.066724 7.929 4.06e-13 ***
Happiness -0.040261 0.075143 -0.536 0.5929
Depression -0.023068 0.055311 -0.417 0.6772
Belonging -0.000217 0.014179 -0.015 0.9878
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.82 on 155 degrees of freedom
Multiple R-squared: 0.3045, Adjusted R-squared: 0.2776
F-statistic: 11.31 on 6 and 155 DF, p-value: 1.844e-10
> 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.99986270 0.0002745959 0.0001372979
[2,] 0.99964384 0.0007123106 0.0003561553
[3,] 0.99952185 0.0009562934 0.0004781467
[4,] 0.99909014 0.0018197167 0.0009098583
[5,] 0.99833092 0.0033381545 0.0016690772
[6,] 0.99799609 0.0040078259 0.0020039129
[7,] 0.99661985 0.0067603079 0.0033801540
[8,] 0.99393542 0.0121291681 0.0060645840
[9,] 0.99257305 0.0148538927 0.0074269463
[10,] 0.98888885 0.0222222921 0.0111111460
[11,] 0.98197735 0.0360452988 0.0180226494
[12,] 0.97350450 0.0529909989 0.0264954994
[13,] 0.96240498 0.0751900336 0.0375950168
[14,] 0.94674351 0.1065129806 0.0532564903
[15,] 0.92822882 0.1435423556 0.0717711778
[16,] 0.92556537 0.1488692510 0.0744346255
[17,] 0.94367604 0.1126479285 0.0563239643
[18,] 0.93319641 0.1336071779 0.0668035889
[19,] 0.93964148 0.1207170309 0.0603585155
[20,] 0.91886097 0.1622780587 0.0811390293
[21,] 0.89839910 0.2032018036 0.1016009018
[22,] 0.87963674 0.2407265139 0.1203632569
[23,] 0.89698233 0.2060353322 0.1030176661
[24,] 0.86784535 0.2643092910 0.1321546455
[25,] 0.83353679 0.3329264243 0.1664632122
[26,] 0.82250186 0.3549962782 0.1774981391
[27,] 0.78564799 0.4287040292 0.2143520146
[28,] 0.82570143 0.3485971333 0.1742985666
[29,] 0.81699378 0.3660124336 0.1830062168
[30,] 0.80653398 0.3869320419 0.1934660210
[31,] 0.78780291 0.4243941715 0.2121970858
[32,] 0.76310074 0.4737985193 0.2368992596
[33,] 0.74724666 0.5055066797 0.2527533399
[34,] 0.74819473 0.5036105439 0.2518052719
[35,] 0.70562059 0.5887588245 0.2943794122
[36,] 0.66139306 0.6772138723 0.3386069362
[37,] 0.72869343 0.5426131389 0.2713065695
[38,] 0.73483145 0.5303370917 0.2651685459
[39,] 0.69084112 0.6183177510 0.3091588755
[40,] 0.65302594 0.6939481152 0.3469740576
[41,] 0.63903319 0.7219336237 0.3609668118
[42,] 0.64450924 0.7109815279 0.3554907639
[43,] 0.59790162 0.8041967537 0.4020983768
[44,] 0.62591875 0.7481625010 0.3740812505
[45,] 0.59094335 0.8181132951 0.4090566475
[46,] 0.68528918 0.6294216447 0.3147108224
[47,] 0.84430680 0.3113863990 0.1556931995
[48,] 0.81714871 0.3657025893 0.1828512947
[49,] 0.78322245 0.4335551060 0.2167775530
[50,] 0.74682278 0.5063544459 0.2531772229
[51,] 0.73536072 0.5292785678 0.2646392839
[52,] 0.75321041 0.4935791812 0.2467895906
[53,] 0.71706726 0.5658654722 0.2829327361
[54,] 0.73169654 0.5366069231 0.2683034616
[55,] 0.69144000 0.6171200023 0.3085600011
[56,] 0.65689978 0.6862004491 0.3431002246
[57,] 0.61526775 0.7694645100 0.3847322550
[58,] 0.59480577 0.8103884598 0.4051942299
[59,] 0.57748973 0.8450205390 0.4225102695
[60,] 0.59610780 0.8077844097 0.4038922049
[61,] 0.55232250 0.8953550047 0.4476775023
[62,] 0.51217300 0.9756540082 0.4878270041
[63,] 0.46906605 0.9381320935 0.5309339532
[64,] 0.44068879 0.8813775864 0.5593112068
[65,] 0.41666626 0.8333325122 0.5833337439
[66,] 0.39064291 0.7812858108 0.6093570946
[67,] 0.44057883 0.8811576502 0.5594211749
[68,] 0.42678357 0.8535671424 0.5732164288
[69,] 0.38603383 0.7720676615 0.6139661692
[70,] 0.39089122 0.7817824445 0.6091087777
[71,] 0.36831449 0.7366289859 0.6316855070
[72,] 0.32762555 0.6552511046 0.6723744477
[73,] 0.32424182 0.6484836322 0.6757581839
[74,] 0.28590204 0.5718040847 0.7140979577
[75,] 0.26083756 0.5216751117 0.7391624442
[76,] 0.22495044 0.4499008816 0.7750495592
[77,] 0.21708678 0.4341735509 0.7829132245
[78,] 0.21679389 0.4335877864 0.7832061068
[79,] 0.18479645 0.3695928915 0.8152035542
[80,] 0.15667696 0.3133539128 0.8433230436
[81,] 0.13571116 0.2714223270 0.8642888365
[82,] 0.11594805 0.2318960969 0.8840519515
[83,] 0.16207714 0.3241542706 0.8379228647
[84,] 0.14130885 0.2826177082 0.8586911459
[85,] 0.12599725 0.2519944951 0.8740027525
[86,] 0.12165917 0.2433183414 0.8783408293
[87,] 0.11321085 0.2264216932 0.8867891534
[88,] 0.10449403 0.2089880637 0.8955059682
[89,] 0.12893683 0.2578736550 0.8710631725
[90,] 0.10760992 0.2152198313 0.8923900844
[91,] 0.09085602 0.1817120393 0.9091439803
[92,] 0.11157534 0.2231506833 0.8884246584
[93,] 0.09231257 0.1846251420 0.9076874290
[94,] 0.08806149 0.1761229860 0.9119385070
[95,] 0.07421863 0.1484372669 0.9257813665
[96,] 0.06253472 0.1250694435 0.9374652783
[97,] 0.06364992 0.1272998445 0.9363500777
[98,] 0.05012751 0.1002550117 0.9498724942
[99,] 0.04432144 0.0886428811 0.9556785594
[100,] 0.03533076 0.0706615261 0.9646692369
[101,] 0.03665618 0.0733123695 0.9633438153
[102,] 0.02880205 0.0576040951 0.9711979525
[103,] 0.03221319 0.0644263756 0.9677868122
[104,] 0.02881520 0.0576303970 0.9711848015
[105,] 0.02313138 0.0462627558 0.9768686221
[106,] 0.01822136 0.0364427130 0.9817786435
[107,] 0.01376606 0.0275321243 0.9862339379
[108,] 0.02205201 0.0441040299 0.9779479850
[109,] 0.02522014 0.0504402761 0.9747798619
[110,] 0.01937500 0.0387499975 0.9806250012
[111,] 0.01502528 0.0300505631 0.9849747185
[112,] 0.01254553 0.0250910685 0.9874544657
[113,] 0.01047970 0.0209594008 0.9895202996
[114,] 0.01235574 0.0247114814 0.9876442593
[115,] 0.01945483 0.0389096533 0.9805451734
[116,] 0.02053953 0.0410790637 0.9794604681
[117,] 0.04897786 0.0979557227 0.9510221386
[118,] 0.03743636 0.0748727243 0.9625636379
[119,] 0.02873530 0.0574705975 0.9712647013
[120,] 0.02403466 0.0480693135 0.9759653433
[121,] 0.02257273 0.0451454607 0.9774272697
[122,] 0.01831186 0.0366237257 0.9816881371
[123,] 0.02083405 0.0416680930 0.9791659535
[124,] 0.03294417 0.0658883421 0.9670558289
[125,] 0.03574487 0.0714897347 0.9642551326
[126,] 0.03969924 0.0793984784 0.9603007608
[127,] 0.03388490 0.0677698040 0.9661150980
[128,] 0.02918492 0.0583698333 0.9708150834
[129,] 0.02109372 0.0421874350 0.9789062825
[130,] 0.02106918 0.0421383546 0.9789308227
[131,] 0.01497114 0.0299422743 0.9850288629
[132,] 0.04530952 0.0906190482 0.9546904759
[133,] 0.05053176 0.1010635277 0.9494682362
[134,] 0.03721931 0.0744386167 0.9627806916
[135,] 0.36436167 0.7287233368 0.6356383316
[136,] 0.37203608 0.7440721559 0.6279639221
[137,] 0.63569541 0.7286091823 0.3643045911
[138,] 0.61905646 0.7618870890 0.3809435445
[139,] 0.82839364 0.3432127142 0.1716063571
[140,] 0.81617407 0.3676518538 0.1838259269
[141,] 0.72591887 0.5481622601 0.2740811300
[142,] 0.61978583 0.7604283371 0.3802141685
[143,] 0.60086371 0.7982725887 0.3991362944
> postscript(file="/var/wessaorg/rcomp/tmp/11qzz1353262083.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/2t1p21353262083.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/3foaf1353262083.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/4y4o11353262083.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/5izbz1353262083.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.12326799 -0.21439813 1.45348666 -5.32172902 2.58761229 0.30372382
7 8 9 10 11 12
-0.68284659 2.78145070 1.45482560 -5.05684974 -1.29354850 0.54048473
13 14 15 16 17 18
0.40430169 -0.43224837 2.78194174 0.85054377 -0.92223700 -1.61772765
19 20 21 22 23 24
-1.66104842 0.41195884 -0.67724135 0.22180655 -0.14616831 -0.72125690
25 26 27 28 29 30
-2.78374619 0.94185705 -1.53958415 2.79050649 0.41362481 -0.66713610
31 32 33 34 35 36
0.93925576 -1.78482344 -0.28467734 0.26022844 1.55496125 0.02817069
37 38 39 40 41 42
-2.64200194 1.56684119 -1.72229629 -1.66599229 -1.47905575 1.55897493
43 44 45 46 47 48
1.46501596 -0.55949517 -0.31598856 2.99651057 2.39187738 -0.16040977
49 50 51 52 53 54
-0.50727726 1.59251558 2.14641966 -0.51862193 2.41037935 1.17061105
55 56 57 58 59 60
-3.09031378 -4.35124264 0.68208257 0.07236511 -0.18096055 -1.62395882
61 62 63 64 65 66
-2.59524619 0.49131494 2.18726234 0.26423256 0.49944393 0.57653349
67 68 69 70 71 72
1.33717680 -1.75566478 2.55619246 0.37374510 -0.33953430 0.26846325
73 74 75 76 77 78
1.18101125 1.23293720 0.51235392 -2.73527701 1.52654879 -0.48554942
79 80 81 82 83 84
1.80629771 0.60240546 0.24484188 -1.74121043 0.25883658 1.12601603
85 86 87 88 89 90
-0.18555861 -1.58339239 -1.51367846 0.29200860 0.19396205 0.80343329
91 92 93 94 95 96
-0.60858608 2.99783941 0.21935347 1.04514458 1.73805176 -1.42928198
97 98 99 100 101 102
1.46076048 -2.53417978 0.58259331 -0.76827040 2.53947644 -0.53837147
103 104 105 106 107 108
1.30256073 -0.17138550 -0.73960998 2.23871882 0.02646168 0.63918437
109 110 111 112 113 114
-0.69365208 -2.27131395 0.23852914 2.17964752 -1.57670469 0.92744560
115 116 117 118 119 120
0.76118517 0.52870462 2.19347518 -2.77855484 0.77679861 0.53707329
121 122 123 124 125 126
0.76490231 1.47738572 1.97230946 2.29872093 1.93895062 3.16898111
127 128 129 130 131 132
-0.79391011 -0.80444094 -2.06459217 1.60073397 -1.78518868 2.27781798
133 134 135 136 137 138
-3.47896131 1.36461587 1.44873451 1.06933384 -0.82967037 -0.11976817
139 140 141 142 143 144
0.72971379 -1.48040395 1.35604415 -3.76468862 -2.19168877 2.59064729
145 146 147 148 149 150
-0.39521379 -0.03891786 0.50116401 1.85576980 0.24194770 -0.99802765
151 152 153 154 155 156
-1.37796844 2.22664910 -2.78173325 -5.85905435 -2.59451209 -0.33357342
157 158 159 160 161 162
2.99783941 -4.22195476 -2.06459217 -0.70010712 -1.61133172 -2.08768161
> postscript(file="/var/wessaorg/rcomp/tmp/6igjg1353262083.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.12326799 NA
1 -0.21439813 2.12326799
2 1.45348666 -0.21439813
3 -5.32172902 1.45348666
4 2.58761229 -5.32172902
5 0.30372382 2.58761229
6 -0.68284659 0.30372382
7 2.78145070 -0.68284659
8 1.45482560 2.78145070
9 -5.05684974 1.45482560
10 -1.29354850 -5.05684974
11 0.54048473 -1.29354850
12 0.40430169 0.54048473
13 -0.43224837 0.40430169
14 2.78194174 -0.43224837
15 0.85054377 2.78194174
16 -0.92223700 0.85054377
17 -1.61772765 -0.92223700
18 -1.66104842 -1.61772765
19 0.41195884 -1.66104842
20 -0.67724135 0.41195884
21 0.22180655 -0.67724135
22 -0.14616831 0.22180655
23 -0.72125690 -0.14616831
24 -2.78374619 -0.72125690
25 0.94185705 -2.78374619
26 -1.53958415 0.94185705
27 2.79050649 -1.53958415
28 0.41362481 2.79050649
29 -0.66713610 0.41362481
30 0.93925576 -0.66713610
31 -1.78482344 0.93925576
32 -0.28467734 -1.78482344
33 0.26022844 -0.28467734
34 1.55496125 0.26022844
35 0.02817069 1.55496125
36 -2.64200194 0.02817069
37 1.56684119 -2.64200194
38 -1.72229629 1.56684119
39 -1.66599229 -1.72229629
40 -1.47905575 -1.66599229
41 1.55897493 -1.47905575
42 1.46501596 1.55897493
43 -0.55949517 1.46501596
44 -0.31598856 -0.55949517
45 2.99651057 -0.31598856
46 2.39187738 2.99651057
47 -0.16040977 2.39187738
48 -0.50727726 -0.16040977
49 1.59251558 -0.50727726
50 2.14641966 1.59251558
51 -0.51862193 2.14641966
52 2.41037935 -0.51862193
53 1.17061105 2.41037935
54 -3.09031378 1.17061105
55 -4.35124264 -3.09031378
56 0.68208257 -4.35124264
57 0.07236511 0.68208257
58 -0.18096055 0.07236511
59 -1.62395882 -0.18096055
60 -2.59524619 -1.62395882
61 0.49131494 -2.59524619
62 2.18726234 0.49131494
63 0.26423256 2.18726234
64 0.49944393 0.26423256
65 0.57653349 0.49944393
66 1.33717680 0.57653349
67 -1.75566478 1.33717680
68 2.55619246 -1.75566478
69 0.37374510 2.55619246
70 -0.33953430 0.37374510
71 0.26846325 -0.33953430
72 1.18101125 0.26846325
73 1.23293720 1.18101125
74 0.51235392 1.23293720
75 -2.73527701 0.51235392
76 1.52654879 -2.73527701
77 -0.48554942 1.52654879
78 1.80629771 -0.48554942
79 0.60240546 1.80629771
80 0.24484188 0.60240546
81 -1.74121043 0.24484188
82 0.25883658 -1.74121043
83 1.12601603 0.25883658
84 -0.18555861 1.12601603
85 -1.58339239 -0.18555861
86 -1.51367846 -1.58339239
87 0.29200860 -1.51367846
88 0.19396205 0.29200860
89 0.80343329 0.19396205
90 -0.60858608 0.80343329
91 2.99783941 -0.60858608
92 0.21935347 2.99783941
93 1.04514458 0.21935347
94 1.73805176 1.04514458
95 -1.42928198 1.73805176
96 1.46076048 -1.42928198
97 -2.53417978 1.46076048
98 0.58259331 -2.53417978
99 -0.76827040 0.58259331
100 2.53947644 -0.76827040
101 -0.53837147 2.53947644
102 1.30256073 -0.53837147
103 -0.17138550 1.30256073
104 -0.73960998 -0.17138550
105 2.23871882 -0.73960998
106 0.02646168 2.23871882
107 0.63918437 0.02646168
108 -0.69365208 0.63918437
109 -2.27131395 -0.69365208
110 0.23852914 -2.27131395
111 2.17964752 0.23852914
112 -1.57670469 2.17964752
113 0.92744560 -1.57670469
114 0.76118517 0.92744560
115 0.52870462 0.76118517
116 2.19347518 0.52870462
117 -2.77855484 2.19347518
118 0.77679861 -2.77855484
119 0.53707329 0.77679861
120 0.76490231 0.53707329
121 1.47738572 0.76490231
122 1.97230946 1.47738572
123 2.29872093 1.97230946
124 1.93895062 2.29872093
125 3.16898111 1.93895062
126 -0.79391011 3.16898111
127 -0.80444094 -0.79391011
128 -2.06459217 -0.80444094
129 1.60073397 -2.06459217
130 -1.78518868 1.60073397
131 2.27781798 -1.78518868
132 -3.47896131 2.27781798
133 1.36461587 -3.47896131
134 1.44873451 1.36461587
135 1.06933384 1.44873451
136 -0.82967037 1.06933384
137 -0.11976817 -0.82967037
138 0.72971379 -0.11976817
139 -1.48040395 0.72971379
140 1.35604415 -1.48040395
141 -3.76468862 1.35604415
142 -2.19168877 -3.76468862
143 2.59064729 -2.19168877
144 -0.39521379 2.59064729
145 -0.03891786 -0.39521379
146 0.50116401 -0.03891786
147 1.85576980 0.50116401
148 0.24194770 1.85576980
149 -0.99802765 0.24194770
150 -1.37796844 -0.99802765
151 2.22664910 -1.37796844
152 -2.78173325 2.22664910
153 -5.85905435 -2.78173325
154 -2.59451209 -5.85905435
155 -0.33357342 -2.59451209
156 2.99783941 -0.33357342
157 -4.22195476 2.99783941
158 -2.06459217 -4.22195476
159 -0.70010712 -2.06459217
160 -1.61133172 -0.70010712
161 -2.08768161 -1.61133172
162 NA -2.08768161
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.21439813 2.12326799
[2,] 1.45348666 -0.21439813
[3,] -5.32172902 1.45348666
[4,] 2.58761229 -5.32172902
[5,] 0.30372382 2.58761229
[6,] -0.68284659 0.30372382
[7,] 2.78145070 -0.68284659
[8,] 1.45482560 2.78145070
[9,] -5.05684974 1.45482560
[10,] -1.29354850 -5.05684974
[11,] 0.54048473 -1.29354850
[12,] 0.40430169 0.54048473
[13,] -0.43224837 0.40430169
[14,] 2.78194174 -0.43224837
[15,] 0.85054377 2.78194174
[16,] -0.92223700 0.85054377
[17,] -1.61772765 -0.92223700
[18,] -1.66104842 -1.61772765
[19,] 0.41195884 -1.66104842
[20,] -0.67724135 0.41195884
[21,] 0.22180655 -0.67724135
[22,] -0.14616831 0.22180655
[23,] -0.72125690 -0.14616831
[24,] -2.78374619 -0.72125690
[25,] 0.94185705 -2.78374619
[26,] -1.53958415 0.94185705
[27,] 2.79050649 -1.53958415
[28,] 0.41362481 2.79050649
[29,] -0.66713610 0.41362481
[30,] 0.93925576 -0.66713610
[31,] -1.78482344 0.93925576
[32,] -0.28467734 -1.78482344
[33,] 0.26022844 -0.28467734
[34,] 1.55496125 0.26022844
[35,] 0.02817069 1.55496125
[36,] -2.64200194 0.02817069
[37,] 1.56684119 -2.64200194
[38,] -1.72229629 1.56684119
[39,] -1.66599229 -1.72229629
[40,] -1.47905575 -1.66599229
[41,] 1.55897493 -1.47905575
[42,] 1.46501596 1.55897493
[43,] -0.55949517 1.46501596
[44,] -0.31598856 -0.55949517
[45,] 2.99651057 -0.31598856
[46,] 2.39187738 2.99651057
[47,] -0.16040977 2.39187738
[48,] -0.50727726 -0.16040977
[49,] 1.59251558 -0.50727726
[50,] 2.14641966 1.59251558
[51,] -0.51862193 2.14641966
[52,] 2.41037935 -0.51862193
[53,] 1.17061105 2.41037935
[54,] -3.09031378 1.17061105
[55,] -4.35124264 -3.09031378
[56,] 0.68208257 -4.35124264
[57,] 0.07236511 0.68208257
[58,] -0.18096055 0.07236511
[59,] -1.62395882 -0.18096055
[60,] -2.59524619 -1.62395882
[61,] 0.49131494 -2.59524619
[62,] 2.18726234 0.49131494
[63,] 0.26423256 2.18726234
[64,] 0.49944393 0.26423256
[65,] 0.57653349 0.49944393
[66,] 1.33717680 0.57653349
[67,] -1.75566478 1.33717680
[68,] 2.55619246 -1.75566478
[69,] 0.37374510 2.55619246
[70,] -0.33953430 0.37374510
[71,] 0.26846325 -0.33953430
[72,] 1.18101125 0.26846325
[73,] 1.23293720 1.18101125
[74,] 0.51235392 1.23293720
[75,] -2.73527701 0.51235392
[76,] 1.52654879 -2.73527701
[77,] -0.48554942 1.52654879
[78,] 1.80629771 -0.48554942
[79,] 0.60240546 1.80629771
[80,] 0.24484188 0.60240546
[81,] -1.74121043 0.24484188
[82,] 0.25883658 -1.74121043
[83,] 1.12601603 0.25883658
[84,] -0.18555861 1.12601603
[85,] -1.58339239 -0.18555861
[86,] -1.51367846 -1.58339239
[87,] 0.29200860 -1.51367846
[88,] 0.19396205 0.29200860
[89,] 0.80343329 0.19396205
[90,] -0.60858608 0.80343329
[91,] 2.99783941 -0.60858608
[92,] 0.21935347 2.99783941
[93,] 1.04514458 0.21935347
[94,] 1.73805176 1.04514458
[95,] -1.42928198 1.73805176
[96,] 1.46076048 -1.42928198
[97,] -2.53417978 1.46076048
[98,] 0.58259331 -2.53417978
[99,] -0.76827040 0.58259331
[100,] 2.53947644 -0.76827040
[101,] -0.53837147 2.53947644
[102,] 1.30256073 -0.53837147
[103,] -0.17138550 1.30256073
[104,] -0.73960998 -0.17138550
[105,] 2.23871882 -0.73960998
[106,] 0.02646168 2.23871882
[107,] 0.63918437 0.02646168
[108,] -0.69365208 0.63918437
[109,] -2.27131395 -0.69365208
[110,] 0.23852914 -2.27131395
[111,] 2.17964752 0.23852914
[112,] -1.57670469 2.17964752
[113,] 0.92744560 -1.57670469
[114,] 0.76118517 0.92744560
[115,] 0.52870462 0.76118517
[116,] 2.19347518 0.52870462
[117,] -2.77855484 2.19347518
[118,] 0.77679861 -2.77855484
[119,] 0.53707329 0.77679861
[120,] 0.76490231 0.53707329
[121,] 1.47738572 0.76490231
[122,] 1.97230946 1.47738572
[123,] 2.29872093 1.97230946
[124,] 1.93895062 2.29872093
[125,] 3.16898111 1.93895062
[126,] -0.79391011 3.16898111
[127,] -0.80444094 -0.79391011
[128,] -2.06459217 -0.80444094
[129,] 1.60073397 -2.06459217
[130,] -1.78518868 1.60073397
[131,] 2.27781798 -1.78518868
[132,] -3.47896131 2.27781798
[133,] 1.36461587 -3.47896131
[134,] 1.44873451 1.36461587
[135,] 1.06933384 1.44873451
[136,] -0.82967037 1.06933384
[137,] -0.11976817 -0.82967037
[138,] 0.72971379 -0.11976817
[139,] -1.48040395 0.72971379
[140,] 1.35604415 -1.48040395
[141,] -3.76468862 1.35604415
[142,] -2.19168877 -3.76468862
[143,] 2.59064729 -2.19168877
[144,] -0.39521379 2.59064729
[145,] -0.03891786 -0.39521379
[146,] 0.50116401 -0.03891786
[147,] 1.85576980 0.50116401
[148,] 0.24194770 1.85576980
[149,] -0.99802765 0.24194770
[150,] -1.37796844 -0.99802765
[151,] 2.22664910 -1.37796844
[152,] -2.78173325 2.22664910
[153,] -5.85905435 -2.78173325
[154,] -2.59451209 -5.85905435
[155,] -0.33357342 -2.59451209
[156,] 2.99783941 -0.33357342
[157,] -4.22195476 2.99783941
[158,] -2.06459217 -4.22195476
[159,] -0.70010712 -2.06459217
[160,] -1.61133172 -0.70010712
[161,] -2.08768161 -1.61133172
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.21439813 2.12326799
2 1.45348666 -0.21439813
3 -5.32172902 1.45348666
4 2.58761229 -5.32172902
5 0.30372382 2.58761229
6 -0.68284659 0.30372382
7 2.78145070 -0.68284659
8 1.45482560 2.78145070
9 -5.05684974 1.45482560
10 -1.29354850 -5.05684974
11 0.54048473 -1.29354850
12 0.40430169 0.54048473
13 -0.43224837 0.40430169
14 2.78194174 -0.43224837
15 0.85054377 2.78194174
16 -0.92223700 0.85054377
17 -1.61772765 -0.92223700
18 -1.66104842 -1.61772765
19 0.41195884 -1.66104842
20 -0.67724135 0.41195884
21 0.22180655 -0.67724135
22 -0.14616831 0.22180655
23 -0.72125690 -0.14616831
24 -2.78374619 -0.72125690
25 0.94185705 -2.78374619
26 -1.53958415 0.94185705
27 2.79050649 -1.53958415
28 0.41362481 2.79050649
29 -0.66713610 0.41362481
30 0.93925576 -0.66713610
31 -1.78482344 0.93925576
32 -0.28467734 -1.78482344
33 0.26022844 -0.28467734
34 1.55496125 0.26022844
35 0.02817069 1.55496125
36 -2.64200194 0.02817069
37 1.56684119 -2.64200194
38 -1.72229629 1.56684119
39 -1.66599229 -1.72229629
40 -1.47905575 -1.66599229
41 1.55897493 -1.47905575
42 1.46501596 1.55897493
43 -0.55949517 1.46501596
44 -0.31598856 -0.55949517
45 2.99651057 -0.31598856
46 2.39187738 2.99651057
47 -0.16040977 2.39187738
48 -0.50727726 -0.16040977
49 1.59251558 -0.50727726
50 2.14641966 1.59251558
51 -0.51862193 2.14641966
52 2.41037935 -0.51862193
53 1.17061105 2.41037935
54 -3.09031378 1.17061105
55 -4.35124264 -3.09031378
56 0.68208257 -4.35124264
57 0.07236511 0.68208257
58 -0.18096055 0.07236511
59 -1.62395882 -0.18096055
60 -2.59524619 -1.62395882
61 0.49131494 -2.59524619
62 2.18726234 0.49131494
63 0.26423256 2.18726234
64 0.49944393 0.26423256
65 0.57653349 0.49944393
66 1.33717680 0.57653349
67 -1.75566478 1.33717680
68 2.55619246 -1.75566478
69 0.37374510 2.55619246
70 -0.33953430 0.37374510
71 0.26846325 -0.33953430
72 1.18101125 0.26846325
73 1.23293720 1.18101125
74 0.51235392 1.23293720
75 -2.73527701 0.51235392
76 1.52654879 -2.73527701
77 -0.48554942 1.52654879
78 1.80629771 -0.48554942
79 0.60240546 1.80629771
80 0.24484188 0.60240546
81 -1.74121043 0.24484188
82 0.25883658 -1.74121043
83 1.12601603 0.25883658
84 -0.18555861 1.12601603
85 -1.58339239 -0.18555861
86 -1.51367846 -1.58339239
87 0.29200860 -1.51367846
88 0.19396205 0.29200860
89 0.80343329 0.19396205
90 -0.60858608 0.80343329
91 2.99783941 -0.60858608
92 0.21935347 2.99783941
93 1.04514458 0.21935347
94 1.73805176 1.04514458
95 -1.42928198 1.73805176
96 1.46076048 -1.42928198
97 -2.53417978 1.46076048
98 0.58259331 -2.53417978
99 -0.76827040 0.58259331
100 2.53947644 -0.76827040
101 -0.53837147 2.53947644
102 1.30256073 -0.53837147
103 -0.17138550 1.30256073
104 -0.73960998 -0.17138550
105 2.23871882 -0.73960998
106 0.02646168 2.23871882
107 0.63918437 0.02646168
108 -0.69365208 0.63918437
109 -2.27131395 -0.69365208
110 0.23852914 -2.27131395
111 2.17964752 0.23852914
112 -1.57670469 2.17964752
113 0.92744560 -1.57670469
114 0.76118517 0.92744560
115 0.52870462 0.76118517
116 2.19347518 0.52870462
117 -2.77855484 2.19347518
118 0.77679861 -2.77855484
119 0.53707329 0.77679861
120 0.76490231 0.53707329
121 1.47738572 0.76490231
122 1.97230946 1.47738572
123 2.29872093 1.97230946
124 1.93895062 2.29872093
125 3.16898111 1.93895062
126 -0.79391011 3.16898111
127 -0.80444094 -0.79391011
128 -2.06459217 -0.80444094
129 1.60073397 -2.06459217
130 -1.78518868 1.60073397
131 2.27781798 -1.78518868
132 -3.47896131 2.27781798
133 1.36461587 -3.47896131
134 1.44873451 1.36461587
135 1.06933384 1.44873451
136 -0.82967037 1.06933384
137 -0.11976817 -0.82967037
138 0.72971379 -0.11976817
139 -1.48040395 0.72971379
140 1.35604415 -1.48040395
141 -3.76468862 1.35604415
142 -2.19168877 -3.76468862
143 2.59064729 -2.19168877
144 -0.39521379 2.59064729
145 -0.03891786 -0.39521379
146 0.50116401 -0.03891786
147 1.85576980 0.50116401
148 0.24194770 1.85576980
149 -0.99802765 0.24194770
150 -1.37796844 -0.99802765
151 2.22664910 -1.37796844
152 -2.78173325 2.22664910
153 -5.85905435 -2.78173325
154 -2.59451209 -5.85905435
155 -0.33357342 -2.59451209
156 2.99783941 -0.33357342
157 -4.22195476 2.99783941
158 -2.06459217 -4.22195476
159 -0.70010712 -2.06459217
160 -1.61133172 -0.70010712
161 -2.08768161 -1.61133172
> 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/763v21353262083.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/8yb7j1353262083.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/9oakp1353262083.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/10toz41353262083.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/11sgja1353262083.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/129n2y1353262083.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/1308601353262083.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/14qnnv1353262083.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/15m7s11353262083.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/16mkk61353262083.tab")
+ }
>
> try(system("convert tmp/11qzz1353262083.ps tmp/11qzz1353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/2t1p21353262083.ps tmp/2t1p21353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/3foaf1353262083.ps tmp/3foaf1353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/4y4o11353262083.ps tmp/4y4o11353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/5izbz1353262083.ps tmp/5izbz1353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/6igjg1353262083.ps tmp/6igjg1353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/763v21353262083.ps tmp/763v21353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/8yb7j1353262083.ps tmp/8yb7j1353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/9oakp1353262083.ps tmp/9oakp1353262083.png",intern=TRUE))
character(0)
> try(system("convert tmp/10toz41353262083.ps tmp/10toz41353262083.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.865 1.235 10.126