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(184
+ ,40
+ ,74
+ ,11
+ ,31
+ ,20
+ ,213
+ ,32
+ ,72
+ ,11
+ ,43
+ ,18
+ ,347
+ ,57
+ ,70
+ ,18
+ ,16
+ ,16
+ ,565
+ ,31
+ ,71
+ ,11
+ ,25
+ ,19
+ ,327
+ ,67
+ ,72
+ ,9
+ ,29
+ ,24
+ ,260
+ ,25
+ ,68
+ ,8
+ ,32
+ ,15
+ ,325
+ ,34
+ ,68
+ ,12
+ ,24
+ ,14
+ ,102
+ ,33
+ ,62
+ ,13
+ ,28
+ ,11
+ ,38
+ ,36
+ ,69
+ ,7
+ ,25
+ ,12
+ ,226
+ ,31
+ ,66
+ ,9
+ ,58
+ ,15
+ ,137
+ ,35
+ ,60
+ ,13
+ ,21
+ ,9
+ ,369
+ ,30
+ ,81
+ ,4
+ ,77
+ ,36
+ ,109
+ ,44
+ ,66
+ ,9
+ ,37
+ ,12
+ ,809
+ ,32
+ ,67
+ ,11
+ ,37
+ ,16
+ ,29
+ ,30
+ ,65
+ ,12
+ ,35
+ ,11
+ ,245
+ ,16
+ ,64
+ ,10
+ ,42
+ ,14
+ ,118
+ ,29
+ ,64
+ ,12
+ ,21
+ ,10
+ ,148
+ ,36
+ ,62
+ ,7
+ ,81
+ ,27
+ ,387
+ ,30
+ ,59
+ ,15
+ ,31
+ ,16
+ ,98
+ ,23
+ ,56
+ ,15
+ ,50
+ ,15
+ ,608
+ ,33
+ ,46
+ ,22
+ ,24
+ ,8
+ ,218
+ ,35
+ ,54
+ ,14
+ ,27
+ ,13
+ ,254
+ ,38
+ ,54
+ ,20
+ ,22
+ ,11
+ ,697
+ ,44
+ ,45
+ ,26
+ ,18
+ ,8
+ ,827
+ ,28
+ ,57
+ ,12
+ ,23
+ ,11
+ ,693
+ ,35
+ ,57
+ ,9
+ ,60
+ ,18
+ ,448
+ ,31
+ ,61
+ ,19
+ ,14
+ ,12
+ ,942
+ ,39
+ ,52
+ ,17
+ ,31
+ ,10
+ ,1017
+ ,27
+ ,44
+ ,21
+ ,24
+ ,9
+ ,216
+ ,36
+ ,43
+ ,18
+ ,23
+ ,8
+ ,673
+ ,38
+ ,48
+ ,19
+ ,22
+ ,10
+ ,989
+ ,46
+ ,57
+ ,14
+ ,25
+ ,12
+ ,630
+ ,29
+ ,47
+ ,19
+ ,25
+ ,9
+ ,404
+ ,32
+ ,50
+ ,19
+ ,21
+ ,9
+ ,692
+ ,39
+ ,48
+ ,16
+ ,32
+ ,11
+ ,1517
+ ,44
+ ,49
+ ,13
+ ,31
+ ,14
+ ,879
+ ,33
+ ,72
+ ,13
+ ,13
+ ,22
+ ,631
+ ,43
+ ,59
+ ,14
+ ,21
+ ,13
+ ,1375
+ ,22
+ ,49
+ ,9
+ ,46
+ ,13
+ ,1139
+ ,30
+ ,54
+ ,13
+ ,27
+ ,12
+ ,3545
+ ,86
+ ,62
+ ,22
+ ,18
+ ,15
+ ,706
+ ,30
+ ,47
+ ,17
+ ,39
+ ,11
+ ,451
+ ,32
+ ,45
+ ,34
+ ,15
+ ,10
+ ,433
+ ,43
+ ,48
+ ,26
+ ,23
+ ,12
+ ,601
+ ,20
+ ,69
+ ,23
+ ,7
+ ,12
+ ,1024
+ ,55
+ ,42
+ ,23
+ ,23
+ ,11
+ ,457
+ ,44
+ ,49
+ ,18
+ ,30
+ ,12
+ ,1441
+ ,37
+ ,57
+ ,15
+ ,35
+ ,13
+ ,1022
+ ,82
+ ,72
+ ,22
+ ,15
+ ,16
+ ,1244
+ ,66
+ ,67
+ ,26
+ ,18
+ ,16)
+ ,dim=c(6
+ ,50)
+ ,dimnames=list(c('Crimerate'
+ ,'Funding'
+ ,'25+HSgraduate'
+ ,'Dropouts16-19'
+ ,'CollegeStudents18-24'
+ ,'25+CollegeGrads')
+ ,1:50))
> y <- array(NA,dim=c(6,50),dimnames=list(c('Crimerate','Funding','25+HSgraduate','Dropouts16-19','CollegeStudents18-24','25+CollegeGrads'),1:50))
> 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
Crimerate Funding 25+HSgraduate Dropouts16-19 CollegeStudents18-24
1 184 40 74 11 31
2 213 32 72 11 43
3 347 57 70 18 16
4 565 31 71 11 25
5 327 67 72 9 29
6 260 25 68 8 32
7 325 34 68 12 24
8 102 33 62 13 28
9 38 36 69 7 25
10 226 31 66 9 58
11 137 35 60 13 21
12 369 30 81 4 77
13 109 44 66 9 37
14 809 32 67 11 37
15 29 30 65 12 35
16 245 16 64 10 42
17 118 29 64 12 21
18 148 36 62 7 81
19 387 30 59 15 31
20 98 23 56 15 50
21 608 33 46 22 24
22 218 35 54 14 27
23 254 38 54 20 22
24 697 44 45 26 18
25 827 28 57 12 23
26 693 35 57 9 60
27 448 31 61 19 14
28 942 39 52 17 31
29 1017 27 44 21 24
30 216 36 43 18 23
31 673 38 48 19 22
32 989 46 57 14 25
33 630 29 47 19 25
34 404 32 50 19 21
35 692 39 48 16 32
36 1517 44 49 13 31
37 879 33 72 13 13
38 631 43 59 14 21
39 1375 22 49 9 46
40 1139 30 54 13 27
41 3545 86 62 22 18
42 706 30 47 17 39
43 451 32 45 34 15
44 433 43 48 26 23
45 601 20 69 23 7
46 1024 55 42 23 23
47 457 44 49 18 30
48 1441 37 57 15 35
49 1022 82 72 22 15
50 1244 66 67 26 18
25+CollegeGrads
1 20
2 18
3 16
4 19
5 24
6 15
7 14
8 11
9 12
10 15
11 9
12 36
13 12
14 16
15 11
16 14
17 10
18 27
19 16
20 15
21 8
22 13
23 11
24 8
25 11
26 18
27 12
28 10
29 9
30 8
31 10
32 12
33 9
34 9
35 11
36 14
37 22
38 13
39 13
40 12
41 15
42 11
43 10
44 12
45 12
46 11
47 12
48 13
49 16
50 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Funding `25+HSgraduate`
1171.268 21.010 -23.911
`Dropouts16-19` `CollegeStudents18-24` `25+CollegeGrads`
-7.097 -6.565 26.273
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-906.69 -299.90 -87.02 179.90 1929.51
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1171.268 920.598 1.272 0.20995
Funding 21.010 5.998 3.503 0.00107 **
`25+HSgraduate` -23.911 12.753 -1.875 0.06745 .
`Dropouts16-19` -7.097 19.593 -0.362 0.71893
`CollegeStudents18-24` -6.565 8.609 -0.763 0.44980
`25+CollegeGrads` 26.273 26.805 0.980 0.33236
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 493.5 on 44 degrees of freedom
Multiple R-squared: 0.3356, Adjusted R-squared: 0.2601
F-statistic: 4.446 on 5 and 44 DF, p-value: 0.002303
> 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,] 1.487085e-02 2.974170e-02 0.9851292
[2,] 1.030493e-02 2.060987e-02 0.9896951
[3,] 2.634112e-03 5.268225e-03 0.9973659
[4,] 1.209381e-03 2.418762e-03 0.9987906
[5,] 3.603368e-04 7.206735e-04 0.9996397
[6,] 7.765927e-03 1.553185e-02 0.9922341
[7,] 4.298332e-03 8.596664e-03 0.9957017
[8,] 1.723366e-03 3.446732e-03 0.9982766
[9,] 8.616411e-04 1.723282e-03 0.9991384
[10,] 4.957809e-04 9.915617e-04 0.9995042
[11,] 1.790943e-04 3.581887e-04 0.9998209
[12,] 9.366092e-05 1.873218e-04 0.9999063
[13,] 6.863282e-05 1.372656e-04 0.9999314
[14,] 4.057315e-05 8.114631e-05 0.9999594
[15,] 2.261324e-05 4.522648e-05 0.9999774
[16,] 1.285925e-05 2.571850e-05 0.9999871
[17,] 5.413257e-05 1.082651e-04 0.9999459
[18,] 1.438368e-04 2.876736e-04 0.9998562
[19,] 5.502830e-05 1.100566e-04 0.9999450
[20,] 1.279483e-04 2.558967e-04 0.9998721
[21,] 1.503642e-04 3.007284e-04 0.9998496
[22,] 2.024630e-04 4.049260e-04 0.9997975
[23,] 8.369885e-05 1.673977e-04 0.9999163
[24,] 1.483115e-04 2.966229e-04 0.9998517
[25,] 5.721020e-05 1.144204e-04 0.9999428
[26,] 2.524500e-05 5.049000e-05 0.9999748
[27,] 1.215309e-05 2.430618e-05 0.9999878
[28,] 4.129447e-05 8.258893e-05 0.9999587
[29,] 1.721704e-05 3.443409e-05 0.9999828
[30,] 1.429083e-05 2.858166e-05 0.9999857
[31,] 2.473580e-05 4.947159e-05 0.9999753
[32,] 1.319969e-05 2.639937e-05 0.9999868
[33,] 4.958228e-01 9.916455e-01 0.5041772
> postscript(file="/var/www/html/rcomp/tmp/156ce1290514708.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/256ce1290514708.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/3gfth1290514708.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/4gfth1290514708.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/5gfth1290514708.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 = 50
Frequency = 1
1 2 3 4 5 6
-302.173565 -21.588020 -535.692341 183.071462 -906.691211 62.157758
7 8 9 10 11 12
-59.792556 -293.070690 -341.275080 32.056050 -341.319707 92.232824
13 14 15 16 17 18
-417.118677 468.015916 -192.450466 246.722658 -171.984810 -425.123768
19 20 21 22 23 24
-114.251374 -176.906802 -53.210787 -462.392853 -427.119554 -230.236434
25 26 27 28 29 30
377.505826 134.126468 -4.560298 256.114520 400.659114 -614.926631
31 32 33 34 35 36
-132.407970 162.369961 35.741989 -207.815709 -116.334368 520.848952
37 38 39 40 41 42
335.557329 -137.310111 937.434047 582.835336 1929.512322 115.898243
43 44 45 46 47 48
-239.578794 -473.763465 553.273823 -273.369531 -457.684446 849.934354
49 50
-316.305959 170.387024
> postscript(file="/var/www/html/rcomp/tmp/6qob21290514708.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 = 50
Frequency = 1
lag(myerror, k = 1) myerror
0 -302.173565 NA
1 -21.588020 -302.173565
2 -535.692341 -21.588020
3 183.071462 -535.692341
4 -906.691211 183.071462
5 62.157758 -906.691211
6 -59.792556 62.157758
7 -293.070690 -59.792556
8 -341.275080 -293.070690
9 32.056050 -341.275080
10 -341.319707 32.056050
11 92.232824 -341.319707
12 -417.118677 92.232824
13 468.015916 -417.118677
14 -192.450466 468.015916
15 246.722658 -192.450466
16 -171.984810 246.722658
17 -425.123768 -171.984810
18 -114.251374 -425.123768
19 -176.906802 -114.251374
20 -53.210787 -176.906802
21 -462.392853 -53.210787
22 -427.119554 -462.392853
23 -230.236434 -427.119554
24 377.505826 -230.236434
25 134.126468 377.505826
26 -4.560298 134.126468
27 256.114520 -4.560298
28 400.659114 256.114520
29 -614.926631 400.659114
30 -132.407970 -614.926631
31 162.369961 -132.407970
32 35.741989 162.369961
33 -207.815709 35.741989
34 -116.334368 -207.815709
35 520.848952 -116.334368
36 335.557329 520.848952
37 -137.310111 335.557329
38 937.434047 -137.310111
39 582.835336 937.434047
40 1929.512322 582.835336
41 115.898243 1929.512322
42 -239.578794 115.898243
43 -473.763465 -239.578794
44 553.273823 -473.763465
45 -273.369531 553.273823
46 -457.684446 -273.369531
47 849.934354 -457.684446
48 -316.305959 849.934354
49 170.387024 -316.305959
50 NA 170.387024
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -21.588020 -302.173565
[2,] -535.692341 -21.588020
[3,] 183.071462 -535.692341
[4,] -906.691211 183.071462
[5,] 62.157758 -906.691211
[6,] -59.792556 62.157758
[7,] -293.070690 -59.792556
[8,] -341.275080 -293.070690
[9,] 32.056050 -341.275080
[10,] -341.319707 32.056050
[11,] 92.232824 -341.319707
[12,] -417.118677 92.232824
[13,] 468.015916 -417.118677
[14,] -192.450466 468.015916
[15,] 246.722658 -192.450466
[16,] -171.984810 246.722658
[17,] -425.123768 -171.984810
[18,] -114.251374 -425.123768
[19,] -176.906802 -114.251374
[20,] -53.210787 -176.906802
[21,] -462.392853 -53.210787
[22,] -427.119554 -462.392853
[23,] -230.236434 -427.119554
[24,] 377.505826 -230.236434
[25,] 134.126468 377.505826
[26,] -4.560298 134.126468
[27,] 256.114520 -4.560298
[28,] 400.659114 256.114520
[29,] -614.926631 400.659114
[30,] -132.407970 -614.926631
[31,] 162.369961 -132.407970
[32,] 35.741989 162.369961
[33,] -207.815709 35.741989
[34,] -116.334368 -207.815709
[35,] 520.848952 -116.334368
[36,] 335.557329 520.848952
[37,] -137.310111 335.557329
[38,] 937.434047 -137.310111
[39,] 582.835336 937.434047
[40,] 1929.512322 582.835336
[41,] 115.898243 1929.512322
[42,] -239.578794 115.898243
[43,] -473.763465 -239.578794
[44,] 553.273823 -473.763465
[45,] -273.369531 553.273823
[46,] -457.684446 -273.369531
[47,] 849.934354 -457.684446
[48,] -316.305959 849.934354
[49,] 170.387024 -316.305959
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -21.588020 -302.173565
2 -535.692341 -21.588020
3 183.071462 -535.692341
4 -906.691211 183.071462
5 62.157758 -906.691211
6 -59.792556 62.157758
7 -293.070690 -59.792556
8 -341.275080 -293.070690
9 32.056050 -341.275080
10 -341.319707 32.056050
11 92.232824 -341.319707
12 -417.118677 92.232824
13 468.015916 -417.118677
14 -192.450466 468.015916
15 246.722658 -192.450466
16 -171.984810 246.722658
17 -425.123768 -171.984810
18 -114.251374 -425.123768
19 -176.906802 -114.251374
20 -53.210787 -176.906802
21 -462.392853 -53.210787
22 -427.119554 -462.392853
23 -230.236434 -427.119554
24 377.505826 -230.236434
25 134.126468 377.505826
26 -4.560298 134.126468
27 256.114520 -4.560298
28 400.659114 256.114520
29 -614.926631 400.659114
30 -132.407970 -614.926631
31 162.369961 -132.407970
32 35.741989 162.369961
33 -207.815709 35.741989
34 -116.334368 -207.815709
35 520.848952 -116.334368
36 335.557329 520.848952
37 -137.310111 335.557329
38 937.434047 -137.310111
39 582.835336 937.434047
40 1929.512322 582.835336
41 115.898243 1929.512322
42 -239.578794 115.898243
43 -473.763465 -239.578794
44 553.273823 -473.763465
45 -273.369531 553.273823
46 -457.684446 -273.369531
47 849.934354 -457.684446
48 -316.305959 849.934354
49 170.387024 -316.305959
> 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/7jya51290514708.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/8jya51290514708.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/9jya51290514708.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/10c7r81290514708.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/11x78w1290514708.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/12jq6k1290514708.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/137rlw1290514708.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/14t92j1290514708.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/154jj41290514708.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/16hszd1290514708.tab")
+ }
>
> try(system("convert tmp/156ce1290514708.ps tmp/156ce1290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/256ce1290514708.ps tmp/256ce1290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/3gfth1290514708.ps tmp/3gfth1290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/4gfth1290514708.ps tmp/4gfth1290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/5gfth1290514708.ps tmp/5gfth1290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/6qob21290514708.ps tmp/6qob21290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/7jya51290514708.ps tmp/7jya51290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/8jya51290514708.ps tmp/8jya51290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jya51290514708.ps tmp/9jya51290514708.png",intern=TRUE))
character(0)
> try(system("convert tmp/10c7r81290514708.ps tmp/10c7r81290514708.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.410 1.589 7.964