R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(38
+ ,39
+ ,13
+ ,12
+ ,15
+ ,11
+ ,89
+ ,54
+ ,37
+ ,38
+ ,16
+ ,14
+ ,15
+ ,8
+ ,76
+ ,47
+ ,33
+ ,31
+ ,15
+ ,13
+ ,15
+ ,11
+ ,73
+ ,45
+ ,31
+ ,33
+ ,16
+ ,15
+ ,13
+ ,11
+ ,79
+ ,47
+ ,39
+ ,32
+ ,15
+ ,10
+ ,17
+ ,8
+ ,90
+ ,55
+ ,44
+ ,39
+ ,17
+ ,11
+ ,17
+ ,10
+ ,74
+ ,44
+ ,33
+ ,36
+ ,15
+ ,9
+ ,19
+ ,11
+ ,81
+ ,53
+ ,35
+ ,33
+ ,12
+ ,11
+ ,15
+ ,13
+ ,72
+ ,44
+ ,32
+ ,33
+ ,16
+ ,10
+ ,13
+ ,11
+ ,71
+ ,42
+ ,28
+ ,32
+ ,10
+ ,11
+ ,9
+ ,20
+ ,66
+ ,40
+ ,40
+ ,37
+ ,16
+ ,8
+ ,15
+ ,10
+ ,77
+ ,46
+ ,27
+ ,30
+ ,12
+ ,11
+ ,15
+ ,15
+ ,65
+ ,40
+ ,37
+ ,38
+ ,14
+ ,12
+ ,15
+ ,12
+ ,74
+ ,46
+ ,32
+ ,29
+ ,15
+ ,12
+ ,16
+ ,14
+ ,82
+ ,53
+ ,28
+ ,22
+ ,13
+ ,9
+ ,11
+ ,23
+ ,54
+ ,33
+ ,34
+ ,35
+ ,15
+ ,11
+ ,14
+ ,14
+ ,63
+ ,42
+ ,30
+ ,35
+ ,11
+ ,10
+ ,11
+ ,16
+ ,54
+ ,35
+ ,35
+ ,34
+ ,12
+ ,8
+ ,15
+ ,11
+ ,64
+ ,40
+ ,31
+ ,35
+ ,8
+ ,9
+ ,13
+ ,12
+ ,69
+ ,41
+ ,32
+ ,34
+ ,16
+ ,8
+ ,15
+ ,10
+ ,54
+ ,33
+ ,30
+ ,34
+ ,15
+ ,9
+ ,16
+ ,14
+ ,84
+ ,51
+ ,30
+ ,35
+ ,17
+ ,15
+ ,14
+ ,12
+ ,86
+ ,53
+ ,31
+ ,23
+ ,16
+ ,11
+ ,15
+ ,12
+ ,77
+ ,46
+ ,40
+ ,31
+ ,10
+ ,8
+ ,16
+ ,11
+ ,89
+ ,55
+ ,32
+ ,27
+ ,18
+ ,13
+ ,16
+ ,12
+ ,76
+ ,47
+ ,36
+ ,36
+ ,13
+ ,12
+ ,11
+ ,13
+ ,60
+ ,38
+ ,32
+ ,31
+ ,16
+ ,12
+ ,12
+ ,11
+ ,75
+ ,46
+ ,35
+ ,32
+ ,13
+ ,9
+ ,9
+ ,19
+ ,73
+ ,46
+ ,38
+ ,39
+ ,10
+ ,7
+ ,16
+ ,12
+ ,85
+ ,53
+ ,42
+ ,37
+ ,15
+ ,13
+ ,13
+ ,17
+ ,79
+ ,47
+ ,34
+ ,38
+ ,16
+ ,9
+ ,16
+ ,9
+ ,71
+ ,41
+ ,35
+ ,39
+ ,16
+ ,6
+ ,12
+ ,12
+ ,72
+ ,44
+ ,35
+ ,34
+ ,14
+ ,8
+ ,9
+ ,19
+ ,69
+ ,43
+ ,33
+ ,31
+ ,10
+ ,8
+ ,13
+ ,18
+ ,78
+ ,51
+ ,36
+ ,32
+ ,17
+ ,15
+ ,13
+ ,15
+ ,54
+ ,33
+ ,32
+ ,37
+ ,13
+ ,6
+ ,14
+ ,14
+ ,69
+ ,43
+ ,33
+ ,36
+ ,15
+ ,9
+ ,19
+ ,11
+ ,81
+ ,53
+ ,34
+ ,32
+ ,16
+ ,11
+ ,13
+ ,9
+ ,84
+ ,51
+ ,32
+ ,35
+ ,12
+ ,8
+ ,12
+ ,18
+ ,84
+ ,50
+ ,34
+ ,36
+ ,13
+ ,8
+ ,13
+ ,16
+ ,69
+ ,46)
+ ,dim=c(8
+ ,40)
+ ,dimnames=list(c('Connected'
+ ,'Separate'
+ ,'Learning'
+ ,'Software'
+ ,'Happiness'
+ ,'Depression'
+ ,'Belonging'
+ ,'Belonging_Final')
+ ,1:40))
> y <- array(NA,dim=c(8,40),dimnames=list(c('Connected','Separate','Learning','Software','Happiness','Depression','Belonging','Belonging_Final'),1:40))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Connected Separate Learning Software Happiness Depression Belonging
1 38 39 13 12 15 11 89
2 37 38 16 14 15 8 76
3 33 31 15 13 15 11 73
4 31 33 16 15 13 11 79
5 39 32 15 10 17 8 90
6 44 39 17 11 17 10 74
7 33 36 15 9 19 11 81
8 35 33 12 11 15 13 72
9 32 33 16 10 13 11 71
10 28 32 10 11 9 20 66
11 40 37 16 8 15 10 77
12 27 30 12 11 15 15 65
13 37 38 14 12 15 12 74
14 32 29 15 12 16 14 82
15 28 22 13 9 11 23 54
16 34 35 15 11 14 14 63
17 30 35 11 10 11 16 54
18 35 34 12 8 15 11 64
19 31 35 8 9 13 12 69
20 32 34 16 8 15 10 54
21 30 34 15 9 16 14 84
22 30 35 17 15 14 12 86
23 31 23 16 11 15 12 77
24 40 31 10 8 16 11 89
25 32 27 18 13 16 12 76
26 36 36 13 12 11 13 60
27 32 31 16 12 12 11 75
28 35 32 13 9 9 19 73
29 38 39 10 7 16 12 85
30 42 37 15 13 13 17 79
31 34 38 16 9 16 9 71
32 35 39 16 6 12 12 72
33 35 34 14 8 9 19 69
34 33 31 10 8 13 18 78
35 36 32 17 15 13 15 54
36 32 37 13 6 14 14 69
37 33 36 15 9 19 11 81
38 34 32 16 11 13 9 84
39 32 35 12 8 12 18 84
40 34 36 13 8 13 16 69
Belonging_Final
1 54
2 47
3 45
4 47
5 55
6 44
7 53
8 44
9 42
10 40
11 46
12 40
13 46
14 53
15 33
16 42
17 35
18 40
19 41
20 33
21 51
22 53
23 46
24 55
25 47
26 38
27 46
28 46
29 53
30 47
31 41
32 44
33 43
34 51
35 33
36 43
37 53
38 51
39 50
40 46
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Separate Learning Software
10.975844 0.434970 0.137589 -0.002754
Happiness Depression Belonging Belonging_Final
0.116676 -0.033594 0.199185 -0.207011
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.8861 -2.6551 0.1711 1.5669 6.4729
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.975844 11.937658 0.919 0.36475
Separate 0.434970 0.153055 2.842 0.00774 **
Learning 0.137589 0.277041 0.497 0.62284
Software -0.002754 0.259035 -0.011 0.99158
Happiness 0.116676 0.345407 0.338 0.73772
Depression -0.033594 0.254622 -0.132 0.89586
Belonging 0.199185 0.236953 0.841 0.40680
Belonging_Final -0.207011 0.386635 -0.535 0.59606
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.364 on 32 degrees of freedom
Multiple R-squared: 0.3439, Adjusted R-squared: 0.2004
F-statistic: 2.396 on 7 and 32 DF, p-value: 0.04329
> 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.4214705 0.84294102 0.57852949
[2,] 0.5968403 0.80631937 0.40315968
[3,] 0.4590259 0.91805181 0.54097409
[4,] 0.5009056 0.99818887 0.49909444
[5,] 0.4698762 0.93975242 0.53012379
[6,] 0.4260556 0.85211118 0.57394441
[7,] 0.3819453 0.76389065 0.61805468
[8,] 0.2900068 0.58001352 0.70999324
[9,] 0.3817070 0.76341395 0.61829303
[10,] 0.3545284 0.70905683 0.64547159
[11,] 0.5769830 0.84603393 0.42301696
[12,] 0.7859040 0.42819209 0.21409605
[13,] 0.6901043 0.61979146 0.30989573
[14,] 0.9597617 0.08047669 0.04023834
[15,] 0.9382993 0.12340136 0.06170068
[16,] 0.9597718 0.08045634 0.04022817
[17,] 0.9540771 0.09184587 0.04592293
[18,] 0.9027687 0.19446266 0.09723133
[19,] 0.7937201 0.41255972 0.20627986
> postscript(file="/var/wessaorg/rcomp/tmp/1een21352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2eq5o1352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/3zivq1352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4ehv51352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/5hfpo1352115767.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 = 40
Frequency = 1
1 2 3 4 5 6
0.37528207 0.44253495 -0.09352902 -3.64328212 3.81307827 6.47288522
7 8 9 10 11 12
-2.68348726 1.50315032 -2.09863029 -3.48442515 3.52197295 -4.55850505
13 14 15 16 17 18
1.03793726 -0.37881126 1.25556503 0.74935426 -1.94224481 1.75816391
19 20 21 22 23 24
-2.64566296 -1.28301596 -5.37431349 -5.88611868 0.68699930 6.34712550
25 26 27 28 29 30
-0.03303003 2.67826052 -1.07520045 2.91148187 1.28092309 5.95048159
31 32 33 34 35 36
-2.90046094 -1.35435701 2.07690484 1.29529686 3.86993358 -2.84727421
37 38 39 40
-2.68348726 -0.45439391 -3.00520206 0.39810055
> postscript(file="/var/wessaorg/rcomp/tmp/6374r1352115767.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 = 40
Frequency = 1
lag(myerror, k = 1) myerror
0 0.37528207 NA
1 0.44253495 0.37528207
2 -0.09352902 0.44253495
3 -3.64328212 -0.09352902
4 3.81307827 -3.64328212
5 6.47288522 3.81307827
6 -2.68348726 6.47288522
7 1.50315032 -2.68348726
8 -2.09863029 1.50315032
9 -3.48442515 -2.09863029
10 3.52197295 -3.48442515
11 -4.55850505 3.52197295
12 1.03793726 -4.55850505
13 -0.37881126 1.03793726
14 1.25556503 -0.37881126
15 0.74935426 1.25556503
16 -1.94224481 0.74935426
17 1.75816391 -1.94224481
18 -2.64566296 1.75816391
19 -1.28301596 -2.64566296
20 -5.37431349 -1.28301596
21 -5.88611868 -5.37431349
22 0.68699930 -5.88611868
23 6.34712550 0.68699930
24 -0.03303003 6.34712550
25 2.67826052 -0.03303003
26 -1.07520045 2.67826052
27 2.91148187 -1.07520045
28 1.28092309 2.91148187
29 5.95048159 1.28092309
30 -2.90046094 5.95048159
31 -1.35435701 -2.90046094
32 2.07690484 -1.35435701
33 1.29529686 2.07690484
34 3.86993358 1.29529686
35 -2.84727421 3.86993358
36 -2.68348726 -2.84727421
37 -0.45439391 -2.68348726
38 -3.00520206 -0.45439391
39 0.39810055 -3.00520206
40 NA 0.39810055
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.44253495 0.37528207
[2,] -0.09352902 0.44253495
[3,] -3.64328212 -0.09352902
[4,] 3.81307827 -3.64328212
[5,] 6.47288522 3.81307827
[6,] -2.68348726 6.47288522
[7,] 1.50315032 -2.68348726
[8,] -2.09863029 1.50315032
[9,] -3.48442515 -2.09863029
[10,] 3.52197295 -3.48442515
[11,] -4.55850505 3.52197295
[12,] 1.03793726 -4.55850505
[13,] -0.37881126 1.03793726
[14,] 1.25556503 -0.37881126
[15,] 0.74935426 1.25556503
[16,] -1.94224481 0.74935426
[17,] 1.75816391 -1.94224481
[18,] -2.64566296 1.75816391
[19,] -1.28301596 -2.64566296
[20,] -5.37431349 -1.28301596
[21,] -5.88611868 -5.37431349
[22,] 0.68699930 -5.88611868
[23,] 6.34712550 0.68699930
[24,] -0.03303003 6.34712550
[25,] 2.67826052 -0.03303003
[26,] -1.07520045 2.67826052
[27,] 2.91148187 -1.07520045
[28,] 1.28092309 2.91148187
[29,] 5.95048159 1.28092309
[30,] -2.90046094 5.95048159
[31,] -1.35435701 -2.90046094
[32,] 2.07690484 -1.35435701
[33,] 1.29529686 2.07690484
[34,] 3.86993358 1.29529686
[35,] -2.84727421 3.86993358
[36,] -2.68348726 -2.84727421
[37,] -0.45439391 -2.68348726
[38,] -3.00520206 -0.45439391
[39,] 0.39810055 -3.00520206
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.44253495 0.37528207
2 -0.09352902 0.44253495
3 -3.64328212 -0.09352902
4 3.81307827 -3.64328212
5 6.47288522 3.81307827
6 -2.68348726 6.47288522
7 1.50315032 -2.68348726
8 -2.09863029 1.50315032
9 -3.48442515 -2.09863029
10 3.52197295 -3.48442515
11 -4.55850505 3.52197295
12 1.03793726 -4.55850505
13 -0.37881126 1.03793726
14 1.25556503 -0.37881126
15 0.74935426 1.25556503
16 -1.94224481 0.74935426
17 1.75816391 -1.94224481
18 -2.64566296 1.75816391
19 -1.28301596 -2.64566296
20 -5.37431349 -1.28301596
21 -5.88611868 -5.37431349
22 0.68699930 -5.88611868
23 6.34712550 0.68699930
24 -0.03303003 6.34712550
25 2.67826052 -0.03303003
26 -1.07520045 2.67826052
27 2.91148187 -1.07520045
28 1.28092309 2.91148187
29 5.95048159 1.28092309
30 -2.90046094 5.95048159
31 -1.35435701 -2.90046094
32 2.07690484 -1.35435701
33 1.29529686 2.07690484
34 3.86993358 1.29529686
35 -2.84727421 3.86993358
36 -2.68348726 -2.84727421
37 -0.45439391 -2.68348726
38 -3.00520206 -0.45439391
39 0.39810055 -3.00520206
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/7hcjq1352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/80em31352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9oqhg1352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/1049z81352115767.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/11m3p01352115767.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12fbty1352115767.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/138y9c1352115767.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/14kqow1352115767.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15bvo71352115767.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/1656j81352115767.tab")
+ }
>
> try(system("convert tmp/1een21352115767.ps tmp/1een21352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/2eq5o1352115767.ps tmp/2eq5o1352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/3zivq1352115767.ps tmp/3zivq1352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ehv51352115767.ps tmp/4ehv51352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/5hfpo1352115767.ps tmp/5hfpo1352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/6374r1352115767.ps tmp/6374r1352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/7hcjq1352115767.ps tmp/7hcjq1352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/80em31352115767.ps tmp/80em31352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/9oqhg1352115767.ps tmp/9oqhg1352115767.png",intern=TRUE))
character(0)
> try(system("convert tmp/1049z81352115767.ps tmp/1049z81352115767.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.080 1.147 7.243