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(2.04 + ,2.01 + ,1070 + ,5 + ,2.56 + ,3.40 + ,1254 + ,6 + ,3.75 + ,3.68 + ,1466 + ,6 + ,1.10 + ,1.54 + ,706 + ,4 + ,3.00 + ,3.32 + ,1160 + ,5 + ,0.05 + ,0.33 + ,756 + ,3 + ,1.38 + ,0.36 + ,1058 + ,2 + ,1.50 + ,1.97 + ,1008 + ,7 + ,1.38 + ,2.03 + ,1104 + ,4 + ,4.01 + ,2.05 + ,1200 + ,7 + ,1.50 + ,2.13 + ,896 + ,7 + ,1.29 + ,1.34 + ,848 + ,3 + ,1.90 + ,1.51 + ,958 + ,5 + ,3.11 + ,3.12 + ,1246 + ,6 + ,1.92 + ,2.14 + ,1106 + ,4 + ,0.81 + ,2.60 + ,790 + ,5 + ,1.01 + ,1.90 + ,954 + ,4 + ,3.66 + ,3.06 + ,1500 + ,6 + ,2.00 + ,1.60 + ,1046 + ,5 + ,2.05 + ,1.96 + ,1054 + ,4 + ,2.60 + ,1.96 + ,1198 + ,6 + ,2.55 + ,1.56 + ,940 + ,3 + ,0.38 + ,1.60 + ,456 + ,6 + ,2.48 + ,1.92 + ,1150 + ,7 + ,2.74 + ,3.09 + ,636 + ,6 + ,1.77 + ,0.78 + ,744 + ,5 + ,1.61 + ,2.12 + ,644 + ,5 + ,0.99 + ,1.85 + ,842 + ,3 + ,1.62 + ,1.78 + ,852 + ,5 + ,2.03 + ,1.03 + ,1170 + ,3 + ,3.50 + ,3.44 + ,1034 + ,10 + ,3.18 + ,2.42 + ,1202 + ,5 + ,2.39 + ,1.74 + ,1018 + ,5 + ,1.48 + ,1.89 + ,1180 + ,5 + ,1.54 + ,1.43 + ,952 + ,3 + ,1.57 + ,1.64 + ,1038 + ,4 + ,2.46 + ,2.69 + ,1090 + ,6 + ,2.42 + ,1.79 + ,694 + ,5 + ,2.11 + ,2.72 + ,1096 + ,6 + ,2.04 + ,2.15 + ,1114 + ,5 + ,1.68 + ,2.22 + ,1256 + ,6 + ,1.64 + ,1.55 + ,1208 + ,5 + ,2.41 + ,2.34 + ,820 + ,6 + ,2.10 + ,2.92 + ,1222 + ,4 + ,1.40 + ,2.10 + ,1120 + ,5 + ,2.03 + ,1.64 + ,886 + ,4 + ,1.99 + ,2.83 + ,1126 + ,7 + ,2.24 + ,1.76 + ,1158 + ,4 + ,0.45 + ,1.81 + ,676 + ,6 + ,2.31 + ,2.68 + ,1214 + ,7 + ,2.41 + ,2.55 + ,1136 + ,6 + ,2.56 + ,2.70 + ,1264 + ,6 + ,2.50 + ,1.66 + ,1116 + ,3 + ,2.92 + ,2.23 + ,1292 + ,4 + ,2.35 + ,2.01 + ,604 + ,5 + ,2.82 + ,1.24 + ,854 + ,6 + ,1.80 + ,1.95 + ,814 + ,6 + ,1.29 + ,1.73 + ,778 + ,3 + ,1.68 + ,1.08 + ,800 + ,2 + ,3.44 + ,3.46 + ,1424 + ,7 + ,1.90 + ,3.01 + ,950 + ,6 + ,2.06 + ,0.54 + ,1056 + ,3 + ,3.30 + ,3.20 + ,956 + ,8 + ,1.80 + ,1.50 + ,1352 + ,5 + ,2.00 + ,1.71 + ,852 + ,5 + ,1.68 + ,1.99 + ,1168 + ,5 + ,1.94 + ,2.76 + ,970 + ,6 + ,0.97 + ,1.56 + ,776 + ,4 + ,1.12 + ,1.78 + ,854 + ,6 + ,1.31 + ,1.32 + ,1232 + ,5 + ,1.68 + ,0.87 + ,1140 + ,6 + ,3.09 + ,1.75 + ,1084 + ,4 + ,1.87 + ,1.41 + ,954 + ,2 + ,2.00 + ,2.77 + ,1000 + ,4 + ,2.39 + ,1.78 + ,1084 + ,4 + ,1.50 + ,1.34 + ,1058 + ,4 + ,1.82 + ,1.52 + ,816 + ,5 + ,1.80 + ,2.97 + ,1146 + ,7 + ,2.01 + ,1.75 + ,1000 + ,6 + ,1.88 + ,1.64 + ,856 + ,4 + ,1.64 + ,1.80 + ,798 + ,4 + ,2.42 + ,3.37 + ,1324 + ,6 + ,0.22 + ,1.15 + ,704 + ,6 + ,2.31 + ,1.72 + ,1222 + ,5 + ,0.95 + ,2.27 + ,948 + ,6 + ,1.99 + ,2.85 + ,1182 + ,8 + ,1.86 + ,2.21 + ,1000 + ,6 + ,1.79 + ,1.94 + ,910 + ,6 + ,3.02 + ,4.25 + ,1374 + ,9 + ,1.85 + ,1.83 + ,1014 + ,6 + ,1.98 + ,2.75 + ,1420 + ,7 + ,2.15 + ,1.71 + ,400 + ,6 + ,1.46 + ,2.20 + ,998 + ,7 + ,2.29 + ,2.13 + ,776 + ,6 + ,2.39 + ,2.38 + ,1134 + ,7 + ,1.80 + ,1.64 + ,772 + ,4 + ,2.64 + ,1.87 + ,1304 + ,6 + ,2.08 + ,2.53 + ,1212 + ,4 + ,0.70 + ,1.78 + ,818 + ,6 + ,0.89 + ,1.20 + ,864 + ,2) + ,dim=c(4 + ,100) + ,dimnames=list(c('CollegeGPA' + ,'HighSchoolGPA' + ,'SATtotal' + ,'Qualityoflettersofrecommendation') + ,1:100)) > y <- array(NA,dim=c(4,100),dimnames=list(c('CollegeGPA','HighSchoolGPA','SATtotal','Qualityoflettersofrecommendation'),1:100)) > 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 = '4' > #'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 Qualityoflettersofrecommendation CollegeGPA HighSchoolGPA SATtotal 1 5 2.04 2.01 1070 2 6 2.56 3.40 1254 3 6 3.75 3.68 1466 4 4 1.10 1.54 706 5 5 3.00 3.32 1160 6 3 0.05 0.33 756 7 2 1.38 0.36 1058 8 7 1.50 1.97 1008 9 4 1.38 2.03 1104 10 7 4.01 2.05 1200 11 7 1.50 2.13 896 12 3 1.29 1.34 848 13 5 1.90 1.51 958 14 6 3.11 3.12 1246 15 4 1.92 2.14 1106 16 5 0.81 2.60 790 17 4 1.01 1.90 954 18 6 3.66 3.06 1500 19 5 2.00 1.60 1046 20 4 2.05 1.96 1054 21 6 2.60 1.96 1198 22 3 2.55 1.56 940 23 6 0.38 1.60 456 24 7 2.48 1.92 1150 25 6 2.74 3.09 636 26 5 1.77 0.78 744 27 5 1.61 2.12 644 28 3 0.99 1.85 842 29 5 1.62 1.78 852 30 3 2.03 1.03 1170 31 10 3.50 3.44 1034 32 5 3.18 2.42 1202 33 5 2.39 1.74 1018 34 5 1.48 1.89 1180 35 3 1.54 1.43 952 36 4 1.57 1.64 1038 37 6 2.46 2.69 1090 38 5 2.42 1.79 694 39 6 2.11 2.72 1096 40 5 2.04 2.15 1114 41 6 1.68 2.22 1256 42 5 1.64 1.55 1208 43 6 2.41 2.34 820 44 4 2.10 2.92 1222 45 5 1.40 2.10 1120 46 4 2.03 1.64 886 47 7 1.99 2.83 1126 48 4 2.24 1.76 1158 49 6 0.45 1.81 676 50 7 2.31 2.68 1214 51 6 2.41 2.55 1136 52 6 2.56 2.70 1264 53 3 2.50 1.66 1116 54 4 2.92 2.23 1292 55 5 2.35 2.01 604 56 6 2.82 1.24 854 57 6 1.80 1.95 814 58 3 1.29 1.73 778 59 2 1.68 1.08 800 60 7 3.44 3.46 1424 61 6 1.90 3.01 950 62 3 2.06 0.54 1056 63 8 3.30 3.20 956 64 5 1.80 1.50 1352 65 5 2.00 1.71 852 66 5 1.68 1.99 1168 67 6 1.94 2.76 970 68 4 0.97 1.56 776 69 6 1.12 1.78 854 70 5 1.31 1.32 1232 71 6 1.68 0.87 1140 72 4 3.09 1.75 1084 73 2 1.87 1.41 954 74 4 2.00 2.77 1000 75 4 2.39 1.78 1084 76 4 1.50 1.34 1058 77 5 1.82 1.52 816 78 7 1.80 2.97 1146 79 6 2.01 1.75 1000 80 4 1.88 1.64 856 81 4 1.64 1.80 798 82 6 2.42 3.37 1324 83 6 0.22 1.15 704 84 5 2.31 1.72 1222 85 6 0.95 2.27 948 86 8 1.99 2.85 1182 87 6 1.86 2.21 1000 88 6 1.79 1.94 910 89 9 3.02 4.25 1374 90 6 1.85 1.83 1014 91 7 1.98 2.75 1420 92 6 2.15 1.71 400 93 7 1.46 2.20 998 94 6 2.29 2.13 776 95 7 2.39 2.38 1134 96 4 1.80 1.64 772 97 6 2.64 1.87 1304 98 4 2.08 2.53 1212 99 6 0.70 1.78 818 100 2 0.89 1.20 864 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) CollegeGPA HighSchoolGPA SATtotal 2.8792692 0.0907256 1.3191699 -0.0005631 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.3718 -0.8369 -0.0182 0.9222 2.8475 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.8792692 0.5759568 4.999 2.59e-06 *** CollegeGPA 0.0907256 0.2039012 0.445 0.657 HighSchoolGPA 1.3191699 0.1999748 6.597 2.29e-09 *** SATtotal -0.0005631 0.0006536 -0.862 0.391 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.179 on 96 degrees of freedom Multiple R-squared: 0.3974, Adjusted R-squared: 0.3785 F-statistic: 21.1 on 3 and 96 DF, p-value: 1.397e-10 > 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.12819931 0.25639863 0.8718007 [2,] 0.57840388 0.84319224 0.4215961 [3,] 0.60271151 0.79457698 0.3972885 [4,] 0.73428121 0.53143758 0.2657188 [5,] 0.80727677 0.38544647 0.1927232 [6,] 0.83357667 0.33284665 0.1664233 [7,] 0.76851519 0.46296961 0.2314848 [8,] 0.69292667 0.61414665 0.3070733 [9,] 0.64794593 0.70410814 0.3520541 [10,] 0.57695737 0.84608526 0.4230426 [11,] 0.50231808 0.99536385 0.4976819 [12,] 0.42632750 0.85265500 0.5736725 [13,] 0.35697944 0.71395889 0.6430206 [14,] 0.32932183 0.65864365 0.6706782 [15,] 0.32069270 0.64138541 0.6793073 [16,] 0.46945628 0.93891256 0.5305437 [17,] 0.47367377 0.94734754 0.5263262 [18,] 0.62665907 0.74668185 0.3733409 [19,] 0.60264422 0.79471156 0.3973558 [20,] 0.58013865 0.83972270 0.4198613 [21,] 0.52127363 0.95745274 0.4787264 [22,] 0.59197349 0.81605302 0.4080265 [23,] 0.52714571 0.94570858 0.4728543 [24,] 0.49944130 0.99888260 0.5005587 [25,] 0.77813252 0.44373497 0.2218675 [26,] 0.74684076 0.50631849 0.2531592 [27,] 0.69430727 0.61138547 0.3056927 [28,] 0.65843492 0.68313015 0.3415651 [29,] 0.67121188 0.65757623 0.3287881 [30,] 0.62333856 0.75332288 0.3766614 [31,] 0.56488121 0.87023759 0.4351188 [32,] 0.51703834 0.96592332 0.4829617 [33,] 0.46176026 0.92352052 0.5382397 [34,] 0.40432466 0.80864931 0.5956753 [35,] 0.40189408 0.80378816 0.5981059 [36,] 0.36921389 0.73842778 0.6307861 [37,] 0.31611425 0.63222849 0.6838858 [38,] 0.43166310 0.86332619 0.5683369 [39,] 0.38333969 0.76667938 0.6166603 [40,] 0.35224614 0.70449228 0.6477539 [41,] 0.34358317 0.68716635 0.6564168 [42,] 0.31084937 0.62169874 0.6891506 [43,] 0.30849059 0.61698119 0.6915094 [44,] 0.30698475 0.61396950 0.6930152 [45,] 0.25915082 0.51830163 0.7408492 [46,] 0.21520516 0.43041033 0.7847948 [47,] 0.26152542 0.52305083 0.7384746 [48,] 0.28114723 0.56229446 0.7188528 [49,] 0.24146110 0.48292220 0.7585389 [50,] 0.29148124 0.58296249 0.7085188 [51,] 0.26699661 0.53399321 0.7330034 [52,] 0.34396926 0.68793852 0.6560307 [53,] 0.45695769 0.91391537 0.5430423 [54,] 0.39969420 0.79938841 0.6003058 [55,] 0.35866959 0.71733918 0.6413304 [56,] 0.30504032 0.61008064 0.6949597 [57,] 0.30756116 0.61512232 0.6924388 [58,] 0.27587318 0.55174635 0.7241268 [59,] 0.22733372 0.45466744 0.7726663 [60,] 0.18856196 0.37712392 0.8114380 [61,] 0.15121504 0.30243009 0.8487850 [62,] 0.13291258 0.26582515 0.8670874 [63,] 0.12292898 0.24585797 0.8770710 [64,] 0.10576317 0.21152633 0.8942368 [65,] 0.22308310 0.44616619 0.7769169 [66,] 0.18983972 0.37967944 0.8101603 [67,] 0.34446804 0.68893608 0.6555320 [68,] 0.58024397 0.83951207 0.4197560 [69,] 0.55554546 0.88890909 0.4444545 [70,] 0.49238621 0.98477241 0.5076138 [71,] 0.42284445 0.84568891 0.5771555 [72,] 0.36304328 0.72608656 0.6369567 [73,] 0.34134605 0.68269209 0.6586540 [74,] 0.31575359 0.63150718 0.6842464 [75,] 0.33639935 0.67279869 0.6636007 [76,] 0.38555180 0.77110359 0.6144482 [77,] 0.49971286 0.99942573 0.5002871 [78,] 0.41399913 0.82799826 0.5860009 [79,] 0.33407272 0.66814544 0.6659273 [80,] 0.33428234 0.66856469 0.6657177 [81,] 0.25450031 0.50900061 0.7454997 [82,] 0.19604042 0.39208084 0.8039596 [83,] 0.16508624 0.33017247 0.8349138 [84,] 0.13729305 0.27458610 0.8627069 [85,] 0.08737291 0.17474583 0.9126271 [86,] 0.05012344 0.10024688 0.9498766 [87,] 0.04888222 0.09776443 0.9511178 > postscript(file="/var/www/rcomp/tmp/1kutb1322142836.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/2qvq41322142836.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/3wbo41322142836.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/4g51q1322142836.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/533uh1322142836.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 = 100 Frequency = 1 1 2 3 4 5 -0.1133730469 -0.8905876530 -1.2485433340 -0.6130464040 -1.8779039422 6 7 8 9 10 0.1065656170 -0.8836209579 1.9534739219 -1.0607324131 1.7283325404 11 12 13 14 15 1.6793405015 -1.2864913169 0.4958472281 -0.5756239256 -1.2537067593 16 17 18 19 20 -0.9377563355 -0.9401355639 -0.4033476053 0.4176014253 -1.0573312737 21 22 23 24 25 0.9738547949 -1.6392185760 1.2323530000 2.0104802759 -0.8459661324 26 27 28 29 30 1.3501339854 -0.4593466674 -1.9354288015 0.1053868509 -0.7633701843 31 32 33 34 35 2.8474833320 -0.6833318441 0.1817680854 0.1576737538 -1.3693365021 36 37 38 39 40 -0.6006580761 -0.0372514891 -0.0693538087 -0.0416940626 -0.2732808029 41 42 43 44 45 0.7469975239 0.6074419641 0.2769595496 -2.2336712542 -0.1458793526 46 47 48 49 50 -0.7279817713 0.8409770734 -0.7521736620 1.0728566558 1.0593723959 51 52 53 54 55 0.1778707799 0.0384621620 -1.6674951834 -1.3584226740 -0.4038986138 56 57 58 59 60 1.7099939907 0.8433998848 -1.8403839633 -2.0059185428 0.0461491414 61 62 63 64 65 -0.4874122900 -0.1838911493 1.1383080919 0.7399695246 0.1632529983 66 67 68 69 70 0.0008545429 -0.1499870220 -0.5882190661 1.1518758531 0.9543046870 71 72 73 74 75 2.4625582227 -0.8577675239 -2.3717663828 -2.1517295152 -0.8338346727 76 77 78 79 80 -0.1872944950 0.4099545937 0.6847929937 1.1929164833 -0.7312656692 81 82 83 84 85 -0.9532179977 -0.7988945658 1.9801422195 0.3302801909 0.5738365783 86 87 88 89 90 1.8461267978 0.5997071945 0.9115556196 1.0139551492 1.1097822772 91 92 93 94 95 1.1129668067 0.8951268140 1.6480629656 0.5400962722 1.4028179855 96 97 98 99 100 -0.7713073005 1.1486387510 -1.7230114115 1.1697093288 -2.0565078181 > postscript(file="/var/www/rcomp/tmp/6hv5r1322142836.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 = 100 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.1133730469 NA 1 -0.8905876530 -0.1133730469 2 -1.2485433340 -0.8905876530 3 -0.6130464040 -1.2485433340 4 -1.8779039422 -0.6130464040 5 0.1065656170 -1.8779039422 6 -0.8836209579 0.1065656170 7 1.9534739219 -0.8836209579 8 -1.0607324131 1.9534739219 9 1.7283325404 -1.0607324131 10 1.6793405015 1.7283325404 11 -1.2864913169 1.6793405015 12 0.4958472281 -1.2864913169 13 -0.5756239256 0.4958472281 14 -1.2537067593 -0.5756239256 15 -0.9377563355 -1.2537067593 16 -0.9401355639 -0.9377563355 17 -0.4033476053 -0.9401355639 18 0.4176014253 -0.4033476053 19 -1.0573312737 0.4176014253 20 0.9738547949 -1.0573312737 21 -1.6392185760 0.9738547949 22 1.2323530000 -1.6392185760 23 2.0104802759 1.2323530000 24 -0.8459661324 2.0104802759 25 1.3501339854 -0.8459661324 26 -0.4593466674 1.3501339854 27 -1.9354288015 -0.4593466674 28 0.1053868509 -1.9354288015 29 -0.7633701843 0.1053868509 30 2.8474833320 -0.7633701843 31 -0.6833318441 2.8474833320 32 0.1817680854 -0.6833318441 33 0.1576737538 0.1817680854 34 -1.3693365021 0.1576737538 35 -0.6006580761 -1.3693365021 36 -0.0372514891 -0.6006580761 37 -0.0693538087 -0.0372514891 38 -0.0416940626 -0.0693538087 39 -0.2732808029 -0.0416940626 40 0.7469975239 -0.2732808029 41 0.6074419641 0.7469975239 42 0.2769595496 0.6074419641 43 -2.2336712542 0.2769595496 44 -0.1458793526 -2.2336712542 45 -0.7279817713 -0.1458793526 46 0.8409770734 -0.7279817713 47 -0.7521736620 0.8409770734 48 1.0728566558 -0.7521736620 49 1.0593723959 1.0728566558 50 0.1778707799 1.0593723959 51 0.0384621620 0.1778707799 52 -1.6674951834 0.0384621620 53 -1.3584226740 -1.6674951834 54 -0.4038986138 -1.3584226740 55 1.7099939907 -0.4038986138 56 0.8433998848 1.7099939907 57 -1.8403839633 0.8433998848 58 -2.0059185428 -1.8403839633 59 0.0461491414 -2.0059185428 60 -0.4874122900 0.0461491414 61 -0.1838911493 -0.4874122900 62 1.1383080919 -0.1838911493 63 0.7399695246 1.1383080919 64 0.1632529983 0.7399695246 65 0.0008545429 0.1632529983 66 -0.1499870220 0.0008545429 67 -0.5882190661 -0.1499870220 68 1.1518758531 -0.5882190661 69 0.9543046870 1.1518758531 70 2.4625582227 0.9543046870 71 -0.8577675239 2.4625582227 72 -2.3717663828 -0.8577675239 73 -2.1517295152 -2.3717663828 74 -0.8338346727 -2.1517295152 75 -0.1872944950 -0.8338346727 76 0.4099545937 -0.1872944950 77 0.6847929937 0.4099545937 78 1.1929164833 0.6847929937 79 -0.7312656692 1.1929164833 80 -0.9532179977 -0.7312656692 81 -0.7988945658 -0.9532179977 82 1.9801422195 -0.7988945658 83 0.3302801909 1.9801422195 84 0.5738365783 0.3302801909 85 1.8461267978 0.5738365783 86 0.5997071945 1.8461267978 87 0.9115556196 0.5997071945 88 1.0139551492 0.9115556196 89 1.1097822772 1.0139551492 90 1.1129668067 1.1097822772 91 0.8951268140 1.1129668067 92 1.6480629656 0.8951268140 93 0.5400962722 1.6480629656 94 1.4028179855 0.5400962722 95 -0.7713073005 1.4028179855 96 1.1486387510 -0.7713073005 97 -1.7230114115 1.1486387510 98 1.1697093288 -1.7230114115 99 -2.0565078181 1.1697093288 100 NA -2.0565078181 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.8905876530 -0.1133730469 [2,] -1.2485433340 -0.8905876530 [3,] -0.6130464040 -1.2485433340 [4,] -1.8779039422 -0.6130464040 [5,] 0.1065656170 -1.8779039422 [6,] -0.8836209579 0.1065656170 [7,] 1.9534739219 -0.8836209579 [8,] -1.0607324131 1.9534739219 [9,] 1.7283325404 -1.0607324131 [10,] 1.6793405015 1.7283325404 [11,] -1.2864913169 1.6793405015 [12,] 0.4958472281 -1.2864913169 [13,] -0.5756239256 0.4958472281 [14,] -1.2537067593 -0.5756239256 [15,] -0.9377563355 -1.2537067593 [16,] -0.9401355639 -0.9377563355 [17,] -0.4033476053 -0.9401355639 [18,] 0.4176014253 -0.4033476053 [19,] -1.0573312737 0.4176014253 [20,] 0.9738547949 -1.0573312737 [21,] -1.6392185760 0.9738547949 [22,] 1.2323530000 -1.6392185760 [23,] 2.0104802759 1.2323530000 [24,] -0.8459661324 2.0104802759 [25,] 1.3501339854 -0.8459661324 [26,] -0.4593466674 1.3501339854 [27,] -1.9354288015 -0.4593466674 [28,] 0.1053868509 -1.9354288015 [29,] -0.7633701843 0.1053868509 [30,] 2.8474833320 -0.7633701843 [31,] -0.6833318441 2.8474833320 [32,] 0.1817680854 -0.6833318441 [33,] 0.1576737538 0.1817680854 [34,] -1.3693365021 0.1576737538 [35,] -0.6006580761 -1.3693365021 [36,] -0.0372514891 -0.6006580761 [37,] -0.0693538087 -0.0372514891 [38,] -0.0416940626 -0.0693538087 [39,] -0.2732808029 -0.0416940626 [40,] 0.7469975239 -0.2732808029 [41,] 0.6074419641 0.7469975239 [42,] 0.2769595496 0.6074419641 [43,] -2.2336712542 0.2769595496 [44,] -0.1458793526 -2.2336712542 [45,] -0.7279817713 -0.1458793526 [46,] 0.8409770734 -0.7279817713 [47,] -0.7521736620 0.8409770734 [48,] 1.0728566558 -0.7521736620 [49,] 1.0593723959 1.0728566558 [50,] 0.1778707799 1.0593723959 [51,] 0.0384621620 0.1778707799 [52,] -1.6674951834 0.0384621620 [53,] -1.3584226740 -1.6674951834 [54,] -0.4038986138 -1.3584226740 [55,] 1.7099939907 -0.4038986138 [56,] 0.8433998848 1.7099939907 [57,] -1.8403839633 0.8433998848 [58,] -2.0059185428 -1.8403839633 [59,] 0.0461491414 -2.0059185428 [60,] -0.4874122900 0.0461491414 [61,] -0.1838911493 -0.4874122900 [62,] 1.1383080919 -0.1838911493 [63,] 0.7399695246 1.1383080919 [64,] 0.1632529983 0.7399695246 [65,] 0.0008545429 0.1632529983 [66,] -0.1499870220 0.0008545429 [67,] -0.5882190661 -0.1499870220 [68,] 1.1518758531 -0.5882190661 [69,] 0.9543046870 1.1518758531 [70,] 2.4625582227 0.9543046870 [71,] -0.8577675239 2.4625582227 [72,] -2.3717663828 -0.8577675239 [73,] -2.1517295152 -2.3717663828 [74,] -0.8338346727 -2.1517295152 [75,] -0.1872944950 -0.8338346727 [76,] 0.4099545937 -0.1872944950 [77,] 0.6847929937 0.4099545937 [78,] 1.1929164833 0.6847929937 [79,] -0.7312656692 1.1929164833 [80,] -0.9532179977 -0.7312656692 [81,] -0.7988945658 -0.9532179977 [82,] 1.9801422195 -0.7988945658 [83,] 0.3302801909 1.9801422195 [84,] 0.5738365783 0.3302801909 [85,] 1.8461267978 0.5738365783 [86,] 0.5997071945 1.8461267978 [87,] 0.9115556196 0.5997071945 [88,] 1.0139551492 0.9115556196 [89,] 1.1097822772 1.0139551492 [90,] 1.1129668067 1.1097822772 [91,] 0.8951268140 1.1129668067 [92,] 1.6480629656 0.8951268140 [93,] 0.5400962722 1.6480629656 [94,] 1.4028179855 0.5400962722 [95,] -0.7713073005 1.4028179855 [96,] 1.1486387510 -0.7713073005 [97,] -1.7230114115 1.1486387510 [98,] 1.1697093288 -1.7230114115 [99,] -2.0565078181 1.1697093288 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.8905876530 -0.1133730469 2 -1.2485433340 -0.8905876530 3 -0.6130464040 -1.2485433340 4 -1.8779039422 -0.6130464040 5 0.1065656170 -1.8779039422 6 -0.8836209579 0.1065656170 7 1.9534739219 -0.8836209579 8 -1.0607324131 1.9534739219 9 1.7283325404 -1.0607324131 10 1.6793405015 1.7283325404 11 -1.2864913169 1.6793405015 12 0.4958472281 -1.2864913169 13 -0.5756239256 0.4958472281 14 -1.2537067593 -0.5756239256 15 -0.9377563355 -1.2537067593 16 -0.9401355639 -0.9377563355 17 -0.4033476053 -0.9401355639 18 0.4176014253 -0.4033476053 19 -1.0573312737 0.4176014253 20 0.9738547949 -1.0573312737 21 -1.6392185760 0.9738547949 22 1.2323530000 -1.6392185760 23 2.0104802759 1.2323530000 24 -0.8459661324 2.0104802759 25 1.3501339854 -0.8459661324 26 -0.4593466674 1.3501339854 27 -1.9354288015 -0.4593466674 28 0.1053868509 -1.9354288015 29 -0.7633701843 0.1053868509 30 2.8474833320 -0.7633701843 31 -0.6833318441 2.8474833320 32 0.1817680854 -0.6833318441 33 0.1576737538 0.1817680854 34 -1.3693365021 0.1576737538 35 -0.6006580761 -1.3693365021 36 -0.0372514891 -0.6006580761 37 -0.0693538087 -0.0372514891 38 -0.0416940626 -0.0693538087 39 -0.2732808029 -0.0416940626 40 0.7469975239 -0.2732808029 41 0.6074419641 0.7469975239 42 0.2769595496 0.6074419641 43 -2.2336712542 0.2769595496 44 -0.1458793526 -2.2336712542 45 -0.7279817713 -0.1458793526 46 0.8409770734 -0.7279817713 47 -0.7521736620 0.8409770734 48 1.0728566558 -0.7521736620 49 1.0593723959 1.0728566558 50 0.1778707799 1.0593723959 51 0.0384621620 0.1778707799 52 -1.6674951834 0.0384621620 53 -1.3584226740 -1.6674951834 54 -0.4038986138 -1.3584226740 55 1.7099939907 -0.4038986138 56 0.8433998848 1.7099939907 57 -1.8403839633 0.8433998848 58 -2.0059185428 -1.8403839633 59 0.0461491414 -2.0059185428 60 -0.4874122900 0.0461491414 61 -0.1838911493 -0.4874122900 62 1.1383080919 -0.1838911493 63 0.7399695246 1.1383080919 64 0.1632529983 0.7399695246 65 0.0008545429 0.1632529983 66 -0.1499870220 0.0008545429 67 -0.5882190661 -0.1499870220 68 1.1518758531 -0.5882190661 69 0.9543046870 1.1518758531 70 2.4625582227 0.9543046870 71 -0.8577675239 2.4625582227 72 -2.3717663828 -0.8577675239 73 -2.1517295152 -2.3717663828 74 -0.8338346727 -2.1517295152 75 -0.1872944950 -0.8338346727 76 0.4099545937 -0.1872944950 77 0.6847929937 0.4099545937 78 1.1929164833 0.6847929937 79 -0.7312656692 1.1929164833 80 -0.9532179977 -0.7312656692 81 -0.7988945658 -0.9532179977 82 1.9801422195 -0.7988945658 83 0.3302801909 1.9801422195 84 0.5738365783 0.3302801909 85 1.8461267978 0.5738365783 86 0.5997071945 1.8461267978 87 0.9115556196 0.5997071945 88 1.0139551492 0.9115556196 89 1.1097822772 1.0139551492 90 1.1129668067 1.1097822772 91 0.8951268140 1.1129668067 92 1.6480629656 0.8951268140 93 0.5400962722 1.6480629656 94 1.4028179855 0.5400962722 95 -0.7713073005 1.4028179855 96 1.1486387510 -0.7713073005 97 -1.7230114115 1.1486387510 98 1.1697093288 -1.7230114115 99 -2.0565078181 1.1697093288 > 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/7incz1322142836.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/8iee31322142836.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/988fz1322142836.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/1035301322142836.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/11gr4w1322142836.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/12w5n01322142836.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/138hip1322142836.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/14dnhv1322142836.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/15buvt1322142836.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/1689xh1322142836.tab") + } > > try(system("convert tmp/1kutb1322142836.ps tmp/1kutb1322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/2qvq41322142836.ps tmp/2qvq41322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/3wbo41322142836.ps tmp/3wbo41322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/4g51q1322142836.ps tmp/4g51q1322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/533uh1322142836.ps tmp/533uh1322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/6hv5r1322142836.ps tmp/6hv5r1322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/7incz1322142836.ps tmp/7incz1322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/8iee31322142836.ps tmp/8iee31322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/988fz1322142836.ps tmp/988fz1322142836.png",intern=TRUE)) character(0) > try(system("convert tmp/1035301322142836.ps tmp/1035301322142836.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.060 0.732 7.507