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(13
+ ,12
+ ,14
+ ,12
+ ,53
+ ,32
+ ,16
+ ,11
+ ,18
+ ,11
+ ,86
+ ,51
+ ,19
+ ,15
+ ,11
+ ,14
+ ,66
+ ,42
+ ,15
+ ,6
+ ,12
+ ,12
+ ,67
+ ,41
+ ,14
+ ,13
+ ,16
+ ,21
+ ,76
+ ,46
+ ,13
+ ,10
+ ,18
+ ,12
+ ,78
+ ,47
+ ,19
+ ,12
+ ,14
+ ,22
+ ,53
+ ,37
+ ,15
+ ,14
+ ,14
+ ,11
+ ,80
+ ,49
+ ,14
+ ,12
+ ,15
+ ,10
+ ,74
+ ,45
+ ,15
+ ,6
+ ,15
+ ,13
+ ,76
+ ,47
+ ,16
+ ,10
+ ,17
+ ,10
+ ,79
+ ,49
+ ,16
+ ,12
+ ,19
+ ,8
+ ,54
+ ,33
+ ,16
+ ,12
+ ,10
+ ,15
+ ,67
+ ,42
+ ,16
+ ,11
+ ,16
+ ,14
+ ,54
+ ,33
+ ,17
+ ,15
+ ,18
+ ,10
+ ,87
+ ,53
+ ,15
+ ,12
+ ,14
+ ,14
+ ,58
+ ,36
+ ,15
+ ,10
+ ,14
+ ,14
+ ,75
+ ,45
+ ,20
+ ,12
+ ,17
+ ,11
+ ,88
+ ,54
+ ,18
+ ,11
+ ,14
+ ,10
+ ,64
+ ,41
+ ,16
+ ,12
+ ,16
+ ,13
+ ,57
+ ,36
+ ,16
+ ,11
+ ,18
+ ,7
+ ,66
+ ,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Software'
+ ,'Hapiness'
+ ,'Depression'
+ ,'Belonging'
+ ,'Belonging_Final
')
+ ,1:162))
> y <- array(NA,dim=c(6,162),dimnames=list(c('Learning','Software','Hapiness','Depression','Belonging','Belonging_Final
'),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'
> 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
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 Software Hapiness Depression Belonging Belonging_Final\r
1 13 12 14 12 53 32
2 16 11 18 11 86 51
3 19 15 11 14 66 42
4 15 6 12 12 67 41
5 14 13 16 21 76 46
6 13 10 18 12 78 47
7 19 12 14 22 53 37
8 15 14 14 11 80 49
9 14 12 15 10 74 45
10 15 6 15 13 76 47
11 16 10 17 10 79 49
12 16 12 19 8 54 33
13 16 12 10 15 67 42
14 16 11 16 14 54 33
15 17 15 18 10 87 53
16 15 12 14 14 58 36
17 15 10 14 14 75 45
18 20 12 17 11 88 54
19 18 11 14 10 64 41
20 16 12 16 13 57 36
21 16 11 18 7 66 41
22 16 12 11 14 68 44
23 19 13 14 12 54 33
24 16 11 12 14 56 37
25 17 9 17 11 86 52
26 17 13 9 9 80 47
27 16 10 16 11 76 43
28 15 14 14 15 69 44
29 16 12 15 14 78 45
30 14 10 11 13 67 44
31 15 12 16 9 80 49
32 12 8 13 15 54 33
33 14 10 17 10 71 43
34 16 12 15 11 84 54
35 14 12 14 13 74 42
36 7 7 16 8 71 44
37 10 6 9 20 63 37
38 14 12 15 12 71 43
39 16 10 17 10 76 46
40 16 10 13 10 69 42
41 16 10 15 9 74 45
42 14 12 16 14 75 44
43 20 15 16 8 54 33
44 14 10 12 14 52 31
45 14 10 12 11 69 42
46 11 12 11 13 68 40
47 14 13 15 9 65 43
48 15 11 15 11 75 46
49 16 11 17 15 74 42
50 14 12 13 11 75 45
51 16 14 16 10 72 44
52 14 10 14 14 67 40
53 12 12 11 18 63 37
54 16 13 12 14 62 46
55 9 5 12 11 63 36
56 14 6 15 12 76 47
57 16 12 16 13 74 45
58 16 12 15 9 67 42
59 15 11 12 10 73 43
60 16 10 12 15 70 43
61 12 7 8 20 53 32
62 16 12 13 12 77 45
63 16 14 11 12 77 45
64 14 11 14 14 52 31
65 16 12 15 13 54 33
66 17 13 10 11 80 49
67 18 14 11 17 66 42
68 18 11 12 12 73 41
69 12 12 15 13 63 38
70 16 12 15 14 69 42
71 10 8 14 13 67 44
72 14 11 16 15 54 33
73 18 14 15 13 81 48
74 18 14 15 10 69 40
75 16 12 13 11 84 50
76 17 9 12 19 80 49
77 16 13 17 13 70 43
78 16 11 13 17 69 44
79 13 12 15 13 77 47
80 16 12 13 9 54 33
81 16 12 15 11 79 46
82 20 12 16 10 30 0
83 16 12 15 9 71 45
84 15 12 16 12 73 43
85 15 11 15 12 72 44
86 16 10 14 13 77 47
87 14 9 15 13 75 45
88 16 12 14 12 69 42
89 16 12 13 15 54 33
90 15 12 7 22 70 43
91 12 9 17 13 73 46
92 17 15 13 15 54 33
93 16 12 15 13 77 46
94 15 12 14 15 82 48
95 13 12 13 10 80 47
96 16 10 16 11 80 47
97 16 13 12 16 69 43
98 16 9 14 11 78 46
99 16 12 17 11 81 48
100 14 10 15 10 76 46
101 16 14 17 10 76 45
102 16 11 12 16 73 45
103 20 15 16 12 85 52
104 15 11 11 11 66 42
105 16 11 15 16 79 47
106 13 12 9 19 68 41
107 17 12 16 11 76 47
108 16 12 15 16 71 43
109 16 11 10 15 54 33
110 12 7 10 24 46 30
111 16 12 15 14 82 49
112 16 14 11 15 74 44
113 17 11 13 11 88 55
114 13 11 14 15 38 11
115 12 10 18 12 76 47
116 18 13 16 10 86 53
117 14 13 14 14 54 33
118 14 8 14 13 70 44
119 13 11 14 9 69 42
120 16 12 14 15 90 55
121 13 11 12 15 54 33
122 16 13 14 14 76 46
123 13 12 15 11 89 54
124 16 14 15 8 76 47
125 15 13 15 11 73 45
126 16 15 13 11 79 47
127 15 10 17 8 90 55
128 17 11 17 10 74 44
129 15 9 19 11 81 53
130 12 11 15 13 72 44
131 16 10 13 11 71 42
132 10 11 9 20 66 40
133 16 8 15 10 77 46
134 12 11 15 15 65 40
135 14 12 15 12 74 46
136 15 12 16 14 82 53
137 13 9 11 23 54 33
138 15 11 14 14 63 42
139 11 10 11 16 54 35
140 12 8 15 11 64 40
141 8 9 13 12 69 41
142 16 8 15 10 54 33
143 15 9 16 14 84 51
144 17 15 14 12 86 53
145 16 11 15 12 77 46
146 10 8 16 11 89 55
147 18 13 16 12 76 47
148 13 12 11 13 60 38
149 16 12 12 11 75 46
150 13 9 9 19 73 46
151 10 7 16 12 85 53
152 15 13 13 17 79 47
153 16 9 16 9 71 41
154 16 6 12 12 72 44
155 14 8 9 19 69 43
156 10 8 13 18 78 51
157 17 15 13 15 54 33
158 13 6 14 14 69 43
159 15 9 19 11 81 53
160 16 11 13 9 84 51
161 12 8 12 18 84 50
162 13 8 13 16 69 46
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Software Hapiness
8.46132 0.54882 0.07108
Depression Belonging `Belonging_Final\\r`
-0.07678 0.03941 -0.05504
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.2022 -1.1890 0.2734 1.1291 4.5948
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.46132 2.04128 4.145 5.56e-05 ***
Software 0.54882 0.06969 7.875 5.41e-13 ***
Hapiness 0.07108 0.07650 0.929 0.354
Depression -0.07678 0.05703 -1.346 0.180
Belonging 0.03941 0.04485 0.879 0.381
`Belonging_Final\\r` -0.05504 0.06457 -0.852 0.395
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.875 on 156 degrees of freedom
Multiple R-squared: 0.3312, Adjusted R-squared: 0.3098
F-statistic: 15.45 on 5 and 156 DF, p-value: 2.483e-12
> 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.64885088 0.70229824 0.35114912
[2,] 0.50576207 0.98847586 0.49423793
[3,] 0.36156415 0.72312829 0.63843585
[4,] 0.38796830 0.77593659 0.61203170
[5,] 0.27706541 0.55413082 0.72293459
[6,] 0.25603062 0.51206124 0.74396938
[7,] 0.19141124 0.38282249 0.80858876
[8,] 0.13238732 0.26477464 0.86761268
[9,] 0.10034369 0.20068737 0.89965631
[10,] 0.28956528 0.57913057 0.71043472
[11,] 0.23426537 0.46853074 0.76573463
[12,] 0.17522986 0.35045971 0.82477014
[13,] 0.13423479 0.26846958 0.86576521
[14,] 0.14796460 0.29592921 0.85203540
[15,] 0.38568436 0.77136872 0.61431564
[16,] 0.36254692 0.72509385 0.63745308
[17,] 0.36588646 0.73177293 0.63411354
[18,] 0.35739442 0.71478883 0.64260558
[19,] 0.39177919 0.78355837 0.60822081
[20,] 0.41038697 0.82077395 0.58961303
[21,] 0.36781105 0.73562209 0.63218895
[22,] 0.42473305 0.84946611 0.57526695
[23,] 0.39657585 0.79315170 0.60342415
[24,] 0.42963613 0.85927226 0.57036387
[25,] 0.40034604 0.80069207 0.59965396
[26,] 0.36235331 0.72470661 0.63764669
[27,] 0.32750136 0.65500271 0.67249864
[28,] 0.90804924 0.18390153 0.09195076
[29,] 0.90726608 0.18546784 0.09273392
[30,] 0.90014008 0.19971983 0.09985992
[31,] 0.88403558 0.23192885 0.11596442
[32,] 0.87130870 0.25738260 0.12869130
[33,] 0.85229812 0.29540376 0.14770188
[34,] 0.83727004 0.32545991 0.16272996
[35,] 0.86418870 0.27162260 0.13581130
[36,] 0.83372467 0.33255067 0.16627533
[37,] 0.80246993 0.39506014 0.19753007
[38,] 0.90285911 0.19428178 0.09714089
[39,] 0.92941177 0.14117646 0.07058823
[40,] 0.91100532 0.17798937 0.08899468
[41,] 0.89858709 0.20282582 0.10141291
[42,] 0.88877114 0.22245771 0.11122886
[43,] 0.86846614 0.26306771 0.13153386
[44,] 0.84061876 0.31876247 0.15938124
[45,] 0.86630996 0.26738008 0.13369004
[46,] 0.85743066 0.28513868 0.14256934
[47,] 0.87587930 0.24824140 0.12412070
[48,] 0.86329621 0.27340757 0.13670379
[49,] 0.83622421 0.32755159 0.16377579
[50,] 0.80557805 0.38884389 0.19442195
[51,] 0.77454207 0.45091587 0.22545793
[52,] 0.77424413 0.45151174 0.22575587
[53,] 0.73781398 0.52437203 0.26218602
[54,] 0.70477500 0.59045000 0.29522500
[55,] 0.66723465 0.66553070 0.33276535
[56,] 0.62588500 0.74822999 0.37411500
[57,] 0.58885427 0.82229145 0.41114573
[58,] 0.55745880 0.88508240 0.44254120
[59,] 0.56353556 0.87292887 0.43646444
[60,] 0.65932160 0.68135680 0.34067840
[61,] 0.74756478 0.50487044 0.25243522
[62,] 0.71275113 0.57449774 0.28724887
[63,] 0.79436021 0.41127957 0.20563979
[64,] 0.76342177 0.47315646 0.23657823
[65,] 0.74239845 0.51520310 0.25760155
[66,] 0.72134627 0.55730745 0.27865373
[67,] 0.68156635 0.63686730 0.31843365
[68,] 0.77236628 0.45526745 0.22763372
[69,] 0.73704893 0.52590214 0.26295107
[70,] 0.72533984 0.54932032 0.27466016
[71,] 0.76228609 0.47542782 0.23771391
[72,] 0.72988350 0.54023300 0.27011650
[73,] 0.69074743 0.61850514 0.30925257
[74,] 0.80799557 0.38400885 0.19200443
[75,] 0.77555222 0.44889555 0.22444778
[76,] 0.74474436 0.51051128 0.25525564
[77,] 0.70615188 0.58769625 0.29384812
[78,] 0.69496891 0.61006218 0.30503109
[79,] 0.65330221 0.69339559 0.34669779
[80,] 0.61337222 0.77325556 0.38662778
[81,] 0.58313452 0.83373097 0.41686548
[82,] 0.54958273 0.90083453 0.45041727
[83,] 0.55113282 0.89773437 0.44886718
[84,] 0.51306068 0.97387864 0.48693932
[85,] 0.47008721 0.94017441 0.52991279
[86,] 0.42753884 0.85507768 0.57246116
[87,] 0.47817292 0.95634584 0.52182708
[88,] 0.45102730 0.90205460 0.54897270
[89,] 0.41168736 0.82337472 0.58831264
[90,] 0.41184907 0.82369813 0.58815093
[91,] 0.36687881 0.73375762 0.63312119
[92,] 0.32841254 0.65682508 0.67158746
[93,] 0.29603597 0.59207193 0.70396403
[94,] 0.28494628 0.56989257 0.71505372
[95,] 0.34059148 0.68118297 0.65940852
[96,] 0.29831252 0.59662504 0.70168748
[97,] 0.28379988 0.56759976 0.71620012
[98,] 0.26975126 0.53950252 0.73024874
[99,] 0.25394998 0.50789995 0.74605002
[100,] 0.23456142 0.46912283 0.76543858
[101,] 0.23320588 0.46641177 0.76679412
[102,] 0.21936373 0.43872747 0.78063627
[103,] 0.19298709 0.38597418 0.80701291
[104,] 0.16520106 0.33040212 0.83479894
[105,] 0.16810944 0.33621887 0.83189056
[106,] 0.16152633 0.32305265 0.83847367
[107,] 0.19188083 0.38376166 0.80811917
[108,] 0.19200662 0.38401323 0.80799338
[109,] 0.17759228 0.35518456 0.82240772
[110,] 0.15176295 0.30352590 0.84823705
[111,] 0.15942037 0.31884074 0.84057963
[112,] 0.14683063 0.29366126 0.85316937
[113,] 0.13171866 0.26343732 0.86828134
[114,] 0.10997325 0.21994650 0.89002675
[115,] 0.12346566 0.24693131 0.87653434
[116,] 0.10159142 0.20318285 0.89840858
[117,] 0.08433405 0.16866810 0.91566595
[118,] 0.06878895 0.13757790 0.93121105
[119,] 0.05238687 0.10477374 0.94761313
[120,] 0.04525261 0.09050521 0.95474739
[121,] 0.03592696 0.07185393 0.96407304
[122,] 0.04762867 0.09525733 0.95237133
[123,] 0.03973077 0.07946154 0.96026923
[124,] 0.07033419 0.14066837 0.92966581
[125,] 0.07342169 0.14684337 0.92657831
[126,] 0.08972993 0.17945986 0.91027007
[127,] 0.07710400 0.15420799 0.92289600
[128,] 0.05693006 0.11386012 0.94306994
[129,] 0.04099953 0.08199905 0.95900047
[130,] 0.02994533 0.05989065 0.97005467
[131,] 0.03896864 0.07793729 0.96103136
[132,] 0.03594561 0.07189122 0.96405439
[133,] 0.52857558 0.94284884 0.47142442
[134,] 0.46486271 0.92972543 0.53513729
[135,] 0.42926431 0.85852863 0.57073569
[136,] 0.37473110 0.74946219 0.62526890
[137,] 0.30507066 0.61014131 0.69492934
[138,] 0.45454228 0.90908455 0.54545772
[139,] 0.51651843 0.96696315 0.48348157
[140,] 0.76147363 0.47705275 0.23852637
[141,] 0.67736344 0.64527313 0.32263656
[142,] 0.56052068 0.87895865 0.43947932
[143,] 0.77130164 0.45739671 0.22869836
[144,] 0.69833280 0.60333440 0.30166720
[145,] 0.59006200 0.81987600 0.40993800
> postscript(file="/var/wessaorg/rcomp/tmp/16zue1352116914.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/296vy1352116914.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/3696d1352116914.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/47d6r1352116914.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/5ju481352116914.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.44822348 0.48483124 2.31024682 2.93052079 -1.58400063 -1.79447751
7 8 9 10 11 12
4.59477072 -1.75092959 -1.78487475 2.76963649 1.19373005 -0.09510560
13 14 15 16 17 18
1.06515106 1.12762065 -0.71653876 -0.27153729 0.65154258 4.09341011
19 20 21 22 23 24
3.00893983 0.54893131 0.41546268 0.98797211 3.01859363 1.55330779
25 26 27 28 29 30
2.70859410 0.88965418 1.12954908 -1.28554194 0.36459642 0.04824075
31 32 33 34 35 36
-0.94901098 -0.93590219 -0.82126328 0.39321097 -1.64859554 -6.20223640
37 38 39 40 41 42
-1.30455827 -1.62318188 1.14682408 1.48683794 1.23598457 -1.64330209
43 44 45 46 47 48
2.47168518 -0.07050456 -0.36530316 -4.30898353 -2.16587554 -0.14364411
49 50 51 52 53 54
0.84053146 -1.60534334 -0.92981900 -0.30840611 -2.89318537 0.71461722
55 56 57 58 59 60
-2.71502404 1.69285938 0.37437475 0.24907941 -0.09349108 1.95744058
61 62 63 64 65 66
0.33657524 0.39261514 -0.56285768 -0.76148639 0.57310714 1.08221585
67 68 69 70 71 72
2.08939634 2.94997386 -3.50635348 0.55414631 -3.06736825 -0.79560225
73 74 75 76 77 78
1.23708887 1.03931220 0.31519604 3.74954191 -0.19797730 1.58554871
79 80 81 82 83 84
-2.56268210 0.40816234 0.14990044 3.40104452 0.25657608 -0.77308231
85 86 87 88 89 90
-0.05872835 1.60603613 0.05250189 0.47167391 0.86882496 0.75265290
91 92 93 94 95 96
-1.95579847 0.22237032 0.38227326 -0.48004801 -2.76907773 1.19209038
97 98 99 100 101 102
0.42717235 1.90684619 0.03900747 -0.71101231 -1.10349341 1.47726081
103 104 105 106 107 108
2.60295304 0.27518837 1.13764880 -1.65111267 1.25209120 0.68392653
109 110 111 112 113 114
1.63088859 0.66729594 0.42713772 -0.26934307 1.98160019 -2.23387164
115 116 117 118 119 120
-2.71565889 1.56267059 -1.82785216 0.81440382 -2.20983919 0.58998996
121 122 123 124 125 126
-1.51127502 0.02072327 -2.80383558 -1.00479473 -1.21750655 -1.29934596
127 128 129 130 131 132
-0.06305875 1.56673522 0.81852168 -2.98195124 1.48479642 -4.00174337
133 134 135 136 137 138
2.34721481 -2.77271041 -1.57627591 -0.42376555 0.27166003 0.41050219
139 140 141 142 143 144
-2.70450863 -1.39395487 -5.86583428 2.53804869 1.03378120 -0.23924802
145 146 147 148 149 150
0.85431437 -3.62459990 1.78005009 -2.10379832 0.52078310 0.07351860
151 152 153 154 155 156
-2.95145662 -0.74104691 1.61177037 3.89860814 1.61484014 -2.66059090
157 158 159 160 161 162
0.22237032 0.97318203 0.81852168 0.76550468 -0.88100958 0.26531552
> postscript(file="/var/wessaorg/rcomp/tmp/6twqd1352116914.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.44822348 NA
1 0.48483124 -2.44822348
2 2.31024682 0.48483124
3 2.93052079 2.31024682
4 -1.58400063 2.93052079
5 -1.79447751 -1.58400063
6 4.59477072 -1.79447751
7 -1.75092959 4.59477072
8 -1.78487475 -1.75092959
9 2.76963649 -1.78487475
10 1.19373005 2.76963649
11 -0.09510560 1.19373005
12 1.06515106 -0.09510560
13 1.12762065 1.06515106
14 -0.71653876 1.12762065
15 -0.27153729 -0.71653876
16 0.65154258 -0.27153729
17 4.09341011 0.65154258
18 3.00893983 4.09341011
19 0.54893131 3.00893983
20 0.41546268 0.54893131
21 0.98797211 0.41546268
22 3.01859363 0.98797211
23 1.55330779 3.01859363
24 2.70859410 1.55330779
25 0.88965418 2.70859410
26 1.12954908 0.88965418
27 -1.28554194 1.12954908
28 0.36459642 -1.28554194
29 0.04824075 0.36459642
30 -0.94901098 0.04824075
31 -0.93590219 -0.94901098
32 -0.82126328 -0.93590219
33 0.39321097 -0.82126328
34 -1.64859554 0.39321097
35 -6.20223640 -1.64859554
36 -1.30455827 -6.20223640
37 -1.62318188 -1.30455827
38 1.14682408 -1.62318188
39 1.48683794 1.14682408
40 1.23598457 1.48683794
41 -1.64330209 1.23598457
42 2.47168518 -1.64330209
43 -0.07050456 2.47168518
44 -0.36530316 -0.07050456
45 -4.30898353 -0.36530316
46 -2.16587554 -4.30898353
47 -0.14364411 -2.16587554
48 0.84053146 -0.14364411
49 -1.60534334 0.84053146
50 -0.92981900 -1.60534334
51 -0.30840611 -0.92981900
52 -2.89318537 -0.30840611
53 0.71461722 -2.89318537
54 -2.71502404 0.71461722
55 1.69285938 -2.71502404
56 0.37437475 1.69285938
57 0.24907941 0.37437475
58 -0.09349108 0.24907941
59 1.95744058 -0.09349108
60 0.33657524 1.95744058
61 0.39261514 0.33657524
62 -0.56285768 0.39261514
63 -0.76148639 -0.56285768
64 0.57310714 -0.76148639
65 1.08221585 0.57310714
66 2.08939634 1.08221585
67 2.94997386 2.08939634
68 -3.50635348 2.94997386
69 0.55414631 -3.50635348
70 -3.06736825 0.55414631
71 -0.79560225 -3.06736825
72 1.23708887 -0.79560225
73 1.03931220 1.23708887
74 0.31519604 1.03931220
75 3.74954191 0.31519604
76 -0.19797730 3.74954191
77 1.58554871 -0.19797730
78 -2.56268210 1.58554871
79 0.40816234 -2.56268210
80 0.14990044 0.40816234
81 3.40104452 0.14990044
82 0.25657608 3.40104452
83 -0.77308231 0.25657608
84 -0.05872835 -0.77308231
85 1.60603613 -0.05872835
86 0.05250189 1.60603613
87 0.47167391 0.05250189
88 0.86882496 0.47167391
89 0.75265290 0.86882496
90 -1.95579847 0.75265290
91 0.22237032 -1.95579847
92 0.38227326 0.22237032
93 -0.48004801 0.38227326
94 -2.76907773 -0.48004801
95 1.19209038 -2.76907773
96 0.42717235 1.19209038
97 1.90684619 0.42717235
98 0.03900747 1.90684619
99 -0.71101231 0.03900747
100 -1.10349341 -0.71101231
101 1.47726081 -1.10349341
102 2.60295304 1.47726081
103 0.27518837 2.60295304
104 1.13764880 0.27518837
105 -1.65111267 1.13764880
106 1.25209120 -1.65111267
107 0.68392653 1.25209120
108 1.63088859 0.68392653
109 0.66729594 1.63088859
110 0.42713772 0.66729594
111 -0.26934307 0.42713772
112 1.98160019 -0.26934307
113 -2.23387164 1.98160019
114 -2.71565889 -2.23387164
115 1.56267059 -2.71565889
116 -1.82785216 1.56267059
117 0.81440382 -1.82785216
118 -2.20983919 0.81440382
119 0.58998996 -2.20983919
120 -1.51127502 0.58998996
121 0.02072327 -1.51127502
122 -2.80383558 0.02072327
123 -1.00479473 -2.80383558
124 -1.21750655 -1.00479473
125 -1.29934596 -1.21750655
126 -0.06305875 -1.29934596
127 1.56673522 -0.06305875
128 0.81852168 1.56673522
129 -2.98195124 0.81852168
130 1.48479642 -2.98195124
131 -4.00174337 1.48479642
132 2.34721481 -4.00174337
133 -2.77271041 2.34721481
134 -1.57627591 -2.77271041
135 -0.42376555 -1.57627591
136 0.27166003 -0.42376555
137 0.41050219 0.27166003
138 -2.70450863 0.41050219
139 -1.39395487 -2.70450863
140 -5.86583428 -1.39395487
141 2.53804869 -5.86583428
142 1.03378120 2.53804869
143 -0.23924802 1.03378120
144 0.85431437 -0.23924802
145 -3.62459990 0.85431437
146 1.78005009 -3.62459990
147 -2.10379832 1.78005009
148 0.52078310 -2.10379832
149 0.07351860 0.52078310
150 -2.95145662 0.07351860
151 -0.74104691 -2.95145662
152 1.61177037 -0.74104691
153 3.89860814 1.61177037
154 1.61484014 3.89860814
155 -2.66059090 1.61484014
156 0.22237032 -2.66059090
157 0.97318203 0.22237032
158 0.81852168 0.97318203
159 0.76550468 0.81852168
160 -0.88100958 0.76550468
161 0.26531552 -0.88100958
162 NA 0.26531552
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.48483124 -2.44822348
[2,] 2.31024682 0.48483124
[3,] 2.93052079 2.31024682
[4,] -1.58400063 2.93052079
[5,] -1.79447751 -1.58400063
[6,] 4.59477072 -1.79447751
[7,] -1.75092959 4.59477072
[8,] -1.78487475 -1.75092959
[9,] 2.76963649 -1.78487475
[10,] 1.19373005 2.76963649
[11,] -0.09510560 1.19373005
[12,] 1.06515106 -0.09510560
[13,] 1.12762065 1.06515106
[14,] -0.71653876 1.12762065
[15,] -0.27153729 -0.71653876
[16,] 0.65154258 -0.27153729
[17,] 4.09341011 0.65154258
[18,] 3.00893983 4.09341011
[19,] 0.54893131 3.00893983
[20,] 0.41546268 0.54893131
[21,] 0.98797211 0.41546268
[22,] 3.01859363 0.98797211
[23,] 1.55330779 3.01859363
[24,] 2.70859410 1.55330779
[25,] 0.88965418 2.70859410
[26,] 1.12954908 0.88965418
[27,] -1.28554194 1.12954908
[28,] 0.36459642 -1.28554194
[29,] 0.04824075 0.36459642
[30,] -0.94901098 0.04824075
[31,] -0.93590219 -0.94901098
[32,] -0.82126328 -0.93590219
[33,] 0.39321097 -0.82126328
[34,] -1.64859554 0.39321097
[35,] -6.20223640 -1.64859554
[36,] -1.30455827 -6.20223640
[37,] -1.62318188 -1.30455827
[38,] 1.14682408 -1.62318188
[39,] 1.48683794 1.14682408
[40,] 1.23598457 1.48683794
[41,] -1.64330209 1.23598457
[42,] 2.47168518 -1.64330209
[43,] -0.07050456 2.47168518
[44,] -0.36530316 -0.07050456
[45,] -4.30898353 -0.36530316
[46,] -2.16587554 -4.30898353
[47,] -0.14364411 -2.16587554
[48,] 0.84053146 -0.14364411
[49,] -1.60534334 0.84053146
[50,] -0.92981900 -1.60534334
[51,] -0.30840611 -0.92981900
[52,] -2.89318537 -0.30840611
[53,] 0.71461722 -2.89318537
[54,] -2.71502404 0.71461722
[55,] 1.69285938 -2.71502404
[56,] 0.37437475 1.69285938
[57,] 0.24907941 0.37437475
[58,] -0.09349108 0.24907941
[59,] 1.95744058 -0.09349108
[60,] 0.33657524 1.95744058
[61,] 0.39261514 0.33657524
[62,] -0.56285768 0.39261514
[63,] -0.76148639 -0.56285768
[64,] 0.57310714 -0.76148639
[65,] 1.08221585 0.57310714
[66,] 2.08939634 1.08221585
[67,] 2.94997386 2.08939634
[68,] -3.50635348 2.94997386
[69,] 0.55414631 -3.50635348
[70,] -3.06736825 0.55414631
[71,] -0.79560225 -3.06736825
[72,] 1.23708887 -0.79560225
[73,] 1.03931220 1.23708887
[74,] 0.31519604 1.03931220
[75,] 3.74954191 0.31519604
[76,] -0.19797730 3.74954191
[77,] 1.58554871 -0.19797730
[78,] -2.56268210 1.58554871
[79,] 0.40816234 -2.56268210
[80,] 0.14990044 0.40816234
[81,] 3.40104452 0.14990044
[82,] 0.25657608 3.40104452
[83,] -0.77308231 0.25657608
[84,] -0.05872835 -0.77308231
[85,] 1.60603613 -0.05872835
[86,] 0.05250189 1.60603613
[87,] 0.47167391 0.05250189
[88,] 0.86882496 0.47167391
[89,] 0.75265290 0.86882496
[90,] -1.95579847 0.75265290
[91,] 0.22237032 -1.95579847
[92,] 0.38227326 0.22237032
[93,] -0.48004801 0.38227326
[94,] -2.76907773 -0.48004801
[95,] 1.19209038 -2.76907773
[96,] 0.42717235 1.19209038
[97,] 1.90684619 0.42717235
[98,] 0.03900747 1.90684619
[99,] -0.71101231 0.03900747
[100,] -1.10349341 -0.71101231
[101,] 1.47726081 -1.10349341
[102,] 2.60295304 1.47726081
[103,] 0.27518837 2.60295304
[104,] 1.13764880 0.27518837
[105,] -1.65111267 1.13764880
[106,] 1.25209120 -1.65111267
[107,] 0.68392653 1.25209120
[108,] 1.63088859 0.68392653
[109,] 0.66729594 1.63088859
[110,] 0.42713772 0.66729594
[111,] -0.26934307 0.42713772
[112,] 1.98160019 -0.26934307
[113,] -2.23387164 1.98160019
[114,] -2.71565889 -2.23387164
[115,] 1.56267059 -2.71565889
[116,] -1.82785216 1.56267059
[117,] 0.81440382 -1.82785216
[118,] -2.20983919 0.81440382
[119,] 0.58998996 -2.20983919
[120,] -1.51127502 0.58998996
[121,] 0.02072327 -1.51127502
[122,] -2.80383558 0.02072327
[123,] -1.00479473 -2.80383558
[124,] -1.21750655 -1.00479473
[125,] -1.29934596 -1.21750655
[126,] -0.06305875 -1.29934596
[127,] 1.56673522 -0.06305875
[128,] 0.81852168 1.56673522
[129,] -2.98195124 0.81852168
[130,] 1.48479642 -2.98195124
[131,] -4.00174337 1.48479642
[132,] 2.34721481 -4.00174337
[133,] -2.77271041 2.34721481
[134,] -1.57627591 -2.77271041
[135,] -0.42376555 -1.57627591
[136,] 0.27166003 -0.42376555
[137,] 0.41050219 0.27166003
[138,] -2.70450863 0.41050219
[139,] -1.39395487 -2.70450863
[140,] -5.86583428 -1.39395487
[141,] 2.53804869 -5.86583428
[142,] 1.03378120 2.53804869
[143,] -0.23924802 1.03378120
[144,] 0.85431437 -0.23924802
[145,] -3.62459990 0.85431437
[146,] 1.78005009 -3.62459990
[147,] -2.10379832 1.78005009
[148,] 0.52078310 -2.10379832
[149,] 0.07351860 0.52078310
[150,] -2.95145662 0.07351860
[151,] -0.74104691 -2.95145662
[152,] 1.61177037 -0.74104691
[153,] 3.89860814 1.61177037
[154,] 1.61484014 3.89860814
[155,] -2.66059090 1.61484014
[156,] 0.22237032 -2.66059090
[157,] 0.97318203 0.22237032
[158,] 0.81852168 0.97318203
[159,] 0.76550468 0.81852168
[160,] -0.88100958 0.76550468
[161,] 0.26531552 -0.88100958
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.48483124 -2.44822348
2 2.31024682 0.48483124
3 2.93052079 2.31024682
4 -1.58400063 2.93052079
5 -1.79447751 -1.58400063
6 4.59477072 -1.79447751
7 -1.75092959 4.59477072
8 -1.78487475 -1.75092959
9 2.76963649 -1.78487475
10 1.19373005 2.76963649
11 -0.09510560 1.19373005
12 1.06515106 -0.09510560
13 1.12762065 1.06515106
14 -0.71653876 1.12762065
15 -0.27153729 -0.71653876
16 0.65154258 -0.27153729
17 4.09341011 0.65154258
18 3.00893983 4.09341011
19 0.54893131 3.00893983
20 0.41546268 0.54893131
21 0.98797211 0.41546268
22 3.01859363 0.98797211
23 1.55330779 3.01859363
24 2.70859410 1.55330779
25 0.88965418 2.70859410
26 1.12954908 0.88965418
27 -1.28554194 1.12954908
28 0.36459642 -1.28554194
29 0.04824075 0.36459642
30 -0.94901098 0.04824075
31 -0.93590219 -0.94901098
32 -0.82126328 -0.93590219
33 0.39321097 -0.82126328
34 -1.64859554 0.39321097
35 -6.20223640 -1.64859554
36 -1.30455827 -6.20223640
37 -1.62318188 -1.30455827
38 1.14682408 -1.62318188
39 1.48683794 1.14682408
40 1.23598457 1.48683794
41 -1.64330209 1.23598457
42 2.47168518 -1.64330209
43 -0.07050456 2.47168518
44 -0.36530316 -0.07050456
45 -4.30898353 -0.36530316
46 -2.16587554 -4.30898353
47 -0.14364411 -2.16587554
48 0.84053146 -0.14364411
49 -1.60534334 0.84053146
50 -0.92981900 -1.60534334
51 -0.30840611 -0.92981900
52 -2.89318537 -0.30840611
53 0.71461722 -2.89318537
54 -2.71502404 0.71461722
55 1.69285938 -2.71502404
56 0.37437475 1.69285938
57 0.24907941 0.37437475
58 -0.09349108 0.24907941
59 1.95744058 -0.09349108
60 0.33657524 1.95744058
61 0.39261514 0.33657524
62 -0.56285768 0.39261514
63 -0.76148639 -0.56285768
64 0.57310714 -0.76148639
65 1.08221585 0.57310714
66 2.08939634 1.08221585
67 2.94997386 2.08939634
68 -3.50635348 2.94997386
69 0.55414631 -3.50635348
70 -3.06736825 0.55414631
71 -0.79560225 -3.06736825
72 1.23708887 -0.79560225
73 1.03931220 1.23708887
74 0.31519604 1.03931220
75 3.74954191 0.31519604
76 -0.19797730 3.74954191
77 1.58554871 -0.19797730
78 -2.56268210 1.58554871
79 0.40816234 -2.56268210
80 0.14990044 0.40816234
81 3.40104452 0.14990044
82 0.25657608 3.40104452
83 -0.77308231 0.25657608
84 -0.05872835 -0.77308231
85 1.60603613 -0.05872835
86 0.05250189 1.60603613
87 0.47167391 0.05250189
88 0.86882496 0.47167391
89 0.75265290 0.86882496
90 -1.95579847 0.75265290
91 0.22237032 -1.95579847
92 0.38227326 0.22237032
93 -0.48004801 0.38227326
94 -2.76907773 -0.48004801
95 1.19209038 -2.76907773
96 0.42717235 1.19209038
97 1.90684619 0.42717235
98 0.03900747 1.90684619
99 -0.71101231 0.03900747
100 -1.10349341 -0.71101231
101 1.47726081 -1.10349341
102 2.60295304 1.47726081
103 0.27518837 2.60295304
104 1.13764880 0.27518837
105 -1.65111267 1.13764880
106 1.25209120 -1.65111267
107 0.68392653 1.25209120
108 1.63088859 0.68392653
109 0.66729594 1.63088859
110 0.42713772 0.66729594
111 -0.26934307 0.42713772
112 1.98160019 -0.26934307
113 -2.23387164 1.98160019
114 -2.71565889 -2.23387164
115 1.56267059 -2.71565889
116 -1.82785216 1.56267059
117 0.81440382 -1.82785216
118 -2.20983919 0.81440382
119 0.58998996 -2.20983919
120 -1.51127502 0.58998996
121 0.02072327 -1.51127502
122 -2.80383558 0.02072327
123 -1.00479473 -2.80383558
124 -1.21750655 -1.00479473
125 -1.29934596 -1.21750655
126 -0.06305875 -1.29934596
127 1.56673522 -0.06305875
128 0.81852168 1.56673522
129 -2.98195124 0.81852168
130 1.48479642 -2.98195124
131 -4.00174337 1.48479642
132 2.34721481 -4.00174337
133 -2.77271041 2.34721481
134 -1.57627591 -2.77271041
135 -0.42376555 -1.57627591
136 0.27166003 -0.42376555
137 0.41050219 0.27166003
138 -2.70450863 0.41050219
139 -1.39395487 -2.70450863
140 -5.86583428 -1.39395487
141 2.53804869 -5.86583428
142 1.03378120 2.53804869
143 -0.23924802 1.03378120
144 0.85431437 -0.23924802
145 -3.62459990 0.85431437
146 1.78005009 -3.62459990
147 -2.10379832 1.78005009
148 0.52078310 -2.10379832
149 0.07351860 0.52078310
150 -2.95145662 0.07351860
151 -0.74104691 -2.95145662
152 1.61177037 -0.74104691
153 3.89860814 1.61177037
154 1.61484014 3.89860814
155 -2.66059090 1.61484014
156 0.22237032 -2.66059090
157 0.97318203 0.22237032
158 0.81852168 0.97318203
159 0.76550468 0.81852168
160 -0.88100958 0.76550468
161 0.26531552 -0.88100958
> 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/7khwb1352116914.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/8w9pj1352116914.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/9bi4s1352116914.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/10af051352116914.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/11grp81352116914.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/12lccs1352116914.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/136uc01352116915.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/14z2n91352116915.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/153s9w1352116915.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/161a1f1352116915.tab")
+ }
>
> try(system("convert tmp/16zue1352116914.ps tmp/16zue1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/296vy1352116914.ps tmp/296vy1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/3696d1352116914.ps tmp/3696d1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/47d6r1352116914.ps tmp/47d6r1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ju481352116914.ps tmp/5ju481352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/6twqd1352116914.ps tmp/6twqd1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/7khwb1352116914.ps tmp/7khwb1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/8w9pj1352116914.ps tmp/8w9pj1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/9bi4s1352116914.ps tmp/9bi4s1352116914.png",intern=TRUE))
character(0)
> try(system("convert tmp/10af051352116914.ps tmp/10af051352116914.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
9.301 1.172 10.586