R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(11 + ,14 + ,3 + ,2 + ,3 + ,3 + ,3 + ,7 + ,6 + ,11 + ,8 + ,5 + ,6 + ,0 + ,7 + ,7 + ,2 + ,7 + ,11 + ,12 + ,6 + ,6 + ,0 + ,6 + ,8 + ,3 + ,8 + ,11 + ,7 + ,6 + ,6 + ,6 + ,6 + ,9 + ,8 + ,8 + ,11 + ,10 + ,7 + ,8 + ,5 + ,5 + ,5 + ,7 + ,9 + ,11 + ,9 + ,3 + ,1 + ,0 + ,7 + ,7 + ,7 + ,8 + ,11 + ,16 + ,8 + ,9 + ,8 + ,8 + ,8 + ,9 + ,8 + ,11 + ,7 + ,4 + ,4 + ,0 + ,2 + ,3 + ,2 + ,7 + ,11 + ,14 + ,7 + ,7 + ,0 + ,4 + ,8 + ,4 + ,7 + ,11 + ,6 + ,4 + ,4 + ,9 + ,9 + ,4 + ,4 + ,4 + ,11 + ,16 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,11 + ,11 + ,6 + ,5 + ,6 + ,6 + ,4 + ,4 + ,7 + ,11 + ,17 + ,7 + ,7 + ,5 + ,5 + ,8 + ,9 + ,5 + ,11 + ,12 + ,4 + ,5 + ,4 + ,4 + ,8 + ,8 + ,8 + ,11 + ,7 + ,6 + ,6 + ,0 + ,2 + ,2 + ,7 + ,5 + ,11 + ,13 + ,5 + ,5 + ,0 + ,4 + ,9 + ,4 + ,4 + ,11 + ,9 + ,0 + ,2 + ,2 + ,2 + ,2 + ,2 + ,9 + ,11 + ,15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8 + ,7 + ,7 + ,12 + ,14 + ,6 + ,6 + ,5 + ,5 + ,5 + ,5 + ,9 + ,12 + ,11 + ,5 + ,5 + ,0 + ,2 + ,9 + ,2 + ,6) + ,dim=c(9 + ,156) + ,dimnames=list(c('Maand' + ,'Schoolprestaties' + ,'Sport' + ,'Goingout' + ,'Relation' + ,'Family' + ,'Friends' + ,'Coach' + ,'Job') + ,1:156)) > y <- array(NA,dim=c(9,156),dimnames=list(c('Maand','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 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '2' > 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 Maand Sport Goingout Relation Family Friends Coach Job t 1 14 11 3 2 3 3 3 7 6 1 2 8 11 5 6 0 7 7 2 7 2 3 12 11 6 6 0 6 8 3 8 3 4 7 11 6 6 6 6 9 8 8 4 5 10 11 7 8 5 5 5 7 9 5 6 9 11 3 1 0 7 7 7 8 6 7 16 11 8 9 8 8 8 9 8 7 8 7 11 4 4 0 2 3 2 7 8 9 14 11 7 7 0 4 8 4 7 9 10 6 11 4 4 9 9 4 4 4 10 11 16 11 6 6 6 6 6 6 6 11 12 11 11 6 5 6 6 4 4 7 12 13 17 11 7 7 5 5 8 9 5 13 14 12 11 4 5 4 4 8 8 8 14 15 7 11 6 6 0 2 2 7 5 15 16 13 11 5 5 0 4 9 4 4 16 17 9 11 0 2 2 2 2 2 9 17 18 15 11 9 9 6 6 8 8 8 18 19 7 11 4 4 0 4 8 4 4 19 20 9 11 4 4 4 4 4 4 6 20 21 7 11 2 5 5 5 5 2 6 21 22 14 11 7 7 7 7 7 9 7 22 23 15 11 5 5 5 5 3 3 3 23 24 7 11 9 9 4 4 4 4 4 24 25 13 11 6 6 6 6 6 6 6 25 26 17 11 6 6 6 6 6 6 6 26 27 15 11 7 3 0 7 9 7 7 27 28 14 11 3 3 1 2 2 2 5 28 29 14 11 6 5 0 6 6 6 8 29 30 8 11 6 5 4 4 4 4 6 30 31 8 11 4 4 4 4 8 2 4 31 32 12 11 7 7 7 7 3 9 9 32 33 14 11 7 6 7 7 7 7 7 33 34 8 11 7 7 0 4 4 4 4 34 35 11 11 4 4 4 4 4 4 6 35 36 16 11 5 5 5 5 8 7 8 36 37 11 11 6 6 0 6 6 6 6 37 38 8 11 5 5 5 5 5 5 5 38 39 14 11 6 0 1 6 6 6 6 39 40 16 11 6 6 2 2 9 2 6 40 41 14 11 6 5 0 6 4 2 4 41 42 5 11 3 3 9 9 7 7 7 42 43 8 11 3 3 3 3 3 3 9 43 44 10 11 3 3 0 4 4 4 8 44 45 8 11 6 7 6 6 6 6 6 45 46 13 11 7 7 1 5 8 5 6 46 47 15 11 5 1 5 5 5 7 5 47 48 6 11 5 5 0 4 4 4 7 48 49 12 11 5 5 0 2 2 2 5 49 50 14 11 6 6 0 6 9 6 8 50 51 5 11 6 2 6 6 6 9 6 51 52 15 11 6 6 7 7 8 8 8 52 53 11 11 5 5 0 5 5 5 5 53 54 8 11 4 2 4 4 4 4 4 54 55 13 11 7 7 5 5 5 2 5 55 56 14 11 5 5 1 5 9 9 6 56 57 12 12 3 3 4 4 4 4 4 57 58 16 12 6 6 9 9 8 6 6 58 59 10 12 2 2 2 2 2 2 9 59 60 15 12 8 8 8 8 8 8 7 60 61 8 12 3 5 3 3 3 3 3 61 62 16 12 0 2 1 6 3 3 6 62 63 19 12 6 6 0 6 6 7 6 63 64 14 12 8 2 6 6 6 2 6 64 65 7 12 4 1 0 5 5 9 5 65 66 13 12 5 5 0 5 5 5 5 66 67 15 12 6 6 6 6 4 4 5 67 68 7 12 5 2 2 2 9 2 9 68 69 13 12 6 6 1 6 6 6 8 69 70 4 12 2 2 5 5 5 5 5 70 71 14 12 6 6 5 5 5 5 6 71 72 13 12 5 5 5 5 3 9 7 72 73 11 12 5 0 5 5 8 2 5 73 74 14 12 6 2 6 6 9 6 6 74 75 12 12 4 4 6 6 6 6 6 75 76 15 12 6 1 0 9 6 6 6 76 77 14 12 5 5 0 5 5 5 6 77 78 13 12 5 5 1 5 3 3 9 78 79 7 12 4 2 7 7 4 2 7 79 80 5 12 2 2 2 2 9 2 9 80 81 7 12 7 7 4 4 4 4 4 81 82 13 12 5 5 0 6 8 8 8 82 83 13 12 6 2 5 5 5 5 5 83 84 11 12 5 5 5 5 5 9 8 84 85 6 12 3 3 3 3 8 2 9 85 86 12 12 6 6 0 6 6 6 6 86 87 8 12 4 1 4 4 9 4 4 87 88 11 12 5 5 9 9 5 5 7 88 89 12 12 7 7 0 8 8 8 8 89 90 9 12 4 2 4 4 3 3 9 90 91 12 12 6 6 2 2 2 2 9 91 92 13 12 8 8 7 7 7 7 7 92 93 16 12 7 7 7 7 7 7 8 93 94 16 12 6 6 6 6 4 9 4 94 95 11 12 7 7 0 5 5 5 6 95 96 8 12 4 4 5 5 9 5 7 96 97 4 12 0 5 6 6 6 2 6 97 98 7 12 3 2 0 3 3 3 7 98 99 14 12 5 5 5 5 5 5 5 99 100 11 12 6 2 9 9 2 2 9 100 101 17 12 5 5 0 7 7 7 7 101 102 15 12 7 7 7 7 7 7 7 102 103 14 12 6 5 1 6 6 6 6 103 104 5 12 8 8 3 3 8 3 6 104 105 4 12 7 2 7 7 9 3 9 105 106 19 12 8 8 8 8 8 2 9 106 107 11 12 3 3 0 3 3 3 8 107 108 15 12 8 2 5 5 5 5 8 108 109 10 12 3 3 3 3 3 3 3 109 110 9 12 4 5 0 4 4 4 6 110 111 12 12 2 2 5 5 5 5 5 111 112 15 12 7 2 7 7 9 7 7 112 113 7 12 6 6 0 6 6 6 6 113 114 13 12 2 2 0 7 7 7 7 114 115 14 12 7 7 0 9 7 2 7 115 116 14 12 6 6 6 6 6 6 6 116 117 14 12 6 2 0 6 3 9 8 117 118 8 12 6 2 6 6 9 4 9 118 119 15 12 6 5 6 6 6 6 6 119 120 15 12 6 6 2 2 2 2 9 120 121 9 12 4 4 5 5 5 2 5 121 122 16 12 5 5 0 5 5 5 6 122 123 9 12 7 7 4 4 9 4 4 123 124 15 12 6 6 0 7 7 7 7 124 125 15 12 6 6 6 6 6 6 6 125 126 6 12 5 5 5 5 8 7 8 126 127 8 12 8 2 8 8 8 8 8 127 128 15 12 6 6 6 6 6 6 9 128 129 10 12 0 3 5 5 3 3 8 129 130 9 12 4 2 0 4 4 4 4 130 131 14 12 8 8 8 8 9 8 6 131 132 12 12 6 6 0 6 6 9 6 132 133 8 12 4 4 9 9 4 2 7 133 134 11 12 6 6 5 5 5 5 9 134 135 13 12 2 5 0 6 6 6 8 135 136 9 12 4 4 0 4 4 4 4 136 137 15 12 6 2 0 6 6 6 6 137 138 13 12 3 3 3 3 3 3 9 138 139 15 12 6 6 6 6 6 6 6 139 140 14 12 5 5 0 5 5 5 5 140 141 16 12 4 4 4 4 9 8 8 141 142 12 12 6 6 6 6 6 6 6 142 143 14 12 1 1 0 5 9 5 6 143 144 10 12 4 5 4 4 3 3 6 144 145 10 12 4 2 7 7 7 2 7 145 146 4 12 6 6 0 6 6 6 7 146 147 8 12 5 5 5 5 5 5 9 147 148 17 12 9 2 6 6 6 6 6 148 149 16 12 6 6 6 6 9 6 6 149 150 12 12 8 8 8 8 8 9 6 150 151 12 12 7 7 2 2 4 4 4 151 152 15 12 7 7 7 7 7 7 7 152 153 9 12 0 9 0 4 4 4 8 153 154 13 12 6 2 0 6 8 7 7 154 155 14 12 6 6 5 5 5 5 9 155 156 11 12 5 5 0 2 9 2 6 156 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Maand Sport Goingout Relation Family -0.9329379 0.6417281 0.4533497 0.1038791 -0.1391977 0.2678751 Friends Coach Job t -0.0758261 0.3314739 0.0007430 0.0001314 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.2767 -2.2632 0.6849 2.1411 6.7768 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.9329379 10.9870577 -0.085 0.9324 Maand 0.6417281 0.9901771 0.648 0.5179 Sport 0.4533497 0.1769789 2.562 0.0114 * Goingout 0.1038791 0.1450672 0.716 0.4751 Relation -0.1391977 0.1008198 -1.381 0.1695 Family 0.2678751 0.1913260 1.400 0.1636 Friends -0.0758261 0.1388819 -0.546 0.5859 Coach 0.3314739 0.1398677 2.370 0.0191 * Job 0.0007430 0.1684111 0.004 0.9965 t 0.0001314 0.0104172 0.013 0.9900 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.232 on 146 degrees of freedom Multiple R-squared: 0.1939, Adjusted R-squared: 0.1442 F-statistic: 3.902 on 9 and 146 DF, p-value: 0.0001833 > 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.6598903 0.6802195 0.3401097 [2,] 0.7892466 0.4215068 0.2107534 [3,] 0.9367430 0.1265140 0.0632570 [4,] 0.8937016 0.2125968 0.1062984 [5,] 0.8944589 0.2110822 0.1055411 [6,] 0.8406130 0.3187740 0.1593870 [7,] 0.8534680 0.2930640 0.1465320 [8,] 0.7970175 0.4059650 0.2029825 [9,] 0.7308101 0.5383797 0.2691899 [10,] 0.6622471 0.6755057 0.3377529 [11,] 0.7374199 0.5251603 0.2625801 [12,] 0.8253025 0.3493950 0.1746975 [13,] 0.7766588 0.4466824 0.2233412 [14,] 0.8134024 0.3731953 0.1865976 [15,] 0.7626147 0.4747705 0.2373853 [16,] 0.7960889 0.4078222 0.2039111 [17,] 0.7515427 0.4969146 0.2484573 [18,] 0.7926695 0.4146609 0.2073305 [19,] 0.7816689 0.4366621 0.2183311 [20,] 0.7485475 0.5029049 0.2514525 [21,] 0.6960293 0.6079413 0.3039707 [22,] 0.6891934 0.6216132 0.3108066 [23,] 0.6326437 0.7347127 0.3673563 [24,] 0.6178032 0.7643936 0.3821968 [25,] 0.5628245 0.8743510 0.4371755 [26,] 0.5714231 0.8571539 0.4285769 [27,] 0.5187536 0.9624928 0.4812464 [28,] 0.5522578 0.8954843 0.4477422 [29,] 0.5805929 0.8388143 0.4194071 [30,] 0.7186872 0.5626256 0.2813128 [31,] 0.6885269 0.6229462 0.3114731 [32,] 0.6375896 0.7248209 0.3624104 [33,] 0.6436225 0.7127550 0.3563775 [34,] 0.5927867 0.8144265 0.4072133 [35,] 0.5712497 0.8575006 0.4287503 [36,] 0.6129130 0.7741741 0.3870870 [37,] 0.5851743 0.8296513 0.4148257 [38,] 0.5520343 0.8959315 0.4479657 [39,] 0.8061561 0.3876878 0.1938439 [40,] 0.7903837 0.4192326 0.2096163 [41,] 0.7546300 0.4907400 0.2453700 [42,] 0.7376604 0.5246791 0.2623396 [43,] 0.7013722 0.5972556 0.2986278 [44,] 0.6608304 0.6783393 0.3391696 [45,] 0.6193117 0.7613767 0.3806883 [46,] 0.5915639 0.8168722 0.4084361 [47,] 0.5559032 0.8881936 0.4440968 [48,] 0.5111545 0.9776910 0.4888455 [49,] 0.4834934 0.9669868 0.5165066 [50,] 0.6502534 0.6994932 0.3497466 [51,] 0.6984977 0.6030046 0.3015023 [52,] 0.6748540 0.6502920 0.3251460 [53,] 0.7891787 0.4216425 0.2108213 [54,] 0.7559643 0.4880714 0.2440357 [55,] 0.7461913 0.5076174 0.2538087 [56,] 0.7932399 0.4135203 0.2067601 [57,] 0.7602051 0.4795898 0.2397949 [58,] 0.8440905 0.3118189 0.1559095 [59,] 0.8248603 0.3502795 0.1751397 [60,] 0.7923626 0.4152748 0.2076374 [61,] 0.7669167 0.4661666 0.2330833 [62,] 0.7501265 0.4997470 0.2498735 [63,] 0.7131297 0.5737407 0.2868703 [64,] 0.6833928 0.6332144 0.3166072 [65,] 0.6600846 0.6798308 0.3399154 [66,] 0.6289411 0.7421179 0.3710589 [67,] 0.6233511 0.7532979 0.3766489 [68,] 0.6271957 0.7456087 0.3728043 [69,] 0.6862878 0.6274244 0.3137122 [70,] 0.6453039 0.7093921 0.3546961 [71,] 0.6102013 0.7795974 0.3897987 [72,] 0.5777347 0.8445306 0.4222653 [73,] 0.5572444 0.8855112 0.4427556 [74,] 0.5132406 0.9735188 0.4867594 [75,] 0.4740238 0.9480476 0.5259762 [76,] 0.4286076 0.8572153 0.5713924 [77,] 0.4052048 0.8104096 0.5947952 [78,] 0.3628480 0.7256959 0.6371520 [79,] 0.3251198 0.6502396 0.6748802 [80,] 0.2835190 0.5670381 0.7164810 [81,] 0.2724003 0.5448006 0.7275997 [82,] 0.2541311 0.5082621 0.7458689 [83,] 0.2264830 0.4529659 0.7735170 [84,] 0.2048544 0.4097089 0.7951456 [85,] 0.2234257 0.4468515 0.7765743 [86,] 0.2151389 0.4302778 0.7848611 [87,] 0.2004048 0.4008095 0.7995952 [88,] 0.1683690 0.3367380 0.8316310 [89,] 0.1874104 0.3748208 0.8125896 [90,] 0.1660081 0.3320163 0.8339919 [91,] 0.1429760 0.2859520 0.8570240 [92,] 0.2363460 0.4726920 0.7636540 [93,] 0.4510654 0.9021309 0.5489346 [94,] 0.6221431 0.7557138 0.3778569 [95,] 0.5747857 0.8504287 0.4252143 [96,] 0.5474903 0.9050194 0.4525097 [97,] 0.4966893 0.9933785 0.5033107 [98,] 0.4664227 0.9328454 0.5335773 [99,] 0.4256033 0.8512066 0.5743967 [100,] 0.3975375 0.7950751 0.6024625 [101,] 0.5107172 0.9785657 0.4892828 [102,] 0.4630764 0.9261527 0.5369236 [103,] 0.4580172 0.9160344 0.5419828 [104,] 0.4165010 0.8330021 0.5834990 [105,] 0.3606962 0.7213924 0.6393038 [106,] 0.3559692 0.7119384 0.6440308 [107,] 0.3375979 0.6751957 0.6624021 [108,] 0.3683109 0.7366218 0.6316891 [109,] 0.3147243 0.6294487 0.6852757 [110,] 0.3861990 0.7723981 0.6138010 [111,] 0.3558559 0.7117118 0.6441441 [112,] 0.3986132 0.7972263 0.6013868 [113,] 0.4129718 0.8259436 0.5870282 [114,] 0.6220655 0.7558689 0.3779345 [115,] 0.8509489 0.2981023 0.1490511 [116,] 0.8393798 0.3212404 0.1606202 [117,] 0.7957505 0.4084990 0.2042495 [118,] 0.7967939 0.4064123 0.2032061 [119,] 0.7396302 0.5207396 0.2603698 [120,] 0.6763630 0.6472740 0.3236370 [121,] 0.6038157 0.7923687 0.3961843 [122,] 0.5187257 0.9625485 0.4812743 [123,] 0.5046787 0.9906426 0.4953213 [124,] 0.4933033 0.9866066 0.5066967 [125,] 0.4928837 0.9857675 0.5071163 [126,] 0.4440435 0.8880869 0.5559565 [127,] 0.4223238 0.8446476 0.5776762 [128,] 0.8188095 0.3623810 0.1811905 [129,] 0.7192843 0.5614313 0.2807157 [130,] 0.6279933 0.7440135 0.3720067 [131,] 0.4905451 0.9810901 0.5094549 > postscript(file="/var/wessaorg/rcomp/tmp/1f52u1321985710.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/2zxay1321985710.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/39asb1321985710.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/411he1321985710.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/5zje51321985710.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.82266058 -3.02884864 0.52915459 -5.21733424 -2.72246966 -2.26139199 7 8 9 10 11 12 1.89928017 -2.33245810 2.17615692 -4.53996015 4.21870166 -0.16699811 13 14 15 16 17 18 3.94786114 0.97345932 -5.17954488 2.36775010 1.88859974 1.03331424 19 20 21 22 23 24 -3.15124136 -0.89937267 -1.48658711 0.61201185 4.67220387 -5.68455592 25 26 27 28 29 30 1.21686258 5.21673122 1.86708773 5.28700096 1.48354417 -2.91126477 31 32 33 34 35 36 -0.93307922 -1.69409238 1.37739375 -4.12820267 1.09865689 4.72001612 37 38 39 40 41 42 -1.61989976 -2.84254815 2.14230952 6.28297595 2.65918326 -5.75610736 43 44 45 46 47 48 -0.96306908 0.09642671 -3.88964374 0.71188817 3.90883797 -5.01781326 49 50 51 52 53 54 2.03058714 1.60438492 -7.36545839 2.57185677 -0.54050692 -1.69459486 55 56 57 58 59 60 2.03518290 1.57496254 2.01275359 3.33641949 1.33465496 0.68668580 61 62 63 64 65 66 -1.81046176 6.77684353 5.40348277 2.40472378 -5.64084113 0.81605725 67 68 69 70 71 72 3.08165578 -2.49579344 -0.12811986 -5.81679358 1.95341697 0.03222340 73 74 75 76 77 78 1.25242149 2.21169233 0.68302385 1.44901897 1.81386924 1.46200205 79 80 81 82 83 84 -3.06492054 -3.13732066 -5.21931419 -0.22309202 1.36809986 -1.81844368 85 86 87 88 89 90 -2.89970981 -1.26806466 -1.85764819 -1.00704016 -2.87421928 -1.08911934 91 92 93 94 95 96 1.10153628 -0.93319261 2.62316178 2.42148241 -2.30295282 -2.63284801 97 98 99 100 101 102 -4.28445068 -2.92425007 2.50771059 -0.38487176 3.76292778 1.62272253 103 104 105 106 107 108 0.97277889 -7.01759442 -7.38221435 6.66800059 0.96994560 2.45588732 109 110 111 112 113 114 0.39099093 -2.21359316 2.17782054 2.29245647 -6.27161146 1.43290636 115 116 117 118 119 120 0.76825057 1.56318044 -0.08000689 -3.13336884 2.66666540 4.09772676 121 122 123 124 125 126 -0.94352887 3.80795791 -2.84570072 1.20267767 2.56199817 -5.93353466 127 128 129 130 131 132 -5.69958419 2.55937504 1.48734288 -1.90309722 -0.24607181 -2.26852911 133 134 135 136 137 138 -2.53712711 -1.05708793 1.64129043 -2.11164351 2.14075206 3.38272332 139 140 141 142 143 144 2.56015909 1.80633639 4.49475332 -0.44023500 4.33741893 -0.40562106 145 146 147 148 149 150 0.15388793 -9.27668945 -3.50156689 3.61444392 3.78632389 -2.65586776 151 152 153 154 155 156 0.02884526 1.61615439 -0.82284517 -0.04204576 1.94015344 0.90484317 > postscript(file="/var/wessaorg/rcomp/tmp/6reo11321985710.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.82266058 NA 1 -3.02884864 3.82266058 2 0.52915459 -3.02884864 3 -5.21733424 0.52915459 4 -2.72246966 -5.21733424 5 -2.26139199 -2.72246966 6 1.89928017 -2.26139199 7 -2.33245810 1.89928017 8 2.17615692 -2.33245810 9 -4.53996015 2.17615692 10 4.21870166 -4.53996015 11 -0.16699811 4.21870166 12 3.94786114 -0.16699811 13 0.97345932 3.94786114 14 -5.17954488 0.97345932 15 2.36775010 -5.17954488 16 1.88859974 2.36775010 17 1.03331424 1.88859974 18 -3.15124136 1.03331424 19 -0.89937267 -3.15124136 20 -1.48658711 -0.89937267 21 0.61201185 -1.48658711 22 4.67220387 0.61201185 23 -5.68455592 4.67220387 24 1.21686258 -5.68455592 25 5.21673122 1.21686258 26 1.86708773 5.21673122 27 5.28700096 1.86708773 28 1.48354417 5.28700096 29 -2.91126477 1.48354417 30 -0.93307922 -2.91126477 31 -1.69409238 -0.93307922 32 1.37739375 -1.69409238 33 -4.12820267 1.37739375 34 1.09865689 -4.12820267 35 4.72001612 1.09865689 36 -1.61989976 4.72001612 37 -2.84254815 -1.61989976 38 2.14230952 -2.84254815 39 6.28297595 2.14230952 40 2.65918326 6.28297595 41 -5.75610736 2.65918326 42 -0.96306908 -5.75610736 43 0.09642671 -0.96306908 44 -3.88964374 0.09642671 45 0.71188817 -3.88964374 46 3.90883797 0.71188817 47 -5.01781326 3.90883797 48 2.03058714 -5.01781326 49 1.60438492 2.03058714 50 -7.36545839 1.60438492 51 2.57185677 -7.36545839 52 -0.54050692 2.57185677 53 -1.69459486 -0.54050692 54 2.03518290 -1.69459486 55 1.57496254 2.03518290 56 2.01275359 1.57496254 57 3.33641949 2.01275359 58 1.33465496 3.33641949 59 0.68668580 1.33465496 60 -1.81046176 0.68668580 61 6.77684353 -1.81046176 62 5.40348277 6.77684353 63 2.40472378 5.40348277 64 -5.64084113 2.40472378 65 0.81605725 -5.64084113 66 3.08165578 0.81605725 67 -2.49579344 3.08165578 68 -0.12811986 -2.49579344 69 -5.81679358 -0.12811986 70 1.95341697 -5.81679358 71 0.03222340 1.95341697 72 1.25242149 0.03222340 73 2.21169233 1.25242149 74 0.68302385 2.21169233 75 1.44901897 0.68302385 76 1.81386924 1.44901897 77 1.46200205 1.81386924 78 -3.06492054 1.46200205 79 -3.13732066 -3.06492054 80 -5.21931419 -3.13732066 81 -0.22309202 -5.21931419 82 1.36809986 -0.22309202 83 -1.81844368 1.36809986 84 -2.89970981 -1.81844368 85 -1.26806466 -2.89970981 86 -1.85764819 -1.26806466 87 -1.00704016 -1.85764819 88 -2.87421928 -1.00704016 89 -1.08911934 -2.87421928 90 1.10153628 -1.08911934 91 -0.93319261 1.10153628 92 2.62316178 -0.93319261 93 2.42148241 2.62316178 94 -2.30295282 2.42148241 95 -2.63284801 -2.30295282 96 -4.28445068 -2.63284801 97 -2.92425007 -4.28445068 98 2.50771059 -2.92425007 99 -0.38487176 2.50771059 100 3.76292778 -0.38487176 101 1.62272253 3.76292778 102 0.97277889 1.62272253 103 -7.01759442 0.97277889 104 -7.38221435 -7.01759442 105 6.66800059 -7.38221435 106 0.96994560 6.66800059 107 2.45588732 0.96994560 108 0.39099093 2.45588732 109 -2.21359316 0.39099093 110 2.17782054 -2.21359316 111 2.29245647 2.17782054 112 -6.27161146 2.29245647 113 1.43290636 -6.27161146 114 0.76825057 1.43290636 115 1.56318044 0.76825057 116 -0.08000689 1.56318044 117 -3.13336884 -0.08000689 118 2.66666540 -3.13336884 119 4.09772676 2.66666540 120 -0.94352887 4.09772676 121 3.80795791 -0.94352887 122 -2.84570072 3.80795791 123 1.20267767 -2.84570072 124 2.56199817 1.20267767 125 -5.93353466 2.56199817 126 -5.69958419 -5.93353466 127 2.55937504 -5.69958419 128 1.48734288 2.55937504 129 -1.90309722 1.48734288 130 -0.24607181 -1.90309722 131 -2.26852911 -0.24607181 132 -2.53712711 -2.26852911 133 -1.05708793 -2.53712711 134 1.64129043 -1.05708793 135 -2.11164351 1.64129043 136 2.14075206 -2.11164351 137 3.38272332 2.14075206 138 2.56015909 3.38272332 139 1.80633639 2.56015909 140 4.49475332 1.80633639 141 -0.44023500 4.49475332 142 4.33741893 -0.44023500 143 -0.40562106 4.33741893 144 0.15388793 -0.40562106 145 -9.27668945 0.15388793 146 -3.50156689 -9.27668945 147 3.61444392 -3.50156689 148 3.78632389 3.61444392 149 -2.65586776 3.78632389 150 0.02884526 -2.65586776 151 1.61615439 0.02884526 152 -0.82284517 1.61615439 153 -0.04204576 -0.82284517 154 1.94015344 -0.04204576 155 0.90484317 1.94015344 156 NA 0.90484317 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.02884864 3.82266058 [2,] 0.52915459 -3.02884864 [3,] -5.21733424 0.52915459 [4,] -2.72246966 -5.21733424 [5,] -2.26139199 -2.72246966 [6,] 1.89928017 -2.26139199 [7,] -2.33245810 1.89928017 [8,] 2.17615692 -2.33245810 [9,] -4.53996015 2.17615692 [10,] 4.21870166 -4.53996015 [11,] -0.16699811 4.21870166 [12,] 3.94786114 -0.16699811 [13,] 0.97345932 3.94786114 [14,] -5.17954488 0.97345932 [15,] 2.36775010 -5.17954488 [16,] 1.88859974 2.36775010 [17,] 1.03331424 1.88859974 [18,] -3.15124136 1.03331424 [19,] -0.89937267 -3.15124136 [20,] -1.48658711 -0.89937267 [21,] 0.61201185 -1.48658711 [22,] 4.67220387 0.61201185 [23,] -5.68455592 4.67220387 [24,] 1.21686258 -5.68455592 [25,] 5.21673122 1.21686258 [26,] 1.86708773 5.21673122 [27,] 5.28700096 1.86708773 [28,] 1.48354417 5.28700096 [29,] -2.91126477 1.48354417 [30,] -0.93307922 -2.91126477 [31,] -1.69409238 -0.93307922 [32,] 1.37739375 -1.69409238 [33,] -4.12820267 1.37739375 [34,] 1.09865689 -4.12820267 [35,] 4.72001612 1.09865689 [36,] -1.61989976 4.72001612 [37,] -2.84254815 -1.61989976 [38,] 2.14230952 -2.84254815 [39,] 6.28297595 2.14230952 [40,] 2.65918326 6.28297595 [41,] -5.75610736 2.65918326 [42,] -0.96306908 -5.75610736 [43,] 0.09642671 -0.96306908 [44,] -3.88964374 0.09642671 [45,] 0.71188817 -3.88964374 [46,] 3.90883797 0.71188817 [47,] -5.01781326 3.90883797 [48,] 2.03058714 -5.01781326 [49,] 1.60438492 2.03058714 [50,] -7.36545839 1.60438492 [51,] 2.57185677 -7.36545839 [52,] -0.54050692 2.57185677 [53,] -1.69459486 -0.54050692 [54,] 2.03518290 -1.69459486 [55,] 1.57496254 2.03518290 [56,] 2.01275359 1.57496254 [57,] 3.33641949 2.01275359 [58,] 1.33465496 3.33641949 [59,] 0.68668580 1.33465496 [60,] -1.81046176 0.68668580 [61,] 6.77684353 -1.81046176 [62,] 5.40348277 6.77684353 [63,] 2.40472378 5.40348277 [64,] -5.64084113 2.40472378 [65,] 0.81605725 -5.64084113 [66,] 3.08165578 0.81605725 [67,] -2.49579344 3.08165578 [68,] -0.12811986 -2.49579344 [69,] -5.81679358 -0.12811986 [70,] 1.95341697 -5.81679358 [71,] 0.03222340 1.95341697 [72,] 1.25242149 0.03222340 [73,] 2.21169233 1.25242149 [74,] 0.68302385 2.21169233 [75,] 1.44901897 0.68302385 [76,] 1.81386924 1.44901897 [77,] 1.46200205 1.81386924 [78,] -3.06492054 1.46200205 [79,] -3.13732066 -3.06492054 [80,] -5.21931419 -3.13732066 [81,] -0.22309202 -5.21931419 [82,] 1.36809986 -0.22309202 [83,] -1.81844368 1.36809986 [84,] -2.89970981 -1.81844368 [85,] -1.26806466 -2.89970981 [86,] -1.85764819 -1.26806466 [87,] -1.00704016 -1.85764819 [88,] -2.87421928 -1.00704016 [89,] -1.08911934 -2.87421928 [90,] 1.10153628 -1.08911934 [91,] -0.93319261 1.10153628 [92,] 2.62316178 -0.93319261 [93,] 2.42148241 2.62316178 [94,] -2.30295282 2.42148241 [95,] -2.63284801 -2.30295282 [96,] -4.28445068 -2.63284801 [97,] -2.92425007 -4.28445068 [98,] 2.50771059 -2.92425007 [99,] -0.38487176 2.50771059 [100,] 3.76292778 -0.38487176 [101,] 1.62272253 3.76292778 [102,] 0.97277889 1.62272253 [103,] -7.01759442 0.97277889 [104,] -7.38221435 -7.01759442 [105,] 6.66800059 -7.38221435 [106,] 0.96994560 6.66800059 [107,] 2.45588732 0.96994560 [108,] 0.39099093 2.45588732 [109,] -2.21359316 0.39099093 [110,] 2.17782054 -2.21359316 [111,] 2.29245647 2.17782054 [112,] -6.27161146 2.29245647 [113,] 1.43290636 -6.27161146 [114,] 0.76825057 1.43290636 [115,] 1.56318044 0.76825057 [116,] -0.08000689 1.56318044 [117,] -3.13336884 -0.08000689 [118,] 2.66666540 -3.13336884 [119,] 4.09772676 2.66666540 [120,] -0.94352887 4.09772676 [121,] 3.80795791 -0.94352887 [122,] -2.84570072 3.80795791 [123,] 1.20267767 -2.84570072 [124,] 2.56199817 1.20267767 [125,] -5.93353466 2.56199817 [126,] -5.69958419 -5.93353466 [127,] 2.55937504 -5.69958419 [128,] 1.48734288 2.55937504 [129,] -1.90309722 1.48734288 [130,] -0.24607181 -1.90309722 [131,] -2.26852911 -0.24607181 [132,] -2.53712711 -2.26852911 [133,] -1.05708793 -2.53712711 [134,] 1.64129043 -1.05708793 [135,] -2.11164351 1.64129043 [136,] 2.14075206 -2.11164351 [137,] 3.38272332 2.14075206 [138,] 2.56015909 3.38272332 [139,] 1.80633639 2.56015909 [140,] 4.49475332 1.80633639 [141,] -0.44023500 4.49475332 [142,] 4.33741893 -0.44023500 [143,] -0.40562106 4.33741893 [144,] 0.15388793 -0.40562106 [145,] -9.27668945 0.15388793 [146,] -3.50156689 -9.27668945 [147,] 3.61444392 -3.50156689 [148,] 3.78632389 3.61444392 [149,] -2.65586776 3.78632389 [150,] 0.02884526 -2.65586776 [151,] 1.61615439 0.02884526 [152,] -0.82284517 1.61615439 [153,] -0.04204576 -0.82284517 [154,] 1.94015344 -0.04204576 [155,] 0.90484317 1.94015344 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.02884864 3.82266058 2 0.52915459 -3.02884864 3 -5.21733424 0.52915459 4 -2.72246966 -5.21733424 5 -2.26139199 -2.72246966 6 1.89928017 -2.26139199 7 -2.33245810 1.89928017 8 2.17615692 -2.33245810 9 -4.53996015 2.17615692 10 4.21870166 -4.53996015 11 -0.16699811 4.21870166 12 3.94786114 -0.16699811 13 0.97345932 3.94786114 14 -5.17954488 0.97345932 15 2.36775010 -5.17954488 16 1.88859974 2.36775010 17 1.03331424 1.88859974 18 -3.15124136 1.03331424 19 -0.89937267 -3.15124136 20 -1.48658711 -0.89937267 21 0.61201185 -1.48658711 22 4.67220387 0.61201185 23 -5.68455592 4.67220387 24 1.21686258 -5.68455592 25 5.21673122 1.21686258 26 1.86708773 5.21673122 27 5.28700096 1.86708773 28 1.48354417 5.28700096 29 -2.91126477 1.48354417 30 -0.93307922 -2.91126477 31 -1.69409238 -0.93307922 32 1.37739375 -1.69409238 33 -4.12820267 1.37739375 34 1.09865689 -4.12820267 35 4.72001612 1.09865689 36 -1.61989976 4.72001612 37 -2.84254815 -1.61989976 38 2.14230952 -2.84254815 39 6.28297595 2.14230952 40 2.65918326 6.28297595 41 -5.75610736 2.65918326 42 -0.96306908 -5.75610736 43 0.09642671 -0.96306908 44 -3.88964374 0.09642671 45 0.71188817 -3.88964374 46 3.90883797 0.71188817 47 -5.01781326 3.90883797 48 2.03058714 -5.01781326 49 1.60438492 2.03058714 50 -7.36545839 1.60438492 51 2.57185677 -7.36545839 52 -0.54050692 2.57185677 53 -1.69459486 -0.54050692 54 2.03518290 -1.69459486 55 1.57496254 2.03518290 56 2.01275359 1.57496254 57 3.33641949 2.01275359 58 1.33465496 3.33641949 59 0.68668580 1.33465496 60 -1.81046176 0.68668580 61 6.77684353 -1.81046176 62 5.40348277 6.77684353 63 2.40472378 5.40348277 64 -5.64084113 2.40472378 65 0.81605725 -5.64084113 66 3.08165578 0.81605725 67 -2.49579344 3.08165578 68 -0.12811986 -2.49579344 69 -5.81679358 -0.12811986 70 1.95341697 -5.81679358 71 0.03222340 1.95341697 72 1.25242149 0.03222340 73 2.21169233 1.25242149 74 0.68302385 2.21169233 75 1.44901897 0.68302385 76 1.81386924 1.44901897 77 1.46200205 1.81386924 78 -3.06492054 1.46200205 79 -3.13732066 -3.06492054 80 -5.21931419 -3.13732066 81 -0.22309202 -5.21931419 82 1.36809986 -0.22309202 83 -1.81844368 1.36809986 84 -2.89970981 -1.81844368 85 -1.26806466 -2.89970981 86 -1.85764819 -1.26806466 87 -1.00704016 -1.85764819 88 -2.87421928 -1.00704016 89 -1.08911934 -2.87421928 90 1.10153628 -1.08911934 91 -0.93319261 1.10153628 92 2.62316178 -0.93319261 93 2.42148241 2.62316178 94 -2.30295282 2.42148241 95 -2.63284801 -2.30295282 96 -4.28445068 -2.63284801 97 -2.92425007 -4.28445068 98 2.50771059 -2.92425007 99 -0.38487176 2.50771059 100 3.76292778 -0.38487176 101 1.62272253 3.76292778 102 0.97277889 1.62272253 103 -7.01759442 0.97277889 104 -7.38221435 -7.01759442 105 6.66800059 -7.38221435 106 0.96994560 6.66800059 107 2.45588732 0.96994560 108 0.39099093 2.45588732 109 -2.21359316 0.39099093 110 2.17782054 -2.21359316 111 2.29245647 2.17782054 112 -6.27161146 2.29245647 113 1.43290636 -6.27161146 114 0.76825057 1.43290636 115 1.56318044 0.76825057 116 -0.08000689 1.56318044 117 -3.13336884 -0.08000689 118 2.66666540 -3.13336884 119 4.09772676 2.66666540 120 -0.94352887 4.09772676 121 3.80795791 -0.94352887 122 -2.84570072 3.80795791 123 1.20267767 -2.84570072 124 2.56199817 1.20267767 125 -5.93353466 2.56199817 126 -5.69958419 -5.93353466 127 2.55937504 -5.69958419 128 1.48734288 2.55937504 129 -1.90309722 1.48734288 130 -0.24607181 -1.90309722 131 -2.26852911 -0.24607181 132 -2.53712711 -2.26852911 133 -1.05708793 -2.53712711 134 1.64129043 -1.05708793 135 -2.11164351 1.64129043 136 2.14075206 -2.11164351 137 3.38272332 2.14075206 138 2.56015909 3.38272332 139 1.80633639 2.56015909 140 4.49475332 1.80633639 141 -0.44023500 4.49475332 142 4.33741893 -0.44023500 143 -0.40562106 4.33741893 144 0.15388793 -0.40562106 145 -9.27668945 0.15388793 146 -3.50156689 -9.27668945 147 3.61444392 -3.50156689 148 3.78632389 3.61444392 149 -2.65586776 3.78632389 150 0.02884526 -2.65586776 151 1.61615439 0.02884526 152 -0.82284517 1.61615439 153 -0.04204576 -0.82284517 154 1.94015344 -0.04204576 155 0.90484317 1.94015344 > 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/7852x1321985710.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/8y00e1321985710.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/962951321985710.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/10zk491321985710.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/11uwlw1321985710.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/12y2ax1321985710.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/13mo3e1321985710.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/143rfc1321985710.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/15xiaw1321985710.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/16iaao1321985710.tab") + } > > try(system("convert tmp/1f52u1321985710.ps tmp/1f52u1321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/2zxay1321985710.ps tmp/2zxay1321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/39asb1321985710.ps tmp/39asb1321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/411he1321985710.ps tmp/411he1321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/5zje51321985710.ps tmp/5zje51321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/6reo11321985710.ps tmp/6reo11321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/7852x1321985710.ps tmp/7852x1321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/8y00e1321985710.ps tmp/8y00e1321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/962951321985710.ps tmp/962951321985710.png",intern=TRUE)) character(0) > try(system("convert tmp/10zk491321985710.ps tmp/10zk491321985710.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.329 0.645 6.043