R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(12
+ ,2
+ ,53
+ ,10
+ ,15
+ ,2
+ ,7
+ ,6
+ ,2
+ ,11
+ ,2
+ ,86
+ ,12
+ ,15
+ ,4
+ ,5
+ ,6
+ ,1
+ ,14
+ ,4
+ ,66
+ ,11
+ ,14
+ ,7
+ ,7
+ ,11
+ ,4
+ ,12
+ ,3
+ ,67
+ ,10
+ ,10
+ ,3
+ ,3
+ ,7
+ ,1
+ ,21
+ ,4
+ ,76
+ ,12
+ ,10
+ ,7
+ ,7
+ ,12
+ ,5
+ ,12
+ ,3
+ ,78
+ ,12
+ ,12
+ ,2
+ ,7
+ ,8
+ ,1
+ ,22
+ ,3
+ ,53
+ ,14
+ ,18
+ ,7
+ ,7
+ ,7
+ ,1
+ ,11
+ ,4
+ ,80
+ ,14
+ ,12
+ ,2
+ ,1
+ ,11
+ ,1
+ ,10
+ ,3
+ ,74
+ ,11
+ ,14
+ ,1
+ ,4
+ ,8
+ ,1
+ ,13
+ ,4
+ ,76
+ ,11
+ ,18
+ ,2
+ ,5
+ ,9
+ ,1
+ ,10
+ ,3
+ ,79
+ ,13
+ ,9
+ ,6
+ ,6
+ ,9
+ ,2
+ ,8
+ ,2
+ ,54
+ ,11
+ ,11
+ ,1
+ ,4
+ ,6
+ ,1
+ ,15
+ ,3
+ ,67
+ ,10
+ ,11
+ ,1
+ ,7
+ ,9
+ ,3
+ ,10
+ ,3
+ ,87
+ ,14
+ ,17
+ ,1
+ ,6
+ ,5
+ ,1
+ ,14
+ ,3
+ ,58
+ ,14
+ ,8
+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leden'
+ ,'Alcoholgebruik'
+ ,'Rookgedrag')
+ ,1:145))
> y <- array(NA,dim=c(9,145),dimnames=list(c('Depressie','Leeftijd','Sportgerelateerde_groep','Stress','Verwachtingen_ouders','Slaapgebrek','Veranderingen_verleden','Alcoholgebruik','Rookgedrag'),1:145))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
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
Depressie Leeftijd Sportgerelateerde_groep Stress Verwachtingen_ouders
1 12 2 53 10 15
2 11 2 86 12 15
3 14 4 66 11 14
4 12 3 67 10 10
5 21 4 76 12 10
6 12 3 78 12 12
7 22 3 53 14 18
8 11 4 80 14 12
9 10 3 74 11 14
10 13 4 76 11 18
11 10 3 79 13 9
12 8 2 54 11 11
13 15 3 67 10 11
14 10 3 87 14 17
15 14 3 58 14 8
16 14 2 75 12 16
17 11 3 88 11 21
18 10 2 64 10 24
19 13 4 57 12 21
20 7 5 66 10 14
21 12 3 54 14 7
22 14 3 56 12 18
23 11 1 86 13 18
24 9 4 80 13 13
25 11 3 76 12 11
26 15 4 69 14 13
27 13 3 67 11 13
28 9 3 80 12 18
29 15 1 54 13 14
30 10 4 71 11 12
31 11 4 84 11 9
32 13 2 74 14 12
33 8 2 71 12 8
34 20 1 63 13 5
35 12 3 71 11 10
36 10 4 76 13 11
37 10 1 69 13 11
38 9 3 74 13 12
39 14 3 75 12 12
40 8 2 54 14 15
41 14 4 52 14 12
42 11 3 69 8 16
43 13 3 68 13 14
44 11 2 75 11 17
45 11 3 75 13 10
46 10 2 72 10 17
47 14 1 67 10 12
48 18 3 63 13 13
49 14 3 62 12 13
50 11 5 63 16 11
51 12 1 76 13 13
52 13 3 74 12 12
53 9 4 67 11 12
54 10 3 73 12 12
55 15 4 70 12 9
56 20 2 53 14 7
57 12 3 77 13 17
58 12 4 77 13 12
59 14 1 52 12 12
60 13 1 54 13 9
61 11 1 80 12 9
62 17 4 66 13 13
63 12 2 73 14 10
64 13 3 63 13 11
65 14 4 69 13 12
66 13 2 67 12 10
67 15 5 54 10 13
68 13 3 81 13 6
69 10 3 69 11 7
70 11 3 84 11 13
71 13 4 70 13 11
72 17 4 69 11 18
73 13 3 77 15 9
74 9 1 54 13 9
75 11 3 79 13 11
76 10 1 30 12 11
77 9 3 71 11 15
78 12 5 73 12 8
79 12 3 72 13 11
80 13 3 77 12 14
81 13 4 75 13 14
82 22 5 70 15 12
83 13 4 73 13 12
84 15 4 54 11 8
85 13 4 77 11 11
86 15 4 82 14 10
87 10 4 80 15 17
88 11 3 80 12 16
89 16 4 69 10 13
90 11 3 78 12 15
91 11 3 81 11 11
92 10 3 76 11 12
93 10 4 76 11 16
94 16 3 73 14 20
95 12 4 85 14 16
96 11 2 66 13 11
97 16 5 79 13 15
98 19 3 68 13 15
99 11 4 76 12 12
100 15 2 54 12 9
101 24 4 46 16 24
102 14 3 82 13 15
103 15 4 74 15 18
104 11 3 88 11 17
105 15 1 38 14 12
106 12 4 76 14 15
107 10 4 86 10 11
108 14 2 54 12 11
109 9 5 69 12 12
110 15 4 90 14 14
111 15 4 54 10 11
112 14 3 76 10 20
113 11 4 89 13 11
114 8 4 76 13 12
115 11 4 79 11 12
116 8 3 90 11 11
117 10 5 74 13 10
118 11 3 81 13 11
119 13 4 72 13 12
120 11 4 71 13 9
121 20 4 66 13 8
122 10 4 77 13 6
123 12 4 74 13 12
124 14 5 82 14 15
125 23 3 54 13 13
126 14 1 63 14 17
127 16 4 54 11 14
128 11 4 64 13 16
129 12 3 69 11 15
130 10 4 54 11 16
131 14 4 84 16 11
132 12 4 86 8 11
133 12 4 77 11 16
134 11 4 89 14 15
135 12 4 76 12 14
136 13 3 60 13 9
137 17 5 79 13 13
138 9 3 71 14 11
139 12 4 72 14 14
140 19 4 69 11 11
141 15 4 54 11 8
142 14 4 69 14 7
143 11 3 81 13 11
144 9 4 84 15 13
145 18 4 84 14 9
Slaapgebrek Veranderingen_verleden Alcoholgebruik Rookgedrag
1 2 7 6 2
2 4 5 6 1
3 7 7 11 4
4 3 3 7 1
5 7 7 12 5
6 2 7 8 1
7 7 7 7 1
8 2 1 11 1
9 1 4 8 1
10 2 5 9 1
11 6 6 9 2
12 1 4 6 1
13 1 7 9 3
14 1 6 5 1
15 2 2 9 1
16 2 2 4 1
17 2 6 9 1
18 1 7 6 1
19 7 5 8 2
20 1 2 12 4
21 2 7 7 1
22 4 4 8 2
23 2 5 3 1
24 1 5 9 2
25 1 5 7 3
26 5 3 9 1
27 2 5 9 1
28 1 1 7 1
29 3 1 5 1
30 1 3 8 1
31 2 2 7 2
32 5 3 6 1
33 2 2 6 1
34 6 5 4 1
35 4 2 8 1
36 1 3 8 1
37 3 4 3 1
38 6 6 8 1
39 7 2 9 2
40 4 7 6 1
41 1 6 9 2
42 5 5 5 1
43 3 3 8 1
44 2 3 6 2
45 2 4 9 1
46 2 5 8 1
47 2 2 5 1
48 1 7 9 1
49 2 6 8 1
50 1 5 11 4
51 2 6 7 2
52 2 5 9 1
53 5 2 11 1
54 5 3 9 4
55 2 5 10 2
56 1 7 6 1
57 1 4 9 1
58 2 7 9 1
59 3 5 3 1
60 7 6 3 1
61 4 6 3 1
62 4 3 12 2
63 1 5 8 1
64 2 7 9 1
65 2 7 10 2
66 2 5 4 1
67 5 6 14 2
68 1 5 8 2
69 6 5 6 4
70 2 2 9 1
71 2 5 10 1
72 4 4 10 3
73 6 6 7 1
74 2 5 3 1
75 2 3 6 1
76 2 3 4 1
77 1 4 9 1
78 1 2 11 1
79 2 2 6 1
80 2 5 7 1
81 3 4 8 4
82 3 6 11 1
83 5 4 9 1
84 2 6 12 2
85 5 4 7 1
86 3 2 9 1
87 1 5 10 1
88 2 2 8 1
89 2 7 9 1
90 1 1 9 1
91 2 3 9 1
92 2 5 9 1
93 5 6 9 1
94 5 6 7 1
95 2 2 11 1
96 3 5 6 1
97 5 5 11 5
98 5 3 9 1
99 6 6 7 1
100 2 5 5 1
101 7 7 9 3
102 1 1 7 1
103 1 6 9 1
104 6 4 9 1
105 6 7 3 1
106 2 2 11 1
107 1 6 7 1
108 2 7 6 1
109 1 5 10 4
110 2 2 8 4
111 1 1 9 1
112 3 3 8 1
113 3 3 10 1
114 6 3 10 4
115 4 5 9 2
116 1 2 9 1
117 2 4 7 1
118 5 6 9 1
119 6 5 12 1
120 3 5 10 1
121 5 2 9 1
122 3 3 12 2
123 2 2 10 4
124 3 6 10 4
125 2 5 9 1
126 5 4 3 1
127 5 6 7 1
128 7 4 10 2
129 4 6 9 1
130 4 2 9 1
131 5 0 11 1
132 1 1 10 3
133 4 5 11 2
134 1 2 7 2
135 4 5 10 1
136 6 6 5 1
137 7 7 8 2
138 1 5 7 3
139 3 5 10 1
140 5 5 11 1
141 2 6 12 2
142 4 6 8 2
143 5 6 9 1
144 1 1 7 1
145 2 3 12 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Leeftijd Sportgerelateerde_groep
8.59793 0.03184 -0.08664
Stress Verwachtingen_ouders Slaapgebrek
0.44762 0.03872 0.34916
Veranderingen_verleden Alcoholgebruik Rookgedrag
0.19679 0.29770 -0.14013
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.25081 -1.55515 -0.08662 1.20570 8.44120
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.59793 2.86168 3.005 0.003168 **
Leeftijd 0.03184 0.38812 0.082 0.934734
Sportgerelateerde_groep -0.08664 0.02347 -3.692 0.000321 ***
Stress 0.44762 0.16023 2.794 0.005967 **
Verwachtingen_ouders 0.03872 0.06910 0.560 0.576199
Slaapgebrek 0.34916 0.13076 2.670 0.008502 **
Veranderingen_verleden 0.19679 0.13700 1.436 0.153174
Alcoholgebruik 0.29770 0.16957 1.756 0.081402 .
Rookgedrag -0.14013 0.26167 -0.536 0.593155
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.819 on 136 degrees of freedom
Multiple R-squared: 0.2549, Adjusted R-squared: 0.211
F-statistic: 5.815 on 8 and 136 DF, p-value: 2.209e-06
> 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.24859171 0.49718341 0.7514083
[2,] 0.22516456 0.45032911 0.7748354
[3,] 0.89466581 0.21066837 0.1053342
[4,] 0.84591198 0.30817605 0.1540880
[5,] 0.85470963 0.29058073 0.1452904
[6,] 0.78768832 0.42462336 0.2123117
[7,] 0.74728571 0.50542859 0.2527143
[8,] 0.83268952 0.33462097 0.1673105
[9,] 0.87240837 0.25518325 0.1275916
[10,] 0.85154862 0.29690275 0.1484514
[11,] 0.79890346 0.40219309 0.2010965
[12,] 0.74674690 0.50650620 0.2532531
[13,] 0.70753014 0.58493972 0.2924699
[14,] 0.63893458 0.72213084 0.3610654
[15,] 0.57695235 0.84609530 0.4230477
[16,] 0.52094064 0.95811871 0.4790594
[17,] 0.45304713 0.90609427 0.5469529
[18,] 0.39386523 0.78773046 0.6061348
[19,] 0.34212813 0.68425626 0.6578719
[20,] 0.30585291 0.61170581 0.6941471
[21,] 0.26534600 0.53069199 0.7346540
[22,] 0.27580617 0.55161234 0.7241938
[23,] 0.38525234 0.77050469 0.6147477
[24,] 0.32608363 0.65216725 0.6739164
[25,] 0.27780764 0.55561527 0.7221924
[26,] 0.28435481 0.56870962 0.7156452
[27,] 0.47190389 0.94380777 0.5280961
[28,] 0.41855738 0.83711477 0.5814426
[29,] 0.69445609 0.61108782 0.3055439
[30,] 0.66527040 0.66945920 0.3347296
[31,] 0.61493817 0.77012365 0.3850618
[32,] 0.56385630 0.87228740 0.4361437
[33,] 0.50746363 0.98507273 0.4925364
[34,] 0.45616552 0.91233104 0.5438345
[35,] 0.41103397 0.82206794 0.5889660
[36,] 0.42972953 0.85945907 0.5702705
[37,] 0.57465763 0.85068474 0.4253424
[38,] 0.53280698 0.93438604 0.4671930
[39,] 0.54961032 0.90077937 0.4503897
[40,] 0.50103299 0.99793401 0.4989670
[41,] 0.45465125 0.90930249 0.5453488
[42,] 0.51422436 0.97155128 0.4857756
[43,] 0.51745642 0.96508717 0.4825436
[44,] 0.51261195 0.97477610 0.4873880
[45,] 0.66685705 0.66628589 0.3331429
[46,] 0.62555977 0.74888047 0.3744402
[47,] 0.57962283 0.84075433 0.4203772
[48,] 0.53681857 0.92636286 0.4631814
[49,] 0.53025377 0.93949246 0.4697462
[50,] 0.50006954 0.99986092 0.4999305
[51,] 0.50266706 0.99466587 0.4973329
[52,] 0.45561062 0.91122124 0.5443894
[53,] 0.41195977 0.82391954 0.5880402
[54,] 0.36535294 0.73070587 0.6346471
[55,] 0.33651562 0.67303124 0.6634844
[56,] 0.30010681 0.60021362 0.6998932
[57,] 0.28377302 0.56754603 0.7162270
[58,] 0.26801830 0.53603660 0.7319817
[59,] 0.23055116 0.46110232 0.7694488
[60,] 0.19545052 0.39090105 0.8045495
[61,] 0.23908100 0.47816201 0.7609190
[62,] 0.20472140 0.40944281 0.7952786
[63,] 0.21862257 0.43724514 0.7813774
[64,] 0.18400687 0.36801375 0.8159931
[65,] 0.22933149 0.45866298 0.7706685
[66,] 0.23221709 0.46443418 0.7677829
[67,] 0.20168426 0.40336853 0.7983157
[68,] 0.17165169 0.34330339 0.8283483
[69,] 0.14938258 0.29876516 0.8506174
[70,] 0.12521353 0.25042705 0.8747865
[71,] 0.28780706 0.57561412 0.7121929
[72,] 0.24857473 0.49714946 0.7514253
[73,] 0.21092956 0.42185912 0.7890704
[74,] 0.18102553 0.36205105 0.8189745
[75,] 0.18001464 0.36002929 0.8199854
[76,] 0.19726249 0.39452499 0.8027375
[77,] 0.16525911 0.33051822 0.8347409
[78,] 0.17674080 0.35348160 0.8232592
[79,] 0.14897772 0.29795544 0.8510223
[80,] 0.12097502 0.24195004 0.8790250
[81,] 0.10616441 0.21232882 0.8938356
[82,] 0.11145367 0.22290733 0.8885463
[83,] 0.09537661 0.19075321 0.9046234
[84,] 0.07751881 0.15503762 0.9224812
[85,] 0.06679454 0.13358909 0.9332055
[86,] 0.06584858 0.13169717 0.9341514
[87,] 0.09715799 0.19431597 0.9028420
[88,] 0.08404512 0.16809025 0.9159549
[89,] 0.07368776 0.14737552 0.9263122
[90,] 0.12721535 0.25443070 0.8727847
[91,] 0.12651906 0.25303812 0.8734809
[92,] 0.10441496 0.20882992 0.8955850
[93,] 0.08291483 0.16582966 0.9170852
[94,] 0.06566729 0.13133459 0.9343327
[95,] 0.05252764 0.10505529 0.9474724
[96,] 0.03923630 0.07847261 0.9607637
[97,] 0.02856353 0.05712706 0.9714365
[98,] 0.03170907 0.06341813 0.9682909
[99,] 0.05599069 0.11198137 0.9440093
[100,] 0.04755117 0.09510233 0.9524488
[101,] 0.04442435 0.08884871 0.9555756
[102,] 0.03218788 0.06437576 0.9678121
[103,] 0.04795957 0.09591915 0.9520404
[104,] 0.03514540 0.07029080 0.9648546
[105,] 0.02816999 0.05633998 0.9718300
[106,] 0.02770737 0.05541473 0.9722926
[107,] 0.02197212 0.04394424 0.9780279
[108,] 0.01687767 0.03375534 0.9831223
[109,] 0.01948363 0.03896726 0.9805164
[110,] 0.04749384 0.09498768 0.9525062
[111,] 0.05999999 0.11999999 0.9400000
[112,] 0.04069027 0.08138053 0.9593097
[113,] 0.03668483 0.07336967 0.9633152
[114,] 0.43217393 0.86434787 0.5678261
[115,] 0.85881596 0.28236808 0.1411840
[116,] 0.88465989 0.23068022 0.1153401
[117,] 0.83227236 0.33545529 0.1677276
[118,] 0.78641134 0.42717731 0.2135887
[119,] 0.69528465 0.60943071 0.3047154
[120,] 0.74399511 0.51200979 0.2560049
[121,] 0.67025088 0.65949824 0.3297491
[122,] 0.83570217 0.32859567 0.1642978
> postscript(file="/var/www/html/rcomp/tmp/1vfyj1293227552.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/www/html/rcomp/tmp/2vfyj1293227552.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/www/html/rcomp/tmp/367gm1293227552.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/www/html/rcomp/tmp/467gm1293227552.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/www/html/rcomp/tmp/567gm1293227552.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 = 145
Frequency = 1
1 2 3 4 5 6
-0.708506847 -0.189509276 -1.008838921 0.666365910 6.407244202 -0.088979093
7 8 9 10 11 12
5.169364374 -1.555147899 -1.125820504 1.017084410 -3.691231638 -4.115210635
13 14 15 16 17 18
3.223667892 -0.958989964 0.124110091 3.702839062 -0.224342257 -1.894908901
19 20 21 22 23 24
-2.500822982 -4.811836196 -2.572277735 -0.195185909 0.869993028 -2.848706686
25 26 27 28 29 30
0.097175607 0.607433810 0.462762317 -1.320399972 2.094987423 -1.143354122
31 32 33 34 35 36
1.384586097 0.036148322 -2.929377825 6.686267523 0.115229901 -1.566676512
37 38 39 40 41 42
-1.484224187 -5.083017004 0.731674460 -7.250806066 -0.880314286 0.006074286
43 44 45 46 47 48
-0.042433513 0.459675642 -1.426412105 -1.481746996 3.793974540 4.176543116
49 50 51 52 53 54
0.682855848 -3.933989420 -0.050283913 0.660339733 -4.582883282 -2.659803952
55 56 57 58 59 60
2.240524023 6.019791195 -0.175001366 -0.952785475 1.255009128 -1.496615487
61 62 63 64 65 66
0.251127298 2.391319181 -0.565394123 -1.095181731 0.196525843 1.651660031
67 68 69 70 71 72
-0.872283811 1.838510824 -2.214782259 0.526012338 -0.424667385 3.891635576
73 74 75 76 77 78
-1.304477749 -3.554012744 -0.028669173 -4.167307876 -2.722162545 0.009017375
79 80 81 82 83 84
0.561642990 1.438229312 0.755812982 6.765873837 -0.756458942 0.548427078
85 86 87 88 89 90
1.119467020 2.745023538 -3.336659547 -0.086619590 3.658237573 0.027069032
91 92 93 94 95 96
0.146739385 -1.718760461 -3.149756117 1.719839144 -0.473614736 -1.865888650
97 98 99 100 101 102
2.383717620 4.922819227 -2.196256007 2.266357198 5.088350057 3.521415802
103 104 105 106 107 108
1.205695547 -1.072534717 -1.294257789 -1.214654451 0.349913110 0.497633949
109 110 111 112 113 114
-3.364684810 4.350534581 2.965985816 2.761233044 -0.734091030 -5.526213369
115 116 117 118 119 120
-1.048874533 -1.527548821 -1.981329553 -2.386360886 -2.282163493 -2.609752403
121 122 123 124 125 126
6.185519206 -3.035449062 -0.106052640 0.855120744 8.441204236 0.617679458
127 128 129 130 131 132
1.617012731 -4.546987177 -1.336511211 -3.919506133 0.084193789 3.616264375
133 134 135 136 137 138
-0.972436803 0.591774640 -1.271689229 -1.286706966 2.841958606 -3.231263835
139 140 141 142 143 144
-2.164326487 5.038742216 0.548427078 0.036373324 -2.386360886 -2.154949932
145
5.216281939
> postscript(file="/var/www/html/rcomp/tmp/6hyx61293227552.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 = 145
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.708506847 NA
1 -0.189509276 -0.708506847
2 -1.008838921 -0.189509276
3 0.666365910 -1.008838921
4 6.407244202 0.666365910
5 -0.088979093 6.407244202
6 5.169364374 -0.088979093
7 -1.555147899 5.169364374
8 -1.125820504 -1.555147899
9 1.017084410 -1.125820504
10 -3.691231638 1.017084410
11 -4.115210635 -3.691231638
12 3.223667892 -4.115210635
13 -0.958989964 3.223667892
14 0.124110091 -0.958989964
15 3.702839062 0.124110091
16 -0.224342257 3.702839062
17 -1.894908901 -0.224342257
18 -2.500822982 -1.894908901
19 -4.811836196 -2.500822982
20 -2.572277735 -4.811836196
21 -0.195185909 -2.572277735
22 0.869993028 -0.195185909
23 -2.848706686 0.869993028
24 0.097175607 -2.848706686
25 0.607433810 0.097175607
26 0.462762317 0.607433810
27 -1.320399972 0.462762317
28 2.094987423 -1.320399972
29 -1.143354122 2.094987423
30 1.384586097 -1.143354122
31 0.036148322 1.384586097
32 -2.929377825 0.036148322
33 6.686267523 -2.929377825
34 0.115229901 6.686267523
35 -1.566676512 0.115229901
36 -1.484224187 -1.566676512
37 -5.083017004 -1.484224187
38 0.731674460 -5.083017004
39 -7.250806066 0.731674460
40 -0.880314286 -7.250806066
41 0.006074286 -0.880314286
42 -0.042433513 0.006074286
43 0.459675642 -0.042433513
44 -1.426412105 0.459675642
45 -1.481746996 -1.426412105
46 3.793974540 -1.481746996
47 4.176543116 3.793974540
48 0.682855848 4.176543116
49 -3.933989420 0.682855848
50 -0.050283913 -3.933989420
51 0.660339733 -0.050283913
52 -4.582883282 0.660339733
53 -2.659803952 -4.582883282
54 2.240524023 -2.659803952
55 6.019791195 2.240524023
56 -0.175001366 6.019791195
57 -0.952785475 -0.175001366
58 1.255009128 -0.952785475
59 -1.496615487 1.255009128
60 0.251127298 -1.496615487
61 2.391319181 0.251127298
62 -0.565394123 2.391319181
63 -1.095181731 -0.565394123
64 0.196525843 -1.095181731
65 1.651660031 0.196525843
66 -0.872283811 1.651660031
67 1.838510824 -0.872283811
68 -2.214782259 1.838510824
69 0.526012338 -2.214782259
70 -0.424667385 0.526012338
71 3.891635576 -0.424667385
72 -1.304477749 3.891635576
73 -3.554012744 -1.304477749
74 -0.028669173 -3.554012744
75 -4.167307876 -0.028669173
76 -2.722162545 -4.167307876
77 0.009017375 -2.722162545
78 0.561642990 0.009017375
79 1.438229312 0.561642990
80 0.755812982 1.438229312
81 6.765873837 0.755812982
82 -0.756458942 6.765873837
83 0.548427078 -0.756458942
84 1.119467020 0.548427078
85 2.745023538 1.119467020
86 -3.336659547 2.745023538
87 -0.086619590 -3.336659547
88 3.658237573 -0.086619590
89 0.027069032 3.658237573
90 0.146739385 0.027069032
91 -1.718760461 0.146739385
92 -3.149756117 -1.718760461
93 1.719839144 -3.149756117
94 -0.473614736 1.719839144
95 -1.865888650 -0.473614736
96 2.383717620 -1.865888650
97 4.922819227 2.383717620
98 -2.196256007 4.922819227
99 2.266357198 -2.196256007
100 5.088350057 2.266357198
101 3.521415802 5.088350057
102 1.205695547 3.521415802
103 -1.072534717 1.205695547
104 -1.294257789 -1.072534717
105 -1.214654451 -1.294257789
106 0.349913110 -1.214654451
107 0.497633949 0.349913110
108 -3.364684810 0.497633949
109 4.350534581 -3.364684810
110 2.965985816 4.350534581
111 2.761233044 2.965985816
112 -0.734091030 2.761233044
113 -5.526213369 -0.734091030
114 -1.048874533 -5.526213369
115 -1.527548821 -1.048874533
116 -1.981329553 -1.527548821
117 -2.386360886 -1.981329553
118 -2.282163493 -2.386360886
119 -2.609752403 -2.282163493
120 6.185519206 -2.609752403
121 -3.035449062 6.185519206
122 -0.106052640 -3.035449062
123 0.855120744 -0.106052640
124 8.441204236 0.855120744
125 0.617679458 8.441204236
126 1.617012731 0.617679458
127 -4.546987177 1.617012731
128 -1.336511211 -4.546987177
129 -3.919506133 -1.336511211
130 0.084193789 -3.919506133
131 3.616264375 0.084193789
132 -0.972436803 3.616264375
133 0.591774640 -0.972436803
134 -1.271689229 0.591774640
135 -1.286706966 -1.271689229
136 2.841958606 -1.286706966
137 -3.231263835 2.841958606
138 -2.164326487 -3.231263835
139 5.038742216 -2.164326487
140 0.548427078 5.038742216
141 0.036373324 0.548427078
142 -2.386360886 0.036373324
143 -2.154949932 -2.386360886
144 5.216281939 -2.154949932
145 NA 5.216281939
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.189509276 -0.708506847
[2,] -1.008838921 -0.189509276
[3,] 0.666365910 -1.008838921
[4,] 6.407244202 0.666365910
[5,] -0.088979093 6.407244202
[6,] 5.169364374 -0.088979093
[7,] -1.555147899 5.169364374
[8,] -1.125820504 -1.555147899
[9,] 1.017084410 -1.125820504
[10,] -3.691231638 1.017084410
[11,] -4.115210635 -3.691231638
[12,] 3.223667892 -4.115210635
[13,] -0.958989964 3.223667892
[14,] 0.124110091 -0.958989964
[15,] 3.702839062 0.124110091
[16,] -0.224342257 3.702839062
[17,] -1.894908901 -0.224342257
[18,] -2.500822982 -1.894908901
[19,] -4.811836196 -2.500822982
[20,] -2.572277735 -4.811836196
[21,] -0.195185909 -2.572277735
[22,] 0.869993028 -0.195185909
[23,] -2.848706686 0.869993028
[24,] 0.097175607 -2.848706686
[25,] 0.607433810 0.097175607
[26,] 0.462762317 0.607433810
[27,] -1.320399972 0.462762317
[28,] 2.094987423 -1.320399972
[29,] -1.143354122 2.094987423
[30,] 1.384586097 -1.143354122
[31,] 0.036148322 1.384586097
[32,] -2.929377825 0.036148322
[33,] 6.686267523 -2.929377825
[34,] 0.115229901 6.686267523
[35,] -1.566676512 0.115229901
[36,] -1.484224187 -1.566676512
[37,] -5.083017004 -1.484224187
[38,] 0.731674460 -5.083017004
[39,] -7.250806066 0.731674460
[40,] -0.880314286 -7.250806066
[41,] 0.006074286 -0.880314286
[42,] -0.042433513 0.006074286
[43,] 0.459675642 -0.042433513
[44,] -1.426412105 0.459675642
[45,] -1.481746996 -1.426412105
[46,] 3.793974540 -1.481746996
[47,] 4.176543116 3.793974540
[48,] 0.682855848 4.176543116
[49,] -3.933989420 0.682855848
[50,] -0.050283913 -3.933989420
[51,] 0.660339733 -0.050283913
[52,] -4.582883282 0.660339733
[53,] -2.659803952 -4.582883282
[54,] 2.240524023 -2.659803952
[55,] 6.019791195 2.240524023
[56,] -0.175001366 6.019791195
[57,] -0.952785475 -0.175001366
[58,] 1.255009128 -0.952785475
[59,] -1.496615487 1.255009128
[60,] 0.251127298 -1.496615487
[61,] 2.391319181 0.251127298
[62,] -0.565394123 2.391319181
[63,] -1.095181731 -0.565394123
[64,] 0.196525843 -1.095181731
[65,] 1.651660031 0.196525843
[66,] -0.872283811 1.651660031
[67,] 1.838510824 -0.872283811
[68,] -2.214782259 1.838510824
[69,] 0.526012338 -2.214782259
[70,] -0.424667385 0.526012338
[71,] 3.891635576 -0.424667385
[72,] -1.304477749 3.891635576
[73,] -3.554012744 -1.304477749
[74,] -0.028669173 -3.554012744
[75,] -4.167307876 -0.028669173
[76,] -2.722162545 -4.167307876
[77,] 0.009017375 -2.722162545
[78,] 0.561642990 0.009017375
[79,] 1.438229312 0.561642990
[80,] 0.755812982 1.438229312
[81,] 6.765873837 0.755812982
[82,] -0.756458942 6.765873837
[83,] 0.548427078 -0.756458942
[84,] 1.119467020 0.548427078
[85,] 2.745023538 1.119467020
[86,] -3.336659547 2.745023538
[87,] -0.086619590 -3.336659547
[88,] 3.658237573 -0.086619590
[89,] 0.027069032 3.658237573
[90,] 0.146739385 0.027069032
[91,] -1.718760461 0.146739385
[92,] -3.149756117 -1.718760461
[93,] 1.719839144 -3.149756117
[94,] -0.473614736 1.719839144
[95,] -1.865888650 -0.473614736
[96,] 2.383717620 -1.865888650
[97,] 4.922819227 2.383717620
[98,] -2.196256007 4.922819227
[99,] 2.266357198 -2.196256007
[100,] 5.088350057 2.266357198
[101,] 3.521415802 5.088350057
[102,] 1.205695547 3.521415802
[103,] -1.072534717 1.205695547
[104,] -1.294257789 -1.072534717
[105,] -1.214654451 -1.294257789
[106,] 0.349913110 -1.214654451
[107,] 0.497633949 0.349913110
[108,] -3.364684810 0.497633949
[109,] 4.350534581 -3.364684810
[110,] 2.965985816 4.350534581
[111,] 2.761233044 2.965985816
[112,] -0.734091030 2.761233044
[113,] -5.526213369 -0.734091030
[114,] -1.048874533 -5.526213369
[115,] -1.527548821 -1.048874533
[116,] -1.981329553 -1.527548821
[117,] -2.386360886 -1.981329553
[118,] -2.282163493 -2.386360886
[119,] -2.609752403 -2.282163493
[120,] 6.185519206 -2.609752403
[121,] -3.035449062 6.185519206
[122,] -0.106052640 -3.035449062
[123,] 0.855120744 -0.106052640
[124,] 8.441204236 0.855120744
[125,] 0.617679458 8.441204236
[126,] 1.617012731 0.617679458
[127,] -4.546987177 1.617012731
[128,] -1.336511211 -4.546987177
[129,] -3.919506133 -1.336511211
[130,] 0.084193789 -3.919506133
[131,] 3.616264375 0.084193789
[132,] -0.972436803 3.616264375
[133,] 0.591774640 -0.972436803
[134,] -1.271689229 0.591774640
[135,] -1.286706966 -1.271689229
[136,] 2.841958606 -1.286706966
[137,] -3.231263835 2.841958606
[138,] -2.164326487 -3.231263835
[139,] 5.038742216 -2.164326487
[140,] 0.548427078 5.038742216
[141,] 0.036373324 0.548427078
[142,] -2.386360886 0.036373324
[143,] -2.154949932 -2.386360886
[144,] 5.216281939 -2.154949932
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.189509276 -0.708506847
2 -1.008838921 -0.189509276
3 0.666365910 -1.008838921
4 6.407244202 0.666365910
5 -0.088979093 6.407244202
6 5.169364374 -0.088979093
7 -1.555147899 5.169364374
8 -1.125820504 -1.555147899
9 1.017084410 -1.125820504
10 -3.691231638 1.017084410
11 -4.115210635 -3.691231638
12 3.223667892 -4.115210635
13 -0.958989964 3.223667892
14 0.124110091 -0.958989964
15 3.702839062 0.124110091
16 -0.224342257 3.702839062
17 -1.894908901 -0.224342257
18 -2.500822982 -1.894908901
19 -4.811836196 -2.500822982
20 -2.572277735 -4.811836196
21 -0.195185909 -2.572277735
22 0.869993028 -0.195185909
23 -2.848706686 0.869993028
24 0.097175607 -2.848706686
25 0.607433810 0.097175607
26 0.462762317 0.607433810
27 -1.320399972 0.462762317
28 2.094987423 -1.320399972
29 -1.143354122 2.094987423
30 1.384586097 -1.143354122
31 0.036148322 1.384586097
32 -2.929377825 0.036148322
33 6.686267523 -2.929377825
34 0.115229901 6.686267523
35 -1.566676512 0.115229901
36 -1.484224187 -1.566676512
37 -5.083017004 -1.484224187
38 0.731674460 -5.083017004
39 -7.250806066 0.731674460
40 -0.880314286 -7.250806066
41 0.006074286 -0.880314286
42 -0.042433513 0.006074286
43 0.459675642 -0.042433513
44 -1.426412105 0.459675642
45 -1.481746996 -1.426412105
46 3.793974540 -1.481746996
47 4.176543116 3.793974540
48 0.682855848 4.176543116
49 -3.933989420 0.682855848
50 -0.050283913 -3.933989420
51 0.660339733 -0.050283913
52 -4.582883282 0.660339733
53 -2.659803952 -4.582883282
54 2.240524023 -2.659803952
55 6.019791195 2.240524023
56 -0.175001366 6.019791195
57 -0.952785475 -0.175001366
58 1.255009128 -0.952785475
59 -1.496615487 1.255009128
60 0.251127298 -1.496615487
61 2.391319181 0.251127298
62 -0.565394123 2.391319181
63 -1.095181731 -0.565394123
64 0.196525843 -1.095181731
65 1.651660031 0.196525843
66 -0.872283811 1.651660031
67 1.838510824 -0.872283811
68 -2.214782259 1.838510824
69 0.526012338 -2.214782259
70 -0.424667385 0.526012338
71 3.891635576 -0.424667385
72 -1.304477749 3.891635576
73 -3.554012744 -1.304477749
74 -0.028669173 -3.554012744
75 -4.167307876 -0.028669173
76 -2.722162545 -4.167307876
77 0.009017375 -2.722162545
78 0.561642990 0.009017375
79 1.438229312 0.561642990
80 0.755812982 1.438229312
81 6.765873837 0.755812982
82 -0.756458942 6.765873837
83 0.548427078 -0.756458942
84 1.119467020 0.548427078
85 2.745023538 1.119467020
86 -3.336659547 2.745023538
87 -0.086619590 -3.336659547
88 3.658237573 -0.086619590
89 0.027069032 3.658237573
90 0.146739385 0.027069032
91 -1.718760461 0.146739385
92 -3.149756117 -1.718760461
93 1.719839144 -3.149756117
94 -0.473614736 1.719839144
95 -1.865888650 -0.473614736
96 2.383717620 -1.865888650
97 4.922819227 2.383717620
98 -2.196256007 4.922819227
99 2.266357198 -2.196256007
100 5.088350057 2.266357198
101 3.521415802 5.088350057
102 1.205695547 3.521415802
103 -1.072534717 1.205695547
104 -1.294257789 -1.072534717
105 -1.214654451 -1.294257789
106 0.349913110 -1.214654451
107 0.497633949 0.349913110
108 -3.364684810 0.497633949
109 4.350534581 -3.364684810
110 2.965985816 4.350534581
111 2.761233044 2.965985816
112 -0.734091030 2.761233044
113 -5.526213369 -0.734091030
114 -1.048874533 -5.526213369
115 -1.527548821 -1.048874533
116 -1.981329553 -1.527548821
117 -2.386360886 -1.981329553
118 -2.282163493 -2.386360886
119 -2.609752403 -2.282163493
120 6.185519206 -2.609752403
121 -3.035449062 6.185519206
122 -0.106052640 -3.035449062
123 0.855120744 -0.106052640
124 8.441204236 0.855120744
125 0.617679458 8.441204236
126 1.617012731 0.617679458
127 -4.546987177 1.617012731
128 -1.336511211 -4.546987177
129 -3.919506133 -1.336511211
130 0.084193789 -3.919506133
131 3.616264375 0.084193789
132 -0.972436803 3.616264375
133 0.591774640 -0.972436803
134 -1.271689229 0.591774640
135 -1.286706966 -1.271689229
136 2.841958606 -1.286706966
137 -3.231263835 2.841958606
138 -2.164326487 -3.231263835
139 5.038742216 -2.164326487
140 0.548427078 5.038742216
141 0.036373324 0.548427078
142 -2.386360886 0.036373324
143 -2.154949932 -2.386360886
144 5.216281939 -2.154949932
> 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/www/html/rcomp/tmp/7a7e91293227552.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/www/html/rcomp/tmp/8a7e91293227552.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/www/html/rcomp/tmp/9a7e91293227552.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/www/html/rcomp/tmp/102yvc1293227552.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/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/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/www/html/rcomp/tmp/11ozui1293227552.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/www/html/rcomp/tmp/12r0ao1293227552.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/www/html/rcomp/tmp/13n98f1293227552.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/www/html/rcomp/tmp/14gjqi1293227552.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/www/html/rcomp/tmp/151j6o1293227552.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/www/html/rcomp/tmp/16xbmw1293227552.tab")
+ }
>
> try(system("convert tmp/1vfyj1293227552.ps tmp/1vfyj1293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/2vfyj1293227552.ps tmp/2vfyj1293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/367gm1293227552.ps tmp/367gm1293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/467gm1293227552.ps tmp/467gm1293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/567gm1293227552.ps tmp/567gm1293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/6hyx61293227552.ps tmp/6hyx61293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/7a7e91293227552.ps tmp/7a7e91293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/8a7e91293227552.ps tmp/8a7e91293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/9a7e91293227552.ps tmp/9a7e91293227552.png",intern=TRUE))
character(0)
> try(system("convert tmp/102yvc1293227552.ps tmp/102yvc1293227552.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.996 1.878 10.353