R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(3 + ,2 + ,1 + ,2 + ,1 + ,2 + ,3 + ,4 + ,1 + ,1 + ,3 + ,1 + ,2 + ,1 + ,3 + ,2 + ,1 + ,2 + ,3 + ,2 + ,4 + ,3 + ,2 + ,1 + ,1 + ,2 + ,1 + ,3 + ,1 + ,1 + ,2 + ,3 + ,3 + ,3 + ,2 + ,4 + ,1 + ,1 + ,2 + ,2 + ,2 + ,1 + ,2 + ,2 + ,4 + ,1 + ,3 + ,3 + ,2 + ,3 + ,3 + ,1 + ,1 + ,2 + ,1 + ,1 + ,4 + ,2 + ,1 + ,2 + ,2 + ,1 + ,2 + ,3 + ,2 + ,2 + ,2 + ,2 + ,2 + ,2 + ,4 + ,2 + ,1 + ,1 + ,1 + ,3 + ,2 + ,4 + ,1 + ,1 + ,1 + ,1 + ,1 + ,3 + ,3 + ,4 + ,2 + ,2 + ,3 + ,1 + ,2 + ,3 + ,2 + ,1 + ,2 + ,3 + ,2 + ,3 + ,4 + ,2 + ,1 + ,2 + ,2 + ,1 + ,1 + ,3 + ,3 + ,1 + ,1 + ,3 + ,2 + ,3 + ,3 + ,3 + ,1 + ,2 + ,1 + ,3 + ,2 + ,4 + ,1 + ,1 + ,2 + ,1 + ,3 + ,1 + ,4 + ,1 + ,1 + ,2 + ,2 + ,1 + ,2 + ,3 + ,2 + ,2 + ,1 + ,1 + ,4 + ,3 + ,4 + ,1 + ,1 + ,1 + ,1 + ,2 + ,3 + ,3 + ,2 + ,1 + ,2 + ,2 + ,2 + ,3 + ,2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+ ,2 + ,3 + ,3 + ,4 + ,2 + ,1 + ,2 + ,2 + ,3 + ,2 + ,3 + ,1 + ,1 + ,1 + ,1 + ,2 + ,3 + ,4 + ,5 + ,1 + ,4 + ,1 + ,4 + ,1 + ,3 + ,2 + ,1 + ,1 + ,3 + ,2 + ,1 + ,3 + ,2 + ,1 + ,2 + ,2 + ,1 + ,2 + ,4 + ,3 + ,1 + ,2 + ,2 + ,1 + ,1 + ,4 + ,2 + ,1 + ,1 + ,3 + ,2 + ,1 + ,3 + ,3 + ,1 + ,1 + ,3 + ,3 + ,3 + ,4 + ,4 + ,1 + ,2 + ,1 + ,2 + ,3 + ,4 + ,4 + ,2 + ,4 + ,3 + ,4 + ,2 + ,4 + ,2 + ,1 + ,1 + ,2 + ,3 + ,2 + ,2 + ,4 + ,2 + ,1 + ,1 + ,4 + ,1 + ,4 + ,2 + ,1 + ,1 + ,1 + ,2 + ,2 + ,4 + ,3 + ,1 + ,2 + ,2 + ,3 + ,2 + ,1 + ,3 + ,3 + ,2 + ,2 + ,2 + ,2 + ,2 + ,4 + ,1 + ,1 + ,3 + ,2 + ,1 + ,3 + ,1 + ,1 + ,1 + ,3 + ,3 + ,3 + ,3 + ,3 + ,1 + ,2 + ,1 + ,4 + ,3 + ,4 + ,1 + ,1 + ,2 + ,2 + ,2 + ,2 + ,4 + ,4 + ,1 + ,1 + ,2 + ,1 + ,1 + ,3 + ,3 + ,2 + ,3 + ,3 + ,3 + ,1 + ,4 + ,4 + ,1 + ,3 + ,4 + ,1 + ,4) + ,dim=c(7 + ,162) + ,dimnames=list(c('Life' + ,'Stress' + ,'Depression' + ,'Effort' + ,'Focus' + ,'Sleep' + ,'Belong') + ,1:162)) > y <- array(NA,dim=c(7,162),dimnames=list(c('Life','Stress','Depression','Effort','Focus','Sleep','Belong'),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 = '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 > 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 Life Stress Depression Effort Focus Sleep Belong 1 3 2 1 2 1 2 3 2 4 1 1 3 1 2 1 3 3 2 1 2 3 2 4 4 3 2 1 1 2 1 3 5 1 1 2 3 3 3 2 6 4 1 1 2 2 2 1 7 2 2 4 1 3 3 2 8 3 3 1 1 2 1 1 9 4 2 1 2 2 1 2 10 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1 1 1 2 1 4 3 75 1 2 2 2 1 4 4 76 3 3 3 2 1 3 2 77 2 1 2 2 3 2 2 78 2 2 2 2 2 4 2 79 1 2 2 3 2 4 3 80 1 1 2 1 3 4 3 81 1 1 1 1 2 4 2 82 1 3 1 1 4 2 1 83 2 1 1 2 4 2 1 84 1 4 1 3 4 2 1 85 2 2 1 2 4 2 1 86 2 2 4 2 3 2 1 87 1 3 2 1 4 2 1 88 3 2 2 3 2 3 1 89 3 3 1 3 3 5 3 90 3 4 4 2 4 2 1 91 2 1 4 1 3 1 1 92 1 3 3 3 3 2 1 93 1 1 3 2 2 3 1 94 2 2 2 1 4 4 1 95 2 1 3 1 4 2 1 96 1 1 3 2 3 3 1 97 2 3 3 2 4 3 1 98 2 2 2 1 4 1 1 99 2 2 1 2 4 2 1 100 1 2 1 2 4 1 1 101 1 2 1 2 4 3 2 102 3 2 3 3 3 2 1 103 2 2 2 1 4 3 1 104 1 1 4 2 4 3 1 105 3 2 4 2 3 4 2 106 2 3 3 3 4 2 1 107 2 2 2 1 2 3 2 108 3 2 1 3 2 3 2 109 2 1 1 3 2 4 3 110 3 4 4 5 3 2 2 111 2 2 1 1 3 4 2 112 2 2 2 2 3 3 1 113 1 1 2 1 4 3 1 114 1 2 4 1 4 2 1 115 2 2 2 1 4 1 1 116 1 3 1 1 2 3 1 117 2 2 2 3 4 3 1 118 3 4 1 2 4 2 1 119 1 2 1 2 4 4 1 120 3 4 3 1 3 3 2 121 3 1 1 3 3 2 1 122 2 2 3 2 4 2 1 123 1 2 3 1 4 2 1 124 1 1 1 1 4 3 1 125 1 1 2 3 3 2 1 126 1 1 2 1 4 1 1 127 1 1 1 1 4 2 1 128 1 1 3 1 4 1 1 129 2 2 2 2 3 3 1 130 1 2 3 2 3 2 2 131 1 1 2 2 3 4 2 132 3 3 4 4 4 3 1 133 2 2 1 2 3 2 1 134 2 2 3 2 4 3 1 135 1 3 1 3 4 3 1 136 2 3 3 1 2 3 4 137 3 2 2 3 3 3 1 138 2 2 2 3 3 3 2 139 2 2 3 4 4 2 1 140 1 2 3 3 4 2 1 141 2 2 3 2 3 1 1 142 1 1 2 3 4 5 1 143 4 1 4 1 3 2 1 144 1 3 2 1 3 2 1 145 2 2 1 2 4 3 1 146 2 2 1 1 4 2 1 147 1 3 2 1 3 3 1 148 1 3 3 3 4 4 1 149 2 1 2 3 4 4 2 150 4 3 4 2 4 2 1 151 1 2 3 2 2 4 2 152 1 1 4 1 4 2 1 153 1 1 2 2 4 3 1 154 2 2 3 2 1 3 3 155 2 2 2 2 2 4 1 156 1 3 2 1 3 1 1 157 1 3 3 3 3 3 1 158 2 1 4 3 4 1 1 159 2 2 2 2 4 4 1 160 1 2 1 1 3 3 2 161 3 3 3 1 4 4 1 162 3 4 1 4 3 2 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Stress Depression Effort Focus Sleep 2.77263 0.08002 -0.02855 0.15769 -0.25668 -0.21164 Belong 0.08241 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.78916 -0.76168 -0.05268 0.60870 2.39224 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.77263 0.44130 6.283 3.21e-09 *** Stress 0.08002 0.09053 0.884 0.37816 Depression -0.02855 0.07955 -0.359 0.72019 Effort 0.15769 0.09022 1.748 0.08247 . Focus -0.25668 0.08373 -3.066 0.00256 ** Sleep -0.21164 0.07631 -2.773 0.00623 ** Belong 0.08241 0.08322 0.990 0.32357 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.9345 on 155 degrees of freedom Multiple R-squared: 0.1562, Adjusted R-squared: 0.1235 F-statistic: 4.782 on 6 and 155 DF, p-value: 0.0001680 > 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.634610516 0.730778967 0.365389484 [2,] 0.539609624 0.920780751 0.460390376 [3,] 0.433009645 0.866019290 0.566990355 [4,] 0.361183496 0.722366992 0.638816504 [5,] 0.269668717 0.539337434 0.730331283 [6,] 0.204615654 0.409231309 0.795384346 [7,] 0.137950993 0.275901987 0.862049007 [8,] 0.094919610 0.189839221 0.905080390 [9,] 0.074360982 0.148721964 0.925639018 [10,] 0.055436165 0.110872330 0.944563835 [11,] 0.036650726 0.073301452 0.963349274 [12,] 0.025976633 0.051953266 0.974023367 [13,] 0.015858263 0.031716527 0.984141737 [14,] 0.013478595 0.026957189 0.986521405 [15,] 0.016730210 0.033460419 0.983269790 [16,] 0.019589391 0.039178781 0.980410609 [17,] 0.018693593 0.037387186 0.981306407 [18,] 0.018556984 0.037113968 0.981443016 [19,] 0.014892331 0.029784662 0.985107669 [20,] 0.009775155 0.019550310 0.990224845 [21,] 0.010745847 0.021491693 0.989254153 [22,] 0.029539944 0.059079887 0.970460056 [23,] 0.053628527 0.107257054 0.946371473 [24,] 0.067770199 0.135540399 0.932229801 [25,] 0.061110583 0.122221166 0.938889417 [26,] 0.053205348 0.106410696 0.946794652 [27,] 0.094857072 0.189714144 0.905142928 [28,] 0.318403006 0.636806012 0.681596994 [29,] 0.301076066 0.602152132 0.698923934 [30,] 0.281654530 0.563309059 0.718345470 [31,] 0.405522168 0.811044335 0.594477832 [32,] 0.370925564 0.741851128 0.629074436 [33,] 0.338444831 0.676889662 0.661555169 [34,] 0.316077975 0.632155950 0.683922025 [35,] 0.483559723 0.967119445 0.516440277 [36,] 0.466081009 0.932162019 0.533918991 [37,] 0.451824981 0.903649963 0.548175019 [38,] 0.448272671 0.896545342 0.551727329 [39,] 0.415079372 0.830158743 0.584920628 [40,] 0.436981774 0.873963548 0.563018226 [41,] 0.422277910 0.844555820 0.577722090 [42,] 0.584483345 0.831033311 0.415516655 [43,] 0.537857478 0.924285044 0.462142522 [44,] 0.524534342 0.950931315 0.475465658 [45,] 0.669804241 0.660391517 0.330195759 [46,] 0.942285475 0.115429050 0.057714525 [47,] 0.943995120 0.112009760 0.056004880 [48,] 0.975963300 0.048073399 0.024036700 [49,] 0.975741447 0.048517106 0.024258553 [50,] 0.984971426 0.030057148 0.015028574 [51,] 0.990011949 0.019976102 0.009988051 [52,] 0.986415908 0.027168185 0.013584092 [53,] 0.991843253 0.016313493 0.008156747 [54,] 0.995616973 0.008766054 0.004383027 [55,] 0.996089218 0.007821563 0.003910782 [56,] 0.996496833 0.007006335 0.003503167 [57,] 0.997492216 0.005015567 0.002507784 [58,] 0.996469704 0.007060591 0.003530296 [59,] 0.997611976 0.004776048 0.002388024 [60,] 0.997770363 0.004459274 0.002229637 [61,] 0.997040555 0.005918890 0.002959445 [62,] 0.997543280 0.004913440 0.002456720 [63,] 0.997515147 0.004969707 0.002484853 [64,] 0.997701642 0.004596717 0.002298358 [65,] 0.997899111 0.004201778 0.002100889 [66,] 0.997989001 0.004021999 0.002010999 [67,] 0.997782623 0.004434754 0.002217377 [68,] 0.997127008 0.005745984 0.002872992 [69,] 0.995940246 0.008119507 0.004059754 [70,] 0.996396365 0.007207269 0.003603635 [71,] 0.995804127 0.008391746 0.004195873 [72,] 0.995362733 0.009274533 0.004637267 [73,] 0.995424299 0.009151401 0.004575701 [74,] 0.994408456 0.011183088 0.005591544 [75,] 0.995653576 0.008692848 0.004346424 [76,] 0.994191733 0.011616534 0.005808267 [77,] 0.991927037 0.016145925 0.008072963 [78,] 0.991570136 0.016859728 0.008429864 [79,] 0.992074679 0.015850642 0.007925321 [80,] 0.993092339 0.013815321 0.006907661 [81,] 0.992813390 0.014373219 0.007186610 [82,] 0.990494378 0.019011243 0.009505622 [83,] 0.993362539 0.013274921 0.006637461 [84,] 0.993175721 0.013648557 0.006824279 [85,] 0.991678436 0.016643128 0.008321564 [86,] 0.989694975 0.020610050 0.010305025 [87,] 0.988536475 0.022927050 0.011463525 [88,] 0.984594495 0.030811009 0.015405505 [89,] 0.980422637 0.039154726 0.019577363 [90,] 0.975371153 0.049257694 0.024628847 [91,] 0.974514511 0.050970978 0.025485489 [92,] 0.970528299 0.058943401 0.029471701 [93,] 0.970160811 0.059678379 0.029839189 [94,] 0.963902597 0.072194805 0.036097403 [95,] 0.958288998 0.083422004 0.041711002 [96,] 0.964920851 0.070158297 0.035079149 [97,] 0.954634520 0.090730959 0.045365480 [98,] 0.942553025 0.114893951 0.057446975 [99,] 0.945693277 0.108613446 0.054306723 [100,] 0.934282984 0.131434032 0.065717016 [101,] 0.918309588 0.163380823 0.081690412 [102,] 0.908978776 0.182042449 0.091021224 [103,] 0.888057710 0.223884579 0.111942290 [104,] 0.864107928 0.271784144 0.135892072 [105,] 0.860801165 0.278397670 0.139198835 [106,] 0.832922961 0.334154078 0.167077039 [107,] 0.825962418 0.348075163 0.174037582 [108,] 0.790572441 0.418855119 0.209427559 [109,] 0.798742677 0.402514646 0.201257323 [110,] 0.765892871 0.468214257 0.234107129 [111,] 0.774876731 0.450246539 0.225123269 [112,] 0.833454551 0.333090898 0.166545449 [113,] 0.796253882 0.407492236 0.203746118 [114,] 0.783774519 0.432450962 0.216225481 [115,] 0.741424654 0.517150691 0.258575346 [116,] 0.723111585 0.553776831 0.276888415 [117,] 0.685029897 0.629940206 0.314970103 [118,] 0.635079394 0.729841213 0.364920606 [119,] 0.612121067 0.775757865 0.387878933 [120,] 0.556851456 0.886297087 0.443148544 [121,] 0.561657280 0.876685440 0.438342720 [122,] 0.513148338 0.973703325 0.486851662 [123,] 0.482868152 0.965736304 0.517131848 [124,] 0.430073804 0.860147608 0.569926196 [125,] 0.368842520 0.737685039 0.631157480 [126,] 0.337827709 0.675655418 0.662172291 [127,] 0.279317763 0.558635527 0.720682237 [128,] 0.319495467 0.638990933 0.680504533 [129,] 0.264782085 0.529564170 0.735217915 [130,] 0.208740032 0.417480065 0.791259968 [131,] 0.218177956 0.436355911 0.781822044 [132,] 0.166928583 0.333857166 0.833071417 [133,] 0.129799257 0.259598513 0.870200743 [134,] 0.449583425 0.899166850 0.550416575 [135,] 0.408051691 0.816103381 0.591948309 [136,] 0.334732548 0.669465095 0.665267452 [137,] 0.282119841 0.564239681 0.717880159 [138,] 0.233941589 0.467883178 0.766058411 [139,] 0.446267424 0.892534848 0.553732576 [140,] 0.335587770 0.671175541 0.664412230 [141,] 0.449416010 0.898832020 0.550583990 [142,] 0.418729042 0.837458083 0.581270958 [143,] 0.275686176 0.551372352 0.724313824 > postscript(file="/var/www/rcomp/tmp/1mmvb1322145884.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/rcomp/tmp/2hihv1322145884.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/rcomp/tmp/3mfxq1322145884.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/rcomp/tmp/4vu9h1322145884.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/rcomp/tmp/5iod81322145884.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.213235140 1.300374603 0.644195439 0.415974589 -1.028479432 1.714752628 7 8 9 10 11 12 0.263985184 0.500773329 1.340688739 0.580874405 1.664975601 1.239307725 13 14 15 16 17 18 0.465885397 0.726603457 1.423096757 0.804280029 0.427264440 1.669707046 19 20 21 22 23 24 1.420706034 0.822753249 1.450946301 0.469919299 -0.548969917 0.921743541 25 26 27 28 29 30 -0.118093400 0.999205841 -0.421516318 -0.061674185 -0.762301673 -0.163138981 31 32 33 34 35 36 -0.706747565 1.070622060 -0.520506610 -0.263822452 0.724212734 -0.466645681 37 38 39 40 41 42 2.169612352 -0.532471424 -0.889839053 1.397085373 0.156899707 -0.645119709 43 44 45 46 47 48 0.662584878 1.818669347 -0.678200476 0.736177548 0.874223455 -0.972247071 49 50 51 52 53 54 -1.376386955 -0.263822452 -1.549053699 -0.918302360 0.609505275 1.839335523 55 56 57 58 59 60 2.392242727 0.644393206 -0.918171870 0.387591771 -1.057026521 -1.635411836 61 62 63 64 65 66 0.305965079 -1.174856028 -1.626680270 -0.616442130 -1.033210878 -1.789155583 67 68 69 70 71 72 0.355094563 -1.473745268 -0.873126288 -0.132201170 -0.788377548 -0.976116700 73 74 75 76 77 78 -1.146308939 -1.283470412 -1.417348635 0.484358617 -0.082424143 0.004151558 79 80 81 82 83 84 -1.235950326 -0.583861140 -0.786684370 -0.774219778 0.228120944 -1.169624805 85 86 87 88 89 90 0.148103650 -0.022939242 -0.745672689 0.717227132 1.123808026 1.073710327 91 92 93 94 95 96 0.003133342 -1.289197492 -1.016514618 0.757621758 0.442908988 -0.759830460 97 98 99 100 101 102 0.336819110 0.122706029 0.148103650 -1.063534927 -0.722665791 0.790819803 103 104 105 106 107 108 0.545983182 -0.474599213 1.317929894 -0.032513334 -0.049793152 0.606272026 109 110 111 112 113 114 -0.184480120 0.261536552 0.389982494 0.131605157 -0.373999524 -0.608561217 115 116 117 118 119 120 0.122706029 -1.075949518 0.230595449 0.988069061 -0.428619197 1.075403506 121 122 123 124 125 126 0.813742920 0.205197827 -0.637108306 -0.402546612 -1.157709992 -0.797276677 127 128 129 130 131 132 -0.614185189 -0.768729588 0.131605157 -1.133894348 -0.659146989 1.049978465 133 134 135 136 137 138 -0.108580508 0.416836404 -0.877968934 -0.266079393 0.973911291 -0.108496727 139 140 141 142 143 144 -0.110189906 -0.952496039 -0.263124907 -0.266110104 2.214771919 -1.002356847 145 146 147 148 149 150 0.359742227 0.305797516 -0.790718271 -0.609236180 0.439843302 2.153727622 151 152 153 154 155 156 -0.967301353 -0.528543923 -0.531693390 -0.518032106 0.086559575 -1.213995424 157 158 159 160 161 162 -1.077558915 -0.055570233 0.599927892 -0.821656083 1.706151553 0.415997170 > postscript(file="/var/www/rcomp/tmp/6wiq71322145884.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.213235140 NA 1 1.300374603 0.213235140 2 0.644195439 1.300374603 3 0.415974589 0.644195439 4 -1.028479432 0.415974589 5 1.714752628 -1.028479432 6 0.263985184 1.714752628 7 0.500773329 0.263985184 8 1.340688739 0.500773329 9 0.580874405 1.340688739 10 1.664975601 0.580874405 11 1.239307725 1.664975601 12 0.465885397 1.239307725 13 0.726603457 0.465885397 14 1.423096757 0.726603457 15 0.804280029 1.423096757 16 0.427264440 0.804280029 17 1.669707046 0.427264440 18 1.420706034 1.669707046 19 0.822753249 1.420706034 20 1.450946301 0.822753249 21 0.469919299 1.450946301 22 -0.548969917 0.469919299 23 0.921743541 -0.548969917 24 -0.118093400 0.921743541 25 0.999205841 -0.118093400 26 -0.421516318 0.999205841 27 -0.061674185 -0.421516318 28 -0.762301673 -0.061674185 29 -0.163138981 -0.762301673 30 -0.706747565 -0.163138981 31 1.070622060 -0.706747565 32 -0.520506610 1.070622060 33 -0.263822452 -0.520506610 34 0.724212734 -0.263822452 35 -0.466645681 0.724212734 36 2.169612352 -0.466645681 37 -0.532471424 2.169612352 38 -0.889839053 -0.532471424 39 1.397085373 -0.889839053 40 0.156899707 1.397085373 41 -0.645119709 0.156899707 42 0.662584878 -0.645119709 43 1.818669347 0.662584878 44 -0.678200476 1.818669347 45 0.736177548 -0.678200476 46 0.874223455 0.736177548 47 -0.972247071 0.874223455 48 -1.376386955 -0.972247071 49 -0.263822452 -1.376386955 50 -1.549053699 -0.263822452 51 -0.918302360 -1.549053699 52 0.609505275 -0.918302360 53 1.839335523 0.609505275 54 2.392242727 1.839335523 55 0.644393206 2.392242727 56 -0.918171870 0.644393206 57 0.387591771 -0.918171870 58 -1.057026521 0.387591771 59 -1.635411836 -1.057026521 60 0.305965079 -1.635411836 61 -1.174856028 0.305965079 62 -1.626680270 -1.174856028 63 -0.616442130 -1.626680270 64 -1.033210878 -0.616442130 65 -1.789155583 -1.033210878 66 0.355094563 -1.789155583 67 -1.473745268 0.355094563 68 -0.873126288 -1.473745268 69 -0.132201170 -0.873126288 70 -0.788377548 -0.132201170 71 -0.976116700 -0.788377548 72 -1.146308939 -0.976116700 73 -1.283470412 -1.146308939 74 -1.417348635 -1.283470412 75 0.484358617 -1.417348635 76 -0.082424143 0.484358617 77 0.004151558 -0.082424143 78 -1.235950326 0.004151558 79 -0.583861140 -1.235950326 80 -0.786684370 -0.583861140 81 -0.774219778 -0.786684370 82 0.228120944 -0.774219778 83 -1.169624805 0.228120944 84 0.148103650 -1.169624805 85 -0.022939242 0.148103650 86 -0.745672689 -0.022939242 87 0.717227132 -0.745672689 88 1.123808026 0.717227132 89 1.073710327 1.123808026 90 0.003133342 1.073710327 91 -1.289197492 0.003133342 92 -1.016514618 -1.289197492 93 0.757621758 -1.016514618 94 0.442908988 0.757621758 95 -0.759830460 0.442908988 96 0.336819110 -0.759830460 97 0.122706029 0.336819110 98 0.148103650 0.122706029 99 -1.063534927 0.148103650 100 -0.722665791 -1.063534927 101 0.790819803 -0.722665791 102 0.545983182 0.790819803 103 -0.474599213 0.545983182 104 1.317929894 -0.474599213 105 -0.032513334 1.317929894 106 -0.049793152 -0.032513334 107 0.606272026 -0.049793152 108 -0.184480120 0.606272026 109 0.261536552 -0.184480120 110 0.389982494 0.261536552 111 0.131605157 0.389982494 112 -0.373999524 0.131605157 113 -0.608561217 -0.373999524 114 0.122706029 -0.608561217 115 -1.075949518 0.122706029 116 0.230595449 -1.075949518 117 0.988069061 0.230595449 118 -0.428619197 0.988069061 119 1.075403506 -0.428619197 120 0.813742920 1.075403506 121 0.205197827 0.813742920 122 -0.637108306 0.205197827 123 -0.402546612 -0.637108306 124 -1.157709992 -0.402546612 125 -0.797276677 -1.157709992 126 -0.614185189 -0.797276677 127 -0.768729588 -0.614185189 128 0.131605157 -0.768729588 129 -1.133894348 0.131605157 130 -0.659146989 -1.133894348 131 1.049978465 -0.659146989 132 -0.108580508 1.049978465 133 0.416836404 -0.108580508 134 -0.877968934 0.416836404 135 -0.266079393 -0.877968934 136 0.973911291 -0.266079393 137 -0.108496727 0.973911291 138 -0.110189906 -0.108496727 139 -0.952496039 -0.110189906 140 -0.263124907 -0.952496039 141 -0.266110104 -0.263124907 142 2.214771919 -0.266110104 143 -1.002356847 2.214771919 144 0.359742227 -1.002356847 145 0.305797516 0.359742227 146 -0.790718271 0.305797516 147 -0.609236180 -0.790718271 148 0.439843302 -0.609236180 149 2.153727622 0.439843302 150 -0.967301353 2.153727622 151 -0.528543923 -0.967301353 152 -0.531693390 -0.528543923 153 -0.518032106 -0.531693390 154 0.086559575 -0.518032106 155 -1.213995424 0.086559575 156 -1.077558915 -1.213995424 157 -0.055570233 -1.077558915 158 0.599927892 -0.055570233 159 -0.821656083 0.599927892 160 1.706151553 -0.821656083 161 0.415997170 1.706151553 162 NA 0.415997170 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.300374603 0.213235140 [2,] 0.644195439 1.300374603 [3,] 0.415974589 0.644195439 [4,] -1.028479432 0.415974589 [5,] 1.714752628 -1.028479432 [6,] 0.263985184 1.714752628 [7,] 0.500773329 0.263985184 [8,] 1.340688739 0.500773329 [9,] 0.580874405 1.340688739 [10,] 1.664975601 0.580874405 [11,] 1.239307725 1.664975601 [12,] 0.465885397 1.239307725 [13,] 0.726603457 0.465885397 [14,] 1.423096757 0.726603457 [15,] 0.804280029 1.423096757 [16,] 0.427264440 0.804280029 [17,] 1.669707046 0.427264440 [18,] 1.420706034 1.669707046 [19,] 0.822753249 1.420706034 [20,] 1.450946301 0.822753249 [21,] 0.469919299 1.450946301 [22,] -0.548969917 0.469919299 [23,] 0.921743541 -0.548969917 [24,] -0.118093400 0.921743541 [25,] 0.999205841 -0.118093400 [26,] -0.421516318 0.999205841 [27,] -0.061674185 -0.421516318 [28,] -0.762301673 -0.061674185 [29,] -0.163138981 -0.762301673 [30,] -0.706747565 -0.163138981 [31,] 1.070622060 -0.706747565 [32,] -0.520506610 1.070622060 [33,] -0.263822452 -0.520506610 [34,] 0.724212734 -0.263822452 [35,] -0.466645681 0.724212734 [36,] 2.169612352 -0.466645681 [37,] -0.532471424 2.169612352 [38,] -0.889839053 -0.532471424 [39,] 1.397085373 -0.889839053 [40,] 0.156899707 1.397085373 [41,] -0.645119709 0.156899707 [42,] 0.662584878 -0.645119709 [43,] 1.818669347 0.662584878 [44,] -0.678200476 1.818669347 [45,] 0.736177548 -0.678200476 [46,] 0.874223455 0.736177548 [47,] -0.972247071 0.874223455 [48,] -1.376386955 -0.972247071 [49,] -0.263822452 -1.376386955 [50,] -1.549053699 -0.263822452 [51,] -0.918302360 -1.549053699 [52,] 0.609505275 -0.918302360 [53,] 1.839335523 0.609505275 [54,] 2.392242727 1.839335523 [55,] 0.644393206 2.392242727 [56,] -0.918171870 0.644393206 [57,] 0.387591771 -0.918171870 [58,] -1.057026521 0.387591771 [59,] -1.635411836 -1.057026521 [60,] 0.305965079 -1.635411836 [61,] -1.174856028 0.305965079 [62,] -1.626680270 -1.174856028 [63,] -0.616442130 -1.626680270 [64,] -1.033210878 -0.616442130 [65,] -1.789155583 -1.033210878 [66,] 0.355094563 -1.789155583 [67,] -1.473745268 0.355094563 [68,] -0.873126288 -1.473745268 [69,] -0.132201170 -0.873126288 [70,] -0.788377548 -0.132201170 [71,] -0.976116700 -0.788377548 [72,] -1.146308939 -0.976116700 [73,] -1.283470412 -1.146308939 [74,] -1.417348635 -1.283470412 [75,] 0.484358617 -1.417348635 [76,] -0.082424143 0.484358617 [77,] 0.004151558 -0.082424143 [78,] -1.235950326 0.004151558 [79,] -0.583861140 -1.235950326 [80,] -0.786684370 -0.583861140 [81,] -0.774219778 -0.786684370 [82,] 0.228120944 -0.774219778 [83,] -1.169624805 0.228120944 [84,] 0.148103650 -1.169624805 [85,] -0.022939242 0.148103650 [86,] -0.745672689 -0.022939242 [87,] 0.717227132 -0.745672689 [88,] 1.123808026 0.717227132 [89,] 1.073710327 1.123808026 [90,] 0.003133342 1.073710327 [91,] -1.289197492 0.003133342 [92,] -1.016514618 -1.289197492 [93,] 0.757621758 -1.016514618 [94,] 0.442908988 0.757621758 [95,] -0.759830460 0.442908988 [96,] 0.336819110 -0.759830460 [97,] 0.122706029 0.336819110 [98,] 0.148103650 0.122706029 [99,] -1.063534927 0.148103650 [100,] -0.722665791 -1.063534927 [101,] 0.790819803 -0.722665791 [102,] 0.545983182 0.790819803 [103,] -0.474599213 0.545983182 [104,] 1.317929894 -0.474599213 [105,] -0.032513334 1.317929894 [106,] -0.049793152 -0.032513334 [107,] 0.606272026 -0.049793152 [108,] -0.184480120 0.606272026 [109,] 0.261536552 -0.184480120 [110,] 0.389982494 0.261536552 [111,] 0.131605157 0.389982494 [112,] -0.373999524 0.131605157 [113,] -0.608561217 -0.373999524 [114,] 0.122706029 -0.608561217 [115,] -1.075949518 0.122706029 [116,] 0.230595449 -1.075949518 [117,] 0.988069061 0.230595449 [118,] -0.428619197 0.988069061 [119,] 1.075403506 -0.428619197 [120,] 0.813742920 1.075403506 [121,] 0.205197827 0.813742920 [122,] -0.637108306 0.205197827 [123,] -0.402546612 -0.637108306 [124,] -1.157709992 -0.402546612 [125,] -0.797276677 -1.157709992 [126,] -0.614185189 -0.797276677 [127,] -0.768729588 -0.614185189 [128,] 0.131605157 -0.768729588 [129,] -1.133894348 0.131605157 [130,] -0.659146989 -1.133894348 [131,] 1.049978465 -0.659146989 [132,] -0.108580508 1.049978465 [133,] 0.416836404 -0.108580508 [134,] -0.877968934 0.416836404 [135,] -0.266079393 -0.877968934 [136,] 0.973911291 -0.266079393 [137,] -0.108496727 0.973911291 [138,] -0.110189906 -0.108496727 [139,] -0.952496039 -0.110189906 [140,] -0.263124907 -0.952496039 [141,] -0.266110104 -0.263124907 [142,] 2.214771919 -0.266110104 [143,] -1.002356847 2.214771919 [144,] 0.359742227 -1.002356847 [145,] 0.305797516 0.359742227 [146,] -0.790718271 0.305797516 [147,] -0.609236180 -0.790718271 [148,] 0.439843302 -0.609236180 [149,] 2.153727622 0.439843302 [150,] -0.967301353 2.153727622 [151,] -0.528543923 -0.967301353 [152,] -0.531693390 -0.528543923 [153,] -0.518032106 -0.531693390 [154,] 0.086559575 -0.518032106 [155,] -1.213995424 0.086559575 [156,] -1.077558915 -1.213995424 [157,] -0.055570233 -1.077558915 [158,] 0.599927892 -0.055570233 [159,] -0.821656083 0.599927892 [160,] 1.706151553 -0.821656083 [161,] 0.415997170 1.706151553 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.300374603 0.213235140 2 0.644195439 1.300374603 3 0.415974589 0.644195439 4 -1.028479432 0.415974589 5 1.714752628 -1.028479432 6 0.263985184 1.714752628 7 0.500773329 0.263985184 8 1.340688739 0.500773329 9 0.580874405 1.340688739 10 1.664975601 0.580874405 11 1.239307725 1.664975601 12 0.465885397 1.239307725 13 0.726603457 0.465885397 14 1.423096757 0.726603457 15 0.804280029 1.423096757 16 0.427264440 0.804280029 17 1.669707046 0.427264440 18 1.420706034 1.669707046 19 0.822753249 1.420706034 20 1.450946301 0.822753249 21 0.469919299 1.450946301 22 -0.548969917 0.469919299 23 0.921743541 -0.548969917 24 -0.118093400 0.921743541 25 0.999205841 -0.118093400 26 -0.421516318 0.999205841 27 -0.061674185 -0.421516318 28 -0.762301673 -0.061674185 29 -0.163138981 -0.762301673 30 -0.706747565 -0.163138981 31 1.070622060 -0.706747565 32 -0.520506610 1.070622060 33 -0.263822452 -0.520506610 34 0.724212734 -0.263822452 35 -0.466645681 0.724212734 36 2.169612352 -0.466645681 37 -0.532471424 2.169612352 38 -0.889839053 -0.532471424 39 1.397085373 -0.889839053 40 0.156899707 1.397085373 41 -0.645119709 0.156899707 42 0.662584878 -0.645119709 43 1.818669347 0.662584878 44 -0.678200476 1.818669347 45 0.736177548 -0.678200476 46 0.874223455 0.736177548 47 -0.972247071 0.874223455 48 -1.376386955 -0.972247071 49 -0.263822452 -1.376386955 50 -1.549053699 -0.263822452 51 -0.918302360 -1.549053699 52 0.609505275 -0.918302360 53 1.839335523 0.609505275 54 2.392242727 1.839335523 55 0.644393206 2.392242727 56 -0.918171870 0.644393206 57 0.387591771 -0.918171870 58 -1.057026521 0.387591771 59 -1.635411836 -1.057026521 60 0.305965079 -1.635411836 61 -1.174856028 0.305965079 62 -1.626680270 -1.174856028 63 -0.616442130 -1.626680270 64 -1.033210878 -0.616442130 65 -1.789155583 -1.033210878 66 0.355094563 -1.789155583 67 -1.473745268 0.355094563 68 -0.873126288 -1.473745268 69 -0.132201170 -0.873126288 70 -0.788377548 -0.132201170 71 -0.976116700 -0.788377548 72 -1.146308939 -0.976116700 73 -1.283470412 -1.146308939 74 -1.417348635 -1.283470412 75 0.484358617 -1.417348635 76 -0.082424143 0.484358617 77 0.004151558 -0.082424143 78 -1.235950326 0.004151558 79 -0.583861140 -1.235950326 80 -0.786684370 -0.583861140 81 -0.774219778 -0.786684370 82 0.228120944 -0.774219778 83 -1.169624805 0.228120944 84 0.148103650 -1.169624805 85 -0.022939242 0.148103650 86 -0.745672689 -0.022939242 87 0.717227132 -0.745672689 88 1.123808026 0.717227132 89 1.073710327 1.123808026 90 0.003133342 1.073710327 91 -1.289197492 0.003133342 92 -1.016514618 -1.289197492 93 0.757621758 -1.016514618 94 0.442908988 0.757621758 95 -0.759830460 0.442908988 96 0.336819110 -0.759830460 97 0.122706029 0.336819110 98 0.148103650 0.122706029 99 -1.063534927 0.148103650 100 -0.722665791 -1.063534927 101 0.790819803 -0.722665791 102 0.545983182 0.790819803 103 -0.474599213 0.545983182 104 1.317929894 -0.474599213 105 -0.032513334 1.317929894 106 -0.049793152 -0.032513334 107 0.606272026 -0.049793152 108 -0.184480120 0.606272026 109 0.261536552 -0.184480120 110 0.389982494 0.261536552 111 0.131605157 0.389982494 112 -0.373999524 0.131605157 113 -0.608561217 -0.373999524 114 0.122706029 -0.608561217 115 -1.075949518 0.122706029 116 0.230595449 -1.075949518 117 0.988069061 0.230595449 118 -0.428619197 0.988069061 119 1.075403506 -0.428619197 120 0.813742920 1.075403506 121 0.205197827 0.813742920 122 -0.637108306 0.205197827 123 -0.402546612 -0.637108306 124 -1.157709992 -0.402546612 125 -0.797276677 -1.157709992 126 -0.614185189 -0.797276677 127 -0.768729588 -0.614185189 128 0.131605157 -0.768729588 129 -1.133894348 0.131605157 130 -0.659146989 -1.133894348 131 1.049978465 -0.659146989 132 -0.108580508 1.049978465 133 0.416836404 -0.108580508 134 -0.877968934 0.416836404 135 -0.266079393 -0.877968934 136 0.973911291 -0.266079393 137 -0.108496727 0.973911291 138 -0.110189906 -0.108496727 139 -0.952496039 -0.110189906 140 -0.263124907 -0.952496039 141 -0.266110104 -0.263124907 142 2.214771919 -0.266110104 143 -1.002356847 2.214771919 144 0.359742227 -1.002356847 145 0.305797516 0.359742227 146 -0.790718271 0.305797516 147 -0.609236180 -0.790718271 148 0.439843302 -0.609236180 149 2.153727622 0.439843302 150 -0.967301353 2.153727622 151 -0.528543923 -0.967301353 152 -0.531693390 -0.528543923 153 -0.518032106 -0.531693390 154 0.086559575 -0.518032106 155 -1.213995424 0.086559575 156 -1.077558915 -1.213995424 157 -0.055570233 -1.077558915 158 0.599927892 -0.055570233 159 -0.821656083 0.599927892 160 1.706151553 -0.821656083 161 0.415997170 1.706151553 > 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/rcomp/tmp/7tok51322145884.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/rcomp/tmp/8pnxb1322145884.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/rcomp/tmp/99snq1322145884.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/rcomp/tmp/10b4my1322145884.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11kjog1322145884.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/rcomp/tmp/12dxxw1322145884.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/rcomp/tmp/13ma5j1322145884.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/rcomp/tmp/14tvrm1322145884.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/rcomp/tmp/15kbsa1322145884.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/rcomp/tmp/16ypl81322145884.tab") + } > > try(system("convert tmp/1mmvb1322145884.ps tmp/1mmvb1322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/2hihv1322145884.ps tmp/2hihv1322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/3mfxq1322145884.ps tmp/3mfxq1322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/4vu9h1322145884.ps tmp/4vu9h1322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/5iod81322145884.ps tmp/5iod81322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/6wiq71322145884.ps tmp/6wiq71322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/7tok51322145884.ps tmp/7tok51322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/8pnxb1322145884.ps tmp/8pnxb1322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/99snq1322145884.ps tmp/99snq1322145884.png",intern=TRUE)) character(0) > try(system("convert tmp/10b4my1322145884.ps tmp/10b4my1322145884.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.86 0.32 6.17