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(8
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,8
+ ,4
+ ,3
+ ,4
+ ,3
+ ,4
+ ,8
+ ,4
+ ,4
+ ,3
+ ,4
+ ,3
+ ,8
+ ,3
+ ,3
+ ,4
+ ,3
+ ,2
+ ,8
+ ,2
+ ,3
+ ,4
+ ,4
+ ,4
+ ,8
+ ,5
+ ,4
+ ,4
+ ,4
+ ,5
+ ,8
+ ,3
+ ,2
+ ,4
+ ,3
+ ,4
+ ,8
+ ,2
+ ,3
+ ,4
+ ,4
+ ,4
+ ,8
+ ,2
+ ,4
+ ,2
+ ,3
+ ,2
+ ,8
+ ,4
+ ,3
+ ,2
+ ,4
+ ,2
+ ,8
+ ,3
+ ,3
+ ,4
+ ,3
+ ,4
+ ,8
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,8
+ ,4
+ ,2
+ ,4
+ ,3
+ ,5
+ ,8
+ ,4
+ ,2
+ ,4
+ ,3
+ ,5
+ ,8
+ ,2
+ ,3
+ ,3
+ ,4
+ ,4
+ ,8
+ ,3
+ ,2
+ ,4
+ ,3
+ ,3
+ ,8
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,8
+ ,2
+ ,2
+ ,3
+ ,3
+ ,4
+ ,8
+ ,2
+ ,1
+ ,2
+ ,3
+ ,2
+ ,8
+ ,3
+ ,3
+ ,2
+ ,4
+ ,4
+ ,8
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,8
+ ,2
+ ,2
+ ,3
+ ,3
+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+ ,4
+ ,4
+ ,11
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,11
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,11
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,11
+ ,3
+ ,2
+ ,4
+ ,4
+ ,4
+ ,11
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,11
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,11
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,11
+ ,4
+ ,4
+ ,4
+ ,5
+ ,4
+ ,11
+ ,3
+ ,2
+ ,4
+ ,3
+ ,3
+ ,11
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,11
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,11
+ ,4
+ ,3
+ ,4
+ ,3
+ ,3)
+ ,dim=c(6
+ ,148)
+ ,dimnames=list(c('Tijd'
+ ,'SocialVisible'
+ ,'ManyFriends'
+ ,'MakeNewFriends'
+ ,'QuiteAccepted'
+ ,'IntendMakeNewFriends')
+ ,1:148))
> y <- array(NA,dim=c(6,148),dimnames=list(c('Tijd','SocialVisible','ManyFriends','MakeNewFriends','QuiteAccepted','IntendMakeNewFriends'),1:148))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'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
SocialVisible Tijd ManyFriends MakeNewFriends QuiteAccepted
1 3 8 3 4 4
2 4 8 3 4 3
3 4 8 4 3 4
4 3 8 3 4 3
5 2 8 3 4 4
6 5 8 4 4 4
7 3 8 2 4 3
8 2 8 3 4 4
9 2 8 4 2 3
10 4 8 3 2 4
11 3 8 3 4 3
12 3 8 4 4 4
13 4 8 2 4 3
14 4 8 2 4 3
15 2 8 3 3 4
16 3 8 2 4 3
17 4 8 4 4 4
18 2 8 2 3 3
19 2 8 1 2 3
20 3 8 3 2 4
21 4 8 4 4 4
22 2 8 2 3 3
23 2 8 3 4 3
24 3 8 3 4 4
25 4 8 4 3 4
26 4 8 3 3 4
27 3 8 3 2 4
28 3 8 4 3 4
29 4 8 4 4 4
30 2 8 4 3 2
31 3 8 3 3 4
32 4 8 4 4 4
33 2 8 2 4 3
34 4 8 4 3 4
35 4 8 3 4 4
36 2 8 2 2 3
37 3 8 4 3 4
38 4 9 4 4 4
39 4 9 4 4 3
40 3 9 4 3 4
41 4 9 2 5 3
42 3 9 2 3 3
43 3 9 3 3 3
44 3 9 4 4 3
45 3 9 5 4 4
46 2 9 2 5 2
47 4 9 3 3 3
48 4 9 3 4 4
49 3 9 3 4 4
50 3 9 2 4 3
51 3 9 4 4 4
52 3 9 3 3 4
53 2 9 3 3 4
54 4 9 4 3 5
55 4 9 1 2 4
56 4 9 4 4 4
57 3 9 2 4 3
58 4 9 4 4 3
59 3 9 4 3 3
60 4 9 4 4 4
61 3 9 2 3 3
62 3 9 4 4 4
63 3 9 2 4 3
64 3 9 4 4 3
65 4 9 4 4 3
66 1 9 1 4 1
67 4 9 4 4 4
68 4 9 4 4 4
69 3 9 3 4 4
70 5 9 3 2 4
71 3 9 3 3 4
72 3 9 3 4 4
73 3 9 3 4 3
74 4 9 3 3 3
75 4 10 4 4 3
76 3 10 1 4 3
77 3 10 3 4 4
78 4 10 3 3 4
79 2 10 3 3 4
80 4 10 4 3 2
81 3 10 3 4 3
82 2 10 2 4 3
83 4 10 3 2 4
84 4 10 4 4 4
85 3 10 3 3 4
86 4 10 4 4 4
87 4 10 3 3 4
88 4 10 4 4 4
89 3 10 4 3 4
90 3 10 3 3 3
91 4 10 2 4 3
92 5 10 1 3 2
93 3 10 2 4 2
94 4 10 2 2 4
95 4 10 3 4 3
96 4 10 4 4 4
97 4 10 4 4 4
98 5 10 3 4 5
99 4 10 3 4 3
100 3 10 1 3 1
101 4 10 3 4 4
102 4 10 3 3 3
103 4 10 4 4 4
104 4 10 2 3 4
105 4 10 3 3 4
106 3 10 3 2 4
107 4 10 3 4 3
108 4 10 4 4 4
109 4 10 4 4 4
110 4 10 4 1 3
111 4 10 4 4 3
112 4 11 2 4 4
113 4 11 3 4 4
114 3 11 4 3 3
115 4 11 3 4 3
116 3 11 4 4 3
117 3 11 2 3 4
118 4 11 4 4 4
119 4 11 4 4 3
120 4 11 3 4 3
121 4 11 4 4 4
122 3 11 3 4 4
123 3 11 3 3 4
124 1 11 1 3 1
125 4 11 4 4 4
126 3 11 4 4 4
127 4 11 2 4 4
128 4 11 3 4 4
129 3 11 4 4 4
130 4 11 3 4 4
131 4 11 4 4 4
132 2 11 2 4 4
133 4 11 5 4 4
134 3 11 3 3 4
135 3 11 4 3 4
136 4 11 3 4 4
137 4 11 4 4 4
138 3 11 3 4 4
139 3 11 3 4 4
140 3 11 2 4 4
141 4 11 4 4 4
142 4 11 4 4 4
143 3 11 3 4 4
144 4 11 4 4 5
145 3 11 2 4 3
146 4 11 4 4 4
147 4 11 4 4 3
148 4 11 3 4 3
IntendMakeNewFriends t
1 4 1
2 4 2
3 3 3
4 2 4
5 4 5
6 5 6
7 4 7
8 4 8
9 2 9
10 2 10
11 4 11
12 4 12
13 5 13
14 5 14
15 4 15
16 3 16
17 4 17
18 4 18
19 2 19
20 4 20
21 4 21
22 4 22
23 4 23
24 4 24
25 4 25
26 4 26
27 3 27
28 3 28
29 4 29
30 3 30
31 4 31
32 4 32
33 4 33
34 4 34
35 4 35
36 3 36
37 4 37
38 4 38
39 4 39
40 3 40
41 5 41
42 4 42
43 4 43
44 4 44
45 4 45
46 5 46
47 4 47
48 4 48
49 4 49
50 4 50
51 5 51
52 4 52
53 3 53
54 3 54
55 4 55
56 4 56
57 4 57
58 4 58
59 3 59
60 3 60
61 3 61
62 4 62
63 4 63
64 4 64
65 4 65
66 5 66
67 3 67
68 4 68
69 3 69
70 2 70
71 4 71
72 4 72
73 5 73
74 2 74
75 4 75
76 4 76
77 4 77
78 4 78
79 3 79
80 4 80
81 5 81
82 2 82
83 2 83
84 4 84
85 4 85
86 3 86
87 4 87
88 4 88
89 4 89
90 4 90
91 4 91
92 2 92
93 4 93
94 4 94
95 4 95
96 4 96
97 4 97
98 5 98
99 4 99
100 4 100
101 4 101
102 3 102
103 4 103
104 4 104
105 4 105
106 3 106
107 4 107
108 4 108
109 4 109
110 5 110
111 4 111
112 4 112
113 4 113
114 4 114
115 4 115
116 4 116
117 4 117
118 4 118
119 4 119
120 4 120
121 4 121
122 4 122
123 3 123
124 1 124
125 4 125
126 4 126
127 4 127
128 4 128
129 4 129
130 4 130
131 4 131
132 4 132
133 4 133
134 3 134
135 4 135
136 4 136
137 4 137
138 4 138
139 4 139
140 4 140
141 4 141
142 4 142
143 4 143
144 4 144
145 3 145
146 3 146
147 4 147
148 3 148
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Tijd ManyFriends
1.286554 -0.011629 0.200736
MakeNewFriends QuiteAccepted IntendMakeNewFriends
0.019477 0.234335 0.111077
t
0.003713
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.5098 -0.5032 0.1181 0.4732 2.5381
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.286554 1.629028 0.790 0.43099
Tijd -0.011629 0.208366 -0.056 0.95557
ManyFriends 0.200736 0.073589 2.728 0.00719 **
MakeNewFriends 0.019477 0.097110 0.201 0.84132
QuiteAccepted 0.234335 0.093916 2.495 0.01374 *
IntendMakeNewFriends 0.111077 0.091974 1.208 0.22918
t 0.003713 0.005429 0.684 0.49512
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6988 on 141 degrees of freedom
Multiple R-squared: 0.2147, Adjusted R-squared: 0.1812
F-statistic: 6.424 on 6 and 141 DF, p-value: 5.283e-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.9985891 0.0028217842 0.0014108921
[2,] 0.9964839 0.0070322113 0.0035161056
[3,] 0.9921517 0.0156966886 0.0078483443
[4,] 0.9907960 0.0184080922 0.0092040461
[5,] 0.9865252 0.0269495154 0.0134747577
[6,] 0.9918955 0.0162090153 0.0081045076
[7,] 0.9900879 0.0198242413 0.0099121207
[8,] 0.9910742 0.0178516089 0.0089258045
[9,] 0.9925118 0.0149764071 0.0074882036
[10,] 0.9880336 0.0239327077 0.0119663538
[11,] 0.9809163 0.0381673322 0.0190836661
[12,] 0.9766272 0.0467456019 0.0233728010
[13,] 0.9768516 0.0462967956 0.0231483978
[14,] 0.9825227 0.0349546930 0.0174773465
[15,] 0.9745092 0.0509815973 0.0254907986
[16,] 0.9730409 0.0539182490 0.0269591245
[17,] 0.9765287 0.0469426147 0.0234713074
[18,] 0.9667859 0.0664282497 0.0332141249
[19,] 0.9551196 0.0897608685 0.0448804343
[20,] 0.9455212 0.1089576823 0.0544788411
[21,] 0.9472683 0.1054633685 0.0527316843
[22,] 0.9307294 0.1385412516 0.0692706258
[23,] 0.9180409 0.1639181316 0.0819590658
[24,] 0.9166124 0.1667751843 0.0833875922
[25,] 0.9039176 0.1921648427 0.0960824214
[26,] 0.9001481 0.1997038421 0.0998519210
[27,] 0.8915430 0.2169140234 0.1084570117
[28,] 0.8814112 0.2371776068 0.1185888034
[29,] 0.8542510 0.2914980061 0.1457490030
[30,] 0.8333584 0.3332832458 0.1666416229
[31,] 0.8249804 0.3500392289 0.1750196144
[32,] 0.8291626 0.3416748593 0.1708374297
[33,] 0.7917317 0.4165366627 0.2082683313
[34,] 0.7547213 0.4905573822 0.2452786911
[35,] 0.7331063 0.5337874211 0.2668937105
[36,] 0.7694161 0.4611678848 0.2305839424
[37,] 0.7811026 0.4377947648 0.2188973824
[38,] 0.8086565 0.3826869030 0.1913434515
[39,] 0.7895428 0.4209144587 0.2104572293
[40,] 0.7704252 0.4591495771 0.2295747886
[41,] 0.7299512 0.5400976032 0.2700488016
[42,] 0.7499387 0.5001225594 0.2500612797
[43,] 0.7235160 0.5529679039 0.2764839520
[44,] 0.8067357 0.3865286617 0.1932643308
[45,] 0.7826008 0.4347984508 0.2173992254
[46,] 0.8132736 0.3734528730 0.1867264365
[47,] 0.7885974 0.4228051675 0.2114025838
[48,] 0.7527422 0.4945156837 0.2472578418
[49,] 0.7531359 0.4937281662 0.2468640831
[50,] 0.7292433 0.5415133072 0.2707566536
[51,] 0.7075185 0.5849630356 0.2924815178
[52,] 0.6733458 0.6533084621 0.3266542310
[53,] 0.6816164 0.6367672648 0.3183836324
[54,] 0.6385926 0.7228148600 0.3614074300
[55,] 0.6185637 0.7628725622 0.3814362811
[56,] 0.6059827 0.7880345973 0.3940172987
[57,] 0.7687564 0.4624872470 0.2312436235
[58,] 0.7415210 0.5169579121 0.2584789561
[59,] 0.7045462 0.5909076215 0.2954538108
[60,] 0.6986926 0.6026148511 0.3013074255
[61,] 0.8666508 0.2666983144 0.1333491572
[62,] 0.8703615 0.2592769003 0.1296384501
[63,] 0.8862089 0.2275821913 0.1137910956
[64,] 0.9122391 0.1755217430 0.0877608715
[65,] 0.9187451 0.1625098035 0.0812549018
[66,] 0.9040362 0.1919275901 0.0959637951
[67,] 0.8838321 0.2323358867 0.1161679433
[68,] 0.8913755 0.2172490977 0.1086245488
[69,] 0.8732924 0.2534151145 0.1267075573
[70,] 0.9514074 0.0971851012 0.0485925506
[71,] 0.9512890 0.0974220627 0.0487110313
[72,] 0.9557615 0.0884769088 0.0442384544
[73,] 0.9785899 0.0428202249 0.0214101125
[74,] 0.9790419 0.0419162797 0.0209581398
[75,] 0.9721650 0.0556699560 0.0278349780
[76,] 0.9753672 0.0492655417 0.0246327709
[77,] 0.9675215 0.0649570759 0.0324785379
[78,] 0.9586965 0.0826069458 0.0413034729
[79,] 0.9473276 0.1053447690 0.0526723845
[80,] 0.9637408 0.0725183693 0.0362591847
[81,] 0.9662026 0.0675947794 0.0337973897
[82,] 0.9627390 0.0745219216 0.0372609608
[83,] 0.9996438 0.0007123198 0.0003561599
[84,] 0.9996157 0.0007686801 0.0003843400
[85,] 0.9995926 0.0008147260 0.0004073630
[86,] 0.9993848 0.0012303199 0.0006151599
[87,] 0.9990983 0.0018034439 0.0009017220
[88,] 0.9987246 0.0025507695 0.0012753848
[89,] 0.9985904 0.0028191591 0.0014095795
[90,] 0.9978928 0.0042144483 0.0021072241
[91,] 0.9969187 0.0061625610 0.0030812805
[92,] 0.9953520 0.0092960214 0.0046480107
[93,] 0.9954826 0.0090347861 0.0045173931
[94,] 0.9936032 0.0127935805 0.0063967903
[95,] 0.9922846 0.0154308437 0.0077154218
[96,] 0.9895877 0.0208245566 0.0104122783
[97,] 0.9861583 0.0276834876 0.0138417438
[98,] 0.9806199 0.0387602590 0.0193801295
[99,] 0.9730551 0.0538897655 0.0269448827
[100,] 0.9648962 0.0702076640 0.0351038320
[101,] 0.9721405 0.0557190640 0.0278595320
[102,] 0.9607609 0.0784781103 0.0392390551
[103,] 0.9595434 0.0809132855 0.0404566427
[104,] 0.9515245 0.0969509031 0.0484754516
[105,] 0.9392224 0.1215551475 0.0607775738
[106,] 0.9376575 0.1246850377 0.0623425189
[107,] 0.9466383 0.1067233181 0.0533616591
[108,] 0.9435605 0.1128789989 0.0564394994
[109,] 0.9224734 0.1550532913 0.0775266456
[110,] 0.8979498 0.2041003447 0.1020501723
[111,] 0.9119937 0.1760126993 0.0880063496
[112,] 0.8887843 0.2224314452 0.1112157226
[113,] 0.8678976 0.2642048612 0.1321024306
[114,] 0.8454739 0.3090522473 0.1545261237
[115,] 0.8709304 0.2581392998 0.1290696499
[116,] 0.8305162 0.3389675849 0.1694837924
[117,] 0.8707430 0.2585139837 0.1292569919
[118,] 0.9292566 0.1414868747 0.0707434374
[119,] 0.9473070 0.1053860692 0.0526930346
[120,] 0.9671510 0.0656979055 0.0328489527
[121,] 0.9822626 0.0354747069 0.0177373534
[122,] 0.9747725 0.0504550519 0.0252275259
[123,] 0.9840617 0.0318765067 0.0159382534
[124,] 0.9804703 0.0390593047 0.0195296524
[125,] 0.9618524 0.0762951904 0.0381475952
[126,] 0.9248476 0.1503048799 0.0751524400
[127,] 0.9581615 0.0836769135 0.0418384568
[128,] 0.9265818 0.1468364832 0.0734182416
[129,] 0.8397900 0.3204199092 0.1602099546
> postscript(file="/var/www/html/rcomp/tmp/1ahf41290587086.ps",horizontal=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/2ahf41290587086.ps",horizontal=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/3ahf41290587086.ps",horizontal=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/4l8e71290587086.ps",horizontal=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/5l8e71290587086.ps",horizontal=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 = 148
Frequency = 1
1 2 3 4 5 6
-0.25899757 0.97162369 0.66339340 0.18635052 -1.27385075 1.41062289
7 8 9 10 11 12
0.15379355 -1.28499064 -0.99399792 0.96869058 -0.06179598 -0.50058017
13 14 15 16 17 18
1.02043706 1.01672376 -1.29150652 0.23145059 0.48085335 -0.86757552
19 20 21 22 23 24
-0.42892185 -0.29059581 0.46600016 -0.88242870 -1.10635554 -0.34440338
25 26 27 28 29 30
0.47062417 0.66764722 -0.20551217 -0.42943901 0.43629379 -0.96819650
31 32 33 34 35 36
-0.35091926 0.42515390 -0.94275216 0.43720450 0.61475036 -0.80386095
37 38 39 40 41 42
-0.57393539 0.41450325 0.64512450 -0.46236944 0.90861669 0.05493449
43 44 45 46 47 48
-0.14951515 -0.37344198 -0.81222617 -0.87561524 0.83563167 0.57810663
49 50 51 52 53 54
-0.42560667 0.00575093 -0.74484632 -0.41726936 -1.30990595 0.25130987
55 56 57 58 59 60
0.99254063 0.34766392 -0.02024214 0.57457187 -0.29858752 0.44388744
61 62 63 64 65 66
0.09545858 -0.67461586 -0.04252192 -0.44770791 0.54857880 -1.49533308
67 68 69 70 71 72
0.41789437 0.30310436 -0.38879588 1.75752192 -0.48782199 -0.51101248
73 74 75 76 77 78
-0.39146794 0.95752609 0.52307496 0.12157069 -0.51794984 0.49781406
79 80 81 82 83 84
-1.39482252 0.75832022 -0.40954519 -0.87929200 0.72087820 0.25532074
85 86 87 88 89 90
-0.52817902 0.35897086 0.46439439 0.24046756 -0.74376854 -0.31241095
91 92 93 94 95 96
0.86513491 2.53812312 0.09204286 0.65861485 0.64954538 0.21076119
97 98 99 100 101 102
0.20704789 1.05865968 0.63469219 0.52059787 0.39293105 0.75410621
103 104 105 106 107 108
0.18476811 0.60200470 0.39755506 -0.47560433 0.60498582 0.16620163
109 110 111 112 113 114
0.16248834 0.34046445 0.38939629 0.56445026 0.36000062 -0.59063728
115 116 117 118 119 120
0.58690857 -0.61754107 -0.43463903 0.14069779 0.37131905 0.56834209
121 122 123 124 125 126
0.12955790 -0.67341905 -0.54657844 -1.22366198 0.11470472 -0.88900858
127 128 129 130 131 132
0.50875081 0.30430117 -0.90014847 0.29687458 0.09242494 -1.50981567
133 134 135 136 137 138
-0.11573800 -0.58742470 -0.90295105 0.27459480 0.07014516 -0.73283179
139 140 141 142 143 144
-0.73654509 -0.53952204 0.05529198 0.05157868 -0.75139827 -0.19018246
145 146 147 148
-0.21267726 0.14780221 0.26734675 0.57544651
> postscript(file="/var/www/html/rcomp/tmp/6l8e71290587086.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 148
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.25899757 NA
1 0.97162369 -0.25899757
2 0.66339340 0.97162369
3 0.18635052 0.66339340
4 -1.27385075 0.18635052
5 1.41062289 -1.27385075
6 0.15379355 1.41062289
7 -1.28499064 0.15379355
8 -0.99399792 -1.28499064
9 0.96869058 -0.99399792
10 -0.06179598 0.96869058
11 -0.50058017 -0.06179598
12 1.02043706 -0.50058017
13 1.01672376 1.02043706
14 -1.29150652 1.01672376
15 0.23145059 -1.29150652
16 0.48085335 0.23145059
17 -0.86757552 0.48085335
18 -0.42892185 -0.86757552
19 -0.29059581 -0.42892185
20 0.46600016 -0.29059581
21 -0.88242870 0.46600016
22 -1.10635554 -0.88242870
23 -0.34440338 -1.10635554
24 0.47062417 -0.34440338
25 0.66764722 0.47062417
26 -0.20551217 0.66764722
27 -0.42943901 -0.20551217
28 0.43629379 -0.42943901
29 -0.96819650 0.43629379
30 -0.35091926 -0.96819650
31 0.42515390 -0.35091926
32 -0.94275216 0.42515390
33 0.43720450 -0.94275216
34 0.61475036 0.43720450
35 -0.80386095 0.61475036
36 -0.57393539 -0.80386095
37 0.41450325 -0.57393539
38 0.64512450 0.41450325
39 -0.46236944 0.64512450
40 0.90861669 -0.46236944
41 0.05493449 0.90861669
42 -0.14951515 0.05493449
43 -0.37344198 -0.14951515
44 -0.81222617 -0.37344198
45 -0.87561524 -0.81222617
46 0.83563167 -0.87561524
47 0.57810663 0.83563167
48 -0.42560667 0.57810663
49 0.00575093 -0.42560667
50 -0.74484632 0.00575093
51 -0.41726936 -0.74484632
52 -1.30990595 -0.41726936
53 0.25130987 -1.30990595
54 0.99254063 0.25130987
55 0.34766392 0.99254063
56 -0.02024214 0.34766392
57 0.57457187 -0.02024214
58 -0.29858752 0.57457187
59 0.44388744 -0.29858752
60 0.09545858 0.44388744
61 -0.67461586 0.09545858
62 -0.04252192 -0.67461586
63 -0.44770791 -0.04252192
64 0.54857880 -0.44770791
65 -1.49533308 0.54857880
66 0.41789437 -1.49533308
67 0.30310436 0.41789437
68 -0.38879588 0.30310436
69 1.75752192 -0.38879588
70 -0.48782199 1.75752192
71 -0.51101248 -0.48782199
72 -0.39146794 -0.51101248
73 0.95752609 -0.39146794
74 0.52307496 0.95752609
75 0.12157069 0.52307496
76 -0.51794984 0.12157069
77 0.49781406 -0.51794984
78 -1.39482252 0.49781406
79 0.75832022 -1.39482252
80 -0.40954519 0.75832022
81 -0.87929200 -0.40954519
82 0.72087820 -0.87929200
83 0.25532074 0.72087820
84 -0.52817902 0.25532074
85 0.35897086 -0.52817902
86 0.46439439 0.35897086
87 0.24046756 0.46439439
88 -0.74376854 0.24046756
89 -0.31241095 -0.74376854
90 0.86513491 -0.31241095
91 2.53812312 0.86513491
92 0.09204286 2.53812312
93 0.65861485 0.09204286
94 0.64954538 0.65861485
95 0.21076119 0.64954538
96 0.20704789 0.21076119
97 1.05865968 0.20704789
98 0.63469219 1.05865968
99 0.52059787 0.63469219
100 0.39293105 0.52059787
101 0.75410621 0.39293105
102 0.18476811 0.75410621
103 0.60200470 0.18476811
104 0.39755506 0.60200470
105 -0.47560433 0.39755506
106 0.60498582 -0.47560433
107 0.16620163 0.60498582
108 0.16248834 0.16620163
109 0.34046445 0.16248834
110 0.38939629 0.34046445
111 0.56445026 0.38939629
112 0.36000062 0.56445026
113 -0.59063728 0.36000062
114 0.58690857 -0.59063728
115 -0.61754107 0.58690857
116 -0.43463903 -0.61754107
117 0.14069779 -0.43463903
118 0.37131905 0.14069779
119 0.56834209 0.37131905
120 0.12955790 0.56834209
121 -0.67341905 0.12955790
122 -0.54657844 -0.67341905
123 -1.22366198 -0.54657844
124 0.11470472 -1.22366198
125 -0.88900858 0.11470472
126 0.50875081 -0.88900858
127 0.30430117 0.50875081
128 -0.90014847 0.30430117
129 0.29687458 -0.90014847
130 0.09242494 0.29687458
131 -1.50981567 0.09242494
132 -0.11573800 -1.50981567
133 -0.58742470 -0.11573800
134 -0.90295105 -0.58742470
135 0.27459480 -0.90295105
136 0.07014516 0.27459480
137 -0.73283179 0.07014516
138 -0.73654509 -0.73283179
139 -0.53952204 -0.73654509
140 0.05529198 -0.53952204
141 0.05157868 0.05529198
142 -0.75139827 0.05157868
143 -0.19018246 -0.75139827
144 -0.21267726 -0.19018246
145 0.14780221 -0.21267726
146 0.26734675 0.14780221
147 0.57544651 0.26734675
148 NA 0.57544651
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.97162369 -0.25899757
[2,] 0.66339340 0.97162369
[3,] 0.18635052 0.66339340
[4,] -1.27385075 0.18635052
[5,] 1.41062289 -1.27385075
[6,] 0.15379355 1.41062289
[7,] -1.28499064 0.15379355
[8,] -0.99399792 -1.28499064
[9,] 0.96869058 -0.99399792
[10,] -0.06179598 0.96869058
[11,] -0.50058017 -0.06179598
[12,] 1.02043706 -0.50058017
[13,] 1.01672376 1.02043706
[14,] -1.29150652 1.01672376
[15,] 0.23145059 -1.29150652
[16,] 0.48085335 0.23145059
[17,] -0.86757552 0.48085335
[18,] -0.42892185 -0.86757552
[19,] -0.29059581 -0.42892185
[20,] 0.46600016 -0.29059581
[21,] -0.88242870 0.46600016
[22,] -1.10635554 -0.88242870
[23,] -0.34440338 -1.10635554
[24,] 0.47062417 -0.34440338
[25,] 0.66764722 0.47062417
[26,] -0.20551217 0.66764722
[27,] -0.42943901 -0.20551217
[28,] 0.43629379 -0.42943901
[29,] -0.96819650 0.43629379
[30,] -0.35091926 -0.96819650
[31,] 0.42515390 -0.35091926
[32,] -0.94275216 0.42515390
[33,] 0.43720450 -0.94275216
[34,] 0.61475036 0.43720450
[35,] -0.80386095 0.61475036
[36,] -0.57393539 -0.80386095
[37,] 0.41450325 -0.57393539
[38,] 0.64512450 0.41450325
[39,] -0.46236944 0.64512450
[40,] 0.90861669 -0.46236944
[41,] 0.05493449 0.90861669
[42,] -0.14951515 0.05493449
[43,] -0.37344198 -0.14951515
[44,] -0.81222617 -0.37344198
[45,] -0.87561524 -0.81222617
[46,] 0.83563167 -0.87561524
[47,] 0.57810663 0.83563167
[48,] -0.42560667 0.57810663
[49,] 0.00575093 -0.42560667
[50,] -0.74484632 0.00575093
[51,] -0.41726936 -0.74484632
[52,] -1.30990595 -0.41726936
[53,] 0.25130987 -1.30990595
[54,] 0.99254063 0.25130987
[55,] 0.34766392 0.99254063
[56,] -0.02024214 0.34766392
[57,] 0.57457187 -0.02024214
[58,] -0.29858752 0.57457187
[59,] 0.44388744 -0.29858752
[60,] 0.09545858 0.44388744
[61,] -0.67461586 0.09545858
[62,] -0.04252192 -0.67461586
[63,] -0.44770791 -0.04252192
[64,] 0.54857880 -0.44770791
[65,] -1.49533308 0.54857880
[66,] 0.41789437 -1.49533308
[67,] 0.30310436 0.41789437
[68,] -0.38879588 0.30310436
[69,] 1.75752192 -0.38879588
[70,] -0.48782199 1.75752192
[71,] -0.51101248 -0.48782199
[72,] -0.39146794 -0.51101248
[73,] 0.95752609 -0.39146794
[74,] 0.52307496 0.95752609
[75,] 0.12157069 0.52307496
[76,] -0.51794984 0.12157069
[77,] 0.49781406 -0.51794984
[78,] -1.39482252 0.49781406
[79,] 0.75832022 -1.39482252
[80,] -0.40954519 0.75832022
[81,] -0.87929200 -0.40954519
[82,] 0.72087820 -0.87929200
[83,] 0.25532074 0.72087820
[84,] -0.52817902 0.25532074
[85,] 0.35897086 -0.52817902
[86,] 0.46439439 0.35897086
[87,] 0.24046756 0.46439439
[88,] -0.74376854 0.24046756
[89,] -0.31241095 -0.74376854
[90,] 0.86513491 -0.31241095
[91,] 2.53812312 0.86513491
[92,] 0.09204286 2.53812312
[93,] 0.65861485 0.09204286
[94,] 0.64954538 0.65861485
[95,] 0.21076119 0.64954538
[96,] 0.20704789 0.21076119
[97,] 1.05865968 0.20704789
[98,] 0.63469219 1.05865968
[99,] 0.52059787 0.63469219
[100,] 0.39293105 0.52059787
[101,] 0.75410621 0.39293105
[102,] 0.18476811 0.75410621
[103,] 0.60200470 0.18476811
[104,] 0.39755506 0.60200470
[105,] -0.47560433 0.39755506
[106,] 0.60498582 -0.47560433
[107,] 0.16620163 0.60498582
[108,] 0.16248834 0.16620163
[109,] 0.34046445 0.16248834
[110,] 0.38939629 0.34046445
[111,] 0.56445026 0.38939629
[112,] 0.36000062 0.56445026
[113,] -0.59063728 0.36000062
[114,] 0.58690857 -0.59063728
[115,] -0.61754107 0.58690857
[116,] -0.43463903 -0.61754107
[117,] 0.14069779 -0.43463903
[118,] 0.37131905 0.14069779
[119,] 0.56834209 0.37131905
[120,] 0.12955790 0.56834209
[121,] -0.67341905 0.12955790
[122,] -0.54657844 -0.67341905
[123,] -1.22366198 -0.54657844
[124,] 0.11470472 -1.22366198
[125,] -0.88900858 0.11470472
[126,] 0.50875081 -0.88900858
[127,] 0.30430117 0.50875081
[128,] -0.90014847 0.30430117
[129,] 0.29687458 -0.90014847
[130,] 0.09242494 0.29687458
[131,] -1.50981567 0.09242494
[132,] -0.11573800 -1.50981567
[133,] -0.58742470 -0.11573800
[134,] -0.90295105 -0.58742470
[135,] 0.27459480 -0.90295105
[136,] 0.07014516 0.27459480
[137,] -0.73283179 0.07014516
[138,] -0.73654509 -0.73283179
[139,] -0.53952204 -0.73654509
[140,] 0.05529198 -0.53952204
[141,] 0.05157868 0.05529198
[142,] -0.75139827 0.05157868
[143,] -0.19018246 -0.75139827
[144,] -0.21267726 -0.19018246
[145,] 0.14780221 -0.21267726
[146,] 0.26734675 0.14780221
[147,] 0.57544651 0.26734675
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.97162369 -0.25899757
2 0.66339340 0.97162369
3 0.18635052 0.66339340
4 -1.27385075 0.18635052
5 1.41062289 -1.27385075
6 0.15379355 1.41062289
7 -1.28499064 0.15379355
8 -0.99399792 -1.28499064
9 0.96869058 -0.99399792
10 -0.06179598 0.96869058
11 -0.50058017 -0.06179598
12 1.02043706 -0.50058017
13 1.01672376 1.02043706
14 -1.29150652 1.01672376
15 0.23145059 -1.29150652
16 0.48085335 0.23145059
17 -0.86757552 0.48085335
18 -0.42892185 -0.86757552
19 -0.29059581 -0.42892185
20 0.46600016 -0.29059581
21 -0.88242870 0.46600016
22 -1.10635554 -0.88242870
23 -0.34440338 -1.10635554
24 0.47062417 -0.34440338
25 0.66764722 0.47062417
26 -0.20551217 0.66764722
27 -0.42943901 -0.20551217
28 0.43629379 -0.42943901
29 -0.96819650 0.43629379
30 -0.35091926 -0.96819650
31 0.42515390 -0.35091926
32 -0.94275216 0.42515390
33 0.43720450 -0.94275216
34 0.61475036 0.43720450
35 -0.80386095 0.61475036
36 -0.57393539 -0.80386095
37 0.41450325 -0.57393539
38 0.64512450 0.41450325
39 -0.46236944 0.64512450
40 0.90861669 -0.46236944
41 0.05493449 0.90861669
42 -0.14951515 0.05493449
43 -0.37344198 -0.14951515
44 -0.81222617 -0.37344198
45 -0.87561524 -0.81222617
46 0.83563167 -0.87561524
47 0.57810663 0.83563167
48 -0.42560667 0.57810663
49 0.00575093 -0.42560667
50 -0.74484632 0.00575093
51 -0.41726936 -0.74484632
52 -1.30990595 -0.41726936
53 0.25130987 -1.30990595
54 0.99254063 0.25130987
55 0.34766392 0.99254063
56 -0.02024214 0.34766392
57 0.57457187 -0.02024214
58 -0.29858752 0.57457187
59 0.44388744 -0.29858752
60 0.09545858 0.44388744
61 -0.67461586 0.09545858
62 -0.04252192 -0.67461586
63 -0.44770791 -0.04252192
64 0.54857880 -0.44770791
65 -1.49533308 0.54857880
66 0.41789437 -1.49533308
67 0.30310436 0.41789437
68 -0.38879588 0.30310436
69 1.75752192 -0.38879588
70 -0.48782199 1.75752192
71 -0.51101248 -0.48782199
72 -0.39146794 -0.51101248
73 0.95752609 -0.39146794
74 0.52307496 0.95752609
75 0.12157069 0.52307496
76 -0.51794984 0.12157069
77 0.49781406 -0.51794984
78 -1.39482252 0.49781406
79 0.75832022 -1.39482252
80 -0.40954519 0.75832022
81 -0.87929200 -0.40954519
82 0.72087820 -0.87929200
83 0.25532074 0.72087820
84 -0.52817902 0.25532074
85 0.35897086 -0.52817902
86 0.46439439 0.35897086
87 0.24046756 0.46439439
88 -0.74376854 0.24046756
89 -0.31241095 -0.74376854
90 0.86513491 -0.31241095
91 2.53812312 0.86513491
92 0.09204286 2.53812312
93 0.65861485 0.09204286
94 0.64954538 0.65861485
95 0.21076119 0.64954538
96 0.20704789 0.21076119
97 1.05865968 0.20704789
98 0.63469219 1.05865968
99 0.52059787 0.63469219
100 0.39293105 0.52059787
101 0.75410621 0.39293105
102 0.18476811 0.75410621
103 0.60200470 0.18476811
104 0.39755506 0.60200470
105 -0.47560433 0.39755506
106 0.60498582 -0.47560433
107 0.16620163 0.60498582
108 0.16248834 0.16620163
109 0.34046445 0.16248834
110 0.38939629 0.34046445
111 0.56445026 0.38939629
112 0.36000062 0.56445026
113 -0.59063728 0.36000062
114 0.58690857 -0.59063728
115 -0.61754107 0.58690857
116 -0.43463903 -0.61754107
117 0.14069779 -0.43463903
118 0.37131905 0.14069779
119 0.56834209 0.37131905
120 0.12955790 0.56834209
121 -0.67341905 0.12955790
122 -0.54657844 -0.67341905
123 -1.22366198 -0.54657844
124 0.11470472 -1.22366198
125 -0.88900858 0.11470472
126 0.50875081 -0.88900858
127 0.30430117 0.50875081
128 -0.90014847 0.30430117
129 0.29687458 -0.90014847
130 0.09242494 0.29687458
131 -1.50981567 0.09242494
132 -0.11573800 -1.50981567
133 -0.58742470 -0.11573800
134 -0.90295105 -0.58742470
135 0.27459480 -0.90295105
136 0.07014516 0.27459480
137 -0.73283179 0.07014516
138 -0.73654509 -0.73283179
139 -0.53952204 -0.73654509
140 0.05529198 -0.53952204
141 0.05157868 0.05529198
142 -0.75139827 0.05157868
143 -0.19018246 -0.75139827
144 -0.21267726 -0.19018246
145 0.14780221 -0.21267726
146 0.26734675 0.14780221
147 0.57544651 0.26734675
> 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/7dhdr1290587086.ps",horizontal=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/86ruu1290587086.ps",horizontal=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/96ruu1290587086.ps",horizontal=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/106ruu1290587086.ps",horizontal=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/11rrb01290587086.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/12vs9o1290587086.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/13kt6i1290587086.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/14ck631290587086.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/15g3491290587086.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/16cv201290587086.tab")
+ }
>
> try(system("convert tmp/1ahf41290587086.ps tmp/1ahf41290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ahf41290587086.ps tmp/2ahf41290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ahf41290587086.ps tmp/3ahf41290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/4l8e71290587086.ps tmp/4l8e71290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/5l8e71290587086.ps tmp/5l8e71290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/6l8e71290587086.ps tmp/6l8e71290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/7dhdr1290587086.ps tmp/7dhdr1290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/86ruu1290587086.ps tmp/86ruu1290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/96ruu1290587086.ps tmp/96ruu1290587086.png",intern=TRUE))
character(0)
> try(system("convert tmp/106ruu1290587086.ps tmp/106ruu1290587086.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.918 1.719 8.896