R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
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(1
+ ,41
+ ,12
+ ,12
+ ,53
+ ,13
+ ,2
+ ,39
+ ,11
+ ,11
+ ,86
+ ,16
+ ,3
+ ,30
+ ,15
+ ,14
+ ,66
+ ,19
+ ,4
+ ,31
+ ,6
+ ,12
+ ,67
+ ,15
+ ,5
+ ,34
+ ,13
+ ,21
+ ,76
+ ,14
+ ,6
+ ,35
+ ,10
+ ,12
+ ,78
+ ,13
+ ,7
+ ,39
+ ,12
+ ,22
+ ,53
+ ,19
+ ,8
+ ,34
+ ,14
+ ,11
+ ,80
+ ,15
+ ,9
+ ,36
+ ,12
+ ,10
+ ,74
+ ,14
+ ,10
+ ,37
+ ,6
+ ,13
+ ,76
+ ,15
+ ,11
+ ,38
+ ,10
+ ,10
+ ,79
+ ,16
+ ,12
+ ,36
+ ,12
+ ,8
+ ,54
+ ,16
+ ,13
+ ,38
+ ,12
+ ,15
+ ,67
+ ,16
+ ,14
+ ,39
+ ,11
+ ,14
+ ,54
+ ,16
+ ,15
+ ,33
+ ,15
+ ,10
+ ,87
+ ,17
+ ,16
+ ,32
+ ,12
+ ,14
+ ,58
+ ,15
+ ,17
+ ,36
+ ,10
+ ,14
+ ,75
+ ,15
+ ,18
+ ,38
+ ,12
+ ,11
+ ,88
+ ,20
+ ,19
+ ,39
+ ,11
+ ,10
+ ,64
+ ,18
+ ,20
+ ,32
+ ,12
+ ,13
+ ,57
+ ,16
+ ,21
+ ,32
+ ,11
+ ,7
+ ,66
+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'Connected'
+ ,'Software'
+ ,'Depression'
+ ,'Belonging'
+ ,'Learning')
+ ,1:162))
> y <- array(NA,dim=c(6,162),dimnames=list(c('t','Connected','Software','Depression','Belonging','Learning'),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 = '6'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '6'
> #'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
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
Learning t Connected Software Depression Belonging
1 13 1 41 12 12 53
2 16 2 39 11 11 86
3 19 3 30 15 14 66
4 15 4 31 6 12 67
5 14 5 34 13 21 76
6 13 6 35 10 12 78
7 19 7 39 12 22 53
8 15 8 34 14 11 80
9 14 9 36 12 10 74
10 15 10 37 6 13 76
11 16 11 38 10 10 79
12 16 12 36 12 8 54
13 16 13 38 12 15 67
14 16 14 39 11 14 54
15 17 15 33 15 10 87
16 15 16 32 12 14 58
17 15 17 36 10 14 75
18 20 18 38 12 11 88
19 18 19 39 11 10 64
20 16 20 32 12 13 57
21 16 21 32 11 7 66
22 16 22 31 12 14 68
23 19 23 39 13 12 54
24 16 24 37 11 14 56
25 17 25 39 9 11 86
26 17 26 41 13 9 80
27 16 27 36 10 11 76
28 15 28 33 14 15 69
29 16 29 33 12 14 78
30 14 30 34 10 13 67
31 15 31 31 12 9 80
32 12 32 27 8 15 54
33 14 33 37 10 10 71
34 16 34 34 12 11 84
35 14 35 34 12 13 74
36 7 36 32 7 8 71
37 10 37 29 6 20 63
38 14 38 36 12 12 71
39 16 39 29 10 10 76
40 16 40 35 10 10 69
41 16 41 37 10 9 74
42 14 42 34 12 14 75
43 20 43 38 15 8 54
44 14 44 35 10 14 52
45 14 45 38 10 11 69
46 11 46 37 12 13 68
47 14 47 38 13 9 65
48 15 48 33 11 11 75
49 16 49 36 11 15 74
50 14 50 38 12 11 75
51 16 51 32 14 10 72
52 14 52 32 10 14 67
53 12 53 32 12 18 63
54 16 54 34 13 14 62
55 9 55 32 5 11 63
56 14 56 37 6 12 76
57 16 57 39 12 13 74
58 16 58 29 12 9 67
59 15 59 37 11 10 73
60 16 60 35 10 15 70
61 12 61 30 7 20 53
62 16 62 38 12 12 77
63 16 63 34 14 12 77
64 14 64 31 11 14 52
65 16 65 34 12 13 54
66 17 66 35 13 11 80
67 18 67 36 14 17 66
68 18 68 30 11 12 73
69 12 69 39 12 13 63
70 16 70 35 12 14 69
71 10 71 38 8 13 67
72 14 72 31 11 15 54
73 18 73 34 14 13 81
74 18 74 38 14 10 69
75 16 75 34 12 11 84
76 17 76 39 9 19 80
77 16 77 37 13 13 70
78 16 78 34 11 17 69
79 13 79 28 12 13 77
80 16 80 37 12 9 54
81 16 81 33 12 11 79
82 20 82 37 12 10 30
83 16 83 35 12 9 71
84 15 84 37 12 12 73
85 15 85 32 11 12 72
86 16 86 33 10 13 77
87 14 87 38 9 13 75
88 16 88 33 12 12 69
89 16 89 29 12 15 54
90 15 90 33 12 22 70
91 12 91 31 9 13 73
92 17 92 36 15 15 54
93 16 93 35 12 13 77
94 15 94 32 12 15 82
95 13 95 29 12 10 80
96 16 96 39 10 11 80
97 16 97 37 13 16 69
98 16 98 35 9 11 78
99 16 99 37 12 11 81
100 14 100 32 10 10 76
101 16 101 38 14 10 76
102 16 102 37 11 16 73
103 20 103 36 15 12 85
104 15 104 32 11 11 66
105 16 105 33 11 16 79
106 13 106 40 12 19 68
107 17 107 38 12 11 76
108 16 108 41 12 16 71
109 16 109 36 11 15 54
110 12 110 43 7 24 46
111 16 111 30 12 14 82
112 16 112 31 14 15 74
113 17 113 32 11 11 88
114 13 114 32 11 15 38
115 12 115 37 10 12 76
116 18 116 37 13 10 86
117 14 117 33 13 14 54
118 14 118 34 8 13 70
119 13 119 33 11 9 69
120 16 120 38 12 15 90
121 13 121 33 11 15 54
122 16 122 31 13 14 76
123 13 123 38 12 11 89
124 16 124 37 14 8 76
125 15 125 33 13 11 73
126 16 126 31 15 11 79
127 15 127 39 10 8 90
128 17 128 44 11 10 74
129 15 129 33 9 11 81
130 12 130 35 11 13 72
131 16 131 32 10 11 71
132 10 132 28 11 20 66
133 16 133 40 8 10 77
134 12 134 27 11 15 65
135 14 135 37 12 12 74
136 15 136 32 12 14 82
137 13 137 28 9 23 54
138 15 138 34 11 14 63
139 11 139 30 10 16 54
140 12 140 35 8 11 64
141 8 141 31 9 12 69
142 16 142 32 8 10 54
143 15 143 30 9 14 84
144 17 144 30 15 12 86
145 16 145 31 11 12 77
146 10 146 40 8 11 89
147 18 147 32 13 12 76
148 13 148 36 12 13 60
149 16 149 32 12 11 75
150 13 150 35 9 19 73
151 10 151 38 7 12 85
152 15 152 42 13 17 79
153 16 153 34 9 9 71
154 16 154 35 6 12 72
155 14 155 35 8 19 69
156 10 156 33 8 18 78
157 17 157 36 15 15 54
158 13 158 32 6 14 69
159 15 159 33 9 11 81
160 16 160 34 11 9 84
161 12 161 32 8 18 84
162 13 162 34 8 16 69
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) t Connected Software Depression Belonging
6.488738 -0.004360 0.102754 0.531584 -0.088842 0.007501
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.1628 -1.0789 0.1572 1.1336 4.3513
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.488738 2.154797 3.011 0.00304 **
t -0.004360 0.003212 -1.358 0.17657
Connected 0.102754 0.043570 2.358 0.01959 *
Software 0.531584 0.068860 7.720 1.31e-12 ***
Depression -0.088842 0.048702 -1.824 0.07004 .
Belonging 0.007501 0.014309 0.524 0.60087
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.837 on 156 degrees of freedom
Multiple R-squared: 0.3579, Adjusted R-squared: 0.3373
F-statistic: 17.39 on 5 and 156 DF, p-value: 1.16e-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,] 0.96234600 0.07530801 0.03765400
[2,] 0.93966144 0.12067712 0.06033856
[3,] 0.91747202 0.16505596 0.08252798
[4,] 0.86334744 0.27330513 0.13665256
[5,] 0.79471646 0.41056709 0.20528354
[6,] 0.71498316 0.57003367 0.28501684
[7,] 0.63617411 0.72765179 0.36382589
[8,] 0.63833956 0.72332088 0.36166044
[9,] 0.55818508 0.88362983 0.44181492
[10,] 0.78488525 0.43022950 0.21511475
[11,] 0.76140438 0.47719125 0.23859562
[12,] 0.71025803 0.57948394 0.28974197
[13,] 0.64198326 0.71603348 0.35801674
[14,] 0.58820960 0.82358081 0.41179040
[15,] 0.56510968 0.86978064 0.43489032
[16,] 0.52735420 0.94529160 0.47264580
[17,] 0.47440053 0.94880107 0.52559947
[18,] 0.42405611 0.84811222 0.57594389
[19,] 0.37721175 0.75442350 0.62278825
[20,] 0.42624322 0.85248644 0.57375678
[21,] 0.37360828 0.74721657 0.62639172
[22,] 0.38822782 0.77645565 0.61177218
[23,] 0.34454021 0.68908043 0.65545979
[24,] 0.34419058 0.68838117 0.65580942
[25,] 0.34357471 0.68714942 0.65642529
[26,] 0.28966169 0.57932337 0.71033831
[27,] 0.28864555 0.57729110 0.71135445
[28,] 0.79635326 0.40729349 0.20364674
[29,] 0.77558581 0.44882839 0.22441419
[30,] 0.75938305 0.48123390 0.24061695
[31,] 0.79532760 0.40934480 0.20467240
[32,] 0.78111830 0.43776339 0.21888170
[33,] 0.75181205 0.49637591 0.24818795
[34,] 0.72815285 0.54369429 0.27184715
[35,] 0.74916732 0.50166535 0.25083268
[36,] 0.70774547 0.58450905 0.29225453
[37,] 0.67503815 0.64992371 0.32496185
[38,] 0.85793410 0.28413179 0.14206590
[39,] 0.87096764 0.25806472 0.12903236
[40,] 0.84755261 0.30489477 0.15244739
[41,] 0.83476425 0.33047151 0.16523575
[42,] 0.82855337 0.34289326 0.17144663
[43,] 0.80011166 0.39977668 0.19988834
[44,] 0.76730201 0.46539597 0.23269799
[45,] 0.78691278 0.42617444 0.21308722
[46,] 0.75931504 0.48136993 0.24068496
[47,] 0.78298957 0.43402086 0.21701043
[48,] 0.77807942 0.44384116 0.22192058
[49,] 0.74399525 0.51200950 0.25600475
[50,] 0.73494007 0.53011985 0.26505993
[51,] 0.69906513 0.60186974 0.30093487
[52,] 0.70569300 0.58861400 0.29430700
[53,] 0.66788053 0.66423894 0.33211947
[54,] 0.62621275 0.74757450 0.37378725
[55,] 0.58581728 0.82836544 0.41418272
[56,] 0.54441034 0.91117931 0.45558966
[57,] 0.51145388 0.97709224 0.48854612
[58,] 0.47988493 0.95976985 0.52011507
[59,] 0.47456281 0.94912563 0.52543719
[60,] 0.59803549 0.80392902 0.40196451
[61,] 0.73482257 0.53035486 0.26517743
[62,] 0.70060665 0.59878670 0.29939335
[63,] 0.81003785 0.37992430 0.18996215
[64,] 0.78078737 0.43842527 0.21921263
[65,] 0.76849697 0.46300606 0.23150303
[66,] 0.74329037 0.51341926 0.25670963
[67,] 0.70667474 0.58665053 0.29332526
[68,] 0.76569468 0.46861063 0.23430532
[69,] 0.72971819 0.54056362 0.27028181
[70,] 0.71268150 0.57463701 0.28731850
[71,] 0.71600799 0.56798403 0.28399201
[72,] 0.68297162 0.63405675 0.31702838
[73,] 0.64370933 0.71258134 0.35629067
[74,] 0.80516795 0.38966409 0.19483205
[75,] 0.77218593 0.45562813 0.22781407
[76,] 0.74422410 0.51155181 0.25577590
[77,] 0.70651285 0.58697430 0.29348715
[78,] 0.69616191 0.60767618 0.30383809
[79,] 0.65600994 0.68798013 0.34399006
[80,] 0.61608715 0.76782571 0.38391285
[81,] 0.59584744 0.80830512 0.40415256
[82,] 0.55849921 0.88300157 0.44150079
[83,] 0.54708849 0.90582302 0.45291151
[84,] 0.50573090 0.98853820 0.49426910
[85,] 0.46172123 0.92344245 0.53827877
[86,] 0.41550068 0.83100136 0.58449932
[87,] 0.44573283 0.89146567 0.55426717
[88,] 0.40823495 0.81646991 0.59176505
[89,] 0.36557206 0.73114411 0.63442794
[90,] 0.35950319 0.71900638 0.64049681
[91,] 0.31605270 0.63210539 0.68394730
[92,] 0.28063917 0.56127834 0.71936083
[93,] 0.25513040 0.51026080 0.74486960
[94,] 0.23286212 0.46572424 0.76713788
[95,] 0.28205317 0.56410634 0.71794683
[96,] 0.24310904 0.48621808 0.75689096
[97,] 0.23539295 0.47078590 0.76460705
[98,] 0.24853023 0.49706047 0.75146977
[99,] 0.22730191 0.45460382 0.77269809
[100,] 0.20280951 0.40561903 0.79719049
[101,] 0.19964335 0.39928670 0.80035665
[102,] 0.19640507 0.39281015 0.80359493
[103,] 0.18151867 0.36303735 0.81848133
[104,] 0.15818830 0.31637659 0.84181170
[105,] 0.18171309 0.36342619 0.81828691
[106,] 0.15542035 0.31084070 0.84457965
[107,] 0.16331015 0.32662030 0.83668985
[108,] 0.17439079 0.34878158 0.82560921
[109,] 0.15153389 0.30306777 0.84846611
[110,] 0.14014127 0.28028255 0.85985873
[111,] 0.13570183 0.27140366 0.86429817
[112,] 0.14351854 0.28703707 0.85648146
[113,] 0.11995882 0.23991764 0.88004118
[114,] 0.11332228 0.22664457 0.88667772
[115,] 0.11683944 0.23367888 0.88316056
[116,] 0.09543279 0.19086559 0.90456721
[117,] 0.07524604 0.15049208 0.92475396
[118,] 0.05806027 0.11612053 0.94193973
[119,] 0.04361587 0.08723173 0.95638413
[120,] 0.04567021 0.09134041 0.95432979
[121,] 0.04433210 0.08866421 0.95566790
[122,] 0.04382000 0.08764001 0.95618000
[123,] 0.04805266 0.09610532 0.95194734
[124,] 0.05779492 0.11558983 0.94220508
[125,] 0.12166303 0.24332606 0.87833697
[126,] 0.12258475 0.24516949 0.87741525
[127,] 0.09723414 0.19446828 0.90276586
[128,] 0.07888350 0.15776700 0.92111650
[129,] 0.07140685 0.14281370 0.92859315
[130,] 0.06642619 0.13285239 0.93357381
[131,] 0.06998667 0.13997333 0.93001333
[132,] 0.05117568 0.10235136 0.94882432
[133,] 0.57089335 0.85821330 0.42910665
[134,] 0.52226443 0.95547114 0.47773557
[135,] 0.47765709 0.95531418 0.52234291
[136,] 0.39556245 0.79112491 0.60443755
[137,] 0.32751695 0.65503389 0.67248305
[138,] 0.35324559 0.70649118 0.64675441
[139,] 0.40010493 0.80020985 0.59989507
[140,] 0.56959055 0.86081891 0.43040945
[141,] 0.46195325 0.92390649 0.53804675
[142,] 0.37575627 0.75151255 0.62424373
[143,] 0.78772929 0.42454141 0.21227071
[144,] 0.76840071 0.46319858 0.23159929
[145,] 0.61993401 0.76013198 0.38006599
> postscript(file="/var/wessaorg/rcomp/tmp/1jos81351952125.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/23i2d1351952125.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/3g87g1351952125.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/46kb21351952125.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/5498l1351952125.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
-3.40774459 -0.00267247 2.21668071 2.71736014 -1.57556535 -1.89378271
7 8 9 10 11 12
3.71233926 -2.01248910 -2.19430247 2.14833128 0.63457333 -0.20888218
13 14 15 16 17 18
0.11434700 0.55621106 -0.55214791 -0.27738243 0.25161238 3.62325770
19 20 21 22 23 24
2.14763433 0.65871791 0.59410255 0.77652082 2.35460140 0.79031776
25 26 27 28 29 30
2.16078012 -0.29937953 1.02118844 -1.38465295 0.52652363 -0.51503049
31 32 33 34 35 36
-0.71845900 -0.44866907 -1.10673982 0.13403948 -1.60890578 -6.16282229
37 38 39 40 41 42
-1.19250945 -1.86767043 1.70394397 1.14429089 0.81679671 -1.49704403
43 44 45 46 47 48
2.12602424 -0.35538268 -1.05332724 -4.82419748 -2.78703777 -0.10306992
49 50 51 52 53 54
0.95589702 -2.13970139 -0.64832630 -0.12475767 -2.79819489 0.12120898
55 56 57 58 59 60
-2.69027663 1.26005842 -0.02674934 0.70228805 -0.53996130 1.66820134
61 62 63 64 65 66
0.35280885 -0.01353984 -0.66133371 -0.38874883 0.67192276 0.66923244
67 68 69 70 71 72
1.67732034 3.39623835 -3.89191450 0.56729458 -3.68410868 -0.28002804
73 74 75 76 77 78
1.44110518 0.85794021 0.31280724 3.13888912 -0.23561801 1.50303844
79 80 81 82 83 84
-1.82303961 0.07369870 0.47922763 4.35128807 0.16476694 -0.78485756
85 86 87 88 89 90
0.27235562 1.75688222 -0.20593891 0.67360195 1.46801815 0.56323681
91 92 93 94 95 96
-1.45422105 0.16707154 0.51872822 -0.02847354 -2.14505824 0.98377629
97 98 99 100 101 102
0.12561160 1.95009725 0.13169457 -0.33834513 -1.07684268 1.18057621
103 104 105 106 107 108
2.71597351 0.31136450 1.55966410 -2.33779739 1.10132825 0.27914133
109 110 111 112 113 114
1.36753123 -0.36146372 1.16231521 0.14960432 2.18558106 -1.07963536
115 116 117 118 119 120
-2.60902689 1.54788639 -1.44133642 0.90933097 -1.92617276 0.40836096
121 122 123 124 125 126
-1.27188586 0.62094648 -2.92642358 -1.05148791 -0.81550130 -0.71380912
127 128 129 130 131 132
-0.22259396 1.03411579 1.26826678 -2.75085495 1.92316801 -3.35596195
133 134 135 136 137 138
2.03917984 -1.68119470 -1.56998906 0.06581284 1.08554563 0.54313196
139 140 141 142 143 144
-2.26471614 -1.23017469 -5.29504858 3.07297620 1.88159133 0.50376140
145 146 147 148 149 150
1.59921480 -3.90530985 2.44951454 -2.21669549 0.90847861 -0.07493469
151 152 153 154 155 156
-3.02757156 -1.13451559 2.16748608 3.92286862 1.50845494 -2.43802963
157 158 159 160 161 162
0.45048384 1.44875657 1.39907246 1.03732431 -0.35848199 0.37520512
> postscript(file="/var/wessaorg/rcomp/tmp/6wtn91351952125.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 -3.40774459 NA
1 -0.00267247 -3.40774459
2 2.21668071 -0.00267247
3 2.71736014 2.21668071
4 -1.57556535 2.71736014
5 -1.89378271 -1.57556535
6 3.71233926 -1.89378271
7 -2.01248910 3.71233926
8 -2.19430247 -2.01248910
9 2.14833128 -2.19430247
10 0.63457333 2.14833128
11 -0.20888218 0.63457333
12 0.11434700 -0.20888218
13 0.55621106 0.11434700
14 -0.55214791 0.55621106
15 -0.27738243 -0.55214791
16 0.25161238 -0.27738243
17 3.62325770 0.25161238
18 2.14763433 3.62325770
19 0.65871791 2.14763433
20 0.59410255 0.65871791
21 0.77652082 0.59410255
22 2.35460140 0.77652082
23 0.79031776 2.35460140
24 2.16078012 0.79031776
25 -0.29937953 2.16078012
26 1.02118844 -0.29937953
27 -1.38465295 1.02118844
28 0.52652363 -1.38465295
29 -0.51503049 0.52652363
30 -0.71845900 -0.51503049
31 -0.44866907 -0.71845900
32 -1.10673982 -0.44866907
33 0.13403948 -1.10673982
34 -1.60890578 0.13403948
35 -6.16282229 -1.60890578
36 -1.19250945 -6.16282229
37 -1.86767043 -1.19250945
38 1.70394397 -1.86767043
39 1.14429089 1.70394397
40 0.81679671 1.14429089
41 -1.49704403 0.81679671
42 2.12602424 -1.49704403
43 -0.35538268 2.12602424
44 -1.05332724 -0.35538268
45 -4.82419748 -1.05332724
46 -2.78703777 -4.82419748
47 -0.10306992 -2.78703777
48 0.95589702 -0.10306992
49 -2.13970139 0.95589702
50 -0.64832630 -2.13970139
51 -0.12475767 -0.64832630
52 -2.79819489 -0.12475767
53 0.12120898 -2.79819489
54 -2.69027663 0.12120898
55 1.26005842 -2.69027663
56 -0.02674934 1.26005842
57 0.70228805 -0.02674934
58 -0.53996130 0.70228805
59 1.66820134 -0.53996130
60 0.35280885 1.66820134
61 -0.01353984 0.35280885
62 -0.66133371 -0.01353984
63 -0.38874883 -0.66133371
64 0.67192276 -0.38874883
65 0.66923244 0.67192276
66 1.67732034 0.66923244
67 3.39623835 1.67732034
68 -3.89191450 3.39623835
69 0.56729458 -3.89191450
70 -3.68410868 0.56729458
71 -0.28002804 -3.68410868
72 1.44110518 -0.28002804
73 0.85794021 1.44110518
74 0.31280724 0.85794021
75 3.13888912 0.31280724
76 -0.23561801 3.13888912
77 1.50303844 -0.23561801
78 -1.82303961 1.50303844
79 0.07369870 -1.82303961
80 0.47922763 0.07369870
81 4.35128807 0.47922763
82 0.16476694 4.35128807
83 -0.78485756 0.16476694
84 0.27235562 -0.78485756
85 1.75688222 0.27235562
86 -0.20593891 1.75688222
87 0.67360195 -0.20593891
88 1.46801815 0.67360195
89 0.56323681 1.46801815
90 -1.45422105 0.56323681
91 0.16707154 -1.45422105
92 0.51872822 0.16707154
93 -0.02847354 0.51872822
94 -2.14505824 -0.02847354
95 0.98377629 -2.14505824
96 0.12561160 0.98377629
97 1.95009725 0.12561160
98 0.13169457 1.95009725
99 -0.33834513 0.13169457
100 -1.07684268 -0.33834513
101 1.18057621 -1.07684268
102 2.71597351 1.18057621
103 0.31136450 2.71597351
104 1.55966410 0.31136450
105 -2.33779739 1.55966410
106 1.10132825 -2.33779739
107 0.27914133 1.10132825
108 1.36753123 0.27914133
109 -0.36146372 1.36753123
110 1.16231521 -0.36146372
111 0.14960432 1.16231521
112 2.18558106 0.14960432
113 -1.07963536 2.18558106
114 -2.60902689 -1.07963536
115 1.54788639 -2.60902689
116 -1.44133642 1.54788639
117 0.90933097 -1.44133642
118 -1.92617276 0.90933097
119 0.40836096 -1.92617276
120 -1.27188586 0.40836096
121 0.62094648 -1.27188586
122 -2.92642358 0.62094648
123 -1.05148791 -2.92642358
124 -0.81550130 -1.05148791
125 -0.71380912 -0.81550130
126 -0.22259396 -0.71380912
127 1.03411579 -0.22259396
128 1.26826678 1.03411579
129 -2.75085495 1.26826678
130 1.92316801 -2.75085495
131 -3.35596195 1.92316801
132 2.03917984 -3.35596195
133 -1.68119470 2.03917984
134 -1.56998906 -1.68119470
135 0.06581284 -1.56998906
136 1.08554563 0.06581284
137 0.54313196 1.08554563
138 -2.26471614 0.54313196
139 -1.23017469 -2.26471614
140 -5.29504858 -1.23017469
141 3.07297620 -5.29504858
142 1.88159133 3.07297620
143 0.50376140 1.88159133
144 1.59921480 0.50376140
145 -3.90530985 1.59921480
146 2.44951454 -3.90530985
147 -2.21669549 2.44951454
148 0.90847861 -2.21669549
149 -0.07493469 0.90847861
150 -3.02757156 -0.07493469
151 -1.13451559 -3.02757156
152 2.16748608 -1.13451559
153 3.92286862 2.16748608
154 1.50845494 3.92286862
155 -2.43802963 1.50845494
156 0.45048384 -2.43802963
157 1.44875657 0.45048384
158 1.39907246 1.44875657
159 1.03732431 1.39907246
160 -0.35848199 1.03732431
161 0.37520512 -0.35848199
162 NA 0.37520512
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.00267247 -3.40774459
[2,] 2.21668071 -0.00267247
[3,] 2.71736014 2.21668071
[4,] -1.57556535 2.71736014
[5,] -1.89378271 -1.57556535
[6,] 3.71233926 -1.89378271
[7,] -2.01248910 3.71233926
[8,] -2.19430247 -2.01248910
[9,] 2.14833128 -2.19430247
[10,] 0.63457333 2.14833128
[11,] -0.20888218 0.63457333
[12,] 0.11434700 -0.20888218
[13,] 0.55621106 0.11434700
[14,] -0.55214791 0.55621106
[15,] -0.27738243 -0.55214791
[16,] 0.25161238 -0.27738243
[17,] 3.62325770 0.25161238
[18,] 2.14763433 3.62325770
[19,] 0.65871791 2.14763433
[20,] 0.59410255 0.65871791
[21,] 0.77652082 0.59410255
[22,] 2.35460140 0.77652082
[23,] 0.79031776 2.35460140
[24,] 2.16078012 0.79031776
[25,] -0.29937953 2.16078012
[26,] 1.02118844 -0.29937953
[27,] -1.38465295 1.02118844
[28,] 0.52652363 -1.38465295
[29,] -0.51503049 0.52652363
[30,] -0.71845900 -0.51503049
[31,] -0.44866907 -0.71845900
[32,] -1.10673982 -0.44866907
[33,] 0.13403948 -1.10673982
[34,] -1.60890578 0.13403948
[35,] -6.16282229 -1.60890578
[36,] -1.19250945 -6.16282229
[37,] -1.86767043 -1.19250945
[38,] 1.70394397 -1.86767043
[39,] 1.14429089 1.70394397
[40,] 0.81679671 1.14429089
[41,] -1.49704403 0.81679671
[42,] 2.12602424 -1.49704403
[43,] -0.35538268 2.12602424
[44,] -1.05332724 -0.35538268
[45,] -4.82419748 -1.05332724
[46,] -2.78703777 -4.82419748
[47,] -0.10306992 -2.78703777
[48,] 0.95589702 -0.10306992
[49,] -2.13970139 0.95589702
[50,] -0.64832630 -2.13970139
[51,] -0.12475767 -0.64832630
[52,] -2.79819489 -0.12475767
[53,] 0.12120898 -2.79819489
[54,] -2.69027663 0.12120898
[55,] 1.26005842 -2.69027663
[56,] -0.02674934 1.26005842
[57,] 0.70228805 -0.02674934
[58,] -0.53996130 0.70228805
[59,] 1.66820134 -0.53996130
[60,] 0.35280885 1.66820134
[61,] -0.01353984 0.35280885
[62,] -0.66133371 -0.01353984
[63,] -0.38874883 -0.66133371
[64,] 0.67192276 -0.38874883
[65,] 0.66923244 0.67192276
[66,] 1.67732034 0.66923244
[67,] 3.39623835 1.67732034
[68,] -3.89191450 3.39623835
[69,] 0.56729458 -3.89191450
[70,] -3.68410868 0.56729458
[71,] -0.28002804 -3.68410868
[72,] 1.44110518 -0.28002804
[73,] 0.85794021 1.44110518
[74,] 0.31280724 0.85794021
[75,] 3.13888912 0.31280724
[76,] -0.23561801 3.13888912
[77,] 1.50303844 -0.23561801
[78,] -1.82303961 1.50303844
[79,] 0.07369870 -1.82303961
[80,] 0.47922763 0.07369870
[81,] 4.35128807 0.47922763
[82,] 0.16476694 4.35128807
[83,] -0.78485756 0.16476694
[84,] 0.27235562 -0.78485756
[85,] 1.75688222 0.27235562
[86,] -0.20593891 1.75688222
[87,] 0.67360195 -0.20593891
[88,] 1.46801815 0.67360195
[89,] 0.56323681 1.46801815
[90,] -1.45422105 0.56323681
[91,] 0.16707154 -1.45422105
[92,] 0.51872822 0.16707154
[93,] -0.02847354 0.51872822
[94,] -2.14505824 -0.02847354
[95,] 0.98377629 -2.14505824
[96,] 0.12561160 0.98377629
[97,] 1.95009725 0.12561160
[98,] 0.13169457 1.95009725
[99,] -0.33834513 0.13169457
[100,] -1.07684268 -0.33834513
[101,] 1.18057621 -1.07684268
[102,] 2.71597351 1.18057621
[103,] 0.31136450 2.71597351
[104,] 1.55966410 0.31136450
[105,] -2.33779739 1.55966410
[106,] 1.10132825 -2.33779739
[107,] 0.27914133 1.10132825
[108,] 1.36753123 0.27914133
[109,] -0.36146372 1.36753123
[110,] 1.16231521 -0.36146372
[111,] 0.14960432 1.16231521
[112,] 2.18558106 0.14960432
[113,] -1.07963536 2.18558106
[114,] -2.60902689 -1.07963536
[115,] 1.54788639 -2.60902689
[116,] -1.44133642 1.54788639
[117,] 0.90933097 -1.44133642
[118,] -1.92617276 0.90933097
[119,] 0.40836096 -1.92617276
[120,] -1.27188586 0.40836096
[121,] 0.62094648 -1.27188586
[122,] -2.92642358 0.62094648
[123,] -1.05148791 -2.92642358
[124,] -0.81550130 -1.05148791
[125,] -0.71380912 -0.81550130
[126,] -0.22259396 -0.71380912
[127,] 1.03411579 -0.22259396
[128,] 1.26826678 1.03411579
[129,] -2.75085495 1.26826678
[130,] 1.92316801 -2.75085495
[131,] -3.35596195 1.92316801
[132,] 2.03917984 -3.35596195
[133,] -1.68119470 2.03917984
[134,] -1.56998906 -1.68119470
[135,] 0.06581284 -1.56998906
[136,] 1.08554563 0.06581284
[137,] 0.54313196 1.08554563
[138,] -2.26471614 0.54313196
[139,] -1.23017469 -2.26471614
[140,] -5.29504858 -1.23017469
[141,] 3.07297620 -5.29504858
[142,] 1.88159133 3.07297620
[143,] 0.50376140 1.88159133
[144,] 1.59921480 0.50376140
[145,] -3.90530985 1.59921480
[146,] 2.44951454 -3.90530985
[147,] -2.21669549 2.44951454
[148,] 0.90847861 -2.21669549
[149,] -0.07493469 0.90847861
[150,] -3.02757156 -0.07493469
[151,] -1.13451559 -3.02757156
[152,] 2.16748608 -1.13451559
[153,] 3.92286862 2.16748608
[154,] 1.50845494 3.92286862
[155,] -2.43802963 1.50845494
[156,] 0.45048384 -2.43802963
[157,] 1.44875657 0.45048384
[158,] 1.39907246 1.44875657
[159,] 1.03732431 1.39907246
[160,] -0.35848199 1.03732431
[161,] 0.37520512 -0.35848199
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.00267247 -3.40774459
2 2.21668071 -0.00267247
3 2.71736014 2.21668071
4 -1.57556535 2.71736014
5 -1.89378271 -1.57556535
6 3.71233926 -1.89378271
7 -2.01248910 3.71233926
8 -2.19430247 -2.01248910
9 2.14833128 -2.19430247
10 0.63457333 2.14833128
11 -0.20888218 0.63457333
12 0.11434700 -0.20888218
13 0.55621106 0.11434700
14 -0.55214791 0.55621106
15 -0.27738243 -0.55214791
16 0.25161238 -0.27738243
17 3.62325770 0.25161238
18 2.14763433 3.62325770
19 0.65871791 2.14763433
20 0.59410255 0.65871791
21 0.77652082 0.59410255
22 2.35460140 0.77652082
23 0.79031776 2.35460140
24 2.16078012 0.79031776
25 -0.29937953 2.16078012
26 1.02118844 -0.29937953
27 -1.38465295 1.02118844
28 0.52652363 -1.38465295
29 -0.51503049 0.52652363
30 -0.71845900 -0.51503049
31 -0.44866907 -0.71845900
32 -1.10673982 -0.44866907
33 0.13403948 -1.10673982
34 -1.60890578 0.13403948
35 -6.16282229 -1.60890578
36 -1.19250945 -6.16282229
37 -1.86767043 -1.19250945
38 1.70394397 -1.86767043
39 1.14429089 1.70394397
40 0.81679671 1.14429089
41 -1.49704403 0.81679671
42 2.12602424 -1.49704403
43 -0.35538268 2.12602424
44 -1.05332724 -0.35538268
45 -4.82419748 -1.05332724
46 -2.78703777 -4.82419748
47 -0.10306992 -2.78703777
48 0.95589702 -0.10306992
49 -2.13970139 0.95589702
50 -0.64832630 -2.13970139
51 -0.12475767 -0.64832630
52 -2.79819489 -0.12475767
53 0.12120898 -2.79819489
54 -2.69027663 0.12120898
55 1.26005842 -2.69027663
56 -0.02674934 1.26005842
57 0.70228805 -0.02674934
58 -0.53996130 0.70228805
59 1.66820134 -0.53996130
60 0.35280885 1.66820134
61 -0.01353984 0.35280885
62 -0.66133371 -0.01353984
63 -0.38874883 -0.66133371
64 0.67192276 -0.38874883
65 0.66923244 0.67192276
66 1.67732034 0.66923244
67 3.39623835 1.67732034
68 -3.89191450 3.39623835
69 0.56729458 -3.89191450
70 -3.68410868 0.56729458
71 -0.28002804 -3.68410868
72 1.44110518 -0.28002804
73 0.85794021 1.44110518
74 0.31280724 0.85794021
75 3.13888912 0.31280724
76 -0.23561801 3.13888912
77 1.50303844 -0.23561801
78 -1.82303961 1.50303844
79 0.07369870 -1.82303961
80 0.47922763 0.07369870
81 4.35128807 0.47922763
82 0.16476694 4.35128807
83 -0.78485756 0.16476694
84 0.27235562 -0.78485756
85 1.75688222 0.27235562
86 -0.20593891 1.75688222
87 0.67360195 -0.20593891
88 1.46801815 0.67360195
89 0.56323681 1.46801815
90 -1.45422105 0.56323681
91 0.16707154 -1.45422105
92 0.51872822 0.16707154
93 -0.02847354 0.51872822
94 -2.14505824 -0.02847354
95 0.98377629 -2.14505824
96 0.12561160 0.98377629
97 1.95009725 0.12561160
98 0.13169457 1.95009725
99 -0.33834513 0.13169457
100 -1.07684268 -0.33834513
101 1.18057621 -1.07684268
102 2.71597351 1.18057621
103 0.31136450 2.71597351
104 1.55966410 0.31136450
105 -2.33779739 1.55966410
106 1.10132825 -2.33779739
107 0.27914133 1.10132825
108 1.36753123 0.27914133
109 -0.36146372 1.36753123
110 1.16231521 -0.36146372
111 0.14960432 1.16231521
112 2.18558106 0.14960432
113 -1.07963536 2.18558106
114 -2.60902689 -1.07963536
115 1.54788639 -2.60902689
116 -1.44133642 1.54788639
117 0.90933097 -1.44133642
118 -1.92617276 0.90933097
119 0.40836096 -1.92617276
120 -1.27188586 0.40836096
121 0.62094648 -1.27188586
122 -2.92642358 0.62094648
123 -1.05148791 -2.92642358
124 -0.81550130 -1.05148791
125 -0.71380912 -0.81550130
126 -0.22259396 -0.71380912
127 1.03411579 -0.22259396
128 1.26826678 1.03411579
129 -2.75085495 1.26826678
130 1.92316801 -2.75085495
131 -3.35596195 1.92316801
132 2.03917984 -3.35596195
133 -1.68119470 2.03917984
134 -1.56998906 -1.68119470
135 0.06581284 -1.56998906
136 1.08554563 0.06581284
137 0.54313196 1.08554563
138 -2.26471614 0.54313196
139 -1.23017469 -2.26471614
140 -5.29504858 -1.23017469
141 3.07297620 -5.29504858
142 1.88159133 3.07297620
143 0.50376140 1.88159133
144 1.59921480 0.50376140
145 -3.90530985 1.59921480
146 2.44951454 -3.90530985
147 -2.21669549 2.44951454
148 0.90847861 -2.21669549
149 -0.07493469 0.90847861
150 -3.02757156 -0.07493469
151 -1.13451559 -3.02757156
152 2.16748608 -1.13451559
153 3.92286862 2.16748608
154 1.50845494 3.92286862
155 -2.43802963 1.50845494
156 0.45048384 -2.43802963
157 1.44875657 0.45048384
158 1.39907246 1.44875657
159 1.03732431 1.39907246
160 -0.35848199 1.03732431
161 0.37520512 -0.35848199
> 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/7nlbt1351952125.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/8kd181351952125.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/963qw1351952125.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/109w4h1351952125.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/11kcw21351952125.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/1211ah1351952126.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/136o3r1351952126.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/14f6cx1351952126.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/15i20z1351952126.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/168tvz1351952126.tab")
+ }
>
> try(system("convert tmp/1jos81351952125.ps tmp/1jos81351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/23i2d1351952125.ps tmp/23i2d1351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/3g87g1351952125.ps tmp/3g87g1351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/46kb21351952125.ps tmp/46kb21351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/5498l1351952125.ps tmp/5498l1351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/6wtn91351952125.ps tmp/6wtn91351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/7nlbt1351952125.ps tmp/7nlbt1351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/8kd181351952125.ps tmp/8kd181351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/963qw1351952125.ps tmp/963qw1351952125.png",intern=TRUE))
character(0)
> try(system("convert tmp/109w4h1351952125.ps tmp/109w4h1351952125.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.619 1.150 8.847