R version 2.12.1 (2010-12-16) 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(14 + ,3 + ,2 + ,3 + ,3 + ,3 + ,7 + ,6 + ,8 + ,5 + ,6 + ,0 + ,7 + ,7 + ,2 + ,7 + ,12 + ,6 + ,6 + ,0 + ,6 + ,8 + ,3 + ,8 + ,7 + ,6 + ,6 + ,6 + ,6 + ,9 + ,8 + ,8 + ,10 + ,7 + ,8 + ,5 + ,5 + ,5 + ,7 + ,9 + ,9 + ,3 + ,1 + ,0 + ,7 + ,7 + ,7 + ,8 + ,16 + ,8 + ,9 + ,8 + ,8 + ,8 + ,9 + ,8 + ,7 + ,4 + ,4 + ,0 + ,2 + ,3 + ,2 + ,7 + ,14 + ,7 + ,7 + ,0 + ,4 + ,8 + ,4 + ,7 + ,6 + ,4 + ,4 + ,9 + ,9 + ,4 + ,4 + ,4 + ,16 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,11 + ,6 + ,5 + ,6 + ,6 + ,4 + ,4 + ,7 + ,17 + ,7 + ,7 + ,5 + ,5 + ,8 + ,9 + ,5 + ,12 + ,4 + ,5 + ,4 + ,4 + ,8 + ,8 + ,8 + ,7 + ,6 + ,6 + ,0 + ,2 + ,2 + ,7 + ,5 + ,13 + ,5 + ,5 + ,0 + ,4 + ,9 + ,4 + ,4 + ,9 + ,0 + ,2 + ,2 + ,2 + ,2 + ,2 + ,9 + ,15 + ,9 + ,9 + ,6 + ,6 + ,8 + ,8 + ,8 + ,7 + ,4 + ,4 + ,0 + ,4 + ,8 + ,4 + ,4 + ,9 + ,4 + ,4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 + ,6 + ,6 + ,6 + ,6 + ,6 + ,16 + ,6 + ,6 + ,6 + ,6 + ,9 + ,6 + ,6 + ,12 + ,8 + ,8 + ,8 + ,8 + ,8 + ,9 + ,6 + ,12 + ,7 + ,7 + ,2 + ,2 + ,4 + ,4 + ,4 + ,15 + ,7 + ,7 + ,7 + ,7 + ,7 + ,7 + ,7 + ,9 + ,0 + ,9 + ,0 + ,4 + ,4 + ,4 + ,8 + ,13 + ,6 + ,2 + ,0 + ,6 + ,8 + ,7 + ,7 + ,14 + ,6 + ,6 + ,5 + ,5 + ,5 + ,5 + ,9 + ,11 + ,5 + ,5 + ,0 + ,2 + ,9 + ,2 + ,6) + ,dim=c(8 + ,156) + ,dimnames=list(c('Schoolprestaties' + ,'Sport' + ,'GoingOut' + ,'Relation' + ,'Family' + ,'Friends' + ,'Coach' + ,'Job') + ,1:156)) > y <- array(NA,dim=c(8,156),dimnames=list(c('Schoolprestaties','Sport','GoingOut','Relation','Family','Friends','Coach','Job'),1:156)) > 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 Schoolprestaties Sport GoingOut Relation Family Friends Coach Job 1 14 3 2 3 3 3 7 6 2 8 5 6 0 7 7 2 7 3 12 6 6 0 6 8 3 8 4 7 6 6 6 6 9 8 8 5 10 7 8 5 5 5 7 9 6 9 3 1 0 7 7 7 8 7 16 8 9 8 8 8 9 8 8 7 4 4 0 2 3 2 7 9 14 7 7 0 4 8 4 7 10 6 4 4 9 9 4 4 4 11 16 6 6 6 6 6 6 6 12 11 6 5 6 6 4 4 7 13 17 7 7 5 5 8 9 5 14 12 4 5 4 4 8 8 8 15 7 6 6 0 2 2 7 5 16 13 5 5 0 4 9 4 4 17 9 0 2 2 2 2 2 9 18 15 9 9 6 6 8 8 8 19 7 4 4 0 4 8 4 4 20 9 4 4 4 4 4 4 6 21 7 2 5 5 5 5 2 6 22 14 7 7 7 7 7 9 7 23 15 5 5 5 5 3 3 3 24 7 9 9 4 4 4 4 4 25 13 6 6 6 6 6 6 6 26 17 6 6 6 6 6 6 6 27 15 7 3 0 7 9 7 7 28 14 3 3 1 2 2 2 5 29 14 6 5 0 6 6 6 8 30 8 6 5 4 4 4 4 6 31 8 4 4 4 4 8 2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 5 7 89 12 7 7 0 8 8 8 8 90 9 4 2 4 4 3 3 9 91 12 6 6 2 2 2 2 9 92 13 8 8 7 7 7 7 7 93 16 7 7 7 7 7 7 8 94 16 6 6 6 6 4 9 4 95 11 7 7 0 5 5 5 6 96 8 4 4 5 5 9 5 7 97 4 0 5 6 6 6 2 6 98 7 3 2 0 3 3 3 7 99 14 5 5 5 5 5 5 5 100 11 6 2 9 9 2 2 9 101 17 5 5 0 7 7 7 7 102 15 7 7 7 7 7 7 7 103 14 6 5 1 6 6 6 6 104 5 8 8 3 3 8 3 6 105 4 7 2 7 7 9 3 9 106 19 8 8 8 8 8 2 9 107 11 3 3 0 3 3 3 8 108 15 8 2 5 5 5 5 8 109 10 3 3 3 3 3 3 3 110 9 4 5 0 4 4 4 6 111 12 2 2 5 5 5 5 5 112 15 7 2 7 7 9 7 7 113 7 6 6 0 6 6 6 6 114 13 2 2 0 7 7 7 7 115 14 7 7 0 9 7 2 7 116 14 6 6 6 6 6 6 6 117 14 6 2 0 6 3 9 8 118 8 6 2 6 6 9 4 9 119 15 6 5 6 6 6 6 6 120 15 6 6 2 2 2 2 9 121 9 4 4 5 5 5 2 5 122 16 5 5 0 5 5 5 6 123 9 7 7 4 4 9 4 4 124 15 6 6 0 7 7 7 7 125 15 6 6 6 6 6 6 6 126 6 5 5 5 5 8 7 8 127 8 8 2 8 8 8 8 8 128 15 6 6 6 6 6 6 9 129 10 0 3 5 5 3 3 8 130 9 4 2 0 4 4 4 4 131 14 8 8 8 8 9 8 6 132 12 6 6 0 6 6 9 6 133 8 4 4 9 9 4 2 7 134 11 6 6 5 5 5 5 9 135 13 2 5 0 6 6 6 8 136 9 4 4 0 4 4 4 4 137 15 6 2 0 6 6 6 6 138 13 3 3 3 3 3 3 9 139 15 6 6 6 6 6 6 6 140 14 5 5 0 5 5 5 5 141 16 4 4 4 4 9 8 8 142 12 6 6 6 6 6 6 6 143 14 1 1 0 5 9 5 6 144 10 4 5 4 4 3 3 6 145 10 4 2 7 7 7 2 7 146 4 6 6 0 6 6 6 7 147 8 5 5 5 5 5 5 9 148 17 9 2 6 6 6 6 6 149 16 6 6 6 6 9 6 6 150 12 8 8 8 8 8 9 6 151 12 7 7 2 2 4 4 4 152 15 7 7 7 7 7 7 7 153 9 0 9 0 4 4 4 8 154 13 6 2 0 6 8 7 7 155 14 6 6 5 5 5 5 9 156 11 5 5 0 2 9 2 6 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Sport GoingOut Relation Family Friends 6.43367 0.45018 0.08537 -0.13816 0.29524 -0.07492 Coach Job 0.31831 0.02064 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.023 -2.094 0.645 2.147 6.908 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.43367 1.45681 4.416 1.93e-05 *** Sport 0.45018 0.17659 2.549 0.0118 * GoingOut 0.08537 0.14353 0.595 0.5529 Relation -0.13816 0.10057 -1.374 0.1716 Family 0.29524 0.18935 1.559 0.1211 Friends -0.07492 0.13832 -0.542 0.5889 Coach 0.31831 0.13907 2.289 0.0235 * Job 0.02064 0.16715 0.123 0.9019 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.225 on 148 degrees of freedom Multiple R-squared: 0.1862, Adjusted R-squared: 0.1478 F-statistic: 4.839 on 7 and 148 DF, p-value: 6.203e-05 > 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.5871268 0.8257464 0.41287318 [2,] 0.4294500 0.8589001 0.57054996 [3,] 0.5054570 0.9890861 0.49454304 [4,] 0.6006882 0.7986235 0.39931176 [5,] 0.8541247 0.2917507 0.14587534 [6,] 0.7903948 0.4192104 0.20960522 [7,] 0.7912955 0.4174090 0.20870451 [8,] 0.7197822 0.5604357 0.28021784 [9,] 0.7462969 0.5074061 0.25370306 [10,] 0.6792196 0.6415609 0.32078045 [11,] 0.6055781 0.7888438 0.39442192 [12,] 0.5293331 0.9413338 0.47066692 [13,] 0.6247425 0.7505150 0.37525751 [14,] 0.7387537 0.5224927 0.26124634 [15,] 0.6811209 0.6377581 0.31887906 [16,] 0.7426142 0.5147716 0.25738580 [17,] 0.6900665 0.6198670 0.30993350 [18,] 0.7552498 0.4895005 0.24475024 [19,] 0.7454912 0.5090176 0.25450882 [20,] 0.7611837 0.4776325 0.23881627 [21,] 0.7400414 0.5199172 0.25995860 [22,] 0.6936022 0.6127957 0.30639783 [23,] 0.6393092 0.7213816 0.36069080 [24,] 0.6252391 0.7495217 0.37476085 [25,] 0.5677274 0.8645451 0.43227256 [26,] 0.5648893 0.8702214 0.43511068 [27,] 0.5133945 0.9732110 0.48660550 [28,] 0.5105423 0.9789154 0.48945769 [29,] 0.4558791 0.9117583 0.54412086 [30,] 0.4928585 0.9857171 0.50714147 [31,] 0.5465602 0.9068796 0.45343981 [32,] 0.6662544 0.6674913 0.33374563 [33,] 0.6314703 0.7370594 0.36852970 [34,] 0.5801549 0.8396902 0.41984510 [35,] 0.5912396 0.8175208 0.40876042 [36,] 0.5390583 0.9218833 0.46094167 [37,] 0.5107189 0.9785623 0.48928114 [38,] 0.5679918 0.8640164 0.43200821 [39,] 0.5364593 0.9270814 0.46354069 [40,] 0.5001277 0.9997446 0.49987231 [41,] 0.7830937 0.4338127 0.21690635 [42,] 0.7645962 0.4708077 0.23540385 [43,] 0.7270483 0.5459034 0.27295169 [44,] 0.7048232 0.5903536 0.29517682 [45,] 0.6699082 0.6601836 0.33009181 [46,] 0.6324526 0.7350948 0.36754741 [47,] 0.6134102 0.7731797 0.38658984 [48,] 0.6342608 0.7314785 0.36573925 [49,] 0.5937083 0.8125833 0.40629166 [50,] 0.5513471 0.8973057 0.44865286 [51,] 0.5086737 0.9826526 0.49132628 [52,] 0.7306207 0.5387586 0.26937932 [53,] 0.8190564 0.3618872 0.18094361 [54,] 0.8031957 0.3936087 0.19680433 [55,] 0.8497940 0.3004121 0.15020604 [56,] 0.8255591 0.3488819 0.17444095 [57,] 0.8296858 0.3406283 0.17031417 [58,] 0.8292681 0.3414639 0.17073195 [59,] 0.7972828 0.4054344 0.20271722 [60,] 0.8611666 0.2776668 0.13883339 [61,] 0.8459830 0.3080341 0.15401704 [62,] 0.8219472 0.3561057 0.17805283 [63,] 0.7964561 0.4070878 0.20354389 [64,] 0.7791096 0.4417808 0.22089038 [65,] 0.7439368 0.5121263 0.25606317 [66,] 0.7159580 0.5680841 0.28404203 [67,] 0.6925420 0.6149160 0.30745802 [68,] 0.6605086 0.6789829 0.33949143 [69,] 0.6548858 0.6902283 0.34511416 [70,] 0.6479157 0.7041685 0.35208426 [71,] 0.7017594 0.5964811 0.29824057 [72,] 0.6588365 0.6823271 0.34116353 [73,] 0.6227883 0.7544235 0.37721173 [74,] 0.5989441 0.8021119 0.40105595 [75,] 0.5809746 0.8380509 0.41902544 [76,] 0.5370984 0.9258033 0.46290163 [77,] 0.5001607 0.9996786 0.49983929 [78,] 0.4573861 0.9147722 0.54261391 [79,] 0.4375202 0.8750404 0.56247982 [80,] 0.3974564 0.7949127 0.60254363 [81,] 0.3579731 0.7159462 0.64202689 [82,] 0.3166060 0.6332120 0.68339400 [83,] 0.3010546 0.6021092 0.69894542 [84,] 0.2809062 0.5618124 0.71909381 [85,] 0.2542398 0.5084797 0.74576017 [86,] 0.2361247 0.4722494 0.76387528 [87,] 0.2649724 0.5299448 0.73502758 [88,] 0.2583089 0.5166178 0.74169109 [89,] 0.2413570 0.4827141 0.75864295 [90,] 0.2061792 0.4123585 0.79382075 [91,] 0.2250434 0.4500867 0.77495664 [92,] 0.1989594 0.3979188 0.80104060 [93,] 0.1709730 0.3419460 0.82902701 [94,] 0.2843770 0.5687540 0.71562299 [95,] 0.5146535 0.9706930 0.48534652 [96,] 0.6834959 0.6330083 0.31650413 [97,] 0.6386179 0.7227641 0.36138206 [98,] 0.6106179 0.7787642 0.38938211 [99,] 0.5627258 0.8745484 0.43727421 [100,] 0.5362015 0.9275970 0.46379850 [101,] 0.4946037 0.9892074 0.50539628 [102,] 0.4647666 0.9295332 0.53523339 [103,] 0.5832033 0.8335935 0.41679675 [104,] 0.5370060 0.9259880 0.46299398 [105,] 0.5337676 0.9324649 0.46623244 [106,] 0.4905100 0.9810201 0.50948995 [107,] 0.4346074 0.8692147 0.56539264 [108,] 0.4351878 0.8703757 0.56481215 [109,] 0.4163873 0.8327746 0.58361271 [110,] 0.4383254 0.8766507 0.56167464 [111,] 0.3875953 0.7751907 0.61240467 [112,] 0.4348858 0.8697716 0.56511420 [113,] 0.4366313 0.8732625 0.56336875 [114,] 0.4435803 0.8871606 0.55641969 [115,] 0.4198508 0.8397015 0.58014925 [116,] 0.7108991 0.5782019 0.28910093 [117,] 0.9110509 0.1778982 0.08894909 [118,] 0.9020916 0.1958167 0.09790835 [119,] 0.8726271 0.2547459 0.12737293 [120,] 0.8784577 0.2430846 0.12154232 [121,] 0.8370579 0.3258842 0.16294210 [122,] 0.7918734 0.4162531 0.20812656 [123,] 0.7367648 0.5264703 0.26323515 [124,] 0.6660016 0.6679968 0.33399840 [125,] 0.6488863 0.7022275 0.35111374 [126,] 0.6524735 0.6950530 0.34752651 [127,] 0.6348562 0.7302877 0.36514383 [128,] 0.5680783 0.8638435 0.43192174 [129,] 0.4991125 0.9982249 0.50088753 [130,] 0.5580027 0.8839946 0.44199731 [131,] 0.5656790 0.8686421 0.43432105 [132,] 0.4599300 0.9198601 0.54006996 [133,] 0.3671412 0.7342824 0.63285881 [134,] 0.2594991 0.5189981 0.74050094 [135,] 0.1946397 0.3892794 0.80536030 > postscript(file="/var/www/rcomp/tmp/1c4ak1321958307.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/2cf8e1321958307.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/3mai31321958307.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/41cp81321958307.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/5hjr81321958307.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 = 156 Frequency = 1 1 2 3 4 5 6 3.44662454 -3.52006182 0.06097375 -5.62666238 -3.09253195 -2.80501932 7 8 9 10 11 12 1.50948632 -2.72264783 1.81822054 -5.04561183 3.82645763 -0.62203278 13 14 15 16 17 18 3.66353204 0.59828965 -5.41894723 2.02615240 1.40894919 0.69175968 19 20 21 22 23 24 -3.51321847 -1.30152289 -1.93206900 0.23319518 4.31114525 -5.93801126 25 26 27 28 29 30 0.82645763 4.82645763 1.39399938 4.91741591 1.04157488 -3.28725379 31 32 33 34 35 36 -1.32394439 -2.10776584 0.95518528 -4.41956434 0.69847711 4.30934736 37 38 39 40 41 42 -2.00252729 -3.21689740 1.64787263 5.95274803 2.24750546 -6.30212404 43 44 45 46 47 48 -1.42741883 -0.35989819 -4.25891500 0.36347515 3.48797564 -5.41036649 49 50 51 52 53 54 1.70814822 1.18097018 -7.78697807 2.14134310 -0.90771816 -2.08950717 55 56 57 58 59 60 1.66692528 1.23626638 2.27529934 3.50508727 1.50859091 0.93380291 61 62 63 64 65 66 -1.47435271 6.90836050 5.67916397 2.54082481 -5.38928346 1.09228184 67 68 69 70 71 72 3.33386505 -2.31748801 0.09436641 -5.61024210 2.22691561 0.31875191 73 74 75 76 77 78 1.38965987 2.39271606 0.89756116 1.53862775 2.07164661 1.63467726 79 80 81 82 83 84 -2.98601103 -2.96695059 -4.86690773 0.00498183 1.58904134 -1.55203803 85 86 87 88 89 90 -2.73449688 -1.00252729 -1.62952134 -0.88645538 -2.65659377 -0.94929722 91 92 93 94 95 96 1.36638385 -0.66573911 2.84917743 2.76295659 -1.99945693 -2.42292552 97 98 99 100 101 102 -4.11385996 -2.71526820 2.78310260 -0.39162881 3.97376712 1.86981266 103 104 105 106 107 108 1.22100949 -6.66865877 -7.32151443 6.80238488 1.17872394 2.62677738 109 110 111 112 113 114 0.69639254 -1.93955212 2.38975790 2.44652108 -6.00252729 1.58042242 115 116 117 118 119 120 0.90373520 1.82645763 0.11799863 -3.03257215 2.91183026 4.36638385 121 122 123 124 125 126 -0.72641942 4.07164661 -2.49229452 1.43821535 2.82645763 -5.69065264 127 128 129 130 131 132 -5.57459655 2.76455194 1.62961006 -1.64216378 0.02936078 -1.95745350 133 134 135 136 137 138 -2.47090005 -0.83499008 1.84229144 -1.81290904 2.33896322 3.57258117 139 140 141 142 143 144 2.82645763 2.09228184 4.75858492 -0.17354237 4.51354424 -0.14350942 145 146 147 148 149 150 0.23875690 -9.02316252 -3.29943832 3.81741072 4.05122555 -2.36387059 151 152 153 154 155 156 0.44723603 1.86981266 -0.52159653 0.14986454 2.16500992 1.21197149 > postscript(file="/var/www/rcomp/tmp/6npf31321958307.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 = 156 Frequency = 1 lag(myerror, k = 1) myerror 0 3.44662454 NA 1 -3.52006182 3.44662454 2 0.06097375 -3.52006182 3 -5.62666238 0.06097375 4 -3.09253195 -5.62666238 5 -2.80501932 -3.09253195 6 1.50948632 -2.80501932 7 -2.72264783 1.50948632 8 1.81822054 -2.72264783 9 -5.04561183 1.81822054 10 3.82645763 -5.04561183 11 -0.62203278 3.82645763 12 3.66353204 -0.62203278 13 0.59828965 3.66353204 14 -5.41894723 0.59828965 15 2.02615240 -5.41894723 16 1.40894919 2.02615240 17 0.69175968 1.40894919 18 -3.51321847 0.69175968 19 -1.30152289 -3.51321847 20 -1.93206900 -1.30152289 21 0.23319518 -1.93206900 22 4.31114525 0.23319518 23 -5.93801126 4.31114525 24 0.82645763 -5.93801126 25 4.82645763 0.82645763 26 1.39399938 4.82645763 27 4.91741591 1.39399938 28 1.04157488 4.91741591 29 -3.28725379 1.04157488 30 -1.32394439 -3.28725379 31 -2.10776584 -1.32394439 32 0.95518528 -2.10776584 33 -4.41956434 0.95518528 34 0.69847711 -4.41956434 35 4.30934736 0.69847711 36 -2.00252729 4.30934736 37 -3.21689740 -2.00252729 38 1.64787263 -3.21689740 39 5.95274803 1.64787263 40 2.24750546 5.95274803 41 -6.30212404 2.24750546 42 -1.42741883 -6.30212404 43 -0.35989819 -1.42741883 44 -4.25891500 -0.35989819 45 0.36347515 -4.25891500 46 3.48797564 0.36347515 47 -5.41036649 3.48797564 48 1.70814822 -5.41036649 49 1.18097018 1.70814822 50 -7.78697807 1.18097018 51 2.14134310 -7.78697807 52 -0.90771816 2.14134310 53 -2.08950717 -0.90771816 54 1.66692528 -2.08950717 55 1.23626638 1.66692528 56 2.27529934 1.23626638 57 3.50508727 2.27529934 58 1.50859091 3.50508727 59 0.93380291 1.50859091 60 -1.47435271 0.93380291 61 6.90836050 -1.47435271 62 5.67916397 6.90836050 63 2.54082481 5.67916397 64 -5.38928346 2.54082481 65 1.09228184 -5.38928346 66 3.33386505 1.09228184 67 -2.31748801 3.33386505 68 0.09436641 -2.31748801 69 -5.61024210 0.09436641 70 2.22691561 -5.61024210 71 0.31875191 2.22691561 72 1.38965987 0.31875191 73 2.39271606 1.38965987 74 0.89756116 2.39271606 75 1.53862775 0.89756116 76 2.07164661 1.53862775 77 1.63467726 2.07164661 78 -2.98601103 1.63467726 79 -2.96695059 -2.98601103 80 -4.86690773 -2.96695059 81 0.00498183 -4.86690773 82 1.58904134 0.00498183 83 -1.55203803 1.58904134 84 -2.73449688 -1.55203803 85 -1.00252729 -2.73449688 86 -1.62952134 -1.00252729 87 -0.88645538 -1.62952134 88 -2.65659377 -0.88645538 89 -0.94929722 -2.65659377 90 1.36638385 -0.94929722 91 -0.66573911 1.36638385 92 2.84917743 -0.66573911 93 2.76295659 2.84917743 94 -1.99945693 2.76295659 95 -2.42292552 -1.99945693 96 -4.11385996 -2.42292552 97 -2.71526820 -4.11385996 98 2.78310260 -2.71526820 99 -0.39162881 2.78310260 100 3.97376712 -0.39162881 101 1.86981266 3.97376712 102 1.22100949 1.86981266 103 -6.66865877 1.22100949 104 -7.32151443 -6.66865877 105 6.80238488 -7.32151443 106 1.17872394 6.80238488 107 2.62677738 1.17872394 108 0.69639254 2.62677738 109 -1.93955212 0.69639254 110 2.38975790 -1.93955212 111 2.44652108 2.38975790 112 -6.00252729 2.44652108 113 1.58042242 -6.00252729 114 0.90373520 1.58042242 115 1.82645763 0.90373520 116 0.11799863 1.82645763 117 -3.03257215 0.11799863 118 2.91183026 -3.03257215 119 4.36638385 2.91183026 120 -0.72641942 4.36638385 121 4.07164661 -0.72641942 122 -2.49229452 4.07164661 123 1.43821535 -2.49229452 124 2.82645763 1.43821535 125 -5.69065264 2.82645763 126 -5.57459655 -5.69065264 127 2.76455194 -5.57459655 128 1.62961006 2.76455194 129 -1.64216378 1.62961006 130 0.02936078 -1.64216378 131 -1.95745350 0.02936078 132 -2.47090005 -1.95745350 133 -0.83499008 -2.47090005 134 1.84229144 -0.83499008 135 -1.81290904 1.84229144 136 2.33896322 -1.81290904 137 3.57258117 2.33896322 138 2.82645763 3.57258117 139 2.09228184 2.82645763 140 4.75858492 2.09228184 141 -0.17354237 4.75858492 142 4.51354424 -0.17354237 143 -0.14350942 4.51354424 144 0.23875690 -0.14350942 145 -9.02316252 0.23875690 146 -3.29943832 -9.02316252 147 3.81741072 -3.29943832 148 4.05122555 3.81741072 149 -2.36387059 4.05122555 150 0.44723603 -2.36387059 151 1.86981266 0.44723603 152 -0.52159653 1.86981266 153 0.14986454 -0.52159653 154 2.16500992 0.14986454 155 1.21197149 2.16500992 156 NA 1.21197149 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.52006182 3.44662454 [2,] 0.06097375 -3.52006182 [3,] -5.62666238 0.06097375 [4,] -3.09253195 -5.62666238 [5,] -2.80501932 -3.09253195 [6,] 1.50948632 -2.80501932 [7,] -2.72264783 1.50948632 [8,] 1.81822054 -2.72264783 [9,] -5.04561183 1.81822054 [10,] 3.82645763 -5.04561183 [11,] -0.62203278 3.82645763 [12,] 3.66353204 -0.62203278 [13,] 0.59828965 3.66353204 [14,] -5.41894723 0.59828965 [15,] 2.02615240 -5.41894723 [16,] 1.40894919 2.02615240 [17,] 0.69175968 1.40894919 [18,] -3.51321847 0.69175968 [19,] -1.30152289 -3.51321847 [20,] -1.93206900 -1.30152289 [21,] 0.23319518 -1.93206900 [22,] 4.31114525 0.23319518 [23,] -5.93801126 4.31114525 [24,] 0.82645763 -5.93801126 [25,] 4.82645763 0.82645763 [26,] 1.39399938 4.82645763 [27,] 4.91741591 1.39399938 [28,] 1.04157488 4.91741591 [29,] -3.28725379 1.04157488 [30,] -1.32394439 -3.28725379 [31,] -2.10776584 -1.32394439 [32,] 0.95518528 -2.10776584 [33,] -4.41956434 0.95518528 [34,] 0.69847711 -4.41956434 [35,] 4.30934736 0.69847711 [36,] -2.00252729 4.30934736 [37,] -3.21689740 -2.00252729 [38,] 1.64787263 -3.21689740 [39,] 5.95274803 1.64787263 [40,] 2.24750546 5.95274803 [41,] -6.30212404 2.24750546 [42,] -1.42741883 -6.30212404 [43,] -0.35989819 -1.42741883 [44,] -4.25891500 -0.35989819 [45,] 0.36347515 -4.25891500 [46,] 3.48797564 0.36347515 [47,] -5.41036649 3.48797564 [48,] 1.70814822 -5.41036649 [49,] 1.18097018 1.70814822 [50,] -7.78697807 1.18097018 [51,] 2.14134310 -7.78697807 [52,] -0.90771816 2.14134310 [53,] -2.08950717 -0.90771816 [54,] 1.66692528 -2.08950717 [55,] 1.23626638 1.66692528 [56,] 2.27529934 1.23626638 [57,] 3.50508727 2.27529934 [58,] 1.50859091 3.50508727 [59,] 0.93380291 1.50859091 [60,] -1.47435271 0.93380291 [61,] 6.90836050 -1.47435271 [62,] 5.67916397 6.90836050 [63,] 2.54082481 5.67916397 [64,] -5.38928346 2.54082481 [65,] 1.09228184 -5.38928346 [66,] 3.33386505 1.09228184 [67,] -2.31748801 3.33386505 [68,] 0.09436641 -2.31748801 [69,] -5.61024210 0.09436641 [70,] 2.22691561 -5.61024210 [71,] 0.31875191 2.22691561 [72,] 1.38965987 0.31875191 [73,] 2.39271606 1.38965987 [74,] 0.89756116 2.39271606 [75,] 1.53862775 0.89756116 [76,] 2.07164661 1.53862775 [77,] 1.63467726 2.07164661 [78,] -2.98601103 1.63467726 [79,] -2.96695059 -2.98601103 [80,] -4.86690773 -2.96695059 [81,] 0.00498183 -4.86690773 [82,] 1.58904134 0.00498183 [83,] -1.55203803 1.58904134 [84,] -2.73449688 -1.55203803 [85,] -1.00252729 -2.73449688 [86,] -1.62952134 -1.00252729 [87,] -0.88645538 -1.62952134 [88,] -2.65659377 -0.88645538 [89,] -0.94929722 -2.65659377 [90,] 1.36638385 -0.94929722 [91,] -0.66573911 1.36638385 [92,] 2.84917743 -0.66573911 [93,] 2.76295659 2.84917743 [94,] -1.99945693 2.76295659 [95,] -2.42292552 -1.99945693 [96,] -4.11385996 -2.42292552 [97,] -2.71526820 -4.11385996 [98,] 2.78310260 -2.71526820 [99,] -0.39162881 2.78310260 [100,] 3.97376712 -0.39162881 [101,] 1.86981266 3.97376712 [102,] 1.22100949 1.86981266 [103,] -6.66865877 1.22100949 [104,] -7.32151443 -6.66865877 [105,] 6.80238488 -7.32151443 [106,] 1.17872394 6.80238488 [107,] 2.62677738 1.17872394 [108,] 0.69639254 2.62677738 [109,] -1.93955212 0.69639254 [110,] 2.38975790 -1.93955212 [111,] 2.44652108 2.38975790 [112,] -6.00252729 2.44652108 [113,] 1.58042242 -6.00252729 [114,] 0.90373520 1.58042242 [115,] 1.82645763 0.90373520 [116,] 0.11799863 1.82645763 [117,] -3.03257215 0.11799863 [118,] 2.91183026 -3.03257215 [119,] 4.36638385 2.91183026 [120,] -0.72641942 4.36638385 [121,] 4.07164661 -0.72641942 [122,] -2.49229452 4.07164661 [123,] 1.43821535 -2.49229452 [124,] 2.82645763 1.43821535 [125,] -5.69065264 2.82645763 [126,] -5.57459655 -5.69065264 [127,] 2.76455194 -5.57459655 [128,] 1.62961006 2.76455194 [129,] -1.64216378 1.62961006 [130,] 0.02936078 -1.64216378 [131,] -1.95745350 0.02936078 [132,] -2.47090005 -1.95745350 [133,] -0.83499008 -2.47090005 [134,] 1.84229144 -0.83499008 [135,] -1.81290904 1.84229144 [136,] 2.33896322 -1.81290904 [137,] 3.57258117 2.33896322 [138,] 2.82645763 3.57258117 [139,] 2.09228184 2.82645763 [140,] 4.75858492 2.09228184 [141,] -0.17354237 4.75858492 [142,] 4.51354424 -0.17354237 [143,] -0.14350942 4.51354424 [144,] 0.23875690 -0.14350942 [145,] -9.02316252 0.23875690 [146,] -3.29943832 -9.02316252 [147,] 3.81741072 -3.29943832 [148,] 4.05122555 3.81741072 [149,] -2.36387059 4.05122555 [150,] 0.44723603 -2.36387059 [151,] 1.86981266 0.44723603 [152,] -0.52159653 1.86981266 [153,] 0.14986454 -0.52159653 [154,] 2.16500992 0.14986454 [155,] 1.21197149 2.16500992 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.52006182 3.44662454 2 0.06097375 -3.52006182 3 -5.62666238 0.06097375 4 -3.09253195 -5.62666238 5 -2.80501932 -3.09253195 6 1.50948632 -2.80501932 7 -2.72264783 1.50948632 8 1.81822054 -2.72264783 9 -5.04561183 1.81822054 10 3.82645763 -5.04561183 11 -0.62203278 3.82645763 12 3.66353204 -0.62203278 13 0.59828965 3.66353204 14 -5.41894723 0.59828965 15 2.02615240 -5.41894723 16 1.40894919 2.02615240 17 0.69175968 1.40894919 18 -3.51321847 0.69175968 19 -1.30152289 -3.51321847 20 -1.93206900 -1.30152289 21 0.23319518 -1.93206900 22 4.31114525 0.23319518 23 -5.93801126 4.31114525 24 0.82645763 -5.93801126 25 4.82645763 0.82645763 26 1.39399938 4.82645763 27 4.91741591 1.39399938 28 1.04157488 4.91741591 29 -3.28725379 1.04157488 30 -1.32394439 -3.28725379 31 -2.10776584 -1.32394439 32 0.95518528 -2.10776584 33 -4.41956434 0.95518528 34 0.69847711 -4.41956434 35 4.30934736 0.69847711 36 -2.00252729 4.30934736 37 -3.21689740 -2.00252729 38 1.64787263 -3.21689740 39 5.95274803 1.64787263 40 2.24750546 5.95274803 41 -6.30212404 2.24750546 42 -1.42741883 -6.30212404 43 -0.35989819 -1.42741883 44 -4.25891500 -0.35989819 45 0.36347515 -4.25891500 46 3.48797564 0.36347515 47 -5.41036649 3.48797564 48 1.70814822 -5.41036649 49 1.18097018 1.70814822 50 -7.78697807 1.18097018 51 2.14134310 -7.78697807 52 -0.90771816 2.14134310 53 -2.08950717 -0.90771816 54 1.66692528 -2.08950717 55 1.23626638 1.66692528 56 2.27529934 1.23626638 57 3.50508727 2.27529934 58 1.50859091 3.50508727 59 0.93380291 1.50859091 60 -1.47435271 0.93380291 61 6.90836050 -1.47435271 62 5.67916397 6.90836050 63 2.54082481 5.67916397 64 -5.38928346 2.54082481 65 1.09228184 -5.38928346 66 3.33386505 1.09228184 67 -2.31748801 3.33386505 68 0.09436641 -2.31748801 69 -5.61024210 0.09436641 70 2.22691561 -5.61024210 71 0.31875191 2.22691561 72 1.38965987 0.31875191 73 2.39271606 1.38965987 74 0.89756116 2.39271606 75 1.53862775 0.89756116 76 2.07164661 1.53862775 77 1.63467726 2.07164661 78 -2.98601103 1.63467726 79 -2.96695059 -2.98601103 80 -4.86690773 -2.96695059 81 0.00498183 -4.86690773 82 1.58904134 0.00498183 83 -1.55203803 1.58904134 84 -2.73449688 -1.55203803 85 -1.00252729 -2.73449688 86 -1.62952134 -1.00252729 87 -0.88645538 -1.62952134 88 -2.65659377 -0.88645538 89 -0.94929722 -2.65659377 90 1.36638385 -0.94929722 91 -0.66573911 1.36638385 92 2.84917743 -0.66573911 93 2.76295659 2.84917743 94 -1.99945693 2.76295659 95 -2.42292552 -1.99945693 96 -4.11385996 -2.42292552 97 -2.71526820 -4.11385996 98 2.78310260 -2.71526820 99 -0.39162881 2.78310260 100 3.97376712 -0.39162881 101 1.86981266 3.97376712 102 1.22100949 1.86981266 103 -6.66865877 1.22100949 104 -7.32151443 -6.66865877 105 6.80238488 -7.32151443 106 1.17872394 6.80238488 107 2.62677738 1.17872394 108 0.69639254 2.62677738 109 -1.93955212 0.69639254 110 2.38975790 -1.93955212 111 2.44652108 2.38975790 112 -6.00252729 2.44652108 113 1.58042242 -6.00252729 114 0.90373520 1.58042242 115 1.82645763 0.90373520 116 0.11799863 1.82645763 117 -3.03257215 0.11799863 118 2.91183026 -3.03257215 119 4.36638385 2.91183026 120 -0.72641942 4.36638385 121 4.07164661 -0.72641942 122 -2.49229452 4.07164661 123 1.43821535 -2.49229452 124 2.82645763 1.43821535 125 -5.69065264 2.82645763 126 -5.57459655 -5.69065264 127 2.76455194 -5.57459655 128 1.62961006 2.76455194 129 -1.64216378 1.62961006 130 0.02936078 -1.64216378 131 -1.95745350 0.02936078 132 -2.47090005 -1.95745350 133 -0.83499008 -2.47090005 134 1.84229144 -0.83499008 135 -1.81290904 1.84229144 136 2.33896322 -1.81290904 137 3.57258117 2.33896322 138 2.82645763 3.57258117 139 2.09228184 2.82645763 140 4.75858492 2.09228184 141 -0.17354237 4.75858492 142 4.51354424 -0.17354237 143 -0.14350942 4.51354424 144 0.23875690 -0.14350942 145 -9.02316252 0.23875690 146 -3.29943832 -9.02316252 147 3.81741072 -3.29943832 148 4.05122555 3.81741072 149 -2.36387059 4.05122555 150 0.44723603 -2.36387059 151 1.86981266 0.44723603 152 -0.52159653 1.86981266 153 0.14986454 -0.52159653 154 2.16500992 0.14986454 155 1.21197149 2.16500992 > 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/7xvrn1321958307.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/88bck1321958307.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/9gm5s1321958307.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/102d7o1321958307.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/11opsp1321958307.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/122hyj1321958307.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/131psp1321958307.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/14e7tc1321958307.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/152k0b1321958307.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/16wcwc1321958307.tab") + } > > try(system("convert tmp/1c4ak1321958307.ps tmp/1c4ak1321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/2cf8e1321958307.ps tmp/2cf8e1321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/3mai31321958307.ps tmp/3mai31321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/41cp81321958307.ps tmp/41cp81321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/5hjr81321958307.ps tmp/5hjr81321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/6npf31321958307.ps tmp/6npf31321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/7xvrn1321958307.ps tmp/7xvrn1321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/88bck1321958307.ps tmp/88bck1321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/9gm5s1321958307.ps tmp/9gm5s1321958307.png",intern=TRUE)) character(0) > try(system("convert tmp/102d7o1321958307.ps tmp/102d7o1321958307.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.632 0.584 12.769