R version 2.9.0 (2009-04-17) Copyright (C) 2009 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. 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(6654 + ,5712 + ,-999 + ,-999 + ,3.3 + ,38.6 + ,645 + ,3 + ,5 + ,3 + ,1 + ,6.6 + ,6.3 + ,2 + ,8.3 + ,4.5 + ,42 + ,3 + ,1 + ,3 + ,3.385 + ,44.5 + ,-999 + ,-999 + ,12.5 + ,14 + ,60 + ,1 + ,1 + ,1 + ,0.92 + ,5.7 + ,-999 + ,-999 + ,16.5 + ,-999 + ,25 + ,5 + ,2 + ,3 + ,2547 + ,4603 + ,2.1 + ,1.8 + ,3.9 + ,69 + ,624 + ,3 + ,5 + ,4 + ,10.55 + ,179.5 + ,9.1 + ,0.7 + ,9.8 + ,27 + ,180 + ,4 + ,4 + ,4 + ,0.023 + ,0.3 + ,15.8 + ,3.9 + ,19.7 + ,19 + ,35 + ,1 + ,1 + ,1 + ,160 + ,169 + ,5.2 + ,1 + ,6.2 + ,30.4 + ,392 + ,4 + ,5 + ,4 + ,3.3 + ,25.6 + ,10.9 + ,3.6 + ,14.5 + ,28 + ,63 + ,1 + ,2 + ,1 + ,52.16 + ,440 + ,8.3 + ,1.4 + ,9.7 + ,50 + ,230 + ,1 + ,1 + ,1 + ,0.425 + ,6.4 + ,11 + ,1.5 + ,12.5 + ,7 + ,112 + ,5 + ,4 + ,4 + ,465 + ,423 + ,3.2 + ,0.7 + ,3.9 + ,30 + ,281 + ,5 + ,5 + ,5 + ,0.55 + ,2.4 + ,7.6 + ,2.7 + ,10.3 + ,-999 + ,-999 + ,2 + ,1 + ,2 + ,187.1 + ,419 + ,-999 + ,-999 + ,3.1 + ,40 + ,365 + ,5 + ,5 + ,5 + ,0.075 + ,1.2 + ,6.3 + ,2.1 + ,8.4 + ,3.5 + ,42 + ,1 + ,1 + ,1 + ,3 + ,25 + ,8.6 + ,0 + ,8.6 + ,50 + ,28 + ,2 + ,2 + ,2 + ,0.785 + ,3.5 + ,6.6 + ,4.1 + ,10.7 + ,6 + ,42 + ,2 + ,2 + ,2 + ,0.2 + ,5 + ,9.5 + ,1.2 + ,10.7 + ,10.4 + ,120 + ,2 + ,2 + ,2 + ,1.41 + ,17.5 + ,4.8 + ,1.3 + ,6.1 + ,34 + ,-999 + ,1 + ,2 + ,1 + ,60 + ,81 + ,12 + ,6.1 + ,18.1 + ,7 + ,-999 + ,1 + ,1 + ,1 + ,529 + ,680 + ,-999 + ,0.3 + ,-999 + ,28 + ,400 + ,5 + ,5 + ,5 + ,27.66 + ,115 + ,3.3 + ,0.5 + ,3.8 + ,20 + ,148 + ,5 + ,5 + ,5 + ,0.12 + ,1 + ,11 + ,3.4 + ,14.4 + ,3.9 + ,16 + ,3 + ,1 + ,2 + ,207 + ,406 + ,-999 + ,-999 + ,12 + ,39.3 + ,252 + ,1 + ,4 + ,1 + ,85 + ,325 + ,4.7 + ,1.5 + ,6.2 + ,41 + ,310 + ,1 + ,3 + ,1 + ,36.33 + ,119.5 + ,-999 + ,-999 + ,13 + ,16.2 + ,63 + ,1 + ,1 + ,1 + ,0.101 + ,4 + ,10.4 + ,3.4 + ,13.8 + ,9 + ,28 + ,5 + ,1 + ,3 + ,1.04 + ,5.5 + ,7.4 + ,0.8 + ,8.2 + ,7.6 + ,68 + ,5 + ,3 + ,4 + ,521 + ,655 + ,2.1 + ,0.8 + ,2.9 + ,46 + ,336 + ,5 + ,5 + ,5 + ,100 + ,157 + ,-999 + ,-999 + ,10.8 + ,22.4 + ,100 + ,1 + ,1 + ,1 + ,35 + ,56 + ,-999 + ,-999 + ,-999 + ,16.3 + ,33 + ,3 + ,5 + ,4 + ,0.005 + ,0.14 + ,7.7 + ,1.4 + ,9.1 + ,2.6 + ,21.5 + ,5 + ,2 + ,4 + ,0.01 + ,0.25 + ,17.9 + ,2 + ,19.9 + ,24 + ,50 + ,1 + ,1 + ,1 + ,62 + ,1320 + ,6.1 + ,1.9 + ,8 + ,100 + ,267 + ,1 + ,1 + ,1 + ,0.122 + ,3 + ,8.2 + ,2.4 + ,10.6 + ,-999 + ,30 + ,2 + ,1 + ,1 + ,1.35 + ,8.1 + ,8.4 + ,2.8 + ,11.2 + ,-999 + ,45 + ,3 + ,1 + ,3 + ,0.023 + ,0.4 + ,11.9 + ,1.3 + ,13.2 + ,3.2 + ,19 + ,4 + ,1 + ,3 + ,0.048 + ,0.33 + ,10.8 + ,2 + ,12.8 + ,2 + ,30 + ,4 + ,1 + ,3 + ,1.7 + ,6.3 + ,13.8 + ,5.6 + ,19.4 + ,5 + ,12 + ,2 + ,1 + ,1 + ,3.5 + ,10.8 + ,14.3 + ,3.1 + ,17.4 + ,6.5 + ,120 + ,2 + ,1 + ,1 + ,250 + ,490 + ,-999 + ,1 + ,-999 + ,23.6 + ,440 + ,5 + ,5 + ,5 + ,0.48 + ,15.5 + ,15.2 + ,1.8 + ,17 + ,12 + ,140 + ,2 + ,2 + ,2 + ,10 + ,115 + ,10 + ,0.9 + ,10.9 + ,20.2 + ,170 + ,4 + ,4 + ,4 + ,1.62 + ,11.4 + ,11.9 + ,1.8 + ,13.7 + ,13 + ,17 + ,2 + ,1 + ,2 + ,192 + ,180 + ,6.5 + ,1.9 + ,8.4 + ,27 + ,115 + ,4 + ,4 + ,4 + ,2.5 + ,12.1 + ,7.5 + ,0.9 + ,8.4 + ,18 + ,31 + ,5 + ,5 + ,5 + ,4.288 + ,39.2 + ,-999 + ,-999 + ,12.5 + ,13.7 + ,63 + ,2 + ,2 + ,2 + ,0.28 + ,1.9 + ,10.6 + ,2.6 + ,13.2 + ,4.7 + ,21 + ,3 + ,1 + ,3 + ,4.235 + ,50.4 + ,7.4 + ,2.4 + ,9.8 + ,9.8 + ,52 + ,1 + ,1 + ,1 + ,6.8 + ,179 + ,8.4 + ,1.2 + ,9.6 + ,29 + ,164 + ,2 + ,3 + ,2 + ,0.75 + ,12.3 + ,5.7 + ,0.9 + ,6.6 + ,7 + ,225 + ,2 + ,2 + ,2 + ,3.6 + ,21 + ,4.9 + ,0.5 + ,5.4 + ,6 + ,225 + ,3 + ,2 + ,3 + ,14.83 + ,98.2 + ,-999 + ,-999 + ,2.6 + ,17 + ,150 + ,5 + ,5 + ,5 + ,55.5 + ,175 + ,3.2 + ,0.6 + ,3.8 + ,20 + ,151 + ,5 + ,5 + ,5 + ,1.4 + ,12.5 + ,-999 + ,-999 + ,11 + ,12.7 + ,90 + ,2 + ,2 + ,2 + ,0.06 + ,1 + ,8.1 + ,2.2 + ,10.3 + ,3.5 + ,-999 + ,3 + ,1 + ,2 + ,0.9 + ,2.6 + ,11 + ,2.3 + ,13.3 + ,4.5 + ,60 + ,2 + ,1 + ,2 + ,2 + ,12.3 + ,4.9 + ,0.5 + ,5.4 + ,7.5 + ,200 + ,3 + ,1 + ,3 + ,0.104 + ,2.5 + ,13.2 + ,2.6 + ,15.8 + ,2.3 + ,46 + ,3 + ,2 + ,2 + ,4.19 + ,58 + ,9.7 + ,0.6 + ,10.3 + ,24 + ,210 + ,4 + ,3 + ,4 + ,3.5 + ,3.9 + ,12.8 + ,6.6 + ,19.4 + ,3 + ,14 + ,2 + ,1 + ,1 + ,4.05 + ,17 + ,-999 + ,-999 + ,-999 + ,13 + ,38 + ,3 + ,1 + ,1) + ,dim=c(10 + ,62) + ,dimnames=list(c('bodyweight' + ,'brainweight' + ,'sws' + ,'ps' + ,'total' + ,'lifespan' + ,'gesttime' + ,'pindex' + ,'expindex' + ,'dangindex') + ,1:62)) > y <- array(NA,dim=c(10,62),dimnames=list(c('bodyweight','brainweight','sws','ps','total','lifespan','gesttime','pindex','expindex','dangindex'),1:62)) > 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 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 ps bodyweight brainweight sws total lifespan gesttime pindex 1 -999.0 6654.000 5712.00 -999.0 3.3 38.6 645.0 3 2 2.0 1.000 6.60 6.3 8.3 4.5 42.0 3 3 -999.0 3.385 44.50 -999.0 12.5 14.0 60.0 1 4 -999.0 0.920 5.70 -999.0 16.5 -999.0 25.0 5 5 1.8 2547.000 4603.00 2.1 3.9 69.0 624.0 3 6 0.7 10.550 179.50 9.1 9.8 27.0 180.0 4 7 3.9 0.023 0.30 15.8 19.7 19.0 35.0 1 8 1.0 160.000 169.00 5.2 6.2 30.4 392.0 4 9 3.6 3.300 25.60 10.9 14.5 28.0 63.0 1 10 1.4 52.160 440.00 8.3 9.7 50.0 230.0 1 11 1.5 0.425 6.40 11.0 12.5 7.0 112.0 5 12 0.7 465.000 423.00 3.2 3.9 30.0 281.0 5 13 2.7 0.550 2.40 7.6 10.3 -999.0 -999.0 2 14 -999.0 187.100 419.00 -999.0 3.1 40.0 365.0 5 15 2.1 0.075 1.20 6.3 8.4 3.5 42.0 1 16 0.0 3.000 25.00 8.6 8.6 50.0 28.0 2 17 4.1 0.785 3.50 6.6 10.7 6.0 42.0 2 18 1.2 0.200 5.00 9.5 10.7 10.4 120.0 2 19 1.3 1.410 17.50 4.8 6.1 34.0 -999.0 1 20 6.1 60.000 81.00 12.0 18.1 7.0 -999.0 1 21 0.3 529.000 680.00 -999.0 -999.0 28.0 400.0 5 22 0.5 27.660 115.00 3.3 3.8 20.0 148.0 5 23 3.4 0.120 1.00 11.0 14.4 3.9 16.0 3 24 -999.0 207.000 406.00 -999.0 12.0 39.3 252.0 1 25 1.5 85.000 325.00 4.7 6.2 41.0 310.0 1 26 -999.0 36.330 119.50 -999.0 13.0 16.2 63.0 1 27 3.4 0.101 4.00 10.4 13.8 9.0 28.0 5 28 0.8 1.040 5.50 7.4 8.2 7.6 68.0 5 29 0.8 521.000 655.00 2.1 2.9 46.0 336.0 5 30 -999.0 100.000 157.00 -999.0 10.8 22.4 100.0 1 31 -999.0 35.000 56.00 -999.0 -999.0 16.3 33.0 3 32 1.4 0.005 0.14 7.7 9.1 2.6 21.5 5 33 2.0 0.010 0.25 17.9 19.9 24.0 50.0 1 34 1.9 62.000 1320.00 6.1 8.0 100.0 267.0 1 35 2.4 0.122 3.00 8.2 10.6 -999.0 30.0 2 36 2.8 1.350 8.10 8.4 11.2 -999.0 45.0 3 37 1.3 0.023 0.40 11.9 13.2 3.2 19.0 4 38 2.0 0.048 0.33 10.8 12.8 2.0 30.0 4 39 5.6 1.700 6.30 13.8 19.4 5.0 12.0 2 40 3.1 3.500 10.80 14.3 17.4 6.5 120.0 2 41 1.0 250.000 490.00 -999.0 -999.0 23.6 440.0 5 42 1.8 0.480 15.50 15.2 17.0 12.0 140.0 2 43 0.9 10.000 115.00 10.0 10.9 20.2 170.0 4 44 1.8 1.620 11.40 11.9 13.7 13.0 17.0 2 45 1.9 192.000 180.00 6.5 8.4 27.0 115.0 4 46 0.9 2.500 12.10 7.5 8.4 18.0 31.0 5 47 -999.0 4.288 39.20 -999.0 12.5 13.7 63.0 2 48 2.6 0.280 1.90 10.6 13.2 4.7 21.0 3 49 2.4 4.235 50.40 7.4 9.8 9.8 52.0 1 50 1.2 6.800 179.00 8.4 9.6 29.0 164.0 2 51 0.9 0.750 12.30 5.7 6.6 7.0 225.0 2 52 0.5 3.600 21.00 4.9 5.4 6.0 225.0 3 53 -999.0 14.830 98.20 -999.0 2.6 17.0 150.0 5 54 0.6 55.500 175.00 3.2 3.8 20.0 151.0 5 55 -999.0 1.400 12.50 -999.0 11.0 12.7 90.0 2 56 2.2 0.060 1.00 8.1 10.3 3.5 -999.0 3 57 2.3 0.900 2.60 11.0 13.3 4.5 60.0 2 58 0.5 2.000 12.30 4.9 5.4 7.5 200.0 3 59 2.6 0.104 2.50 13.2 15.8 2.3 46.0 3 60 0.6 4.190 58.00 9.7 10.3 24.0 210.0 4 61 6.6 3.500 3.90 12.8 19.4 3.0 14.0 2 62 -999.0 4.050 17.00 -999.0 -999.0 13.0 38.0 3 expindex dangindex 1 5 3 2 1 3 3 1 1 4 2 3 5 5 4 6 4 4 7 1 1 8 5 4 9 2 1 10 1 1 11 4 4 12 5 5 13 1 2 14 5 5 15 1 1 16 2 2 17 2 2 18 2 2 19 2 1 20 1 1 21 5 5 22 5 5 23 1 2 24 4 1 25 3 1 26 1 1 27 1 3 28 3 4 29 5 5 30 1 1 31 5 4 32 2 4 33 1 1 34 1 1 35 1 1 36 1 3 37 1 3 38 1 3 39 1 1 40 1 1 41 5 5 42 2 2 43 4 4 44 1 2 45 4 4 46 5 5 47 2 2 48 1 3 49 1 1 50 3 2 51 2 2 52 2 3 53 5 5 54 5 5 55 2 2 56 1 2 57 1 2 58 1 3 59 2 2 60 3 4 61 1 1 62 1 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) bodyweight brainweight sws total lifespan -40.39612 -0.01193 0.01398 0.99041 -0.47358 -0.01973 gesttime pindex expindex dangindex 0.04068 -20.30790 -11.55873 46.12661 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -509.463 -27.827 2.508 22.316 466.800 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -40.39612 41.68929 -0.969 0.337 bodyweight -0.01193 0.05644 -0.211 0.833 brainweight 0.01398 0.05623 0.249 0.805 sws 0.99041 0.05038 19.657 < 2e-16 *** total -0.47358 0.08203 -5.773 4.38e-07 *** lifespan -0.01973 0.07347 -0.269 0.789 gesttime 0.04068 0.06601 0.616 0.540 pindex -20.30790 33.35860 -0.609 0.545 expindex -11.55873 21.87674 -0.528 0.599 dangindex 46.12661 43.01496 1.072 0.289 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 133.8 on 52 degrees of freedom Multiple R-squared: 0.9041, Adjusted R-squared: 0.8875 F-statistic: 54.44 on 9 and 52 DF, p-value: < 2.2e-16 > 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,] 4.581277e-06 9.162555e-06 9.999954e-01 [2,] 1.880891e-07 3.761781e-07 9.999998e-01 [3,] 2.818324e-09 5.636649e-09 1.000000e+00 [4,] 8.056453e-11 1.611291e-10 1.000000e+00 [5,] 6.198892e-12 1.239778e-11 1.000000e+00 [6,] 1.457939e-13 2.915879e-13 1.000000e+00 [7,] 3.649468e-15 7.298936e-15 1.000000e+00 [8,] 1.315725e-16 2.631450e-16 1.000000e+00 [9,] 2.040736e-16 4.081473e-16 1.000000e+00 [10,] 4.861810e-18 9.723619e-18 1.000000e+00 [11,] 1.101260e-19 2.202520e-19 1.000000e+00 [12,] 2.541823e-21 5.083645e-21 1.000000e+00 [13,] 6.699594e-23 1.339919e-22 1.000000e+00 [14,] 1.390372e-24 2.780744e-24 1.000000e+00 [15,] 2.888417e-26 5.776834e-26 1.000000e+00 [16,] 6.792269e-28 1.358454e-27 1.000000e+00 [17,] 1.132285e-27 2.264569e-27 1.000000e+00 [18,] 5.564161e-29 1.112832e-28 1.000000e+00 [19,] 9.138830e-01 1.722339e-01 8.611697e-02 [20,] 8.794716e-01 2.410568e-01 1.205284e-01 [21,] 8.281840e-01 3.436321e-01 1.718160e-01 [22,] 9.448179e-01 1.103642e-01 5.518212e-02 [23,] 9.214685e-01 1.570629e-01 7.853147e-02 [24,] 9.925005e-01 1.499896e-02 7.499478e-03 [25,] 9.861702e-01 2.765955e-02 1.382978e-02 [26,] 9.750909e-01 4.981814e-02 2.490907e-02 [27,] 9.617099e-01 7.658013e-02 3.829007e-02 [28,] 9.543007e-01 9.139855e-02 4.569928e-02 [29,] 1.000000e+00 2.553918e-17 1.276959e-17 [30,] 1.000000e+00 1.250282e-16 6.251411e-17 [31,] 1.000000e+00 3.592726e-15 1.796363e-15 [32,] 1.000000e+00 1.236958e-13 6.184789e-14 [33,] 1.000000e+00 4.400427e-12 2.200214e-12 [34,] 1.000000e+00 2.631475e-10 1.315737e-10 [35,] 1.000000e+00 1.580808e-08 7.904040e-09 [36,] 9.999997e-01 5.977458e-07 2.988729e-07 [37,] 9.999835e-01 3.292537e-05 1.646268e-05 > postscript(file="/var/www/html/rcomp/tmp/1i73m1292671137.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/rcomp/tmp/2i73m1292671137.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/rcomp/tmp/3i73m1292671137.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/rcomp/tmp/4bykp1292671137.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/rcomp/tmp/5bykp1292671137.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 = 62 Frequency = 1 1 2 3 4 5 6 -13.2074744 -27.5102057 19.7293863 4.1145396 -81.8046826 -29.4884931 7 8 9 10 11 12 22.6642988 -22.0982893 35.0373917 10.0108467 -4.3129237 -42.7292558 13 14 15 16 17 18 21.2713572 -56.6992873 24.3193023 6.9650314 12.8770587 3.9908516 19 20 21 22 23 24 78.2096276 69.2817047 466.7996458 -38.7760083 19.3638760 44.2336778 25 26 27 28 29 30 33.7042050 19.2321558 13.7334721 -13.2209796 -46.5102509 17.0430859 31 32 33 34 35 36 -509.4631236 -22.1951444 18.2681639 -0.8197061 24.7749288 -47.3511415 37 38 39 40 41 42 -10.1431069 -9.0129365 47.1064928 38.7590974 465.1124458 1.0036033 43 44 45 46 47 48 -28.4910962 -3.7555641 -21.5739165 -34.4990799 5.4263271 -27.9331457 49 50 51 52 53 54 23.2721531 12.3413049 1.0790163 -25.0230051 -46.2149552 -39.2055977 55 56 57 58 59 60 3.9367561 60.3736749 -4.3560057 -35.4326617 27.3336533 -41.1614295 61 62 49.0311297 -417.4107958 > postscript(file="/var/www/html/rcomp/tmp/6bykp1292671137.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 = 62 Frequency = 1 lag(myerror, k = 1) myerror 0 -13.2074744 NA 1 -27.5102057 -13.2074744 2 19.7293863 -27.5102057 3 4.1145396 19.7293863 4 -81.8046826 4.1145396 5 -29.4884931 -81.8046826 6 22.6642988 -29.4884931 7 -22.0982893 22.6642988 8 35.0373917 -22.0982893 9 10.0108467 35.0373917 10 -4.3129237 10.0108467 11 -42.7292558 -4.3129237 12 21.2713572 -42.7292558 13 -56.6992873 21.2713572 14 24.3193023 -56.6992873 15 6.9650314 24.3193023 16 12.8770587 6.9650314 17 3.9908516 12.8770587 18 78.2096276 3.9908516 19 69.2817047 78.2096276 20 466.7996458 69.2817047 21 -38.7760083 466.7996458 22 19.3638760 -38.7760083 23 44.2336778 19.3638760 24 33.7042050 44.2336778 25 19.2321558 33.7042050 26 13.7334721 19.2321558 27 -13.2209796 13.7334721 28 -46.5102509 -13.2209796 29 17.0430859 -46.5102509 30 -509.4631236 17.0430859 31 -22.1951444 -509.4631236 32 18.2681639 -22.1951444 33 -0.8197061 18.2681639 34 24.7749288 -0.8197061 35 -47.3511415 24.7749288 36 -10.1431069 -47.3511415 37 -9.0129365 -10.1431069 38 47.1064928 -9.0129365 39 38.7590974 47.1064928 40 465.1124458 38.7590974 41 1.0036033 465.1124458 42 -28.4910962 1.0036033 43 -3.7555641 -28.4910962 44 -21.5739165 -3.7555641 45 -34.4990799 -21.5739165 46 5.4263271 -34.4990799 47 -27.9331457 5.4263271 48 23.2721531 -27.9331457 49 12.3413049 23.2721531 50 1.0790163 12.3413049 51 -25.0230051 1.0790163 52 -46.2149552 -25.0230051 53 -39.2055977 -46.2149552 54 3.9367561 -39.2055977 55 60.3736749 3.9367561 56 -4.3560057 60.3736749 57 -35.4326617 -4.3560057 58 27.3336533 -35.4326617 59 -41.1614295 27.3336533 60 49.0311297 -41.1614295 61 -417.4107958 49.0311297 62 NA -417.4107958 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -27.5102057 -13.2074744 [2,] 19.7293863 -27.5102057 [3,] 4.1145396 19.7293863 [4,] -81.8046826 4.1145396 [5,] -29.4884931 -81.8046826 [6,] 22.6642988 -29.4884931 [7,] -22.0982893 22.6642988 [8,] 35.0373917 -22.0982893 [9,] 10.0108467 35.0373917 [10,] -4.3129237 10.0108467 [11,] -42.7292558 -4.3129237 [12,] 21.2713572 -42.7292558 [13,] -56.6992873 21.2713572 [14,] 24.3193023 -56.6992873 [15,] 6.9650314 24.3193023 [16,] 12.8770587 6.9650314 [17,] 3.9908516 12.8770587 [18,] 78.2096276 3.9908516 [19,] 69.2817047 78.2096276 [20,] 466.7996458 69.2817047 [21,] -38.7760083 466.7996458 [22,] 19.3638760 -38.7760083 [23,] 44.2336778 19.3638760 [24,] 33.7042050 44.2336778 [25,] 19.2321558 33.7042050 [26,] 13.7334721 19.2321558 [27,] -13.2209796 13.7334721 [28,] -46.5102509 -13.2209796 [29,] 17.0430859 -46.5102509 [30,] -509.4631236 17.0430859 [31,] -22.1951444 -509.4631236 [32,] 18.2681639 -22.1951444 [33,] -0.8197061 18.2681639 [34,] 24.7749288 -0.8197061 [35,] -47.3511415 24.7749288 [36,] -10.1431069 -47.3511415 [37,] -9.0129365 -10.1431069 [38,] 47.1064928 -9.0129365 [39,] 38.7590974 47.1064928 [40,] 465.1124458 38.7590974 [41,] 1.0036033 465.1124458 [42,] -28.4910962 1.0036033 [43,] -3.7555641 -28.4910962 [44,] -21.5739165 -3.7555641 [45,] -34.4990799 -21.5739165 [46,] 5.4263271 -34.4990799 [47,] -27.9331457 5.4263271 [48,] 23.2721531 -27.9331457 [49,] 12.3413049 23.2721531 [50,] 1.0790163 12.3413049 [51,] -25.0230051 1.0790163 [52,] -46.2149552 -25.0230051 [53,] -39.2055977 -46.2149552 [54,] 3.9367561 -39.2055977 [55,] 60.3736749 3.9367561 [56,] -4.3560057 60.3736749 [57,] -35.4326617 -4.3560057 [58,] 27.3336533 -35.4326617 [59,] -41.1614295 27.3336533 [60,] 49.0311297 -41.1614295 [61,] -417.4107958 49.0311297 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -27.5102057 -13.2074744 2 19.7293863 -27.5102057 3 4.1145396 19.7293863 4 -81.8046826 4.1145396 5 -29.4884931 -81.8046826 6 22.6642988 -29.4884931 7 -22.0982893 22.6642988 8 35.0373917 -22.0982893 9 10.0108467 35.0373917 10 -4.3129237 10.0108467 11 -42.7292558 -4.3129237 12 21.2713572 -42.7292558 13 -56.6992873 21.2713572 14 24.3193023 -56.6992873 15 6.9650314 24.3193023 16 12.8770587 6.9650314 17 3.9908516 12.8770587 18 78.2096276 3.9908516 19 69.2817047 78.2096276 20 466.7996458 69.2817047 21 -38.7760083 466.7996458 22 19.3638760 -38.7760083 23 44.2336778 19.3638760 24 33.7042050 44.2336778 25 19.2321558 33.7042050 26 13.7334721 19.2321558 27 -13.2209796 13.7334721 28 -46.5102509 -13.2209796 29 17.0430859 -46.5102509 30 -509.4631236 17.0430859 31 -22.1951444 -509.4631236 32 18.2681639 -22.1951444 33 -0.8197061 18.2681639 34 24.7749288 -0.8197061 35 -47.3511415 24.7749288 36 -10.1431069 -47.3511415 37 -9.0129365 -10.1431069 38 47.1064928 -9.0129365 39 38.7590974 47.1064928 40 465.1124458 38.7590974 41 1.0036033 465.1124458 42 -28.4910962 1.0036033 43 -3.7555641 -28.4910962 44 -21.5739165 -3.7555641 45 -34.4990799 -21.5739165 46 5.4263271 -34.4990799 47 -27.9331457 5.4263271 48 23.2721531 -27.9331457 49 12.3413049 23.2721531 50 1.0790163 12.3413049 51 -25.0230051 1.0790163 52 -46.2149552 -25.0230051 53 -39.2055977 -46.2149552 54 3.9367561 -39.2055977 55 60.3736749 3.9367561 56 -4.3560057 60.3736749 57 -35.4326617 -4.3560057 58 27.3336533 -35.4326617 59 -41.1614295 27.3336533 60 49.0311297 -41.1614295 61 -417.4107958 49.0311297 > 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/rcomp/tmp/7m81a1292671137.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/rcomp/tmp/8ez1d1292671137.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/rcomp/tmp/9ez1d1292671137.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') Warning messages: 1: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced 2: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10ez1d1292671137.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/110hz11292671137.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/rcomp/tmp/12liy71292671137.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/rcomp/tmp/13ajv11292671137.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/rcomp/tmp/14lac41292671137.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/rcomp/tmp/156tsa1292671137.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/rcomp/tmp/162k801292671137.tab") + } > > try(system("convert tmp/1i73m1292671137.ps tmp/1i73m1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/2i73m1292671137.ps tmp/2i73m1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/3i73m1292671137.ps tmp/3i73m1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/4bykp1292671137.ps tmp/4bykp1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/5bykp1292671137.ps tmp/5bykp1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/6bykp1292671137.ps tmp/6bykp1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/7m81a1292671137.ps tmp/7m81a1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/8ez1d1292671137.ps tmp/8ez1d1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/9ez1d1292671137.ps tmp/9ez1d1292671137.png",intern=TRUE)) character(0) > try(system("convert tmp/10ez1d1292671137.ps tmp/10ez1d1292671137.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.562 1.653 7.628