R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(26 + ,21 + ,21 + ,23 + ,17 + ,23 + ,4 + ,14 + ,12 + ,20 + ,16 + ,15 + ,24 + ,17 + ,20 + ,4 + ,18 + ,11 + ,19 + ,19 + ,18 + ,22 + ,18 + ,20 + ,6 + ,11 + ,14 + ,19 + ,18 + ,11 + ,20 + ,21 + ,21 + ,8 + ,12 + ,12 + ,20 + ,16 + ,8 + ,24 + ,20 + ,24 + ,8 + ,16 + ,21 + ,25 + ,23 + ,19 + ,27 + ,28 + ,22 + ,4 + ,18 + ,12 + ,25 + ,17 + ,4 + ,28 + ,19 + ,23 + ,4 + ,14 + ,22 + ,22 + ,12 + ,20 + ,27 + ,22 + ,20 + ,8 + ,14 + ,11 + ,26 + ,19 + ,16 + ,24 + ,16 + ,25 + ,5 + ,15 + ,10 + ,22 + ,16 + ,14 + ,23 + ,18 + ,23 + ,4 + ,15 + ,13 + ,17 + ,19 + ,10 + ,24 + ,25 + ,27 + ,4 + ,17 + ,10 + ,22 + ,20 + ,13 + ,27 + ,17 + ,27 + ,4 + ,19 + ,8 + ,19 + ,13 + ,14 + ,27 + ,14 + ,22 + ,4 + ,10 + ,15 + ,24 + ,20 + ,8 + ,28 + ,11 + ,24 + ,4 + ,16 + ,14 + ,26 + ,27 + ,23 + ,27 + ,27 + ,25 + ,4 + ,18 + ,10 + ,21 + ,17 + ,11 + ,23 + ,20 + ,22 + ,8 + ,14 + ,14 + ,13 + ,8 + ,9 + ,24 + ,22 + ,28 + ,4 + ,14 + ,14 + ,26 + ,25 + ,24 + ,28 + ,22 + ,28 + ,4 + ,17 + ,11 + ,20 + ,26 + ,5 + ,27 + ,21 + ,27 + ,4 + ,14 + ,10 + ,22 + ,13 + ,15 + ,25 + ,23 + ,25 + ,8 + ,16 + ,13 + ,14 + ,19 + ,5 + ,19 + ,17 + ,16 + ,4 + ,18 + ,7 + ,21 + ,15 + ,19 + ,24 + ,24 + ,28 + ,7 + ,11 + ,14 + ,7 + ,5 + ,6 + ,20 + ,14 + ,21 + ,4 + ,14 + ,12 + ,23 + ,16 + ,13 + ,28 + ,17 + ,24 + ,4 + ,12 + ,14 + ,17 + ,14 + ,11 + ,26 + ,23 + ,27 + ,5 + ,17 + ,11 + ,25 + ,24 + ,17 + ,23 + ,24 + ,14 + ,4 + ,9 + ,9 + ,25 + ,24 + ,17 + ,23 + ,24 + ,14 + ,4 + ,16 + ,11 + ,19 + ,9 + ,5 + ,20 + ,8 + ,27 + ,4 + ,14 + ,15 + ,20 + ,19 + ,9 + ,11 + ,22 + ,20 + ,4 + ,15 + ,14 + ,23 + ,19 + ,15 + ,24 + ,23 + ,21 + ,4 + ,11 + ,13 + ,22 + ,25 + ,17 + ,25 + ,25 + ,22 + ,4 + ,16 + ,9 + ,22 + ,19 + ,17 + ,23 + ,21 + ,21 + ,4 + ,13 + ,15 + ,21 + ,18 + ,20 + ,18 + ,24 + ,12 + ,15 + ,17 + ,10 + ,15 + ,15 + ,12 + ,20 + ,15 + ,20 + ,10 + ,15 + ,11 + ,20 + ,12 + ,7 + ,20 + ,22 + ,24 + ,4 + ,14 + ,13 + ,22 + ,21 + ,16 + ,24 + ,21 + ,19 + ,8 + ,16 + ,8 + ,18 + ,12 + ,7 + ,23 + ,25 + ,28 + ,4 + ,9 + ,20 + ,20 + ,15 + ,14 + ,25 + ,16 + ,23 + ,4 + ,15 + ,12 + ,28 + ,28 + ,24 + ,28 + ,28 + ,27 + ,4 + ,17 + ,10 + ,22 + ,25 + ,15 + ,26 + ,23 + ,22 + ,4 + ,13 + ,10 + ,18 + ,19 + ,15 + ,26 + ,21 + ,27 + ,7 + ,15 + ,9 + ,23 + ,20 + ,10 + ,23 + ,21 + ,26 + ,4 + ,16 + ,14 + ,20 + ,24 + ,14 + ,22 + ,26 + ,22 + ,6 + ,16 + ,8 + ,25 + ,26 + ,18 + ,24 + ,22 + ,21 + ,5 + ,12 + ,14 + ,26 + ,25 + ,12 + ,21 + ,21 + ,19 + ,4 + ,12 + ,11 + ,15 + ,12 + ,9 + ,20 + ,18 + ,24 + ,16 + ,11 + ,13 + ,17 + ,12 + ,9 + ,22 + ,12 + ,19 + ,5 + ,15 + ,9 + ,23 + ,15 + ,8 + ,20 + ,25 + ,26 + ,12 + ,15 + ,11 + ,21 + ,17 + ,18 + ,25 + ,17 + ,22 + ,6 + ,17 + ,15 + ,13 + ,14 + ,10 + ,20 + ,24 + ,28 + ,9 + ,13 + ,11 + ,18 + ,16 + ,17 + ,22 + ,15 + ,21 + ,9 + ,16 + ,10 + ,19 + ,11 + ,14 + ,23 + ,13 + ,23 + ,4 + ,14 + ,14 + ,22 + ,20 + ,16 + ,25 + ,26 + ,28 + ,5 + ,11 + ,18 + ,16 + ,11 + ,10 + ,23 + ,16 + ,10 + ,4 + ,12 + ,14 + ,24 + ,22 + ,19 + ,23 + ,24 + ,24 + ,4 + ,12 + ,11 + ,18 + ,20 + ,10 + ,22 + ,21 + ,21 + ,5 + ,15 + ,12 + ,20 + ,19 + ,14 + ,24 + ,20 + ,21 + ,4 + ,16 + ,13 + ,24 + ,17 + ,10 + ,25 + ,14 + ,24 + ,4 + ,15 + ,9 + ,14 + ,21 + ,4 + ,21 + ,25 + ,24 + ,4 + ,12 + ,10 + ,22 + ,23 + ,19 + ,12 + ,25 + ,25 + ,5 + ,12 + ,15 + ,24 + ,18 + ,9 + ,17 + ,20 + ,25 + ,4 + ,8 + ,20 + ,18 + ,17 + ,12 + ,20 + ,22 + ,23 + ,6 + ,13 + ,12 + ,21 + ,27 + ,16 + ,23 + ,20 + ,21 + ,4 + ,11 + ,12 + ,23 + ,25 + ,11 + ,23 + ,26 + ,16 + ,4 + ,14 + ,14 + ,17 + ,19 + ,18 + ,20 + ,18 + ,17 + ,18 + ,15 + ,13 + ,22 + ,22 + ,11 + ,28 + ,22 + ,25 + ,4 + ,10 + ,11 + ,24 + ,24 + ,24 + ,24 + ,24 + ,24 + ,6 + ,11 + ,17 + ,21 + ,20 + ,17 + ,24 + ,17 + ,23 + ,4 + ,12 + ,12 + ,22 + ,19 + ,18 + ,24 + ,24 + ,25 + ,4 + ,15 + ,13 + ,16 + ,11 + ,9 + ,24 + ,20 + ,23 + ,5 + ,15 + ,14 + ,21 + ,22 + ,19 + ,28 + ,19 + ,28 + ,4 + ,14 + ,13 + ,23 + ,22 + ,18 + ,25 + ,20 + ,26 + ,4 + ,16 + ,15 + ,22 + ,16 + ,12 + ,21 + ,15 + ,22 + ,5 + ,15 + ,13 + ,24 + ,20 + ,23 + ,25 + ,23 + ,19 + ,10 + ,15 + ,10 + ,24 + ,24 + ,22 + ,25 + ,26 + ,26 + ,5 + ,13 + ,11 + ,16 + ,16 + ,14 + ,18 + ,22 + ,18 + ,8 + ,12 + ,19 + ,16 + ,16 + ,14 + ,17 + ,20 + ,18 + ,8 + ,17 + ,13 + ,21 + ,22 + ,16 + ,26 + ,24 + ,25 + ,5 + ,13 + ,17 + ,26 + ,24 + ,23 + ,28 + ,26 + ,27 + ,4 + ,15 + ,13 + ,15 + ,16 + ,7 + ,21 + ,21 + ,12 + ,4 + ,13 + ,9 + ,25 + ,27 + ,10 + ,27 + ,25 + ,15 + ,4 + ,15 + ,11 + ,18 + ,11 + ,12 + ,22 + ,13 + ,21 + ,5 + ,16 + ,10 + ,23 + ,21 + ,12 + ,21 + ,20 + ,23 + ,4 + ,15 + ,9 + ,20 + ,20 + ,12 + ,25 + ,22 + ,22 + ,4 + ,16 + ,12 + ,17 + ,20 + ,17 + ,22 + ,23 + ,21 + ,8 + ,15 + ,12 + ,25 + ,27 + ,21 + ,23 + ,28 + ,24 + ,4 + ,14 + ,13 + ,24 + ,20 + ,16 + ,26 + ,22 + ,27 + ,5 + ,15 + ,13 + ,17 + ,12 + ,11 + ,19 + ,20 + ,22 + ,14 + ,14 + ,12 + ,19 + ,8 + ,14 + ,25 + ,6 + ,28 + ,8 + ,13 + ,15 + ,20 + ,21 + ,13 + ,21 + ,21 + ,26 + ,8 + ,7 + ,22 + ,15 + ,18 + ,9 + ,13 + ,20 + ,10 + ,4 + ,17 + ,13 + ,27 + ,24 + ,19 + ,24 + ,18 + ,19 + ,4 + ,13 + ,15 + ,22 + ,16 + ,13 + ,25 + ,23 + ,22 + ,6 + ,15 + ,13 + ,23 + ,18 + ,19 + ,26 + ,20 + ,21 + ,4 + ,14 + ,15 + ,16 + ,20 + ,13 + ,25 + ,24 + ,24 + ,7 + ,13 + ,10 + ,19 + ,20 + ,13 + ,25 + ,22 + ,25 + ,7 + ,16 + ,11 + ,25 + ,19 + ,13 + ,22 + ,21 + ,21 + ,4 + ,12 + ,16 + ,19 + ,17 + ,14 + ,21 + ,18 + ,20 + ,6 + ,14 + ,11 + ,19 + ,16 + ,12 + ,23 + ,21 + ,21 + ,4 + ,17 + ,11 + ,26 + ,26 + ,22 + ,25 + ,23 + ,24 + ,7 + ,15 + ,10 + ,21 + ,15 + ,11 + ,24 + ,23 + ,23 + ,4 + ,17 + ,10 + ,20 + ,22 + ,5 + ,21 + ,15 + ,18 + ,4 + ,12 + ,16 + ,24 + ,17 + ,18 + ,21 + ,21 + ,24 + ,8 + ,16 + ,12 + ,22 + ,23 + ,19 + ,25 + ,24 + ,24 + ,4 + ,11 + ,11 + ,20 + ,21 + ,14 + ,22 + ,23 + ,19 + ,4 + ,15 + ,16 + ,18 + ,19 + ,15 + ,20 + ,21 + ,20 + ,10 + ,9 + ,19 + ,18 + ,14 + ,12 + ,20 + ,21 + ,18 + ,8 + ,16 + ,11 + ,24 + ,17 + ,19 + ,23 + ,20 + ,20 + ,6 + ,15 + ,16 + ,24 + ,12 + ,15 + ,28 + ,11 + ,27 + ,4 + ,10 + ,15 + ,22 + ,24 + ,17 + ,23 + ,22 + ,23 + ,4 + ,10 + ,24 + ,23 + ,18 + ,8 + ,28 + ,27 + ,26 + ,4 + ,15 + ,14 + ,22 + ,20 + ,10 + ,24 + ,25 + ,23 + ,5 + ,11 + ,15 + ,20 + ,16 + ,12 + ,18 + ,18 + ,17 + ,4 + ,13 + ,11 + ,18 + ,20 + ,12 + ,20 + ,20 + ,21 + ,6 + ,14 + ,15 + ,25 + ,22 + ,20 + ,28 + ,24 + ,25 + ,4 + ,18 + ,12 + ,18 + ,12 + ,12 + ,21 + ,10 + ,23 + ,5 + ,16 + ,10 + ,16 + ,16 + ,12 + ,21 + ,27 + ,27 + ,7 + ,14 + ,14 + ,20 + ,17 + ,14 + ,25 + ,21 + ,24 + ,8 + ,14 + ,13 + ,19 + ,22 + ,6 + ,19 + ,21 + ,20 + ,5 + ,14 + ,9 + ,15 + ,12 + ,10 + ,18 + ,18 + ,27 + ,8 + ,14 + ,15 + ,19 + ,14 + ,18 + ,21 + ,15 + ,21 + ,10 + ,12 + ,15 + ,19 + ,23 + ,18 + ,22 + ,24 + ,24 + ,8 + ,14 + ,14 + ,16 + ,15 + ,7 + ,24 + ,22 + ,21 + ,5 + ,15 + ,11 + ,17 + ,17 + ,18 + ,15 + ,14 + ,15 + ,12 + ,15 + ,8 + ,28 + ,28 + ,9 + ,28 + ,28 + ,25 + ,4 + ,15 + ,11 + ,23 + ,20 + ,17 + ,26 + ,18 + ,25 + ,5 + ,13 + ,11 + ,25 + ,23 + ,22 + ,23 + ,26 + ,22 + ,4 + ,17 + ,8 + ,20 + ,13 + ,11 + ,26 + ,17 + ,24 + ,6 + ,17 + ,10 + ,17 + ,18 + ,15 + ,20 + ,19 + ,21 + ,4 + ,19 + ,11 + ,23 + ,23 + ,17 + ,22 + ,22 + ,22 + ,4 + ,15 + ,13 + ,16 + ,19 + ,15 + ,20 + ,18 + ,23 + ,7 + ,13 + ,11 + ,23 + ,23 + ,22 + ,23 + ,24 + ,22 + ,7 + ,9 + ,20 + ,11 + ,12 + ,9 + ,22 + ,15 + ,20 + ,10 + ,15 + ,10 + ,18 + ,16 + ,13 + ,24 + ,18 + ,23 + ,4 + ,15 + ,15 + ,24 + ,23 + ,20 + ,23 + ,26 + ,25 + ,5 + ,15 + ,12 + ,23 + ,13 + ,14 + ,22 + ,11 + ,23 + ,8 + ,16 + ,14 + ,21 + ,22 + ,14 + ,26 + ,26 + ,22 + ,11 + ,11 + ,23 + ,16 + ,18 + ,12 + ,23 + ,21 + ,25 + ,7 + ,14 + ,14 + ,24 + ,23 + ,20 + ,27 + ,23 + ,26 + ,4 + ,11 + ,16 + ,23 + ,20 + ,20 + ,23 + ,23 + ,22 + ,8 + ,15 + ,11 + ,18 + ,10 + ,8 + ,21 + ,15 + ,24 + ,6 + ,13 + ,12 + ,20 + ,17 + ,17 + ,26 + ,22 + ,24 + ,7 + ,15 + ,10 + ,9 + ,18 + ,9 + ,23 + ,26 + ,25 + ,5 + ,16 + ,14 + ,24 + ,15 + ,18 + ,21 + ,16 + ,20 + ,4 + ,14 + ,12 + ,25 + ,23 + ,22 + ,27 + ,20 + ,26 + ,8 + ,15 + ,12 + ,20 + ,17 + ,10 + ,19 + ,18 + ,21 + ,4 + ,16 + ,11 + ,21 + ,17 + ,13 + ,23 + ,22 + ,26 + ,8 + ,16 + ,12 + ,25 + ,22 + ,15 + ,25 + ,16 + ,21 + ,6 + ,11 + ,13 + ,22 + ,20 + ,18 + ,23 + ,19 + ,22 + ,4 + ,12 + ,11 + ,21 + ,20 + ,18 + ,22 + ,20 + ,16 + ,9 + ,9 + ,19 + ,21 + ,19 + ,12 + ,22 + ,19 + ,26 + ,5 + ,16 + ,12 + ,22 + ,18 + ,12 + ,25 + ,23 + ,28 + ,6 + ,13 + ,17 + ,27 + ,22 + ,20 + ,25 + ,24 + ,18 + ,4 + ,16 + ,9 + ,24 + ,20 + ,12 + ,28 + ,25 + ,25 + ,4 + ,12 + ,12 + ,24 + ,22 + ,16 + ,28 + ,21 + ,23 + ,4 + ,9 + ,19 + ,21 + ,18 + ,16 + ,20 + ,21 + ,21 + ,5 + ,13 + ,18 + ,18 + ,16 + ,18 + ,25 + ,23 + ,20 + ,6 + ,13 + ,15 + ,16 + ,16 + ,16 + ,19 + ,27 + ,25 + ,16 + ,14 + ,14 + ,22 + ,16 + ,13 + ,25 + ,23 + ,22 + ,6 + ,19 + ,11 + ,20 + ,16 + ,17 + ,22 + ,18 + ,21 + ,6 + ,13 + ,9 + ,18 + ,17 + ,13 + ,18 + ,16 + ,16 + ,4 + ,12 + ,18 + ,20 + ,18 + ,17 + ,20 + ,16 + ,18 + ,4 + ,13 + ,16) + ,dim=c(9 + ,162) + ,dimnames=list(c('I1' + ,'I2' + ,'I3' + ,'E1' + ,'E2' + ,'E3' + ,'A' + ,'Happiness' + ,'Depression ') + ,1:162)) > y <- array(NA,dim=c(9,162),dimnames=list(c('I1','I2','I3','E1','E2','E3','A','Happiness','Depression '),1:162)) > 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 = '3' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 I3 I1 I2 E1 E2 E3 A Happiness Depression\r 1 21 26 21 23 17 23 4 14 12 2 15 20 16 24 17 20 4 18 11 3 18 19 19 22 18 20 6 11 14 4 11 19 18 20 21 21 8 12 12 5 8 20 16 24 20 24 8 16 21 6 19 25 23 27 28 22 4 18 12 7 4 25 17 28 19 23 4 14 22 8 20 22 12 27 22 20 8 14 11 9 16 26 19 24 16 25 5 15 10 10 14 22 16 23 18 23 4 15 13 11 10 17 19 24 25 27 4 17 10 12 13 22 20 27 17 27 4 19 8 13 14 19 13 27 14 22 4 10 15 14 8 24 20 28 11 24 4 16 14 15 23 26 27 27 27 25 4 18 10 16 11 21 17 23 20 22 8 14 14 17 9 13 8 24 22 28 4 14 14 18 24 26 25 28 22 28 4 17 11 19 5 20 26 27 21 27 4 14 10 20 15 22 13 25 23 25 8 16 13 21 5 14 19 19 17 16 4 18 7 22 19 21 15 24 24 28 7 11 14 23 6 7 5 20 14 21 4 14 12 24 13 23 16 28 17 24 4 12 14 25 11 17 14 26 23 27 5 17 11 26 17 25 24 23 24 14 4 9 9 27 17 25 24 23 24 14 4 16 11 28 5 19 9 20 8 27 4 14 15 29 9 20 19 11 22 20 4 15 14 30 15 23 19 24 23 21 4 11 13 31 17 22 25 25 25 22 4 16 9 32 17 22 19 23 21 21 4 13 15 33 20 21 18 18 24 12 15 17 10 34 12 15 15 20 15 20 10 15 11 35 7 20 12 20 22 24 4 14 13 36 16 22 21 24 21 19 8 16 8 37 7 18 12 23 25 28 4 9 20 38 14 20 15 25 16 23 4 15 12 39 24 28 28 28 28 27 4 17 10 40 15 22 25 26 23 22 4 13 10 41 15 18 19 26 21 27 7 15 9 42 10 23 20 23 21 26 4 16 14 43 14 20 24 22 26 22 6 16 8 44 18 25 26 24 22 21 5 12 14 45 12 26 25 21 21 19 4 12 11 46 9 15 12 20 18 24 16 11 13 47 9 17 12 22 12 19 5 15 9 48 8 23 15 20 25 26 12 15 11 49 18 21 17 25 17 22 6 17 15 50 10 13 14 20 24 28 9 13 11 51 17 18 16 22 15 21 9 16 10 52 14 19 11 23 13 23 4 14 14 53 16 22 20 25 26 28 5 11 18 54 10 16 11 23 16 10 4 12 14 55 19 24 22 23 24 24 4 12 11 56 10 18 20 22 21 21 5 15 12 57 14 20 19 24 20 21 4 16 13 58 10 24 17 25 14 24 4 15 9 59 4 14 21 21 25 24 4 12 10 60 19 22 23 12 25 25 5 12 15 61 9 24 18 17 20 25 4 8 20 62 12 18 17 20 22 23 6 13 12 63 16 21 27 23 20 21 4 11 12 64 11 23 25 23 26 16 4 14 14 65 18 17 19 20 18 17 18 15 13 66 11 22 22 28 22 25 4 10 11 67 24 24 24 24 24 24 6 11 17 68 17 21 20 24 17 23 4 12 12 69 18 22 19 24 24 25 4 15 13 70 9 16 11 24 20 23 5 15 14 71 19 21 22 28 19 28 4 14 13 72 18 23 22 25 20 26 4 16 15 73 12 22 16 21 15 22 5 15 13 74 23 24 20 25 23 19 10 15 10 75 22 24 24 25 26 26 5 13 11 76 14 16 16 18 22 18 8 12 19 77 14 16 16 17 20 18 8 17 13 78 16 21 22 26 24 25 5 13 17 79 23 26 24 28 26 27 4 15 13 80 7 15 16 21 21 12 4 13 9 81 10 25 27 27 25 15 4 15 11 82 12 18 11 22 13 21 5 16 10 83 12 23 21 21 20 23 4 15 9 84 12 20 20 25 22 22 4 16 12 85 17 17 20 22 23 21 8 15 12 86 21 25 27 23 28 24 4 14 13 87 16 24 20 26 22 27 5 15 13 88 11 17 12 19 20 22 14 14 12 89 14 19 8 25 6 28 8 13 15 90 13 20 21 21 21 26 8 7 22 91 9 15 18 13 20 10 4 17 13 92 19 27 24 24 18 19 4 13 15 93 13 22 16 25 23 22 6 15 13 94 19 23 18 26 20 21 4 14 15 95 13 16 20 25 24 24 7 13 10 96 13 19 20 25 22 25 7 16 11 97 13 25 19 22 21 21 4 12 16 98 14 19 17 21 18 20 6 14 11 99 12 19 16 23 21 21 4 17 11 100 22 26 26 25 23 24 7 15 10 101 11 21 15 24 23 23 4 17 10 102 5 20 22 21 15 18 4 12 16 103 18 24 17 21 21 24 8 16 12 104 19 22 23 25 24 24 4 11 11 105 14 20 21 22 23 19 4 15 16 106 15 18 19 20 21 20 10 9 19 107 12 18 14 20 21 18 8 16 11 108 19 24 17 23 20 20 6 15 16 109 15 24 12 28 11 27 4 10 15 110 17 22 24 23 22 23 4 10 24 111 8 23 18 28 27 26 4 15 14 112 10 22 20 24 25 23 5 11 15 113 12 20 16 18 18 17 4 13 11 114 12 18 20 20 20 21 6 14 15 115 20 25 22 28 24 25 4 18 12 116 12 18 12 21 10 23 5 16 10 117 12 16 16 21 27 27 7 14 14 118 14 20 17 25 21 24 8 14 13 119 6 19 22 19 21 20 5 14 9 120 10 15 12 18 18 27 8 14 15 121 18 19 14 21 15 21 10 12 15 122 18 19 23 22 24 24 8 14 14 123 7 16 15 24 22 21 5 15 11 124 18 17 17 15 14 15 12 15 8 125 9 28 28 28 28 25 4 15 11 126 17 23 20 26 18 25 5 13 11 127 22 25 23 23 26 22 4 17 8 128 11 20 13 26 17 24 6 17 10 129 15 17 18 20 19 21 4 19 11 130 17 23 23 22 22 22 4 15 13 131 15 16 19 20 18 23 7 13 11 132 22 23 23 23 24 22 7 9 20 133 9 11 12 22 15 20 10 15 10 134 13 18 16 24 18 23 4 15 15 135 20 24 23 23 26 25 5 15 12 136 14 23 13 22 11 23 8 16 14 137 14 21 22 26 26 22 11 11 23 138 12 16 18 23 21 25 7 14 14 139 20 24 23 27 23 26 4 11 16 140 20 23 20 23 23 22 8 15 11 141 8 18 10 21 15 24 6 13 12 142 17 20 17 26 22 24 7 15 10 143 9 9 18 23 26 25 5 16 14 144 18 24 15 21 16 20 4 14 12 145 22 25 23 27 20 26 8 15 12 146 10 20 17 19 18 21 4 16 11 147 13 21 17 23 22 26 8 16 12 148 15 25 22 25 16 21 6 11 13 149 18 22 20 23 19 22 4 12 11 150 18 21 20 22 20 16 9 9 19 151 12 21 19 22 19 26 5 16 12 152 12 22 18 25 23 28 6 13 17 153 20 27 22 25 24 18 4 16 9 154 12 24 20 28 25 25 4 12 12 155 16 24 22 28 21 23 4 9 19 156 16 21 18 20 21 21 5 13 18 157 18 18 16 25 23 20 6 13 15 158 16 16 16 19 27 25 16 14 14 159 13 22 16 25 23 22 6 19 11 160 17 20 16 22 18 21 6 13 9 161 13 18 17 18 16 16 4 12 18 162 17 20 18 20 16 18 4 13 16 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) I1 I2 E1 -6.12669 0.55895 0.22704 0.10342 E2 E3 A Happiness 0.01915 -0.02636 0.51350 0.00609 `Depression\\r` -0.05185 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.3585 -1.9593 0.3523 2.8636 6.6876 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -6.12669 4.28848 -1.429 0.1551 I1 0.55895 0.11187 4.996 1.58e-06 *** I2 0.22704 0.10293 2.206 0.0289 * E1 0.10342 0.11622 0.890 0.3749 E2 0.01915 0.08919 0.215 0.8303 E3 -0.02636 0.09196 -0.287 0.7748 A 0.51350 0.12098 4.244 3.78e-05 *** Happiness 0.00609 0.15168 0.040 0.9680 `Depression\\r` -0.05185 0.11296 -0.459 0.6469 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.727 on 153 degrees of freedom Multiple R-squared: 0.3763, Adjusted R-squared: 0.3436 F-statistic: 11.54 on 8 and 153 DF, p-value: 9.526e-13 > 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.8697264 0.26054715 0.130273576 [2,] 0.7998776 0.40024478 0.200122391 [3,] 0.8060972 0.38780550 0.193902750 [4,] 0.8016006 0.39679878 0.198399390 [5,] 0.7577213 0.48455733 0.242278666 [6,] 0.7194288 0.56114250 0.280571248 [7,] 0.8530636 0.29387283 0.146936413 [8,] 0.9732083 0.05358341 0.026791706 [9,] 0.9579562 0.08408762 0.042043812 [10,] 0.9600898 0.07982048 0.039910242 [11,] 0.9495380 0.10092392 0.050461960 [12,] 0.9532175 0.09356501 0.046782504 [13,] 0.9416505 0.11669891 0.058349455 [14,] 0.9185334 0.16293316 0.081466582 [15,] 0.9394177 0.12116458 0.060582291 [16,] 0.9158397 0.16832069 0.084160346 [17,] 0.9256075 0.14878504 0.074392522 [18,] 0.9075421 0.18491587 0.092457933 [19,] 0.8835456 0.23290884 0.116454420 [20,] 0.8520143 0.29597131 0.147985655 [21,] 0.8590460 0.28190809 0.140954045 [22,] 0.8300714 0.33985719 0.169928593 [23,] 0.8069802 0.38603952 0.193019759 [24,] 0.8672472 0.26550552 0.132752761 [25,] 0.8430447 0.31391057 0.156955285 [26,] 0.8155089 0.36898226 0.184491130 [27,] 0.7853267 0.42934662 0.214673308 [28,] 0.7753113 0.44937734 0.224688670 [29,] 0.7326874 0.53462528 0.267312639 [30,] 0.6858403 0.62831939 0.314159697 [31,] 0.6881093 0.62378143 0.311890717 [32,] 0.6508558 0.69828835 0.349144176 [33,] 0.6222086 0.75558271 0.377791355 [34,] 0.6695235 0.66095303 0.330476514 [35,] 0.6772834 0.64543311 0.322716554 [36,] 0.6393353 0.72132950 0.360664748 [37,] 0.8650548 0.26989037 0.134945185 [38,] 0.8933446 0.21331078 0.106655392 [39,] 0.8703051 0.25938983 0.129694914 [40,] 0.8780674 0.24386514 0.121932569 [41,] 0.8790651 0.24186978 0.120934891 [42,] 0.8713515 0.25729699 0.128648493 [43,] 0.8526559 0.29468819 0.147344094 [44,] 0.8431377 0.31372451 0.156862253 [45,] 0.8214738 0.35705236 0.178526180 [46,] 0.7911224 0.41775528 0.208877642 [47,] 0.8297217 0.34055664 0.170278318 [48,] 0.8676595 0.26468093 0.132340464 [49,] 0.9220064 0.15598715 0.077993576 [50,] 0.9292425 0.14151499 0.070757496 [51,] 0.9117192 0.17656164 0.088280818 [52,] 0.8972975 0.20540496 0.102702478 [53,] 0.9109241 0.17815190 0.089075950 [54,] 0.9036240 0.19275204 0.096376018 [55,] 0.9083386 0.18332289 0.091661443 [56,] 0.9543932 0.09121366 0.045606832 [57,] 0.9523499 0.09530011 0.047650057 [58,] 0.9520781 0.09584390 0.047921948 [59,] 0.9391068 0.12178641 0.060893205 [60,] 0.9458647 0.10827061 0.054135305 [61,] 0.9401431 0.11971373 0.059856866 [62,] 0.9293778 0.14124436 0.070622179 [63,] 0.9321863 0.13562749 0.067813743 [64,] 0.9404466 0.11910680 0.059553399 [65,] 0.9359853 0.12802949 0.064014747 [66,] 0.9272238 0.14555237 0.072776184 [67,] 0.9112800 0.17743992 0.088719958 [68,] 0.9249915 0.15001699 0.075008496 [69,] 0.9159927 0.16801452 0.084007258 [70,] 0.9679756 0.06404884 0.032024418 [71,] 0.9599148 0.08017049 0.040085246 [72,] 0.9575673 0.08486542 0.042432710 [73,] 0.9481548 0.10369050 0.051845249 [74,] 0.9452507 0.10949864 0.054749322 [75,] 0.9426328 0.11473443 0.057367216 [76,] 0.9276089 0.14478223 0.072391117 [77,] 0.9278691 0.14426182 0.072130912 [78,] 0.9174508 0.16509836 0.082549182 [79,] 0.9033528 0.19329445 0.096647225 [80,] 0.8875991 0.22480179 0.112400897 [81,] 0.8654350 0.26912995 0.134564976 [82,] 0.8439907 0.31201860 0.156009302 [83,] 0.8537026 0.29259484 0.146297419 [84,] 0.8243724 0.35125528 0.175627638 [85,] 0.7960408 0.40791842 0.203959208 [86,] 0.7815551 0.43688974 0.218444871 [87,] 0.7465085 0.50698290 0.253491451 [88,] 0.7055829 0.58883429 0.294417146 [89,] 0.6764883 0.64702337 0.323511683 [90,] 0.6438964 0.71220713 0.356103564 [91,] 0.8549038 0.29019245 0.145096225 [92,] 0.8283775 0.34324500 0.171622500 [93,] 0.8351791 0.32964170 0.164820852 [94,] 0.8045438 0.39091230 0.195456151 [95,] 0.7731366 0.45372688 0.226863440 [96,] 0.7391693 0.52166135 0.260830673 [97,] 0.7188132 0.56237364 0.281186821 [98,] 0.6847945 0.63041090 0.315205451 [99,] 0.6482853 0.70342948 0.351714738 [100,] 0.7286554 0.54268923 0.271344614 [101,] 0.7625470 0.47490604 0.237453022 [102,] 0.7334340 0.53313203 0.266566015 [103,] 0.7043280 0.59134397 0.295671983 [104,] 0.7050317 0.58993654 0.294968268 [105,] 0.6610129 0.67797411 0.338987054 [106,] 0.6102353 0.77952935 0.389764677 [107,] 0.5573134 0.88537325 0.442686624 [108,] 0.8436694 0.31266111 0.156330554 [109,] 0.8099850 0.38003008 0.190015040 [110,] 0.8040338 0.39193237 0.195966185 [111,] 0.7727174 0.45456528 0.227282639 [112,] 0.8068960 0.38620808 0.193104039 [113,] 0.7780201 0.44395974 0.221979868 [114,] 0.9944407 0.01111855 0.005559276 [115,] 0.9915264 0.01694723 0.008473614 [116,] 0.9890902 0.02181956 0.010909778 [117,] 0.9835305 0.03293893 0.016469463 [118,] 0.9793759 0.04124812 0.020624058 [119,] 0.9707135 0.05857308 0.029286542 [120,] 0.9582844 0.08343122 0.041715608 [121,] 0.9620186 0.07596273 0.037981364 [122,] 0.9506261 0.09874789 0.049373946 [123,] 0.9342029 0.13159429 0.065797144 [124,] 0.9225459 0.15490829 0.077454143 [125,] 0.8927491 0.21450181 0.107250905 [126,] 0.9030110 0.19397791 0.096988957 [127,] 0.8648026 0.27039484 0.135197418 [128,] 0.8903141 0.21937172 0.109685862 [129,] 0.8611388 0.27772239 0.138861197 [130,] 0.8588470 0.28230592 0.141152962 [131,] 0.8071133 0.38577341 0.192886707 [132,] 0.7339274 0.53214517 0.266072585 [133,] 0.7863815 0.42723701 0.213618507 [134,] 0.8613285 0.27734304 0.138671521 [135,] 0.9049431 0.19011383 0.095056913 [136,] 0.8363097 0.32738059 0.163690297 [137,] 0.7518855 0.49622905 0.248114524 [138,] 0.6590147 0.68197068 0.340985339 [139,] 0.5518855 0.89622907 0.448114534 > postscript(file="/var/fisher/rcomp/tmp/13o871353157613.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/fisher/rcomp/tmp/2vsz01353157613.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/fisher/rcomp/tmp/30yzh1353157613.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/fisher/rcomp/tmp/47vpw1353157613.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/fisher/rcomp/tmp/5cop01353157613.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 = 162 Frequency = 1 1 2 3 4 5 4.211346016 2.441491339 4.678203737 -3.055776266 -6.033848511 6 7 8 9 10 1.641212019 -11.358489994 4.796120397 -0.989423583 0.608918816 11 12 13 14 15 -1.577190502 -1.871928686 2.737545635 -7.728089069 4.168649967 16 17 18 19 20 -4.119877028 2.465442504 5.752042227 -10.058690345 -0.019909523 21 22 23 24 25 -4.681661735 4.844113133 3.778866515 -1.351512023 -0.072213409 26 27 28 29 30 -0.407155918 -0.346092895 -4.408052621 -2.817050609 0.141359487 31 32 33 34 35 0.984894088 2.933531744 1.009876802 -0.147487165 -4.098914838 36 37 38 39 40 -1.111874782 -2.849907499 1.733445901 3.759964128 -1.010118305 41 42 43 44 45 1.153441664 -4.790773529 -1.457903832 -0.014378693 -5.711639193 46 47 48 49 50 -5.371313946 -1.296238852 -9.679348390 3.791289442 -0.238321139 51 52 53 54 55 3.223717141 3.574600098 1.242661027 0.863515033 2.954873714 56 57 58 59 60 -2.635522334 0.845180759 -5.047299501 -6.092787069 4.684470591 61 62 63 64 65 -4.922524161 -0.215316682 0.551972860 -5.273089117 -0.314325819 66 67 68 69 70 -4.367513333 6.687558198 3.141867370 3.762233562 -0.505592916 71 72 73 74 75 4.407278856 2.619304159 -1.666658364 3.938346536 4.788796588 76 77 78 79 80 2.546684470 2.346861651 1.139299414 4.992012478 -2.814213722 81 82 83 84 85 -8.427583831 1.451181113 -3.124043916 -1.549056502 3.344637241 86 87 88 89 90 3.275680453 -0.212025704 -3.519913381 2.318622680 -1.718532002 91 92 93 94 95 -0.291456451 0.904922606 -1.747007380 4.304412931 0.075232593 96 97 98 99 100 -1.503376723 -2.581944892 1.061884481 0.059725135 2.130528671 101 102 103 104 105 -1.971971859 -8.329108069 1.327827176 3.644975316 0.649430048 106 107 108 109 110 0.603980175 -0.743971800 3.275170365 1.255664369 2.316820976 111 112 113 114 115 -6.962592586 -4.922108110 -0.005749799 -0.761399388 2.920485095 116 117 118 119 120 1.437721013 0.620002197 -0.786050221 -7.514085538 0.108015443 121 122 123 124 125 3.992365164 2.715354583 -3.660287849 3.502471119 -11.228725657 126 127 128 129 130 1.279269846 4.891890278 -2.051562077 4.059919123 1.461202052 131 132 133 134 135 2.959738478 5.178467876 -0.489288570 1.844973132 3.235983870 136 137 138 139 140 -1.039713713 -3.735792640 0.021242573 3.651341621 2.862055334 141 142 143 144 145 -2.569108571 2.443248443 1.852947802 3.838364931 2.864089623 146 147 148 149 150 -2.249042841 -2.168608054 -2.654038327 3.569846385 1.920473503 151 152 153 154 155 -1.921327202 -2.823356399 1.784985884 -4.049101651 -0.098106742 156 157 158 159 160 2.671821807 5.551931381 0.152643885 -1.875063133 3.555307908 161 162 2.266058944 4.657221785 > postscript(file="/var/fisher/rcomp/tmp/6ogdf1353157613.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 = 162 Frequency = 1 lag(myerror, k = 1) myerror 0 4.211346016 NA 1 2.441491339 4.211346016 2 4.678203737 2.441491339 3 -3.055776266 4.678203737 4 -6.033848511 -3.055776266 5 1.641212019 -6.033848511 6 -11.358489994 1.641212019 7 4.796120397 -11.358489994 8 -0.989423583 4.796120397 9 0.608918816 -0.989423583 10 -1.577190502 0.608918816 11 -1.871928686 -1.577190502 12 2.737545635 -1.871928686 13 -7.728089069 2.737545635 14 4.168649967 -7.728089069 15 -4.119877028 4.168649967 16 2.465442504 -4.119877028 17 5.752042227 2.465442504 18 -10.058690345 5.752042227 19 -0.019909523 -10.058690345 20 -4.681661735 -0.019909523 21 4.844113133 -4.681661735 22 3.778866515 4.844113133 23 -1.351512023 3.778866515 24 -0.072213409 -1.351512023 25 -0.407155918 -0.072213409 26 -0.346092895 -0.407155918 27 -4.408052621 -0.346092895 28 -2.817050609 -4.408052621 29 0.141359487 -2.817050609 30 0.984894088 0.141359487 31 2.933531744 0.984894088 32 1.009876802 2.933531744 33 -0.147487165 1.009876802 34 -4.098914838 -0.147487165 35 -1.111874782 -4.098914838 36 -2.849907499 -1.111874782 37 1.733445901 -2.849907499 38 3.759964128 1.733445901 39 -1.010118305 3.759964128 40 1.153441664 -1.010118305 41 -4.790773529 1.153441664 42 -1.457903832 -4.790773529 43 -0.014378693 -1.457903832 44 -5.711639193 -0.014378693 45 -5.371313946 -5.711639193 46 -1.296238852 -5.371313946 47 -9.679348390 -1.296238852 48 3.791289442 -9.679348390 49 -0.238321139 3.791289442 50 3.223717141 -0.238321139 51 3.574600098 3.223717141 52 1.242661027 3.574600098 53 0.863515033 1.242661027 54 2.954873714 0.863515033 55 -2.635522334 2.954873714 56 0.845180759 -2.635522334 57 -5.047299501 0.845180759 58 -6.092787069 -5.047299501 59 4.684470591 -6.092787069 60 -4.922524161 4.684470591 61 -0.215316682 -4.922524161 62 0.551972860 -0.215316682 63 -5.273089117 0.551972860 64 -0.314325819 -5.273089117 65 -4.367513333 -0.314325819 66 6.687558198 -4.367513333 67 3.141867370 6.687558198 68 3.762233562 3.141867370 69 -0.505592916 3.762233562 70 4.407278856 -0.505592916 71 2.619304159 4.407278856 72 -1.666658364 2.619304159 73 3.938346536 -1.666658364 74 4.788796588 3.938346536 75 2.546684470 4.788796588 76 2.346861651 2.546684470 77 1.139299414 2.346861651 78 4.992012478 1.139299414 79 -2.814213722 4.992012478 80 -8.427583831 -2.814213722 81 1.451181113 -8.427583831 82 -3.124043916 1.451181113 83 -1.549056502 -3.124043916 84 3.344637241 -1.549056502 85 3.275680453 3.344637241 86 -0.212025704 3.275680453 87 -3.519913381 -0.212025704 88 2.318622680 -3.519913381 89 -1.718532002 2.318622680 90 -0.291456451 -1.718532002 91 0.904922606 -0.291456451 92 -1.747007380 0.904922606 93 4.304412931 -1.747007380 94 0.075232593 4.304412931 95 -1.503376723 0.075232593 96 -2.581944892 -1.503376723 97 1.061884481 -2.581944892 98 0.059725135 1.061884481 99 2.130528671 0.059725135 100 -1.971971859 2.130528671 101 -8.329108069 -1.971971859 102 1.327827176 -8.329108069 103 3.644975316 1.327827176 104 0.649430048 3.644975316 105 0.603980175 0.649430048 106 -0.743971800 0.603980175 107 3.275170365 -0.743971800 108 1.255664369 3.275170365 109 2.316820976 1.255664369 110 -6.962592586 2.316820976 111 -4.922108110 -6.962592586 112 -0.005749799 -4.922108110 113 -0.761399388 -0.005749799 114 2.920485095 -0.761399388 115 1.437721013 2.920485095 116 0.620002197 1.437721013 117 -0.786050221 0.620002197 118 -7.514085538 -0.786050221 119 0.108015443 -7.514085538 120 3.992365164 0.108015443 121 2.715354583 3.992365164 122 -3.660287849 2.715354583 123 3.502471119 -3.660287849 124 -11.228725657 3.502471119 125 1.279269846 -11.228725657 126 4.891890278 1.279269846 127 -2.051562077 4.891890278 128 4.059919123 -2.051562077 129 1.461202052 4.059919123 130 2.959738478 1.461202052 131 5.178467876 2.959738478 132 -0.489288570 5.178467876 133 1.844973132 -0.489288570 134 3.235983870 1.844973132 135 -1.039713713 3.235983870 136 -3.735792640 -1.039713713 137 0.021242573 -3.735792640 138 3.651341621 0.021242573 139 2.862055334 3.651341621 140 -2.569108571 2.862055334 141 2.443248443 -2.569108571 142 1.852947802 2.443248443 143 3.838364931 1.852947802 144 2.864089623 3.838364931 145 -2.249042841 2.864089623 146 -2.168608054 -2.249042841 147 -2.654038327 -2.168608054 148 3.569846385 -2.654038327 149 1.920473503 3.569846385 150 -1.921327202 1.920473503 151 -2.823356399 -1.921327202 152 1.784985884 -2.823356399 153 -4.049101651 1.784985884 154 -0.098106742 -4.049101651 155 2.671821807 -0.098106742 156 5.551931381 2.671821807 157 0.152643885 5.551931381 158 -1.875063133 0.152643885 159 3.555307908 -1.875063133 160 2.266058944 3.555307908 161 4.657221785 2.266058944 162 NA 4.657221785 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.441491339 4.211346016 [2,] 4.678203737 2.441491339 [3,] -3.055776266 4.678203737 [4,] -6.033848511 -3.055776266 [5,] 1.641212019 -6.033848511 [6,] -11.358489994 1.641212019 [7,] 4.796120397 -11.358489994 [8,] -0.989423583 4.796120397 [9,] 0.608918816 -0.989423583 [10,] -1.577190502 0.608918816 [11,] -1.871928686 -1.577190502 [12,] 2.737545635 -1.871928686 [13,] -7.728089069 2.737545635 [14,] 4.168649967 -7.728089069 [15,] -4.119877028 4.168649967 [16,] 2.465442504 -4.119877028 [17,] 5.752042227 2.465442504 [18,] -10.058690345 5.752042227 [19,] -0.019909523 -10.058690345 [20,] -4.681661735 -0.019909523 [21,] 4.844113133 -4.681661735 [22,] 3.778866515 4.844113133 [23,] -1.351512023 3.778866515 [24,] -0.072213409 -1.351512023 [25,] -0.407155918 -0.072213409 [26,] -0.346092895 -0.407155918 [27,] -4.408052621 -0.346092895 [28,] -2.817050609 -4.408052621 [29,] 0.141359487 -2.817050609 [30,] 0.984894088 0.141359487 [31,] 2.933531744 0.984894088 [32,] 1.009876802 2.933531744 [33,] -0.147487165 1.009876802 [34,] -4.098914838 -0.147487165 [35,] -1.111874782 -4.098914838 [36,] -2.849907499 -1.111874782 [37,] 1.733445901 -2.849907499 [38,] 3.759964128 1.733445901 [39,] -1.010118305 3.759964128 [40,] 1.153441664 -1.010118305 [41,] -4.790773529 1.153441664 [42,] -1.457903832 -4.790773529 [43,] -0.014378693 -1.457903832 [44,] -5.711639193 -0.014378693 [45,] -5.371313946 -5.711639193 [46,] -1.296238852 -5.371313946 [47,] -9.679348390 -1.296238852 [48,] 3.791289442 -9.679348390 [49,] -0.238321139 3.791289442 [50,] 3.223717141 -0.238321139 [51,] 3.574600098 3.223717141 [52,] 1.242661027 3.574600098 [53,] 0.863515033 1.242661027 [54,] 2.954873714 0.863515033 [55,] -2.635522334 2.954873714 [56,] 0.845180759 -2.635522334 [57,] -5.047299501 0.845180759 [58,] -6.092787069 -5.047299501 [59,] 4.684470591 -6.092787069 [60,] -4.922524161 4.684470591 [61,] -0.215316682 -4.922524161 [62,] 0.551972860 -0.215316682 [63,] -5.273089117 0.551972860 [64,] -0.314325819 -5.273089117 [65,] -4.367513333 -0.314325819 [66,] 6.687558198 -4.367513333 [67,] 3.141867370 6.687558198 [68,] 3.762233562 3.141867370 [69,] -0.505592916 3.762233562 [70,] 4.407278856 -0.505592916 [71,] 2.619304159 4.407278856 [72,] -1.666658364 2.619304159 [73,] 3.938346536 -1.666658364 [74,] 4.788796588 3.938346536 [75,] 2.546684470 4.788796588 [76,] 2.346861651 2.546684470 [77,] 1.139299414 2.346861651 [78,] 4.992012478 1.139299414 [79,] -2.814213722 4.992012478 [80,] -8.427583831 -2.814213722 [81,] 1.451181113 -8.427583831 [82,] -3.124043916 1.451181113 [83,] -1.549056502 -3.124043916 [84,] 3.344637241 -1.549056502 [85,] 3.275680453 3.344637241 [86,] -0.212025704 3.275680453 [87,] -3.519913381 -0.212025704 [88,] 2.318622680 -3.519913381 [89,] -1.718532002 2.318622680 [90,] -0.291456451 -1.718532002 [91,] 0.904922606 -0.291456451 [92,] -1.747007380 0.904922606 [93,] 4.304412931 -1.747007380 [94,] 0.075232593 4.304412931 [95,] -1.503376723 0.075232593 [96,] -2.581944892 -1.503376723 [97,] 1.061884481 -2.581944892 [98,] 0.059725135 1.061884481 [99,] 2.130528671 0.059725135 [100,] -1.971971859 2.130528671 [101,] -8.329108069 -1.971971859 [102,] 1.327827176 -8.329108069 [103,] 3.644975316 1.327827176 [104,] 0.649430048 3.644975316 [105,] 0.603980175 0.649430048 [106,] -0.743971800 0.603980175 [107,] 3.275170365 -0.743971800 [108,] 1.255664369 3.275170365 [109,] 2.316820976 1.255664369 [110,] -6.962592586 2.316820976 [111,] -4.922108110 -6.962592586 [112,] -0.005749799 -4.922108110 [113,] -0.761399388 -0.005749799 [114,] 2.920485095 -0.761399388 [115,] 1.437721013 2.920485095 [116,] 0.620002197 1.437721013 [117,] -0.786050221 0.620002197 [118,] -7.514085538 -0.786050221 [119,] 0.108015443 -7.514085538 [120,] 3.992365164 0.108015443 [121,] 2.715354583 3.992365164 [122,] -3.660287849 2.715354583 [123,] 3.502471119 -3.660287849 [124,] -11.228725657 3.502471119 [125,] 1.279269846 -11.228725657 [126,] 4.891890278 1.279269846 [127,] -2.051562077 4.891890278 [128,] 4.059919123 -2.051562077 [129,] 1.461202052 4.059919123 [130,] 2.959738478 1.461202052 [131,] 5.178467876 2.959738478 [132,] -0.489288570 5.178467876 [133,] 1.844973132 -0.489288570 [134,] 3.235983870 1.844973132 [135,] -1.039713713 3.235983870 [136,] -3.735792640 -1.039713713 [137,] 0.021242573 -3.735792640 [138,] 3.651341621 0.021242573 [139,] 2.862055334 3.651341621 [140,] -2.569108571 2.862055334 [141,] 2.443248443 -2.569108571 [142,] 1.852947802 2.443248443 [143,] 3.838364931 1.852947802 [144,] 2.864089623 3.838364931 [145,] -2.249042841 2.864089623 [146,] -2.168608054 -2.249042841 [147,] -2.654038327 -2.168608054 [148,] 3.569846385 -2.654038327 [149,] 1.920473503 3.569846385 [150,] -1.921327202 1.920473503 [151,] -2.823356399 -1.921327202 [152,] 1.784985884 -2.823356399 [153,] -4.049101651 1.784985884 [154,] -0.098106742 -4.049101651 [155,] 2.671821807 -0.098106742 [156,] 5.551931381 2.671821807 [157,] 0.152643885 5.551931381 [158,] -1.875063133 0.152643885 [159,] 3.555307908 -1.875063133 [160,] 2.266058944 3.555307908 [161,] 4.657221785 2.266058944 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.441491339 4.211346016 2 4.678203737 2.441491339 3 -3.055776266 4.678203737 4 -6.033848511 -3.055776266 5 1.641212019 -6.033848511 6 -11.358489994 1.641212019 7 4.796120397 -11.358489994 8 -0.989423583 4.796120397 9 0.608918816 -0.989423583 10 -1.577190502 0.608918816 11 -1.871928686 -1.577190502 12 2.737545635 -1.871928686 13 -7.728089069 2.737545635 14 4.168649967 -7.728089069 15 -4.119877028 4.168649967 16 2.465442504 -4.119877028 17 5.752042227 2.465442504 18 -10.058690345 5.752042227 19 -0.019909523 -10.058690345 20 -4.681661735 -0.019909523 21 4.844113133 -4.681661735 22 3.778866515 4.844113133 23 -1.351512023 3.778866515 24 -0.072213409 -1.351512023 25 -0.407155918 -0.072213409 26 -0.346092895 -0.407155918 27 -4.408052621 -0.346092895 28 -2.817050609 -4.408052621 29 0.141359487 -2.817050609 30 0.984894088 0.141359487 31 2.933531744 0.984894088 32 1.009876802 2.933531744 33 -0.147487165 1.009876802 34 -4.098914838 -0.147487165 35 -1.111874782 -4.098914838 36 -2.849907499 -1.111874782 37 1.733445901 -2.849907499 38 3.759964128 1.733445901 39 -1.010118305 3.759964128 40 1.153441664 -1.010118305 41 -4.790773529 1.153441664 42 -1.457903832 -4.790773529 43 -0.014378693 -1.457903832 44 -5.711639193 -0.014378693 45 -5.371313946 -5.711639193 46 -1.296238852 -5.371313946 47 -9.679348390 -1.296238852 48 3.791289442 -9.679348390 49 -0.238321139 3.791289442 50 3.223717141 -0.238321139 51 3.574600098 3.223717141 52 1.242661027 3.574600098 53 0.863515033 1.242661027 54 2.954873714 0.863515033 55 -2.635522334 2.954873714 56 0.845180759 -2.635522334 57 -5.047299501 0.845180759 58 -6.092787069 -5.047299501 59 4.684470591 -6.092787069 60 -4.922524161 4.684470591 61 -0.215316682 -4.922524161 62 0.551972860 -0.215316682 63 -5.273089117 0.551972860 64 -0.314325819 -5.273089117 65 -4.367513333 -0.314325819 66 6.687558198 -4.367513333 67 3.141867370 6.687558198 68 3.762233562 3.141867370 69 -0.505592916 3.762233562 70 4.407278856 -0.505592916 71 2.619304159 4.407278856 72 -1.666658364 2.619304159 73 3.938346536 -1.666658364 74 4.788796588 3.938346536 75 2.546684470 4.788796588 76 2.346861651 2.546684470 77 1.139299414 2.346861651 78 4.992012478 1.139299414 79 -2.814213722 4.992012478 80 -8.427583831 -2.814213722 81 1.451181113 -8.427583831 82 -3.124043916 1.451181113 83 -1.549056502 -3.124043916 84 3.344637241 -1.549056502 85 3.275680453 3.344637241 86 -0.212025704 3.275680453 87 -3.519913381 -0.212025704 88 2.318622680 -3.519913381 89 -1.718532002 2.318622680 90 -0.291456451 -1.718532002 91 0.904922606 -0.291456451 92 -1.747007380 0.904922606 93 4.304412931 -1.747007380 94 0.075232593 4.304412931 95 -1.503376723 0.075232593 96 -2.581944892 -1.503376723 97 1.061884481 -2.581944892 98 0.059725135 1.061884481 99 2.130528671 0.059725135 100 -1.971971859 2.130528671 101 -8.329108069 -1.971971859 102 1.327827176 -8.329108069 103 3.644975316 1.327827176 104 0.649430048 3.644975316 105 0.603980175 0.649430048 106 -0.743971800 0.603980175 107 3.275170365 -0.743971800 108 1.255664369 3.275170365 109 2.316820976 1.255664369 110 -6.962592586 2.316820976 111 -4.922108110 -6.962592586 112 -0.005749799 -4.922108110 113 -0.761399388 -0.005749799 114 2.920485095 -0.761399388 115 1.437721013 2.920485095 116 0.620002197 1.437721013 117 -0.786050221 0.620002197 118 -7.514085538 -0.786050221 119 0.108015443 -7.514085538 120 3.992365164 0.108015443 121 2.715354583 3.992365164 122 -3.660287849 2.715354583 123 3.502471119 -3.660287849 124 -11.228725657 3.502471119 125 1.279269846 -11.228725657 126 4.891890278 1.279269846 127 -2.051562077 4.891890278 128 4.059919123 -2.051562077 129 1.461202052 4.059919123 130 2.959738478 1.461202052 131 5.178467876 2.959738478 132 -0.489288570 5.178467876 133 1.844973132 -0.489288570 134 3.235983870 1.844973132 135 -1.039713713 3.235983870 136 -3.735792640 -1.039713713 137 0.021242573 -3.735792640 138 3.651341621 0.021242573 139 2.862055334 3.651341621 140 -2.569108571 2.862055334 141 2.443248443 -2.569108571 142 1.852947802 2.443248443 143 3.838364931 1.852947802 144 2.864089623 3.838364931 145 -2.249042841 2.864089623 146 -2.168608054 -2.249042841 147 -2.654038327 -2.168608054 148 3.569846385 -2.654038327 149 1.920473503 3.569846385 150 -1.921327202 1.920473503 151 -2.823356399 -1.921327202 152 1.784985884 -2.823356399 153 -4.049101651 1.784985884 154 -0.098106742 -4.049101651 155 2.671821807 -0.098106742 156 5.551931381 2.671821807 157 0.152643885 5.551931381 158 -1.875063133 0.152643885 159 3.555307908 -1.875063133 160 2.266058944 3.555307908 161 4.657221785 2.266058944 > 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/fisher/rcomp/tmp/7mjov1353157613.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/fisher/rcomp/tmp/89fkq1353157613.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/fisher/rcomp/tmp/94jpa1353157613.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/fisher/rcomp/tmp/10tcsm1353157613.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11o6n21353157613.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/fisher/rcomp/tmp/121fci1353157613.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/fisher/rcomp/tmp/137mf01353157613.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/fisher/rcomp/tmp/14i3oq1353157613.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/fisher/rcomp/tmp/15d7t91353157613.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/fisher/rcomp/tmp/160h1g1353157614.tab") + } > > try(system("convert tmp/13o871353157613.ps tmp/13o871353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/2vsz01353157613.ps tmp/2vsz01353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/30yzh1353157613.ps tmp/30yzh1353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/47vpw1353157613.ps tmp/47vpw1353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/5cop01353157613.ps tmp/5cop01353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/6ogdf1353157613.ps tmp/6ogdf1353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/7mjov1353157613.ps tmp/7mjov1353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/89fkq1353157613.ps tmp/89fkq1353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/94jpa1353157613.ps tmp/94jpa1353157613.png",intern=TRUE)) character(0) > try(system("convert tmp/10tcsm1353157613.ps tmp/10tcsm1353157613.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.307 1.328 9.637