R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-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(0.9
+ ,0.96
+ ,1.01
+ ,0.77
+ ,0.91
+ ,0.65
+ ,1.02
+ ,0.83
+ ,0.87
+ ,0.68
+ ,0.79
+ ,0.74
+ ,0.93
+ ,0.93
+ ,0.99
+ ,0.86
+ ,0.93
+ ,0.9
+ ,0.94
+ ,0.67
+ ,0.73
+ ,0.54
+ ,0.65
+ ,0.9
+ ,1.01
+ ,0.99
+ ,1.08
+ ,0.98
+ ,1.02
+ ,0.9
+ ,0.91
+ ,1.02
+ ,0.88
+ ,0.96
+ ,0.95
+ ,0.93
+ ,0.97
+ ,1.01
+ ,0.99
+ ,0.85
+ ,0.95
+ ,0.99
+ ,0.98
+ ,0.97
+ ,0.85
+ ,0.84
+ ,0.88
+ ,0.8
+ ,0.83
+ ,0.86
+ ,0.91
+ ,0.84
+ ,0.87
+ ,0.83
+ ,0.94
+ ,0.93
+ ,0.85
+ ,0.94
+ ,0.91
+ ,0.91
+ ,0.97
+ ,0.98
+ ,1
+ ,0.91
+ ,0.96
+ ,1
+ ,0.97
+ ,0.75
+ ,0.74
+ ,0.65
+ ,0.71
+ ,0.67
+ ,0.93
+ ,1.01
+ ,0.96
+ ,1.05
+ ,1.01
+ ,0.89
+ ,0.83
+ ,0.76
+ ,0.66
+ ,0.7
+ ,0.71
+ ,0.73
+ ,0.88
+ ,0.35
+ ,0.49
+ ,0.65
+ ,0.5
+ ,0.81
+ ,0.9
+ ,1.01
+ ,0.95
+ ,0.6
+ ,0.85
+ ,0.95
+ ,1.01
+ ,0.95
+ ,0.8
+ ,0.66
+ ,0.81
+ ,0.85
+ ,1.02
+ ,0.75
+ ,1
+ ,1.01
+ ,0.92
+ ,0.8
+ ,0.91
+ ,0.67
+ ,0.95
+ ,0.82
+ ,0.81
+ ,0.84
+ ,0.91
+ ,0.49
+ ,0.89
+ ,0.9
+ ,0.76
+ ,0.63
+ ,1.06
+ ,1.05
+ ,1.11
+ ,1.13
+ ,1.1
+ ,0.96
+ ,0.93
+ ,1
+ ,0.82
+ ,0.92
+ ,0.91
+ ,0.91
+ ,0.93
+ ,0.86
+ ,0.89
+ ,0.89
+ ,0.88
+ ,0.74
+ ,0.84
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0.12
+ ,0.97
+ ,0.86
+ ,0.99
+ ,0.95
+ ,0.93
+ ,0.79
+ ,0.9
+ ,0.41
+ ,0.5
+ ,0.69
+ ,0.53
+ ,0.44
+ ,0.85
+ ,0.79
+ ,0.87
+ ,0.81
+ ,0.82
+ ,0.75
+ ,0.93
+ ,0.87
+ ,0.92
+ ,0.98
+ ,0.92
+ ,0.72
+ ,0.96
+ ,1.04
+ ,0.88
+ ,0.91
+ ,0.94
+ ,0.95
+ ,0.9
+ ,0.63
+ ,0.8
+ ,0.65
+ ,0.69
+ ,0.67
+ ,0.98
+ ,0.51
+ ,0.77
+ ,0.79
+ ,0.69
+ ,0.99
+ ,1.04
+ ,1.43
+ ,0.51
+ ,0.83
+ ,0.92
+ ,0.85
+ ,0.88
+ ,0.95
+ ,1.13
+ ,0.85
+ ,0.98
+ ,0.75
+ ,0.99
+ ,1.12
+ ,0.85
+ ,0.75
+ ,0.9
+ ,0.86
+ ,0.87
+ ,0.78
+ ,0.77
+ ,0.69
+ ,0.75
+ ,0.94
+ ,0.94
+ ,0.59
+ ,0.62
+ ,0.69
+ ,0.64
+ ,0.82
+ ,0.98
+ ,1.02
+ ,0.83
+ ,0.76
+ ,0.87
+ ,0.87
+ ,0.97
+ ,1.03
+ ,0.7
+ ,0.81
+ ,0.84
+ ,0.98
+ ,0.87
+ ,0.82
+ ,0.49
+ ,0.46
+ ,0.59
+ ,0.8
+ ,0.9
+ ,0.73
+ ,0.66
+ ,0.65
+ ,0.68
+ ,0.86
+ ,1.05
+ ,0.99
+ ,0.91
+ ,0.97
+ ,0.96
+ ,0.9)
+ ,dim=c(6
+ ,41)
+ ,dimnames=list(c('VR'
+ ,'AT1'
+ ,'AT2'
+ ,'AT3'
+ ,'ATM'
+ ,'NAH')
+ ,1:41))
> y <- array(NA,dim=c(6,41),dimnames=list(c('VR','AT1','AT2','AT3','ATM','NAH'),1:41))
> 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.2.327 (Thu, 30 Apr 2015 13:26:50 +0100)
> #Author: root
> #To cite this work: Wessa P., (2015), Multiple Regression (v1.0.30) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_multipleregression.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following objects 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
VR AT1 AT2 AT3 ATM NAH
1 0.90 0.96 1.01 0.77 0.91 0.65
2 1.02 0.83 0.87 0.68 0.79 0.74
3 0.93 0.93 0.99 0.86 0.93 0.90
4 0.94 0.67 0.73 0.54 0.65 0.90
5 1.01 0.99 1.08 0.98 1.02 0.90
6 0.91 1.02 0.88 0.96 0.95 0.93
7 0.97 1.01 0.99 0.85 0.95 0.99
8 0.98 0.97 0.85 0.84 0.88 0.80
9 0.83 0.86 0.91 0.84 0.87 0.83
10 0.94 0.93 0.85 0.94 0.91 0.91
11 0.97 0.98 1.00 0.91 0.96 1.00
12 0.97 0.75 0.74 0.65 0.71 0.67
13 0.93 1.01 0.96 1.05 1.01 0.89
14 0.83 0.76 0.66 0.70 0.71 0.73
15 0.88 0.35 0.49 0.65 0.50 0.81
16 0.90 1.01 0.95 0.60 0.85 0.95
17 1.01 0.95 0.80 0.66 0.81 0.85
18 1.02 0.75 1.00 1.01 0.92 0.80
19 0.91 0.67 0.95 0.82 0.81 0.84
20 0.91 0.49 0.89 0.90 0.76 0.63
21 1.06 1.05 1.11 1.13 1.10 0.96
22 0.93 1.00 0.82 0.92 0.91 0.91
23 0.93 0.86 0.89 0.89 0.88 0.74
24 0.84 0.00 0.00 0.00 0.00 0.12
25 0.97 0.86 0.99 0.95 0.93 0.79
26 0.90 0.41 0.50 0.69 0.53 0.44
27 0.85 0.79 0.87 0.81 0.82 0.75
28 0.93 0.87 0.92 0.98 0.92 0.72
29 0.96 1.04 0.88 0.91 0.94 0.95
30 0.90 0.63 0.80 0.65 0.69 0.67
31 0.98 0.51 0.77 0.79 0.69 0.99
32 1.04 1.43 0.51 0.83 0.92 0.85
33 0.88 0.95 1.13 0.85 0.98 0.75
34 0.99 1.12 0.85 0.75 0.90 0.86
35 0.87 0.78 0.77 0.69 0.75 0.94
36 0.94 0.59 0.62 0.69 0.64 0.82
37 0.98 1.02 0.83 0.76 0.87 0.87
38 0.97 1.03 0.70 0.81 0.84 0.98
39 0.87 0.82 0.49 0.46 0.59 0.80
40 0.90 0.73 0.66 0.65 0.68 0.86
41 1.05 0.99 0.91 0.97 0.96 0.90
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) AT1 AT2 AT3 ATM NAH
0.80353 -0.06621 -0.19806 -0.03957 0.44289 0.02879
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.112321 -0.028562 -0.002529 0.033017 0.099461
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.80353 0.04583 17.535 <2e-16 ***
AT1 -0.06621 0.83451 -0.079 0.937
AT2 -0.19806 0.85435 -0.232 0.818
AT3 -0.03957 0.85436 -0.046 0.963
ATM 0.44289 2.55061 0.174 0.863
NAH 0.02879 0.07745 0.372 0.712
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.05342 on 35 degrees of freedom
Multiple R-squared: 0.2955, Adjusted R-squared: 0.1949
F-statistic: 2.937 on 5 and 35 DF, p-value: 0.0257
> 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.9458358 0.1083284 0.05416421
[2,] 0.9252989 0.1494021 0.07470107
[3,] 0.8622731 0.2754538 0.13772690
[4,] 0.8367871 0.3264258 0.16321291
[5,] 0.7871159 0.4257683 0.21288414
[6,] 0.8786863 0.2426274 0.12131368
[7,] 0.8345536 0.3308928 0.16544641
[8,] 0.8268636 0.3462728 0.17313640
[9,] 0.9085511 0.1828979 0.09144895
[10,] 0.9233339 0.1533322 0.07666608
[11,] 0.8923440 0.2153120 0.10765600
[12,] 0.8408076 0.3183847 0.15919237
[13,] 0.8798585 0.2402829 0.12014145
[14,] 0.8515313 0.2969375 0.14846875
[15,] 0.7834206 0.4331587 0.21657937
[16,] 0.8152522 0.3694957 0.18474783
[17,] 0.7413012 0.5173976 0.25869881
[18,] 0.6542712 0.6914576 0.34572881
[19,] 0.7491023 0.5017955 0.25089773
[20,] 0.8082349 0.3835302 0.19176510
[21,] 0.7963235 0.4073530 0.20367650
[22,] 0.6840501 0.6318999 0.31594993
[23,] 0.5723942 0.8552115 0.42760576
[24,] 0.7311922 0.5376155 0.26880777
> postscript(file="/var/wessaorg/rcomp/tmp/1tqtm1433420942.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/2ega01433420942.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/3bh1h1433420942.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/4g55n1433420942.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/5rksz1433420942.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 = 41
Frequency = 1
1 2 3 4 5 6
-0.031197153 0.099460623 -0.019639059 0.032995643 0.047047909 -0.061230919
7 8 9 10 11 12
0.013812899 0.029513167 -0.112321276 -0.025631755 0.011464807 0.054675313
13 14 15 16 17 18
-0.047908133 -0.100256299 -0.022348425 -0.028562421 0.070725174 0.073667931
19 20 21 22 23 24
-0.011484958 -0.003929593 0.075739774 -0.037730306 -0.016141298 0.033016737
25 26 27 28 29 30
0.022455095 0.002554543 -0.081617774 -0.023115408 -0.008032381 -0.002528558
31 32 33 34 35 36
0.059910940 0.033078552 -0.058807605 0.035297739 -0.061303271 0.018580579
37 38 39 40 41
0.028109942 0.005122318 -0.048320561 -0.024677752 0.079555220
> postscript(file="/var/wessaorg/rcomp/tmp/6k2531433420942.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 = 41
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.031197153 NA
1 0.099460623 -0.031197153
2 -0.019639059 0.099460623
3 0.032995643 -0.019639059
4 0.047047909 0.032995643
5 -0.061230919 0.047047909
6 0.013812899 -0.061230919
7 0.029513167 0.013812899
8 -0.112321276 0.029513167
9 -0.025631755 -0.112321276
10 0.011464807 -0.025631755
11 0.054675313 0.011464807
12 -0.047908133 0.054675313
13 -0.100256299 -0.047908133
14 -0.022348425 -0.100256299
15 -0.028562421 -0.022348425
16 0.070725174 -0.028562421
17 0.073667931 0.070725174
18 -0.011484958 0.073667931
19 -0.003929593 -0.011484958
20 0.075739774 -0.003929593
21 -0.037730306 0.075739774
22 -0.016141298 -0.037730306
23 0.033016737 -0.016141298
24 0.022455095 0.033016737
25 0.002554543 0.022455095
26 -0.081617774 0.002554543
27 -0.023115408 -0.081617774
28 -0.008032381 -0.023115408
29 -0.002528558 -0.008032381
30 0.059910940 -0.002528558
31 0.033078552 0.059910940
32 -0.058807605 0.033078552
33 0.035297739 -0.058807605
34 -0.061303271 0.035297739
35 0.018580579 -0.061303271
36 0.028109942 0.018580579
37 0.005122318 0.028109942
38 -0.048320561 0.005122318
39 -0.024677752 -0.048320561
40 0.079555220 -0.024677752
41 NA 0.079555220
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.099460623 -0.031197153
[2,] -0.019639059 0.099460623
[3,] 0.032995643 -0.019639059
[4,] 0.047047909 0.032995643
[5,] -0.061230919 0.047047909
[6,] 0.013812899 -0.061230919
[7,] 0.029513167 0.013812899
[8,] -0.112321276 0.029513167
[9,] -0.025631755 -0.112321276
[10,] 0.011464807 -0.025631755
[11,] 0.054675313 0.011464807
[12,] -0.047908133 0.054675313
[13,] -0.100256299 -0.047908133
[14,] -0.022348425 -0.100256299
[15,] -0.028562421 -0.022348425
[16,] 0.070725174 -0.028562421
[17,] 0.073667931 0.070725174
[18,] -0.011484958 0.073667931
[19,] -0.003929593 -0.011484958
[20,] 0.075739774 -0.003929593
[21,] -0.037730306 0.075739774
[22,] -0.016141298 -0.037730306
[23,] 0.033016737 -0.016141298
[24,] 0.022455095 0.033016737
[25,] 0.002554543 0.022455095
[26,] -0.081617774 0.002554543
[27,] -0.023115408 -0.081617774
[28,] -0.008032381 -0.023115408
[29,] -0.002528558 -0.008032381
[30,] 0.059910940 -0.002528558
[31,] 0.033078552 0.059910940
[32,] -0.058807605 0.033078552
[33,] 0.035297739 -0.058807605
[34,] -0.061303271 0.035297739
[35,] 0.018580579 -0.061303271
[36,] 0.028109942 0.018580579
[37,] 0.005122318 0.028109942
[38,] -0.048320561 0.005122318
[39,] -0.024677752 -0.048320561
[40,] 0.079555220 -0.024677752
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.099460623 -0.031197153
2 -0.019639059 0.099460623
3 0.032995643 -0.019639059
4 0.047047909 0.032995643
5 -0.061230919 0.047047909
6 0.013812899 -0.061230919
7 0.029513167 0.013812899
8 -0.112321276 0.029513167
9 -0.025631755 -0.112321276
10 0.011464807 -0.025631755
11 0.054675313 0.011464807
12 -0.047908133 0.054675313
13 -0.100256299 -0.047908133
14 -0.022348425 -0.100256299
15 -0.028562421 -0.022348425
16 0.070725174 -0.028562421
17 0.073667931 0.070725174
18 -0.011484958 0.073667931
19 -0.003929593 -0.011484958
20 0.075739774 -0.003929593
21 -0.037730306 0.075739774
22 -0.016141298 -0.037730306
23 0.033016737 -0.016141298
24 0.022455095 0.033016737
25 0.002554543 0.022455095
26 -0.081617774 0.002554543
27 -0.023115408 -0.081617774
28 -0.008032381 -0.023115408
29 -0.002528558 -0.008032381
30 0.059910940 -0.002528558
31 0.033078552 0.059910940
32 -0.058807605 0.033078552
33 0.035297739 -0.058807605
34 -0.061303271 0.035297739
35 0.018580579 -0.061303271
36 0.028109942 0.018580579
37 0.005122318 0.028109942
38 -0.048320561 0.005122318
39 -0.024677752 -0.048320561
40 0.079555220 -0.024677752
> 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/7ee8g1433420942.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/8zk531433420942.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/90q0g1433420942.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/10lxhz1433420942.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, signif(mysum$coefficients[i,1],6), 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/1159ru1433420942.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,signif(mysum$coefficients[i,1],6))
+ a<-table.element(a, signif(mysum$coefficients[i,2],6))
+ a<-table.element(a, signif(mysum$coefficients[i,3],4))
+ a<-table.element(a, signif(mysum$coefficients[i,4],6))
+ a<-table.element(a, signif(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12qiev1433420942.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, signif(sqrt(mysum$r.squared),6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, signif(mysum$r.squared,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, signif(mysum$adj.r.squared,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[1],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[2],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[3],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, signif(1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]),6))
> 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, signif(mysum$sigma,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, signif(sum(myerror*myerror),6))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/13x93r1433420942.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,signif(x[i],6))
+ a<-table.element(a,signif(x[i]-mysum$resid[i],6))
+ a<-table.element(a,signif(mysum$resid[i],6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/149nrw1433420942.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,signif(gqarr[mypoint-kp3+1,1],6))
+ a<-table.element(a,signif(gqarr[mypoint-kp3+1,2],6))
+ a<-table.element(a,signif(gqarr[mypoint-kp3+1,3],6))
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15xsfm1433420942.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,signif(numsignificant1,6))
+ a<-table.element(a,signif(numsignificant1/numgqtests,6))
+ 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,signif(numsignificant5,6))
+ a<-table.element(a,signif(numsignificant5/numgqtests,6))
+ 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,signif(numsignificant10,6))
+ a<-table.element(a,signif(numsignificant10/numgqtests,6))
+ 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/16zz0j1433420942.tab")
+ }
>
> try(system("convert tmp/1tqtm1433420942.ps tmp/1tqtm1433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ega01433420942.ps tmp/2ega01433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/3bh1h1433420942.ps tmp/3bh1h1433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/4g55n1433420942.ps tmp/4g55n1433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/5rksz1433420942.ps tmp/5rksz1433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/6k2531433420942.ps tmp/6k2531433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ee8g1433420942.ps tmp/7ee8g1433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/8zk531433420942.ps tmp/8zk531433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/90q0g1433420942.ps tmp/90q0g1433420942.png",intern=TRUE))
character(0)
> try(system("convert tmp/10lxhz1433420942.ps tmp/10lxhz1433420942.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.295 0.665 5.009