R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(0 + ,9 + ,12 + ,9 + ,24 + ,13 + ,14 + ,1 + ,9 + ,15 + ,6 + ,25 + ,12 + ,8 + ,1 + ,9 + ,14 + ,13 + ,19 + ,15 + ,12 + ,1 + ,8 + ,10 + ,7 + ,18 + ,12 + ,7 + ,1 + ,14 + ,10 + ,8 + ,18 + ,10 + ,10 + ,0 + ,14 + ,9 + ,8 + ,23 + ,12 + ,7 + ,1 + ,15 + ,18 + ,11 + ,23 + ,15 + ,16 + ,1 + ,11 + ,11 + ,11 + ,23 + ,9 + ,11 + ,0 + ,14 + ,14 + ,8 + ,17 + ,7 + ,12 + ,0 + ,8 + ,24 + ,20 + ,30 + ,11 + ,7 + ,1 + ,16 + ,18 + ,16 + ,26 + ,10 + ,11 + ,0 + ,11 + ,14 + ,8 + ,23 + ,14 + ,15 + ,1 + ,7 + ,18 + ,11 + ,35 + ,11 + ,7 + ,0 + ,9 + ,12 + ,8 + ,21 + ,15 + ,14 + ,0 + ,16 + ,5 + ,4 + ,23 + ,12 + ,7 + ,1 + ,10 + ,12 + ,8 + ,20 + ,14 + ,15 + ,0 + ,14 + ,11 + ,8 + ,24 + ,15 + ,17 + ,0 + ,11 + ,9 + ,6 + ,20 + ,9 + ,15 + ,1 + ,6 + ,11 + ,8 + ,17 + ,13 + ,14 + ,1 + ,12 + ,16 + ,14 + ,27 + ,16 + ,8 + ,1 + ,14 + ,14 + ,10 + ,18 + ,13 + ,8 + ,0 + ,13 + ,8 + ,9 + ,24 + ,12 + ,14 + ,0 + ,14 + ,18 + ,10 + ,26 + ,11 + ,8 + ,0 + ,10 + ,10 + ,8 + ,26 + ,16 + ,16 + ,1 + ,14 + ,13 + ,10 + ,25 + ,12 + ,10 + ,1 + ,8 + ,12 + ,7 + ,20 + ,13 + ,14 + ,1 + ,10 + ,12 + ,8 + ,26 + ,16 + ,16 + ,0 + ,9 + ,12 + ,7 + ,18 + ,14 + ,13 + ,1 + ,9 + ,13 + ,6 + ,19 + ,15 + ,5 + ,0 + ,15 + ,7 + ,5 + ,21 + ,8 + ,10 + ,1 + ,12 + ,14 + ,7 + ,24 + ,17 + ,15 + ,1 + ,14 + ,9 + ,9 + ,23 + ,13 + ,16 + ,0 + ,11 + ,9 + ,5 + ,31 + ,6 + ,15 + ,0 + ,12 + ,10 + ,8 + ,23 + ,8 + ,8 + ,0 + ,13 + ,10 + ,6 + ,19 + ,14 + ,13 + ,1 + ,14 + ,11 + ,8 + ,26 + ,12 + ,14 + ,1 + ,15 + ,13 + ,8 + ,14 + ,11 + ,12 + ,0 + ,11 + ,13 + ,6 + ,25 + ,16 + ,16 + ,0 + ,9 + ,13 + ,8 + ,27 + ,8 + ,10 + ,1 + ,8 + ,6 + ,6 + ,20 + ,15 + ,15 + ,0 + ,10 + ,13 + ,6 + ,24 + ,16 + ,16 + ,0 + ,10 + ,21 + ,12 + ,32 + ,14 + ,19 + ,1 + ,10 + ,11 + ,5 + ,26 + ,16 + ,14 + ,0 + ,9 + ,9 + ,7 + ,21 + ,9 + ,6 + ,1 + ,13 + ,18 + ,12 + ,21 + ,14 + ,13 + ,0 + ,8 + ,9 + ,11 + ,24 + ,13 + ,7 + ,1 + ,10 + ,15 + ,10 + ,23 + ,15 + ,13 + ,1 + ,11 + ,11 + ,8 + ,24 + ,15 + ,14 + ,1 + ,10 + ,14 + ,9 + ,21 + ,13 + ,13 + ,0 + ,16 + ,14 + ,9 + ,21 + ,11 + ,11 + ,0 + ,11 + ,8 + ,4 + ,13 + ,11 + ,14 + ,1 + ,6 + ,8 + ,11 + ,29 + ,12 + ,14 + ,0 + ,9 + ,11 + ,10 + ,21 + ,7 + ,7 + ,0 + ,20 + ,8 + ,7 + ,19 + ,12 + ,12 + ,1 + ,12 + ,13 + ,9 + ,21 + ,12 + ,11 + ,0 + ,9 + ,13 + ,10 + ,19 + ,16 + ,14 + ,1 + ,14 + ,15 + ,11 + ,22 + ,14 + ,10 + ,1 + ,8 + ,12 + ,7 + ,14 + ,10 + ,13 + ,0 + ,7 + ,12 + ,6 + ,19 + ,12 + ,11 + ,0 + ,11 + ,21 + ,7 + ,29 + ,10 + ,8 + ,1 + ,14 + ,24 + ,20 + ,21 + ,8 + ,4 + ,0 + ,14 + ,12 + ,6 + ,15 + ,11 + ,14 + ,1 + ,9 + ,17 + ,9 + ,25 + ,16 + ,15 + ,1 + ,16 + ,11 + ,6 + ,27 + ,9 + ,11 + ,1 + ,13 + ,15 + ,10 + ,22 + ,14 + ,15 + ,1 + ,13 + ,12 + ,6 + ,19 + ,8 + ,10 + ,1 + ,8 + ,14 + ,10 + ,20 + ,8 + ,9 + ,0 + ,9 + ,12 + ,8 + ,16 + ,11 + ,12 + ,1 + ,11 + ,20 + ,13 + ,24 + ,12 + ,15 + ,0 + ,8 + ,12 + ,9 + ,21 + ,15 + ,12 + ,1 + ,7 + ,11 + ,9 + ,26 + ,16 + ,14 + ,1 + ,11 + ,12 + ,7 + ,17 + ,12 + ,12 + ,1 + ,9 + ,19 + ,10 + ,20 + ,4 + ,6 + ,1 + ,16 + ,16 + ,8 + ,24 + ,10 + ,8 + ,0 + ,13 + ,20 + ,10 + ,26 + ,15 + ,13 + ,1 + ,12 + ,15 + ,10 + ,29 + ,7 + ,13 + ,1 + ,9 + ,14 + ,6 + ,19 + ,19 + ,15) + ,dim=c(7 + ,77) + ,dimnames=list(c('Gen' + ,'DoubtsAboutActions' + ,'ParentalExpectations' + ,'ParentalCritism' + ,'PersonalStandards' + ,'Popularity' + ,'KnowingPeople') + ,1:77)) > y <- array(NA,dim=c(7,77),dimnames=list(c('Gen','DoubtsAboutActions','ParentalExpectations','ParentalCritism','PersonalStandards','Popularity','KnowingPeople'),1:77)) > 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 = '2' > #'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 Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x DoubtsAboutActions Gen ParentalExpectations ParentalCritism 1 9 0 12 9 2 9 1 15 6 3 9 1 14 13 4 8 1 10 7 5 14 1 10 8 6 14 0 9 8 7 15 1 18 11 8 11 1 11 11 9 14 0 14 8 10 8 0 24 20 11 16 1 18 16 12 11 0 14 8 13 7 1 18 11 14 9 0 12 8 15 16 0 5 4 16 10 1 12 8 17 14 0 11 8 18 11 0 9 6 19 6 1 11 8 20 12 1 16 14 21 14 1 14 10 22 13 0 8 9 23 14 0 18 10 24 10 0 10 8 25 14 1 13 10 26 8 1 12 7 27 10 1 12 8 28 9 0 12 7 29 9 1 13 6 30 15 0 7 5 31 12 1 14 7 32 14 1 9 9 33 11 0 9 5 34 12 0 10 8 35 13 0 10 6 36 14 1 11 8 37 15 1 13 8 38 11 0 13 6 39 9 0 13 8 40 8 1 6 6 41 10 0 13 6 42 10 0 21 12 43 10 1 11 5 44 9 0 9 7 45 13 1 18 12 46 8 0 9 11 47 10 1 15 10 48 11 1 11 8 49 10 1 14 9 50 16 0 14 9 51 11 0 8 4 52 6 1 8 11 53 9 0 11 10 54 20 0 8 7 55 12 1 13 9 56 9 0 13 10 57 14 1 15 11 58 8 1 12 7 59 7 0 12 6 60 11 0 21 7 61 14 1 24 20 62 14 0 12 6 63 9 1 17 9 64 16 1 11 6 65 13 1 15 10 66 13 1 12 6 67 8 1 14 10 68 9 0 12 8 69 11 1 20 13 70 8 0 12 9 71 7 1 11 9 72 11 1 12 7 73 9 1 19 10 74 16 1 16 8 75 13 0 20 10 76 12 1 15 10 77 9 1 14 6 PersonalStandards Popularity KnowingPeople 1 24 13 14 2 25 12 8 3 19 15 12 4 18 12 7 5 18 10 10 6 23 12 7 7 23 15 16 8 23 9 11 9 17 7 12 10 30 11 7 11 26 10 11 12 23 14 15 13 35 11 7 14 21 15 14 15 23 12 7 16 20 14 15 17 24 15 17 18 20 9 15 19 17 13 14 20 27 16 8 21 18 13 8 22 24 12 14 23 26 11 8 24 26 16 16 25 25 12 10 26 20 13 14 27 26 16 16 28 18 14 13 29 19 15 5 30 21 8 10 31 24 17 15 32 23 13 16 33 31 6 15 34 23 8 8 35 19 14 13 36 26 12 14 37 14 11 12 38 25 16 16 39 27 8 10 40 20 15 15 41 24 16 16 42 32 14 19 43 26 16 14 44 21 9 6 45 21 14 13 46 24 13 7 47 23 15 13 48 24 15 14 49 21 13 13 50 21 11 11 51 13 11 14 52 29 12 14 53 21 7 7 54 19 12 12 55 21 12 11 56 19 16 14 57 22 14 10 58 14 10 13 59 19 12 11 60 29 10 8 61 21 8 4 62 15 11 14 63 25 16 15 64 27 9 11 65 22 14 15 66 19 8 10 67 20 8 9 68 16 11 12 69 24 12 15 70 21 15 12 71 26 16 14 72 17 12 12 73 20 4 6 74 24 10 8 75 26 15 13 76 29 7 13 77 19 19 15 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Gen ParentalExpectations 13.7755022 -0.2059533 0.0223982 ParentalCritism PersonalStandards Popularity -0.0005269 -0.0391623 -0.1831208 KnowingPeople 0.0329767 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.2271 -2.1807 -0.4136 2.0990 8.5948 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 13.7755022 2.4479085 5.627 3.51e-07 *** Gen -0.2059533 0.6969435 -0.296 0.768 ParentalExpectations 0.0223982 0.1204456 0.186 0.853 ParentalCritism -0.0005269 0.1615168 -0.003 0.997 PersonalStandards -0.0391623 0.0850101 -0.461 0.646 Popularity -0.1831208 0.1307536 -1.401 0.166 KnowingPeople 0.0329767 0.1210661 0.272 0.786 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 2.924 on 70 degrees of freedom Multiple R-squared: 0.03681, Adjusted R-squared: -0.04575 F-statistic: 0.4459 on 6 and 70 DF, p-value: 0.8455 > 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.85510952 0.28978096 0.1448905 [2,] 0.88498924 0.23002153 0.1150108 [3,] 0.80776076 0.38447848 0.1922392 [4,] 0.77093088 0.45813824 0.2290691 [5,] 0.70021206 0.59957588 0.2997879 [6,] 0.83759694 0.32480611 0.1624031 [7,] 0.78510238 0.42979524 0.2148976 [8,] 0.73808606 0.52382789 0.2619139 [9,] 0.73890131 0.52219738 0.2610987 [10,] 0.85014013 0.29971974 0.1498599 [11,] 0.82076763 0.35846474 0.1792324 [12,] 0.82916458 0.34167085 0.1708354 [13,] 0.78010223 0.43979554 0.2198978 [14,] 0.76926215 0.46147570 0.2307378 [15,] 0.71067862 0.57864275 0.2893214 [16,] 0.70487967 0.59024067 0.2951203 [17,] 0.69508085 0.60983830 0.3049192 [18,] 0.62494505 0.75010990 0.3750549 [19,] 0.58655455 0.82689089 0.4134454 [20,] 0.52232608 0.95534785 0.4776739 [21,] 0.49963497 0.99926995 0.5003650 [22,] 0.47256774 0.94513547 0.5274323 [23,] 0.45899971 0.91799941 0.5410003 [24,] 0.41195561 0.82391122 0.5880444 [25,] 0.34956767 0.69913534 0.6504323 [26,] 0.31089444 0.62178888 0.6891056 [27,] 0.31267262 0.62534525 0.6873274 [28,] 0.32967788 0.65935576 0.6703221 [29,] 0.26987516 0.53975031 0.7301248 [30,] 0.25510570 0.51021140 0.7448943 [31,] 0.25486294 0.50972588 0.7451371 [32,] 0.20172981 0.40345962 0.7982702 [33,] 0.16035519 0.32071037 0.8396448 [34,] 0.12042503 0.24085006 0.8795750 [35,] 0.11316407 0.22632814 0.8868359 [36,] 0.09487489 0.18974979 0.9051251 [37,] 0.09402798 0.18805595 0.9059720 [38,] 0.06797963 0.13595925 0.9320204 [39,] 0.04738073 0.09476146 0.9526193 [40,] 0.03327104 0.06654209 0.9667290 [41,] 0.04915194 0.09830388 0.9508481 [42,] 0.03433928 0.06867857 0.9656607 [43,] 0.06355928 0.12711855 0.9364407 [44,] 0.07803981 0.15607961 0.9219602 [45,] 0.47477927 0.94955855 0.5252207 [46,] 0.39974450 0.79948900 0.6002555 [47,] 0.33443830 0.66887660 0.6655617 [48,] 0.34365021 0.68730043 0.6563498 [49,] 0.34033263 0.68066526 0.6596674 [50,] 0.36905348 0.73810697 0.6309465 [51,] 0.34774403 0.69548806 0.6522560 [52,] 0.66435755 0.67128490 0.3356425 [53,] 0.58186063 0.83627875 0.4181394 [54,] 0.58599698 0.82800604 0.4140030 [55,] 0.52886339 0.94227321 0.4711366 [56,] 0.58582244 0.82835513 0.4141776 [57,] 0.45408789 0.90817577 0.5459121 [58,] 0.31565248 0.63130495 0.6843475 > postscript(file="/var/www/html/freestat/rcomp/tmp/1424r1293203858.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/html/freestat/rcomp/tmp/2424r1293203858.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/html/freestat/rcomp/tmp/3fclc1293203858.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/html/freestat/rcomp/tmp/4fclc1293203858.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/html/freestat/rcomp/tmp/5fclc1293203858.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 = 77 Frequency = 1 1 2 3 4 5 6 -2.18074549 -1.98966594 -1.78109731 -3.11830760 2.41704766 2.89447569 7 8 9 10 11 12 4.15299866 -0.62405575 1.46702362 -3.34415836 4.52239947 -0.11508689 13 14 15 16 17 18 -3.81274698 -1.93251766 4.98196063 -0.98182418 3.10843735 -1.03724093 19 20 21 22 23 24 -5.22705705 1.80295919 2.94382468 1.72572633 2.59533548 -0.57474240 25 26 27 28 29 30 2.99128473 -3.13249525 -0.41358544 -2.20067562 -1.53155090 3.02795332 31 32 33 34 35 36 1.67886421 2.98728662 -1.15634508 0.10661757 1.88275607 2.94228279 37 38 39 40 41 42 3.31037146 0.31784697 -2.86988109 -2.66536825 -0.72131533 -1.04921237 43 44 45 46 47 48 -0.32681471 -2.70076161 1.99101021 -2.88166041 -0.68140375 0.41332066 49 50 51 52 53 54 -1.10409875 4.38965969 -0.89081437 -4.87145506 -3.14319547 8.59481436 55 56 57 58 59 60 0.80113195 -1.84906574 3.19577009 -3.88385481 -4.46232854 -0.53907372 61 62 63 64 65 66 2.05890183 2.09897143 -1.53123494 4.52995880 2.03035978 1.04411813 67 68 69 70 71 72 -3.92643151 -2.79485907 -0.36796730 -2.86603738 -3.32470700 -0.36714960 73 74 75 76 77 -3.67197557 4.58358581 2.11813905 0.08860346 -1.15123255 > postscript(file="/var/www/html/freestat/rcomp/tmp/68lkx1293203858.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 = 77 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.18074549 NA 1 -1.98966594 -2.18074549 2 -1.78109731 -1.98966594 3 -3.11830760 -1.78109731 4 2.41704766 -3.11830760 5 2.89447569 2.41704766 6 4.15299866 2.89447569 7 -0.62405575 4.15299866 8 1.46702362 -0.62405575 9 -3.34415836 1.46702362 10 4.52239947 -3.34415836 11 -0.11508689 4.52239947 12 -3.81274698 -0.11508689 13 -1.93251766 -3.81274698 14 4.98196063 -1.93251766 15 -0.98182418 4.98196063 16 3.10843735 -0.98182418 17 -1.03724093 3.10843735 18 -5.22705705 -1.03724093 19 1.80295919 -5.22705705 20 2.94382468 1.80295919 21 1.72572633 2.94382468 22 2.59533548 1.72572633 23 -0.57474240 2.59533548 24 2.99128473 -0.57474240 25 -3.13249525 2.99128473 26 -0.41358544 -3.13249525 27 -2.20067562 -0.41358544 28 -1.53155090 -2.20067562 29 3.02795332 -1.53155090 30 1.67886421 3.02795332 31 2.98728662 1.67886421 32 -1.15634508 2.98728662 33 0.10661757 -1.15634508 34 1.88275607 0.10661757 35 2.94228279 1.88275607 36 3.31037146 2.94228279 37 0.31784697 3.31037146 38 -2.86988109 0.31784697 39 -2.66536825 -2.86988109 40 -0.72131533 -2.66536825 41 -1.04921237 -0.72131533 42 -0.32681471 -1.04921237 43 -2.70076161 -0.32681471 44 1.99101021 -2.70076161 45 -2.88166041 1.99101021 46 -0.68140375 -2.88166041 47 0.41332066 -0.68140375 48 -1.10409875 0.41332066 49 4.38965969 -1.10409875 50 -0.89081437 4.38965969 51 -4.87145506 -0.89081437 52 -3.14319547 -4.87145506 53 8.59481436 -3.14319547 54 0.80113195 8.59481436 55 -1.84906574 0.80113195 56 3.19577009 -1.84906574 57 -3.88385481 3.19577009 58 -4.46232854 -3.88385481 59 -0.53907372 -4.46232854 60 2.05890183 -0.53907372 61 2.09897143 2.05890183 62 -1.53123494 2.09897143 63 4.52995880 -1.53123494 64 2.03035978 4.52995880 65 1.04411813 2.03035978 66 -3.92643151 1.04411813 67 -2.79485907 -3.92643151 68 -0.36796730 -2.79485907 69 -2.86603738 -0.36796730 70 -3.32470700 -2.86603738 71 -0.36714960 -3.32470700 72 -3.67197557 -0.36714960 73 4.58358581 -3.67197557 74 2.11813905 4.58358581 75 0.08860346 2.11813905 76 -1.15123255 0.08860346 77 NA -1.15123255 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.98966594 -2.18074549 [2,] -1.78109731 -1.98966594 [3,] -3.11830760 -1.78109731 [4,] 2.41704766 -3.11830760 [5,] 2.89447569 2.41704766 [6,] 4.15299866 2.89447569 [7,] -0.62405575 4.15299866 [8,] 1.46702362 -0.62405575 [9,] -3.34415836 1.46702362 [10,] 4.52239947 -3.34415836 [11,] -0.11508689 4.52239947 [12,] -3.81274698 -0.11508689 [13,] -1.93251766 -3.81274698 [14,] 4.98196063 -1.93251766 [15,] -0.98182418 4.98196063 [16,] 3.10843735 -0.98182418 [17,] -1.03724093 3.10843735 [18,] -5.22705705 -1.03724093 [19,] 1.80295919 -5.22705705 [20,] 2.94382468 1.80295919 [21,] 1.72572633 2.94382468 [22,] 2.59533548 1.72572633 [23,] -0.57474240 2.59533548 [24,] 2.99128473 -0.57474240 [25,] -3.13249525 2.99128473 [26,] -0.41358544 -3.13249525 [27,] -2.20067562 -0.41358544 [28,] -1.53155090 -2.20067562 [29,] 3.02795332 -1.53155090 [30,] 1.67886421 3.02795332 [31,] 2.98728662 1.67886421 [32,] -1.15634508 2.98728662 [33,] 0.10661757 -1.15634508 [34,] 1.88275607 0.10661757 [35,] 2.94228279 1.88275607 [36,] 3.31037146 2.94228279 [37,] 0.31784697 3.31037146 [38,] -2.86988109 0.31784697 [39,] -2.66536825 -2.86988109 [40,] -0.72131533 -2.66536825 [41,] -1.04921237 -0.72131533 [42,] -0.32681471 -1.04921237 [43,] -2.70076161 -0.32681471 [44,] 1.99101021 -2.70076161 [45,] -2.88166041 1.99101021 [46,] -0.68140375 -2.88166041 [47,] 0.41332066 -0.68140375 [48,] -1.10409875 0.41332066 [49,] 4.38965969 -1.10409875 [50,] -0.89081437 4.38965969 [51,] -4.87145506 -0.89081437 [52,] -3.14319547 -4.87145506 [53,] 8.59481436 -3.14319547 [54,] 0.80113195 8.59481436 [55,] -1.84906574 0.80113195 [56,] 3.19577009 -1.84906574 [57,] -3.88385481 3.19577009 [58,] -4.46232854 -3.88385481 [59,] -0.53907372 -4.46232854 [60,] 2.05890183 -0.53907372 [61,] 2.09897143 2.05890183 [62,] -1.53123494 2.09897143 [63,] 4.52995880 -1.53123494 [64,] 2.03035978 4.52995880 [65,] 1.04411813 2.03035978 [66,] -3.92643151 1.04411813 [67,] -2.79485907 -3.92643151 [68,] -0.36796730 -2.79485907 [69,] -2.86603738 -0.36796730 [70,] -3.32470700 -2.86603738 [71,] -0.36714960 -3.32470700 [72,] -3.67197557 -0.36714960 [73,] 4.58358581 -3.67197557 [74,] 2.11813905 4.58358581 [75,] 0.08860346 2.11813905 [76,] -1.15123255 0.08860346 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.98966594 -2.18074549 2 -1.78109731 -1.98966594 3 -3.11830760 -1.78109731 4 2.41704766 -3.11830760 5 2.89447569 2.41704766 6 4.15299866 2.89447569 7 -0.62405575 4.15299866 8 1.46702362 -0.62405575 9 -3.34415836 1.46702362 10 4.52239947 -3.34415836 11 -0.11508689 4.52239947 12 -3.81274698 -0.11508689 13 -1.93251766 -3.81274698 14 4.98196063 -1.93251766 15 -0.98182418 4.98196063 16 3.10843735 -0.98182418 17 -1.03724093 3.10843735 18 -5.22705705 -1.03724093 19 1.80295919 -5.22705705 20 2.94382468 1.80295919 21 1.72572633 2.94382468 22 2.59533548 1.72572633 23 -0.57474240 2.59533548 24 2.99128473 -0.57474240 25 -3.13249525 2.99128473 26 -0.41358544 -3.13249525 27 -2.20067562 -0.41358544 28 -1.53155090 -2.20067562 29 3.02795332 -1.53155090 30 1.67886421 3.02795332 31 2.98728662 1.67886421 32 -1.15634508 2.98728662 33 0.10661757 -1.15634508 34 1.88275607 0.10661757 35 2.94228279 1.88275607 36 3.31037146 2.94228279 37 0.31784697 3.31037146 38 -2.86988109 0.31784697 39 -2.66536825 -2.86988109 40 -0.72131533 -2.66536825 41 -1.04921237 -0.72131533 42 -0.32681471 -1.04921237 43 -2.70076161 -0.32681471 44 1.99101021 -2.70076161 45 -2.88166041 1.99101021 46 -0.68140375 -2.88166041 47 0.41332066 -0.68140375 48 -1.10409875 0.41332066 49 4.38965969 -1.10409875 50 -0.89081437 4.38965969 51 -4.87145506 -0.89081437 52 -3.14319547 -4.87145506 53 8.59481436 -3.14319547 54 0.80113195 8.59481436 55 -1.84906574 0.80113195 56 3.19577009 -1.84906574 57 -3.88385481 3.19577009 58 -4.46232854 -3.88385481 59 -0.53907372 -4.46232854 60 2.05890183 -0.53907372 61 2.09897143 2.05890183 62 -1.53123494 2.09897143 63 4.52995880 -1.53123494 64 2.03035978 4.52995880 65 1.04411813 2.03035978 66 -3.92643151 1.04411813 67 -2.79485907 -3.92643151 68 -0.36796730 -2.79485907 69 -2.86603738 -0.36796730 70 -3.32470700 -2.86603738 71 -0.36714960 -3.32470700 72 -3.67197557 -0.36714960 73 4.58358581 -3.67197557 74 2.11813905 4.58358581 75 0.08860346 2.11813905 76 -1.15123255 0.08860346 > 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/html/freestat/rcomp/tmp/70cj01293203858.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/html/freestat/rcomp/tmp/80cj01293203858.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/html/freestat/rcomp/tmp/90cj01293203858.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/html/freestat/rcomp/tmp/10t3jl1293203858.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/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/html/freestat/rcomp/tmp/11fmh91293203858.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/html/freestat/rcomp/tmp/12i4yx1293203858.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/html/freestat/rcomp/tmp/1375v81293203858.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/html/freestat/rcomp/tmp/1475v81293203858.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/html/freestat/rcomp/tmp/15aotw1293203858.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/html/freestat/rcomp/tmp/166yr51293203858.tab") + } > > try(system("convert tmp/1424r1293203858.ps tmp/1424r1293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/2424r1293203858.ps tmp/2424r1293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/3fclc1293203858.ps tmp/3fclc1293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/4fclc1293203858.ps tmp/4fclc1293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/5fclc1293203858.ps tmp/5fclc1293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/68lkx1293203858.ps tmp/68lkx1293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/70cj01293203858.ps tmp/70cj01293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/80cj01293203858.ps tmp/80cj01293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/90cj01293203858.ps tmp/90cj01293203858.png",intern=TRUE)) character(0) > try(system("convert tmp/10t3jl1293203858.ps tmp/10t3jl1293203858.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.179 2.525 4.699