R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(41
+ ,38
+ ,13
+ ,12
+ ,14
+ ,12
+ ,39
+ ,32
+ ,16
+ ,11
+ ,18
+ ,11
+ ,30
+ ,35
+ ,19
+ ,15
+ ,11
+ ,14
+ ,31
+ ,33
+ ,15
+ ,6
+ ,12
+ ,12
+ ,34
+ ,37
+ ,14
+ ,13
+ ,16
+ ,21
+ ,35
+ ,29
+ ,13
+ ,10
+ ,18
+ ,12
+ ,39
+ ,31
+ ,19
+ ,12
+ ,14
+ ,22
+ ,34
+ ,36
+ ,15
+ ,14
+ ,14
+ ,11
+ ,36
+ ,35
+ ,14
+ ,12
+ ,15
+ ,10
+ ,37
+ ,38
+ ,15
+ ,6
+ ,15
+ ,13
+ ,38
+ ,31
+ ,16
+ ,10
+ ,17
+ ,10
+ ,36
+ ,34
+ ,16
+ ,12
+ ,19
+ ,8
+ ,38
+ ,35
+ ,16
+ ,12
+ ,10
+ ,15
+ ,39
+ ,38
+ ,16
+ ,11
+ ,16
+ ,14
+ ,33
+ ,37
+ ,17
+ ,15
+ ,18
+ ,10
+ ,32
+ ,33
+ ,15
+ ,12
+ ,14
+ ,14
+ ,36
+ ,32
+ ,15
+ ,10
+ ,14
+ ,14
+ ,38
+ ,38
+ ,20
+ ,12
+ ,17
+ ,11
+ ,39
+ ,38
+ ,18
+ ,11
+ ,14
+ ,10
+ ,32
+ ,32
+ ,16
+ ,12
+ ,16
+ ,13
+ ,32
+ ,33
+ ,16
+ ,11
+ ,18
+ ,7
+ ,31
+ ,31
+ ,16
+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software'
+ ,'Happiness'
+ ,'Depression')
+ ,1:162))
> y <- array(NA,dim=c(6,162),dimnames=list(c('Connected','Separate','Learning','Software','Happiness','Depression'),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 = '5'
> #'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
Happiness Connected Separate Learning Software Depression
1 14 41 38 13 12 12
2 18 39 32 16 11 11
3 11 30 35 19 15 14
4 12 31 33 15 6 12
5 16 34 37 14 13 21
6 18 35 29 13 10 12
7 14 39 31 19 12 22
8 14 34 36 15 14 11
9 15 36 35 14 12 10
10 15 37 38 15 6 13
11 17 38 31 16 10 10
12 19 36 34 16 12 8
13 10 38 35 16 12 15
14 16 39 38 16 11 14
15 18 33 37 17 15 10
16 14 32 33 15 12 14
17 14 36 32 15 10 14
18 17 38 38 20 12 11
19 14 39 38 18 11 10
20 16 32 32 16 12 13
21 18 32 33 16 11 7
22 11 31 31 16 12 14
23 14 39 38 19 13 12
24 12 37 39 16 11 14
25 17 39 32 17 9 11
26 9 41 32 17 13 9
27 16 36 35 16 10 11
28 14 33 37 15 14 15
29 15 33 33 16 12 14
30 11 34 33 14 10 13
31 16 31 28 15 12 9
32 13 27 32 12 8 15
33 17 37 31 14 10 10
34 15 34 37 16 12 11
35 14 34 30 14 12 13
36 16 32 33 7 7 8
37 9 29 31 10 6 20
38 15 36 33 14 12 12
39 17 29 31 16 10 10
40 13 35 33 16 10 10
41 15 37 32 16 10 9
42 16 34 33 14 12 14
43 16 38 32 20 15 8
44 12 35 33 14 10 14
45 12 38 28 14 10 11
46 11 37 35 11 12 13
47 15 38 39 14 13 9
48 15 33 34 15 11 11
49 17 36 38 16 11 15
50 13 38 32 14 12 11
51 16 32 38 16 14 10
52 14 32 30 14 10 14
53 11 32 33 12 12 18
54 12 34 38 16 13 14
55 12 32 32 9 5 11
56 15 37 32 14 6 12
57 16 39 34 16 12 13
58 15 29 34 16 12 9
59 12 37 36 15 11 10
60 12 35 34 16 10 15
61 8 30 28 12 7 20
62 13 38 34 16 12 12
63 11 34 35 16 14 12
64 14 31 35 14 11 14
65 15 34 31 16 12 13
66 10 35 37 17 13 11
67 11 36 35 18 14 17
68 12 30 27 18 11 12
69 15 39 40 12 12 13
70 15 35 37 16 12 14
71 14 38 36 10 8 13
72 16 31 38 14 11 15
73 15 34 39 18 14 13
74 15 38 41 18 14 10
75 13 34 27 16 12 11
76 12 39 30 17 9 19
77 17 37 37 16 13 13
78 13 34 31 16 11 17
79 15 28 31 13 12 13
80 13 37 27 16 12 9
81 15 33 36 16 12 11
82 16 37 38 20 12 10
83 15 35 37 16 12 9
84 16 37 33 15 12 12
85 15 32 34 15 11 12
86 14 33 31 16 10 13
87 15 38 39 14 9 13
88 14 33 34 16 12 12
89 13 29 32 16 12 15
90 7 33 33 15 12 22
91 17 31 36 12 9 13
92 13 36 32 17 15 15
93 15 35 41 16 12 13
94 14 32 28 15 12 15
95 13 29 30 13 12 10
96 16 39 36 16 10 11
97 12 37 35 16 13 16
98 14 35 31 16 9 11
99 17 37 34 16 12 11
100 15 32 36 14 10 10
101 17 38 36 16 14 10
102 12 37 35 16 11 16
103 16 36 37 20 15 12
104 11 32 28 15 11 11
105 15 33 39 16 11 16
106 9 40 32 13 12 19
107 16 38 35 17 12 11
108 15 41 39 16 12 16
109 10 36 35 16 11 15
110 10 43 42 12 7 24
111 15 30 34 16 12 14
112 11 31 33 16 14 15
113 13 32 41 17 11 11
114 14 32 33 13 11 15
115 18 37 34 12 10 12
116 16 37 32 18 13 10
117 14 33 40 14 13 14
118 14 34 40 14 8 13
119 14 33 35 13 11 9
120 14 38 36 16 12 15
121 12 33 37 13 11 15
122 14 31 27 16 13 14
123 15 38 39 13 12 11
124 15 37 38 16 14 8
125 15 33 31 15 13 11
126 13 31 33 16 15 11
127 17 39 32 15 10 8
128 17 44 39 17 11 10
129 19 33 36 15 9 11
130 15 35 33 12 11 13
131 13 32 33 16 10 11
132 9 28 32 10 11 20
133 15 40 37 16 8 10
134 15 27 30 12 11 15
135 15 37 38 14 12 12
136 16 32 29 15 12 14
137 11 28 22 13 9 23
138 14 34 35 15 11 14
139 11 30 35 11 10 16
140 15 35 34 12 8 11
141 13 31 35 8 9 12
142 15 32 34 16 8 10
143 16 30 34 15 9 14
144 14 30 35 17 15 12
145 15 31 23 16 11 12
146 16 40 31 10 8 11
147 16 32 27 18 13 12
148 11 36 36 13 12 13
149 12 32 31 16 12 11
150 9 35 32 13 9 19
151 16 38 39 10 7 12
152 13 42 37 15 13 17
153 16 34 38 16 9 9
154 12 35 39 16 6 12
155 9 35 34 14 8 19
156 13 33 31 10 8 18
157 13 36 32 17 15 15
158 14 32 37 13 6 14
159 19 33 36 15 9 11
160 13 34 32 16 11 9
161 12 32 35 12 8 18
162 13 34 36 13 8 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Connected Separate Learning Software Depression
15.48935 0.02162 0.06490 0.07317 -0.04758 -0.38555
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.6078 -1.4759 0.1714 1.2671 5.0652
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.48935 2.27780 6.800 2.10e-10 ***
Connected 0.02162 0.05068 0.427 0.670
Separate 0.06490 0.04706 1.379 0.170
Learning 0.07317 0.08530 0.858 0.392
Software -0.04758 0.08673 -0.549 0.584
Depression -0.38555 0.05054 -7.629 2.19e-12 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.968 on 156 degrees of freedom
Multiple R-squared: 0.3135, Adjusted R-squared: 0.2915
F-statistic: 14.25 on 5 and 156 DF, p-value: 1.757e-11
> 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.6103845 0.779230927 0.3896154637
[2,] 0.6976948 0.604610494 0.3023052470
[3,] 0.6013374 0.797325278 0.3986626389
[4,] 0.8375101 0.324979763 0.1624898816
[5,] 0.9711783 0.057643429 0.0288217143
[6,] 0.9690040 0.061992033 0.0309960167
[7,] 0.9864617 0.027076595 0.0135382975
[8,] 0.9779659 0.044068211 0.0220341053
[9,] 0.9687900 0.062420054 0.0312100271
[10,] 0.9648635 0.070273017 0.0351365084
[11,] 0.9589965 0.082007053 0.0410035267
[12,] 0.9482935 0.103412996 0.0517064979
[13,] 0.9402272 0.119545601 0.0597728004
[14,] 0.9643040 0.071392057 0.0356960283
[15,] 0.9537125 0.092574951 0.0462874754
[16,] 0.9500673 0.099865453 0.0499327264
[17,] 0.9369949 0.126010229 0.0630051143
[18,] 0.9993042 0.001391595 0.0006957976
[19,] 0.9989249 0.002150158 0.0010750792
[20,] 0.9982709 0.003458253 0.0017291263
[21,] 0.9974766 0.005046893 0.0025234465
[22,] 0.9988587 0.002282657 0.0011413284
[23,] 0.9982393 0.003521454 0.0017607272
[24,] 0.9974309 0.005138199 0.0025690997
[25,] 0.9968854 0.006229129 0.0031145643
[26,] 0.9952863 0.009427325 0.0047136626
[27,] 0.9933120 0.013375928 0.0066879640
[28,] 0.9903362 0.019327670 0.0096638350
[29,] 0.9924218 0.015156354 0.0075781772
[30,] 0.9893381 0.021323870 0.0106619352
[31,] 0.9887725 0.022454935 0.0112274674
[32,] 0.9895472 0.020905556 0.0104527780
[33,] 0.9858281 0.028343809 0.0141719045
[34,] 0.9863033 0.027393406 0.0136967029
[35,] 0.9812550 0.037490065 0.0187450327
[36,] 0.9799556 0.040088891 0.0200444456
[37,] 0.9841916 0.031616817 0.0158084087
[38,] 0.9884281 0.023143721 0.0115718607
[39,] 0.9844540 0.031091917 0.0155459585
[40,] 0.9788974 0.042205218 0.0211026092
[41,] 0.9870543 0.025891361 0.0129456807
[42,] 0.9853414 0.029317212 0.0146586060
[43,] 0.9806140 0.038771989 0.0193859944
[44,] 0.9745819 0.050836215 0.0254181073
[45,] 0.9687947 0.062410523 0.0312052616
[46,] 0.9683652 0.063269576 0.0316347878
[47,] 0.9708416 0.058316841 0.0291584205
[48,] 0.9627275 0.074545071 0.0372725354
[49,] 0.9607668 0.078466307 0.0392331536
[50,] 0.9503200 0.099359908 0.0496799539
[51,] 0.9669424 0.066115285 0.0330576427
[52,] 0.9628833 0.074233349 0.0371166745
[53,] 0.9729973 0.054005389 0.0270026944
[54,] 0.9696178 0.060764389 0.0303821944
[55,] 0.9819395 0.036120905 0.0180604523
[56,] 0.9764023 0.047195462 0.0235977311
[57,] 0.9713709 0.057258142 0.0286290710
[58,] 0.9940035 0.011993075 0.0059965374
[59,] 0.9933982 0.013203678 0.0066018391
[60,] 0.9938437 0.012312616 0.0061563082
[61,] 0.9919864 0.016027277 0.0080136383
[62,] 0.9901666 0.019666815 0.0098334075
[63,] 0.9867702 0.026459616 0.0132298080
[64,] 0.9897441 0.020511887 0.0102559437
[65,] 0.9866278 0.026744330 0.0133721650
[66,] 0.9827508 0.034498347 0.0172491737
[67,] 0.9803134 0.039373143 0.0196865717
[68,] 0.9741494 0.051701261 0.0258506303
[69,] 0.9802954 0.039409277 0.0197046384
[70,] 0.9749102 0.050179691 0.0250898454
[71,] 0.9719046 0.056190827 0.0280954135
[72,] 0.9760449 0.047910204 0.0239551022
[73,] 0.9687035 0.062592989 0.0312964946
[74,] 0.9597145 0.080571064 0.0402855322
[75,] 0.9507625 0.098474932 0.0492374661
[76,] 0.9462698 0.107460354 0.0537301769
[77,] 0.9338783 0.132243462 0.0661217312
[78,] 0.9175721 0.164855842 0.0824279208
[79,] 0.8997481 0.200503840 0.1002519200
[80,] 0.8785039 0.242992290 0.1214961450
[81,] 0.8536529 0.292694200 0.1463471000
[82,] 0.8951665 0.209666965 0.1048334824
[83,] 0.9230181 0.153963778 0.0769818890
[84,] 0.9045263 0.190947440 0.0954737200
[85,] 0.8863882 0.227223520 0.1136117600
[86,] 0.8712942 0.257411531 0.1287057656
[87,] 0.8647648 0.270470412 0.1352352062
[88,] 0.8413244 0.317351274 0.1586756368
[89,] 0.8171746 0.365650807 0.1828254034
[90,] 0.7937333 0.412533307 0.2062666536
[91,] 0.7956678 0.408664413 0.2043322065
[92,] 0.7603145 0.479371097 0.2396855486
[93,] 0.7501390 0.499721984 0.2498609919
[94,] 0.7208492 0.558301580 0.2791507898
[95,] 0.7026446 0.594710862 0.2973554311
[96,] 0.8017615 0.396476956 0.1982384779
[97,] 0.8186097 0.362780538 0.1813902691
[98,] 0.8481274 0.303745226 0.1518726128
[99,] 0.8238400 0.352319966 0.1761599831
[100,] 0.8297468 0.340506397 0.1702531987
[101,] 0.8842734 0.231453225 0.1157266126
[102,] 0.8601016 0.279796896 0.1398984480
[103,] 0.8574857 0.285028673 0.1425143364
[104,] 0.8506532 0.298693563 0.1493467814
[105,] 0.8448105 0.310379080 0.1551895402
[106,] 0.8209382 0.358123661 0.1790618304
[107,] 0.8868806 0.226238789 0.1131193944
[108,] 0.8615961 0.276807839 0.1384039195
[109,] 0.8423517 0.315296576 0.1576482880
[110,] 0.8088264 0.382347123 0.1911735616
[111,] 0.7953906 0.409218844 0.2046094222
[112,] 0.7644767 0.471046682 0.2355233412
[113,] 0.7278867 0.544226576 0.2721132882
[114,] 0.6845008 0.630998343 0.3154991714
[115,] 0.6356512 0.728697645 0.3643488224
[116,] 0.5930582 0.813883665 0.4069418323
[117,] 0.5380032 0.923993674 0.4619968371
[118,] 0.5153761 0.969247851 0.4846239255
[119,] 0.4612490 0.922498061 0.5387509694
[120,] 0.4373040 0.874607950 0.5626960250
[121,] 0.6349633 0.730073425 0.3650367125
[122,] 0.5934605 0.813079029 0.4065395143
[123,] 0.5914387 0.817122611 0.4085613055
[124,] 0.5802927 0.839414572 0.4197072858
[125,] 0.5184405 0.963118980 0.4815594899
[126,] 0.5078383 0.984323364 0.4921616821
[127,] 0.4590783 0.918156553 0.5409217237
[128,] 0.4959887 0.991977447 0.5040112763
[129,] 0.4541801 0.908360137 0.5458199314
[130,] 0.3953727 0.790745331 0.6046273343
[131,] 0.3530366 0.706073185 0.6469634077
[132,] 0.2873698 0.574739674 0.7126301631
[133,] 0.2838934 0.567786741 0.7161066296
[134,] 0.2236701 0.447340159 0.7763299203
[135,] 0.2527241 0.505448159 0.7472759205
[136,] 0.1920410 0.384081987 0.8079590064
[137,] 0.1478488 0.295697602 0.8521511990
[138,] 0.1084842 0.216968305 0.8915158477
[139,] 0.1978110 0.395621912 0.8021890440
[140,] 0.6319139 0.736172175 0.3680860875
[141,] 0.6762651 0.647469875 0.3237349375
[142,] 0.5708998 0.858200373 0.4291001864
[143,] 0.5047228 0.990554337 0.4952771683
[144,] 0.3630773 0.726154598 0.6369227009
[145,] 0.2661378 0.532275643 0.7338621786
> postscript(file="/var/www/html/freestat/rcomp/tmp/19dy31293038336.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/freestat/rcomp/tmp/29dy31293038336.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/freestat/rcomp/tmp/3k4go1293038336.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/freestat/rcomp/tmp/4k4go1293038336.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/freestat/rcomp/tmp/5k4go1293038336.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
-0.595424142 3.184579624 -2.688117856 -2.486552641 5.065182601 4.023223213
7 8 9 10 11 12
3.318652051 -0.751051249 -0.136920189 0.444805486 1.837965943 3.010537857
13 14 15 16 17 18
-3.398713769 1.951839212 2.721351069 0.548393413 0.431680670 1.571699575
19 20 21 22 23 24
-1.736711882 2.154572711 1.728770886 -2.373356875 -0.943619238 -2.069830197
25 26 27 28 29 30
2.016261655 -6.607776052 1.007149180 0.747880951 1.453610886 -2.902376077
31 32 33 34 35 36
0.966740256 0.136124956 2.005915427 0.015730233 0.387476583 0.582525771
37 38 39 40 41 42
-1.863251258 0.763989499 2.032506075 -2.226988445 -0.590873331 2.578329230
43 44 45 46 47 48
-0.052833496 -1.538437352 -2.435444200 -2.782372004 -0.777732316 0.257638903
49 50 51 52 53 54
3.402240217 -1.599895386 0.703657541 0.721111007 -0.689888537 -1.844931926
55 56 57 58 59 60
-2.437395720 0.521821444 1.873462620 -0.452598857 -3.344178771 -1.364117521
61 62 63 64 65 66
-2.788923588 -1.490476104 -3.373763362 0.465799336 1.176242120 -5.031476788
67 68 69 70 71 72
-1.635556942 -2.057157116 0.776727152 1.150777548 0.013976811 2.656651982
73 74 75 76 77 78
0.605854822 -0.767071443 -1.335264272 0.230497113 2.769567618 0.670883793
79 80 81 82 83 84
1.525436412 -2.171219573 0.102246353 0.207760850 -0.776993927 1.669206972
85 86 87 88 89 90
0.664808768 0.102706678 0.574182840 -0.382398253 -0.009471989 -3.388787799
91 92 93 94 95 96
3.066527394 -0.091221420 0.505621055 1.258450455 -1.587941493 0.877401920
97 98 99 100 101 102
-0.943968399 -0.759208557 2.145585171 -0.210509469 1.703765219 -1.039119410
103 104 105 106 107 108
1.208112077 -3.331342230 1.787740673 -2.485525211 0.985902094 1.662391617
109 110 111 112 113 114
-3.403058135 -0.436316514 1.453557047 -2.022452668 -2.321383287 1.032706116
115 116 117 118 119 120
3.728656282 0.791073567 0.193216460 -0.451830934 -1.432036322 0.536385681
121 122 123 124 125 126
-1.248511652 0.933820829 0.018967725 -1.175528900 0.547491563 -1.517094341
127 128 129 130 131 132
1.053508190 1.163476675 4.032686793 1.269917773 -1.776587440 -1.668658708
133 134 135 136 137 138
-0.689819506 2.408652572 0.417871182 2.807995611 1.822357788 0.327785668
139 140 141 142 143 144
-1.569551139 0.291182117 -0.961458523 -0.322193296 2.383997487 -0.312892532
145 146 147 148 149 150
1.327163425 1.524139828 1.994762755 -2.971990897 -2.551635330 -2.520173877
151 152 153 154 155 156
1.386145362 0.276873903 0.036994577 -3.035585175 -2.770717439 1.374328883
157 158 159 160 161 162
-0.091221420 0.149672095 4.032686793 -2.478451115 -0.009991658 0.037601105
> postscript(file="/var/www/html/freestat/rcomp/tmp/6cwfr1293038336.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 -0.595424142 NA
1 3.184579624 -0.595424142
2 -2.688117856 3.184579624
3 -2.486552641 -2.688117856
4 5.065182601 -2.486552641
5 4.023223213 5.065182601
6 3.318652051 4.023223213
7 -0.751051249 3.318652051
8 -0.136920189 -0.751051249
9 0.444805486 -0.136920189
10 1.837965943 0.444805486
11 3.010537857 1.837965943
12 -3.398713769 3.010537857
13 1.951839212 -3.398713769
14 2.721351069 1.951839212
15 0.548393413 2.721351069
16 0.431680670 0.548393413
17 1.571699575 0.431680670
18 -1.736711882 1.571699575
19 2.154572711 -1.736711882
20 1.728770886 2.154572711
21 -2.373356875 1.728770886
22 -0.943619238 -2.373356875
23 -2.069830197 -0.943619238
24 2.016261655 -2.069830197
25 -6.607776052 2.016261655
26 1.007149180 -6.607776052
27 0.747880951 1.007149180
28 1.453610886 0.747880951
29 -2.902376077 1.453610886
30 0.966740256 -2.902376077
31 0.136124956 0.966740256
32 2.005915427 0.136124956
33 0.015730233 2.005915427
34 0.387476583 0.015730233
35 0.582525771 0.387476583
36 -1.863251258 0.582525771
37 0.763989499 -1.863251258
38 2.032506075 0.763989499
39 -2.226988445 2.032506075
40 -0.590873331 -2.226988445
41 2.578329230 -0.590873331
42 -0.052833496 2.578329230
43 -1.538437352 -0.052833496
44 -2.435444200 -1.538437352
45 -2.782372004 -2.435444200
46 -0.777732316 -2.782372004
47 0.257638903 -0.777732316
48 3.402240217 0.257638903
49 -1.599895386 3.402240217
50 0.703657541 -1.599895386
51 0.721111007 0.703657541
52 -0.689888537 0.721111007
53 -1.844931926 -0.689888537
54 -2.437395720 -1.844931926
55 0.521821444 -2.437395720
56 1.873462620 0.521821444
57 -0.452598857 1.873462620
58 -3.344178771 -0.452598857
59 -1.364117521 -3.344178771
60 -2.788923588 -1.364117521
61 -1.490476104 -2.788923588
62 -3.373763362 -1.490476104
63 0.465799336 -3.373763362
64 1.176242120 0.465799336
65 -5.031476788 1.176242120
66 -1.635556942 -5.031476788
67 -2.057157116 -1.635556942
68 0.776727152 -2.057157116
69 1.150777548 0.776727152
70 0.013976811 1.150777548
71 2.656651982 0.013976811
72 0.605854822 2.656651982
73 -0.767071443 0.605854822
74 -1.335264272 -0.767071443
75 0.230497113 -1.335264272
76 2.769567618 0.230497113
77 0.670883793 2.769567618
78 1.525436412 0.670883793
79 -2.171219573 1.525436412
80 0.102246353 -2.171219573
81 0.207760850 0.102246353
82 -0.776993927 0.207760850
83 1.669206972 -0.776993927
84 0.664808768 1.669206972
85 0.102706678 0.664808768
86 0.574182840 0.102706678
87 -0.382398253 0.574182840
88 -0.009471989 -0.382398253
89 -3.388787799 -0.009471989
90 3.066527394 -3.388787799
91 -0.091221420 3.066527394
92 0.505621055 -0.091221420
93 1.258450455 0.505621055
94 -1.587941493 1.258450455
95 0.877401920 -1.587941493
96 -0.943968399 0.877401920
97 -0.759208557 -0.943968399
98 2.145585171 -0.759208557
99 -0.210509469 2.145585171
100 1.703765219 -0.210509469
101 -1.039119410 1.703765219
102 1.208112077 -1.039119410
103 -3.331342230 1.208112077
104 1.787740673 -3.331342230
105 -2.485525211 1.787740673
106 0.985902094 -2.485525211
107 1.662391617 0.985902094
108 -3.403058135 1.662391617
109 -0.436316514 -3.403058135
110 1.453557047 -0.436316514
111 -2.022452668 1.453557047
112 -2.321383287 -2.022452668
113 1.032706116 -2.321383287
114 3.728656282 1.032706116
115 0.791073567 3.728656282
116 0.193216460 0.791073567
117 -0.451830934 0.193216460
118 -1.432036322 -0.451830934
119 0.536385681 -1.432036322
120 -1.248511652 0.536385681
121 0.933820829 -1.248511652
122 0.018967725 0.933820829
123 -1.175528900 0.018967725
124 0.547491563 -1.175528900
125 -1.517094341 0.547491563
126 1.053508190 -1.517094341
127 1.163476675 1.053508190
128 4.032686793 1.163476675
129 1.269917773 4.032686793
130 -1.776587440 1.269917773
131 -1.668658708 -1.776587440
132 -0.689819506 -1.668658708
133 2.408652572 -0.689819506
134 0.417871182 2.408652572
135 2.807995611 0.417871182
136 1.822357788 2.807995611
137 0.327785668 1.822357788
138 -1.569551139 0.327785668
139 0.291182117 -1.569551139
140 -0.961458523 0.291182117
141 -0.322193296 -0.961458523
142 2.383997487 -0.322193296
143 -0.312892532 2.383997487
144 1.327163425 -0.312892532
145 1.524139828 1.327163425
146 1.994762755 1.524139828
147 -2.971990897 1.994762755
148 -2.551635330 -2.971990897
149 -2.520173877 -2.551635330
150 1.386145362 -2.520173877
151 0.276873903 1.386145362
152 0.036994577 0.276873903
153 -3.035585175 0.036994577
154 -2.770717439 -3.035585175
155 1.374328883 -2.770717439
156 -0.091221420 1.374328883
157 0.149672095 -0.091221420
158 4.032686793 0.149672095
159 -2.478451115 4.032686793
160 -0.009991658 -2.478451115
161 0.037601105 -0.009991658
162 NA 0.037601105
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.184579624 -0.595424142
[2,] -2.688117856 3.184579624
[3,] -2.486552641 -2.688117856
[4,] 5.065182601 -2.486552641
[5,] 4.023223213 5.065182601
[6,] 3.318652051 4.023223213
[7,] -0.751051249 3.318652051
[8,] -0.136920189 -0.751051249
[9,] 0.444805486 -0.136920189
[10,] 1.837965943 0.444805486
[11,] 3.010537857 1.837965943
[12,] -3.398713769 3.010537857
[13,] 1.951839212 -3.398713769
[14,] 2.721351069 1.951839212
[15,] 0.548393413 2.721351069
[16,] 0.431680670 0.548393413
[17,] 1.571699575 0.431680670
[18,] -1.736711882 1.571699575
[19,] 2.154572711 -1.736711882
[20,] 1.728770886 2.154572711
[21,] -2.373356875 1.728770886
[22,] -0.943619238 -2.373356875
[23,] -2.069830197 -0.943619238
[24,] 2.016261655 -2.069830197
[25,] -6.607776052 2.016261655
[26,] 1.007149180 -6.607776052
[27,] 0.747880951 1.007149180
[28,] 1.453610886 0.747880951
[29,] -2.902376077 1.453610886
[30,] 0.966740256 -2.902376077
[31,] 0.136124956 0.966740256
[32,] 2.005915427 0.136124956
[33,] 0.015730233 2.005915427
[34,] 0.387476583 0.015730233
[35,] 0.582525771 0.387476583
[36,] -1.863251258 0.582525771
[37,] 0.763989499 -1.863251258
[38,] 2.032506075 0.763989499
[39,] -2.226988445 2.032506075
[40,] -0.590873331 -2.226988445
[41,] 2.578329230 -0.590873331
[42,] -0.052833496 2.578329230
[43,] -1.538437352 -0.052833496
[44,] -2.435444200 -1.538437352
[45,] -2.782372004 -2.435444200
[46,] -0.777732316 -2.782372004
[47,] 0.257638903 -0.777732316
[48,] 3.402240217 0.257638903
[49,] -1.599895386 3.402240217
[50,] 0.703657541 -1.599895386
[51,] 0.721111007 0.703657541
[52,] -0.689888537 0.721111007
[53,] -1.844931926 -0.689888537
[54,] -2.437395720 -1.844931926
[55,] 0.521821444 -2.437395720
[56,] 1.873462620 0.521821444
[57,] -0.452598857 1.873462620
[58,] -3.344178771 -0.452598857
[59,] -1.364117521 -3.344178771
[60,] -2.788923588 -1.364117521
[61,] -1.490476104 -2.788923588
[62,] -3.373763362 -1.490476104
[63,] 0.465799336 -3.373763362
[64,] 1.176242120 0.465799336
[65,] -5.031476788 1.176242120
[66,] -1.635556942 -5.031476788
[67,] -2.057157116 -1.635556942
[68,] 0.776727152 -2.057157116
[69,] 1.150777548 0.776727152
[70,] 0.013976811 1.150777548
[71,] 2.656651982 0.013976811
[72,] 0.605854822 2.656651982
[73,] -0.767071443 0.605854822
[74,] -1.335264272 -0.767071443
[75,] 0.230497113 -1.335264272
[76,] 2.769567618 0.230497113
[77,] 0.670883793 2.769567618
[78,] 1.525436412 0.670883793
[79,] -2.171219573 1.525436412
[80,] 0.102246353 -2.171219573
[81,] 0.207760850 0.102246353
[82,] -0.776993927 0.207760850
[83,] 1.669206972 -0.776993927
[84,] 0.664808768 1.669206972
[85,] 0.102706678 0.664808768
[86,] 0.574182840 0.102706678
[87,] -0.382398253 0.574182840
[88,] -0.009471989 -0.382398253
[89,] -3.388787799 -0.009471989
[90,] 3.066527394 -3.388787799
[91,] -0.091221420 3.066527394
[92,] 0.505621055 -0.091221420
[93,] 1.258450455 0.505621055
[94,] -1.587941493 1.258450455
[95,] 0.877401920 -1.587941493
[96,] -0.943968399 0.877401920
[97,] -0.759208557 -0.943968399
[98,] 2.145585171 -0.759208557
[99,] -0.210509469 2.145585171
[100,] 1.703765219 -0.210509469
[101,] -1.039119410 1.703765219
[102,] 1.208112077 -1.039119410
[103,] -3.331342230 1.208112077
[104,] 1.787740673 -3.331342230
[105,] -2.485525211 1.787740673
[106,] 0.985902094 -2.485525211
[107,] 1.662391617 0.985902094
[108,] -3.403058135 1.662391617
[109,] -0.436316514 -3.403058135
[110,] 1.453557047 -0.436316514
[111,] -2.022452668 1.453557047
[112,] -2.321383287 -2.022452668
[113,] 1.032706116 -2.321383287
[114,] 3.728656282 1.032706116
[115,] 0.791073567 3.728656282
[116,] 0.193216460 0.791073567
[117,] -0.451830934 0.193216460
[118,] -1.432036322 -0.451830934
[119,] 0.536385681 -1.432036322
[120,] -1.248511652 0.536385681
[121,] 0.933820829 -1.248511652
[122,] 0.018967725 0.933820829
[123,] -1.175528900 0.018967725
[124,] 0.547491563 -1.175528900
[125,] -1.517094341 0.547491563
[126,] 1.053508190 -1.517094341
[127,] 1.163476675 1.053508190
[128,] 4.032686793 1.163476675
[129,] 1.269917773 4.032686793
[130,] -1.776587440 1.269917773
[131,] -1.668658708 -1.776587440
[132,] -0.689819506 -1.668658708
[133,] 2.408652572 -0.689819506
[134,] 0.417871182 2.408652572
[135,] 2.807995611 0.417871182
[136,] 1.822357788 2.807995611
[137,] 0.327785668 1.822357788
[138,] -1.569551139 0.327785668
[139,] 0.291182117 -1.569551139
[140,] -0.961458523 0.291182117
[141,] -0.322193296 -0.961458523
[142,] 2.383997487 -0.322193296
[143,] -0.312892532 2.383997487
[144,] 1.327163425 -0.312892532
[145,] 1.524139828 1.327163425
[146,] 1.994762755 1.524139828
[147,] -2.971990897 1.994762755
[148,] -2.551635330 -2.971990897
[149,] -2.520173877 -2.551635330
[150,] 1.386145362 -2.520173877
[151,] 0.276873903 1.386145362
[152,] 0.036994577 0.276873903
[153,] -3.035585175 0.036994577
[154,] -2.770717439 -3.035585175
[155,] 1.374328883 -2.770717439
[156,] -0.091221420 1.374328883
[157,] 0.149672095 -0.091221420
[158,] 4.032686793 0.149672095
[159,] -2.478451115 4.032686793
[160,] -0.009991658 -2.478451115
[161,] 0.037601105 -0.009991658
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.184579624 -0.595424142
2 -2.688117856 3.184579624
3 -2.486552641 -2.688117856
4 5.065182601 -2.486552641
5 4.023223213 5.065182601
6 3.318652051 4.023223213
7 -0.751051249 3.318652051
8 -0.136920189 -0.751051249
9 0.444805486 -0.136920189
10 1.837965943 0.444805486
11 3.010537857 1.837965943
12 -3.398713769 3.010537857
13 1.951839212 -3.398713769
14 2.721351069 1.951839212
15 0.548393413 2.721351069
16 0.431680670 0.548393413
17 1.571699575 0.431680670
18 -1.736711882 1.571699575
19 2.154572711 -1.736711882
20 1.728770886 2.154572711
21 -2.373356875 1.728770886
22 -0.943619238 -2.373356875
23 -2.069830197 -0.943619238
24 2.016261655 -2.069830197
25 -6.607776052 2.016261655
26 1.007149180 -6.607776052
27 0.747880951 1.007149180
28 1.453610886 0.747880951
29 -2.902376077 1.453610886
30 0.966740256 -2.902376077
31 0.136124956 0.966740256
32 2.005915427 0.136124956
33 0.015730233 2.005915427
34 0.387476583 0.015730233
35 0.582525771 0.387476583
36 -1.863251258 0.582525771
37 0.763989499 -1.863251258
38 2.032506075 0.763989499
39 -2.226988445 2.032506075
40 -0.590873331 -2.226988445
41 2.578329230 -0.590873331
42 -0.052833496 2.578329230
43 -1.538437352 -0.052833496
44 -2.435444200 -1.538437352
45 -2.782372004 -2.435444200
46 -0.777732316 -2.782372004
47 0.257638903 -0.777732316
48 3.402240217 0.257638903
49 -1.599895386 3.402240217
50 0.703657541 -1.599895386
51 0.721111007 0.703657541
52 -0.689888537 0.721111007
53 -1.844931926 -0.689888537
54 -2.437395720 -1.844931926
55 0.521821444 -2.437395720
56 1.873462620 0.521821444
57 -0.452598857 1.873462620
58 -3.344178771 -0.452598857
59 -1.364117521 -3.344178771
60 -2.788923588 -1.364117521
61 -1.490476104 -2.788923588
62 -3.373763362 -1.490476104
63 0.465799336 -3.373763362
64 1.176242120 0.465799336
65 -5.031476788 1.176242120
66 -1.635556942 -5.031476788
67 -2.057157116 -1.635556942
68 0.776727152 -2.057157116
69 1.150777548 0.776727152
70 0.013976811 1.150777548
71 2.656651982 0.013976811
72 0.605854822 2.656651982
73 -0.767071443 0.605854822
74 -1.335264272 -0.767071443
75 0.230497113 -1.335264272
76 2.769567618 0.230497113
77 0.670883793 2.769567618
78 1.525436412 0.670883793
79 -2.171219573 1.525436412
80 0.102246353 -2.171219573
81 0.207760850 0.102246353
82 -0.776993927 0.207760850
83 1.669206972 -0.776993927
84 0.664808768 1.669206972
85 0.102706678 0.664808768
86 0.574182840 0.102706678
87 -0.382398253 0.574182840
88 -0.009471989 -0.382398253
89 -3.388787799 -0.009471989
90 3.066527394 -3.388787799
91 -0.091221420 3.066527394
92 0.505621055 -0.091221420
93 1.258450455 0.505621055
94 -1.587941493 1.258450455
95 0.877401920 -1.587941493
96 -0.943968399 0.877401920
97 -0.759208557 -0.943968399
98 2.145585171 -0.759208557
99 -0.210509469 2.145585171
100 1.703765219 -0.210509469
101 -1.039119410 1.703765219
102 1.208112077 -1.039119410
103 -3.331342230 1.208112077
104 1.787740673 -3.331342230
105 -2.485525211 1.787740673
106 0.985902094 -2.485525211
107 1.662391617 0.985902094
108 -3.403058135 1.662391617
109 -0.436316514 -3.403058135
110 1.453557047 -0.436316514
111 -2.022452668 1.453557047
112 -2.321383287 -2.022452668
113 1.032706116 -2.321383287
114 3.728656282 1.032706116
115 0.791073567 3.728656282
116 0.193216460 0.791073567
117 -0.451830934 0.193216460
118 -1.432036322 -0.451830934
119 0.536385681 -1.432036322
120 -1.248511652 0.536385681
121 0.933820829 -1.248511652
122 0.018967725 0.933820829
123 -1.175528900 0.018967725
124 0.547491563 -1.175528900
125 -1.517094341 0.547491563
126 1.053508190 -1.517094341
127 1.163476675 1.053508190
128 4.032686793 1.163476675
129 1.269917773 4.032686793
130 -1.776587440 1.269917773
131 -1.668658708 -1.776587440
132 -0.689819506 -1.668658708
133 2.408652572 -0.689819506
134 0.417871182 2.408652572
135 2.807995611 0.417871182
136 1.822357788 2.807995611
137 0.327785668 1.822357788
138 -1.569551139 0.327785668
139 0.291182117 -1.569551139
140 -0.961458523 0.291182117
141 -0.322193296 -0.961458523
142 2.383997487 -0.322193296
143 -0.312892532 2.383997487
144 1.327163425 -0.312892532
145 1.524139828 1.327163425
146 1.994762755 1.524139828
147 -2.971990897 1.994762755
148 -2.551635330 -2.971990897
149 -2.520173877 -2.551635330
150 1.386145362 -2.520173877
151 0.276873903 1.386145362
152 0.036994577 0.276873903
153 -3.035585175 0.036994577
154 -2.770717439 -3.035585175
155 1.374328883 -2.770717439
156 -0.091221420 1.374328883
157 0.149672095 -0.091221420
158 4.032686793 0.149672095
159 -2.478451115 4.032686793
160 -0.009991658 -2.478451115
161 0.037601105 -0.009991658
> 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/freestat/rcomp/tmp/755wu1293038336.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/freestat/rcomp/tmp/855wu1293038336.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/freestat/rcomp/tmp/955wu1293038336.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/freestat/rcomp/tmp/10gwvf1293038336.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11jfuk1293038336.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/freestat/rcomp/tmp/125fsq1293038336.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/freestat/rcomp/tmp/13j7qz1293038336.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/freestat/rcomp/tmp/1447pn1293038336.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/freestat/rcomp/tmp/15p85t1293038336.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/freestat/rcomp/tmp/16b84h1293038336.tab")
+ }
>
> try(system("convert tmp/19dy31293038336.ps tmp/19dy31293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/29dy31293038336.ps tmp/29dy31293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/3k4go1293038336.ps tmp/3k4go1293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/4k4go1293038336.ps tmp/4k4go1293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/5k4go1293038336.ps tmp/5k4go1293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/6cwfr1293038336.ps tmp/6cwfr1293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/755wu1293038336.ps tmp/755wu1293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/855wu1293038336.ps tmp/855wu1293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/955wu1293038336.ps tmp/955wu1293038336.png",intern=TRUE))
character(0)
> try(system("convert tmp/10gwvf1293038336.ps tmp/10gwvf1293038336.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.783 2.715 6.269