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 = '1' > 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 I1 I2 I3 E1 E2 E3 A Happiness Depression 1 26 21 21 23 17 23 4 14 12 2 20 16 15 24 17 20 4 18 11 3 19 19 18 22 18 20 6 11 14 4 19 18 11 20 21 21 8 12 12 5 20 16 8 24 20 24 8 16 21 6 25 23 19 27 28 22 4 18 12 7 25 17 4 28 19 23 4 14 22 8 22 12 20 27 22 20 8 14 11 9 26 19 16 24 16 25 5 15 10 10 22 16 14 23 18 23 4 15 13 11 17 19 10 24 25 27 4 17 10 12 22 20 13 27 17 27 4 19 8 13 19 13 14 27 14 22 4 10 15 14 24 20 8 28 11 24 4 16 14 15 26 27 23 27 27 25 4 18 10 16 21 17 11 23 20 22 8 14 14 17 13 8 9 24 22 28 4 14 14 18 26 25 24 28 22 28 4 17 11 19 20 26 5 27 21 27 4 14 10 20 22 13 15 25 23 25 8 16 13 21 14 19 5 19 17 16 4 18 7 22 21 15 19 24 24 28 7 11 14 23 7 5 6 20 14 21 4 14 12 24 23 16 13 28 17 24 4 12 14 25 17 14 11 26 23 27 5 17 11 26 25 24 17 23 24 14 4 9 9 27 25 24 17 23 24 14 4 16 11 28 19 9 5 20 8 27 4 14 15 29 20 19 9 11 22 20 4 15 14 30 23 19 15 24 23 21 4 11 13 31 22 25 17 25 25 22 4 16 9 32 22 19 17 23 21 21 4 13 15 33 21 18 20 18 24 12 15 17 10 34 15 15 12 20 15 20 10 15 11 35 20 12 7 20 22 24 4 14 13 36 22 21 16 24 21 19 8 16 8 37 18 12 7 23 25 28 4 9 20 38 20 15 14 25 16 23 4 15 12 39 28 28 24 28 28 27 4 17 10 40 22 25 15 26 23 22 4 13 10 41 18 19 15 26 21 27 7 15 9 42 23 20 10 23 21 26 4 16 14 43 20 24 14 22 26 22 6 16 8 44 25 26 18 24 22 21 5 12 14 45 26 25 12 21 21 19 4 12 11 46 15 12 9 20 18 24 16 11 13 47 17 12 9 22 12 19 5 15 9 48 23 15 8 20 25 26 12 15 11 49 21 17 18 25 17 22 6 17 15 50 13 14 10 20 24 28 9 13 11 51 18 16 17 22 15 21 9 16 10 52 19 11 14 23 13 23 4 14 14 53 22 20 16 25 26 28 5 11 18 54 16 11 10 23 16 10 4 12 14 55 24 22 19 23 24 24 4 12 11 56 18 20 10 22 21 21 5 15 12 57 20 19 14 24 20 21 4 16 13 58 24 17 10 25 14 24 4 15 9 59 14 21 4 21 25 24 4 12 10 60 22 23 19 12 25 25 5 12 15 61 24 18 9 17 20 25 4 8 20 62 18 17 12 20 22 23 6 13 12 63 21 27 16 23 20 21 4 11 12 64 23 25 11 23 26 16 4 14 14 65 17 19 18 20 18 17 18 15 13 66 22 22 11 28 22 25 4 10 11 67 24 24 24 24 24 24 6 11 17 68 21 20 17 24 17 23 4 12 12 69 22 19 18 24 24 25 4 15 13 70 16 11 9 24 20 23 5 15 14 71 21 22 19 28 19 28 4 14 13 72 23 22 18 25 20 26 4 16 15 73 22 16 12 21 15 22 5 15 13 74 24 20 23 25 23 19 10 15 10 75 24 24 22 25 26 26 5 13 11 76 16 16 14 18 22 18 8 12 19 77 16 16 14 17 20 18 8 17 13 78 21 22 16 26 24 25 5 13 17 79 26 24 23 28 26 27 4 15 13 80 15 16 7 21 21 12 4 13 9 81 25 27 10 27 25 15 4 15 11 82 18 11 12 22 13 21 5 16 10 83 23 21 12 21 20 23 4 15 9 84 20 20 12 25 22 22 4 16 12 85 17 20 17 22 23 21 8 15 12 86 25 27 21 23 28 24 4 14 13 87 24 20 16 26 22 27 5 15 13 88 17 12 11 19 20 22 14 14 12 89 19 8 14 25 6 28 8 13 15 90 20 21 13 21 21 26 8 7 22 91 15 18 9 13 20 10 4 17 13 92 27 24 19 24 18 19 4 13 15 93 22 16 13 25 23 22 6 15 13 94 23 18 19 26 20 21 4 14 15 95 16 20 13 25 24 24 7 13 10 96 19 20 13 25 22 25 7 16 11 97 25 19 13 22 21 21 4 12 16 98 19 17 14 21 18 20 6 14 11 99 19 16 12 23 21 21 4 17 11 100 26 26 22 25 23 24 7 15 10 101 21 15 11 24 23 23 4 17 10 102 20 22 5 21 15 18 4 12 16 103 24 17 18 21 21 24 8 16 12 104 22 23 19 25 24 24 4 11 11 105 20 21 14 22 23 19 4 15 16 106 18 19 15 20 21 20 10 9 19 107 18 14 12 20 21 18 8 16 11 108 24 17 19 23 20 20 6 15 16 109 24 12 15 28 11 27 4 10 15 110 22 24 17 23 22 23 4 10 24 111 23 18 8 28 27 26 4 15 14 112 22 20 10 24 25 23 5 11 15 113 20 16 12 18 18 17 4 13 11 114 18 20 12 20 20 21 6 14 15 115 25 22 20 28 24 25 4 18 12 116 18 12 12 21 10 23 5 16 10 117 16 16 12 21 27 27 7 14 14 118 20 17 14 25 21 24 8 14 13 119 19 22 6 19 21 20 5 14 9 120 15 12 10 18 18 27 8 14 15 121 19 14 18 21 15 21 10 12 15 122 19 23 18 22 24 24 8 14 14 123 16 15 7 24 22 21 5 15 11 124 17 17 18 15 14 15 12 15 8 125 28 28 9 28 28 25 4 15 11 126 23 20 17 26 18 25 5 13 11 127 25 23 22 23 26 22 4 17 8 128 20 13 11 26 17 24 6 17 10 129 17 18 15 20 19 21 4 19 11 130 23 23 17 22 22 22 4 15 13 131 16 19 15 20 18 23 7 13 11 132 23 23 22 23 24 22 7 9 20 133 11 12 9 22 15 20 10 15 10 134 18 16 13 24 18 23 4 15 15 135 24 23 20 23 26 25 5 15 12 136 23 13 14 22 11 23 8 16 14 137 21 22 14 26 26 22 11 11 23 138 16 18 12 23 21 25 7 14 14 139 24 23 20 27 23 26 4 11 16 140 23 20 20 23 23 22 8 15 11 141 18 10 8 21 15 24 6 13 12 142 20 17 17 26 22 24 7 15 10 143 9 18 9 23 26 25 5 16 14 144 24 15 18 21 16 20 4 14 12 145 25 23 22 27 20 26 8 15 12 146 20 17 10 19 18 21 4 16 11 147 21 17 13 23 22 26 8 16 12 148 25 22 15 25 16 21 6 11 13 149 22 20 18 23 19 22 4 12 11 150 21 20 18 22 20 16 9 9 19 151 21 19 12 22 19 26 5 16 12 152 22 18 12 25 23 28 6 13 17 153 27 22 20 25 24 18 4 16 9 154 24 20 12 28 25 25 4 12 12 155 24 22 16 28 21 23 4 9 19 156 21 18 16 20 21 21 5 13 18 157 18 16 18 25 23 20 6 13 15 158 16 16 16 19 27 25 16 14 14 159 22 16 13 25 23 22 6 19 11 160 20 16 17 22 18 21 6 13 9 161 18 17 13 18 16 16 4 12 18 162 20 18 17 20 16 18 4 13 16 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) I2 I3 E1 E2 E3 5.09224 0.36689 0.25096 0.26871 -0.12012 0.02717 A Happiness Depression -0.21228 0.04720 0.11027 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.9290 -1.6145 -0.1073 1.7307 7.9455 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.09224 2.86322 1.779 0.077307 . I2 0.36689 0.06347 5.780 4.05e-08 *** I3 0.25096 0.05023 4.996 1.58e-06 *** E1 0.26871 0.07499 3.583 0.000455 *** E2 -0.12012 0.05898 -2.037 0.043416 * E3 0.02717 0.06160 0.441 0.659813 A -0.21228 0.08397 -2.528 0.012483 * Happiness 0.04720 0.10157 0.465 0.642816 Depression 0.11027 0.07522 1.466 0.144684 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.497 on 153 degrees of freedom Multiple R-squared: 0.5568, Adjusted R-squared: 0.5336 F-statistic: 24.03 on 8 and 153 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,] 0.87595201 0.248095975 0.124047988 [2,] 0.90685898 0.186282042 0.093141021 [3,] 0.84943174 0.301136515 0.150568258 [4,] 0.78915089 0.421698230 0.210849115 [5,] 0.71151100 0.576978010 0.288489005 [6,] 0.64056679 0.718866419 0.359433210 [7,] 0.56695792 0.866084152 0.433042076 [8,] 0.49769916 0.995398315 0.502300843 [9,] 0.47987316 0.959746311 0.520126844 [10,] 0.45137248 0.902744962 0.548627519 [11,] 0.36958159 0.739163182 0.630418409 [12,] 0.50414623 0.991707536 0.495853768 [13,] 0.45029122 0.900582450 0.549708775 [14,] 0.38599953 0.771999063 0.614000468 [15,] 0.42935473 0.858709463 0.570645268 [16,] 0.37178435 0.743568697 0.628215651 [17,] 0.57613600 0.847728009 0.423864005 [18,] 0.62556255 0.748874890 0.374437445 [19,] 0.58361204 0.832775927 0.416387963 [20,] 0.54643780 0.907124409 0.453562204 [21,] 0.50361071 0.992778590 0.496389295 [22,] 0.47108879 0.942177587 0.528911206 [23,] 0.53102213 0.937955749 0.468977874 [24,] 0.69106550 0.617868990 0.308934495 [25,] 0.64448883 0.711022336 0.355511168 [26,] 0.59243233 0.815135335 0.407567668 [27,] 0.53575609 0.928487822 0.464243911 [28,] 0.47805705 0.956114096 0.521942952 [29,] 0.44962134 0.899242685 0.550378657 [30,] 0.45324814 0.906496285 0.546751858 [31,] 0.42490474 0.849809482 0.575095259 [32,] 0.37732983 0.754659660 0.622670170 [33,] 0.34749577 0.694991531 0.652504235 [34,] 0.40850319 0.817006389 0.591496806 [35,] 0.35776818 0.715536356 0.642231822 [36,] 0.31739333 0.634786656 0.682606672 [37,] 0.74107789 0.517844230 0.258922115 [38,] 0.72837798 0.543244041 0.271622020 [39,] 0.76008897 0.479822062 0.239911031 [40,] 0.74289379 0.514212412 0.257106206 [41,] 0.70166639 0.596667217 0.298333609 [42,] 0.68422877 0.631542468 0.315771234 [43,] 0.65696612 0.686067764 0.343033882 [44,] 0.61643386 0.767132270 0.383566135 [45,] 0.60838876 0.783222479 0.391611239 [46,] 0.58383753 0.832324936 0.416162468 [47,] 0.68651308 0.626973844 0.313486922 [48,] 0.74028772 0.519424557 0.259712279 [49,] 0.71681755 0.566364894 0.283182447 [50,] 0.81943714 0.361125718 0.180562859 [51,] 0.78790161 0.424196779 0.212098389 [52,] 0.83767503 0.324649943 0.162324971 [53,] 0.81082266 0.378354673 0.189177336 [54,] 0.83545933 0.329081332 0.164540666 [55,] 0.80586041 0.388279176 0.194139588 [56,] 0.80185727 0.396285462 0.198142731 [57,] 0.78658150 0.426836991 0.213418495 [58,] 0.75052684 0.498946324 0.249473162 [59,] 0.72157626 0.556847472 0.278423736 [60,] 0.79850228 0.402995432 0.201497716 [61,] 0.77805290 0.443894196 0.221947098 [62,] 0.77658298 0.446834041 0.223417020 [63,] 0.75260738 0.494785239 0.247392619 [64,] 0.71562505 0.568749897 0.284374948 [65,] 0.73958926 0.520821485 0.260410743 [66,] 0.72261905 0.554761895 0.277380947 [67,] 0.72866003 0.542679946 0.271339973 [68,] 0.69031058 0.619378846 0.309689423 [69,] 0.67537266 0.649254679 0.324627339 [70,] 0.64470120 0.710597598 0.355298799 [71,] 0.60522877 0.789542466 0.394771233 [72,] 0.60804989 0.783900219 0.391950110 [73,] 0.57878916 0.842421671 0.421210836 [74,] 0.63967086 0.720658270 0.360329135 [75,] 0.59538965 0.809220708 0.404610354 [76,] 0.56242069 0.875158611 0.437579306 [77,] 0.57639987 0.847200253 0.423600126 [78,] 0.53102123 0.937957539 0.468978769 [79,] 0.51320373 0.973592538 0.486796269 [80,] 0.48677225 0.973544492 0.513227754 [81,] 0.46305838 0.926116766 0.536941617 [82,] 0.45207208 0.904144158 0.547927921 [83,] 0.40883166 0.817663325 0.591168337 [84,] 0.51668045 0.966639103 0.483319551 [85,] 0.50147847 0.997043056 0.498521528 [86,] 0.60284858 0.794302847 0.397151424 [87,] 0.55757678 0.884846449 0.442423225 [88,] 0.51249369 0.975012613 0.487506306 [89,] 0.46714554 0.934291089 0.532854456 [90,] 0.45490548 0.909810968 0.545094516 [91,] 0.40990082 0.819801646 0.590099177 [92,] 0.50338757 0.993224862 0.496612431 [93,] 0.49205472 0.984109439 0.507945281 [94,] 0.46029241 0.920584818 0.539707591 [95,] 0.43035872 0.860717439 0.569641281 [96,] 0.39640764 0.792815276 0.603592362 [97,] 0.40439339 0.808786783 0.595606609 [98,] 0.38461491 0.769229820 0.615385090 [99,] 0.37153323 0.743066456 0.628466772 [100,] 0.38900584 0.778011677 0.610994161 [101,] 0.37774581 0.755491626 0.622254187 [102,] 0.37217455 0.744349101 0.627825450 [103,] 0.34127499 0.682549974 0.658725013 [104,] 0.29720148 0.594402968 0.702798516 [105,] 0.25589837 0.511796746 0.744101627 [106,] 0.22536869 0.450737380 0.774631310 [107,] 0.18691557 0.373831141 0.813084429 [108,] 0.15920225 0.318404502 0.840797749 [109,] 0.13777501 0.275550025 0.862224988 [110,] 0.11012596 0.220251924 0.889874038 [111,] 0.11834081 0.236681612 0.881659194 [112,] 0.09643260 0.192865194 0.903567403 [113,] 0.07572527 0.151450535 0.924274732 [114,] 0.13803458 0.276069162 0.861965419 [115,] 0.11260970 0.225219397 0.887390302 [116,] 0.09127363 0.182547254 0.908726373 [117,] 0.07053841 0.141076810 0.929461595 [118,] 0.08313928 0.166278565 0.916860717 [119,] 0.06216699 0.124333976 0.937833012 [120,] 0.08986013 0.179720256 0.910139872 [121,] 0.06945589 0.138911773 0.930544113 [122,] 0.19955933 0.399118666 0.800440667 [123,] 0.20233818 0.404676356 0.797661822 [124,] 0.18265607 0.365312136 0.817343932 [125,] 0.15474939 0.309498774 0.845250613 [126,] 0.12975244 0.259504883 0.870247559 [127,] 0.15496310 0.309926204 0.845036898 [128,] 0.11521314 0.230426270 0.884786865 [129,] 0.08478463 0.169569262 0.915215369 [130,] 0.06079062 0.121581248 0.939209376 [131,] 0.05420736 0.108414713 0.945792644 [132,] 0.89898603 0.202027930 0.101013965 [133,] 0.99526286 0.009474281 0.004737140 [134,] 0.99139906 0.017201881 0.008600941 [135,] 0.97997489 0.040050213 0.020025107 [136,] 0.95828255 0.083434902 0.041717451 [137,] 0.92056004 0.158879912 0.079439956 [138,] 0.85124426 0.297511470 0.148755735 [139,] 0.76592179 0.468156415 0.234078208 > postscript(file="/var/fisher/rcomp/tmp/1amvq1353168590.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/26nth1353168590.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/33lxc1353168590.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/4q1in1353168590.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/57fgq1353168590.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 6 2.03479175 -0.89073320 -2.66261019 0.92951006 0.95847190 0.88774508 7 8 9 10 11 12 4.56261350 2.15438675 3.96582660 1.58860537 -2.80837078 -0.56907043 13 14 15 16 17 18 -1.82343935 1.25777266 -0.56472814 2.02804012 -3.20863009 -1.09578152 19 20 21 22 23 24 -2.26682917 3.24906714 -3.58849668 0.73221463 -6.83045778 1.38003066 25 26 27 28 29 30 -1.90053105 2.59007484 2.03915659 2.73842292 3.41899371 1.81196931 31 32 33 34 35 36 -1.74183706 0.02359588 3.28368003 -2.52107472 4.11951950 0.80581888 37 38 39 40 41 42 1.02915240 -0.71189610 0.66168943 -1.71754835 -3.23955774 2.24626419 43 44 45 46 47 48 -1.16098043 0.42555614 4.15708893 0.82608444 -0.37899985 7.94549429 49 50 51 52 53 54 -1.30287290 -2.90643128 -1.85656005 -0.24060409 -0.24348197 -1.42885452 55 56 57 58 59 60 1.18813824 -1.86916988 -1.53340759 3.62156910 -3.91277273 1.64124790 61 62 63 64 65 66 5.46628580 -0.36053181 -3.35547962 1.12750234 -1.57483634 -0.32076783 67 68 69 70 71 72 -1.25901712 -1.76880281 -0.11824401 -1.24861826 -4.17961955 -1.26300298 73 74 75 76 77 78 2.50704549 1.63873387 -0.48496188 -2.12243494 -1.66831584 -2.38883352 79 80 81 82 83 84 -0.09644377 -1.92259200 1.76049005 0.14333026 2.47481653 -1.34375530 85 86 87 88 89 90 -3.74880670 0.01730398 1.39706767 2.43156898 0.13203021 -0.94434891 91 92 93 94 95 96 -1.70423316 2.11249434 2.35445081 -0.08488706 -4.40984107 -1.92910344 97 98 99 100 101 102 4.23307128 -0.46705863 -0.36864329 0.91567650 2.27666389 -0.23041873 103 104 105 106 107 108 4.00068714 -1.66898290 -1.59868992 -1.61979273 1.14909647 2.38240440 109 110 111 112 113 114 2.52759207 -2.59591713 2.90629468 1.87751355 1.91202754 -2.02511242 115 116 117 118 119 120 0.17299271 -0.36953203 -1.82589332 -0.08620967 0.61220179 -1.02932008 121 122 123 124 125 126 -0.25531060 -3.23516396 -1.58888139 -0.64595081 4.46452901 0.03490748 127 128 129 130 131 132 1.45776798 1.14970606 -3.38378736 0.04384692 -4.00510780 -1.09129993 133 134 135 136 137 138 -5.09468419 -2.64969077 0.74377648 3.80882160 -0.85872977 -3.76347223 139 140 141 142 143 144 -1.18317343 1.31270669 2.07483332 -0.91634774 -9.92896240 3.48782066 145 146 147 148 149 150 0.05597293 1.52808386 1.78383774 2.02632326 -0.37337569 -0.50071758 151 152 153 154 155 156 0.57253712 1.36193928 3.59450697 2.31774200 -0.47631422 0.32905473 157 158 159 160 161 162 -2.97215776 -0.32744606 2.38620517 0.11881238 -1.64358721 -1.43272966 > postscript(file="/var/fisher/rcomp/tmp/6diii1353168590.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 2.03479175 NA 1 -0.89073320 2.03479175 2 -2.66261019 -0.89073320 3 0.92951006 -2.66261019 4 0.95847190 0.92951006 5 0.88774508 0.95847190 6 4.56261350 0.88774508 7 2.15438675 4.56261350 8 3.96582660 2.15438675 9 1.58860537 3.96582660 10 -2.80837078 1.58860537 11 -0.56907043 -2.80837078 12 -1.82343935 -0.56907043 13 1.25777266 -1.82343935 14 -0.56472814 1.25777266 15 2.02804012 -0.56472814 16 -3.20863009 2.02804012 17 -1.09578152 -3.20863009 18 -2.26682917 -1.09578152 19 3.24906714 -2.26682917 20 -3.58849668 3.24906714 21 0.73221463 -3.58849668 22 -6.83045778 0.73221463 23 1.38003066 -6.83045778 24 -1.90053105 1.38003066 25 2.59007484 -1.90053105 26 2.03915659 2.59007484 27 2.73842292 2.03915659 28 3.41899371 2.73842292 29 1.81196931 3.41899371 30 -1.74183706 1.81196931 31 0.02359588 -1.74183706 32 3.28368003 0.02359588 33 -2.52107472 3.28368003 34 4.11951950 -2.52107472 35 0.80581888 4.11951950 36 1.02915240 0.80581888 37 -0.71189610 1.02915240 38 0.66168943 -0.71189610 39 -1.71754835 0.66168943 40 -3.23955774 -1.71754835 41 2.24626419 -3.23955774 42 -1.16098043 2.24626419 43 0.42555614 -1.16098043 44 4.15708893 0.42555614 45 0.82608444 4.15708893 46 -0.37899985 0.82608444 47 7.94549429 -0.37899985 48 -1.30287290 7.94549429 49 -2.90643128 -1.30287290 50 -1.85656005 -2.90643128 51 -0.24060409 -1.85656005 52 -0.24348197 -0.24060409 53 -1.42885452 -0.24348197 54 1.18813824 -1.42885452 55 -1.86916988 1.18813824 56 -1.53340759 -1.86916988 57 3.62156910 -1.53340759 58 -3.91277273 3.62156910 59 1.64124790 -3.91277273 60 5.46628580 1.64124790 61 -0.36053181 5.46628580 62 -3.35547962 -0.36053181 63 1.12750234 -3.35547962 64 -1.57483634 1.12750234 65 -0.32076783 -1.57483634 66 -1.25901712 -0.32076783 67 -1.76880281 -1.25901712 68 -0.11824401 -1.76880281 69 -1.24861826 -0.11824401 70 -4.17961955 -1.24861826 71 -1.26300298 -4.17961955 72 2.50704549 -1.26300298 73 1.63873387 2.50704549 74 -0.48496188 1.63873387 75 -2.12243494 -0.48496188 76 -1.66831584 -2.12243494 77 -2.38883352 -1.66831584 78 -0.09644377 -2.38883352 79 -1.92259200 -0.09644377 80 1.76049005 -1.92259200 81 0.14333026 1.76049005 82 2.47481653 0.14333026 83 -1.34375530 2.47481653 84 -3.74880670 -1.34375530 85 0.01730398 -3.74880670 86 1.39706767 0.01730398 87 2.43156898 1.39706767 88 0.13203021 2.43156898 89 -0.94434891 0.13203021 90 -1.70423316 -0.94434891 91 2.11249434 -1.70423316 92 2.35445081 2.11249434 93 -0.08488706 2.35445081 94 -4.40984107 -0.08488706 95 -1.92910344 -4.40984107 96 4.23307128 -1.92910344 97 -0.46705863 4.23307128 98 -0.36864329 -0.46705863 99 0.91567650 -0.36864329 100 2.27666389 0.91567650 101 -0.23041873 2.27666389 102 4.00068714 -0.23041873 103 -1.66898290 4.00068714 104 -1.59868992 -1.66898290 105 -1.61979273 -1.59868992 106 1.14909647 -1.61979273 107 2.38240440 1.14909647 108 2.52759207 2.38240440 109 -2.59591713 2.52759207 110 2.90629468 -2.59591713 111 1.87751355 2.90629468 112 1.91202754 1.87751355 113 -2.02511242 1.91202754 114 0.17299271 -2.02511242 115 -0.36953203 0.17299271 116 -1.82589332 -0.36953203 117 -0.08620967 -1.82589332 118 0.61220179 -0.08620967 119 -1.02932008 0.61220179 120 -0.25531060 -1.02932008 121 -3.23516396 -0.25531060 122 -1.58888139 -3.23516396 123 -0.64595081 -1.58888139 124 4.46452901 -0.64595081 125 0.03490748 4.46452901 126 1.45776798 0.03490748 127 1.14970606 1.45776798 128 -3.38378736 1.14970606 129 0.04384692 -3.38378736 130 -4.00510780 0.04384692 131 -1.09129993 -4.00510780 132 -5.09468419 -1.09129993 133 -2.64969077 -5.09468419 134 0.74377648 -2.64969077 135 3.80882160 0.74377648 136 -0.85872977 3.80882160 137 -3.76347223 -0.85872977 138 -1.18317343 -3.76347223 139 1.31270669 -1.18317343 140 2.07483332 1.31270669 141 -0.91634774 2.07483332 142 -9.92896240 -0.91634774 143 3.48782066 -9.92896240 144 0.05597293 3.48782066 145 1.52808386 0.05597293 146 1.78383774 1.52808386 147 2.02632326 1.78383774 148 -0.37337569 2.02632326 149 -0.50071758 -0.37337569 150 0.57253712 -0.50071758 151 1.36193928 0.57253712 152 3.59450697 1.36193928 153 2.31774200 3.59450697 154 -0.47631422 2.31774200 155 0.32905473 -0.47631422 156 -2.97215776 0.32905473 157 -0.32744606 -2.97215776 158 2.38620517 -0.32744606 159 0.11881238 2.38620517 160 -1.64358721 0.11881238 161 -1.43272966 -1.64358721 162 NA -1.43272966 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.89073320 2.03479175 [2,] -2.66261019 -0.89073320 [3,] 0.92951006 -2.66261019 [4,] 0.95847190 0.92951006 [5,] 0.88774508 0.95847190 [6,] 4.56261350 0.88774508 [7,] 2.15438675 4.56261350 [8,] 3.96582660 2.15438675 [9,] 1.58860537 3.96582660 [10,] -2.80837078 1.58860537 [11,] -0.56907043 -2.80837078 [12,] -1.82343935 -0.56907043 [13,] 1.25777266 -1.82343935 [14,] -0.56472814 1.25777266 [15,] 2.02804012 -0.56472814 [16,] -3.20863009 2.02804012 [17,] -1.09578152 -3.20863009 [18,] -2.26682917 -1.09578152 [19,] 3.24906714 -2.26682917 [20,] -3.58849668 3.24906714 [21,] 0.73221463 -3.58849668 [22,] -6.83045778 0.73221463 [23,] 1.38003066 -6.83045778 [24,] -1.90053105 1.38003066 [25,] 2.59007484 -1.90053105 [26,] 2.03915659 2.59007484 [27,] 2.73842292 2.03915659 [28,] 3.41899371 2.73842292 [29,] 1.81196931 3.41899371 [30,] -1.74183706 1.81196931 [31,] 0.02359588 -1.74183706 [32,] 3.28368003 0.02359588 [33,] -2.52107472 3.28368003 [34,] 4.11951950 -2.52107472 [35,] 0.80581888 4.11951950 [36,] 1.02915240 0.80581888 [37,] -0.71189610 1.02915240 [38,] 0.66168943 -0.71189610 [39,] -1.71754835 0.66168943 [40,] -3.23955774 -1.71754835 [41,] 2.24626419 -3.23955774 [42,] -1.16098043 2.24626419 [43,] 0.42555614 -1.16098043 [44,] 4.15708893 0.42555614 [45,] 0.82608444 4.15708893 [46,] -0.37899985 0.82608444 [47,] 7.94549429 -0.37899985 [48,] -1.30287290 7.94549429 [49,] -2.90643128 -1.30287290 [50,] -1.85656005 -2.90643128 [51,] -0.24060409 -1.85656005 [52,] -0.24348197 -0.24060409 [53,] -1.42885452 -0.24348197 [54,] 1.18813824 -1.42885452 [55,] -1.86916988 1.18813824 [56,] -1.53340759 -1.86916988 [57,] 3.62156910 -1.53340759 [58,] -3.91277273 3.62156910 [59,] 1.64124790 -3.91277273 [60,] 5.46628580 1.64124790 [61,] -0.36053181 5.46628580 [62,] -3.35547962 -0.36053181 [63,] 1.12750234 -3.35547962 [64,] -1.57483634 1.12750234 [65,] -0.32076783 -1.57483634 [66,] -1.25901712 -0.32076783 [67,] -1.76880281 -1.25901712 [68,] -0.11824401 -1.76880281 [69,] -1.24861826 -0.11824401 [70,] -4.17961955 -1.24861826 [71,] -1.26300298 -4.17961955 [72,] 2.50704549 -1.26300298 [73,] 1.63873387 2.50704549 [74,] -0.48496188 1.63873387 [75,] -2.12243494 -0.48496188 [76,] -1.66831584 -2.12243494 [77,] -2.38883352 -1.66831584 [78,] -0.09644377 -2.38883352 [79,] -1.92259200 -0.09644377 [80,] 1.76049005 -1.92259200 [81,] 0.14333026 1.76049005 [82,] 2.47481653 0.14333026 [83,] -1.34375530 2.47481653 [84,] -3.74880670 -1.34375530 [85,] 0.01730398 -3.74880670 [86,] 1.39706767 0.01730398 [87,] 2.43156898 1.39706767 [88,] 0.13203021 2.43156898 [89,] -0.94434891 0.13203021 [90,] -1.70423316 -0.94434891 [91,] 2.11249434 -1.70423316 [92,] 2.35445081 2.11249434 [93,] -0.08488706 2.35445081 [94,] -4.40984107 -0.08488706 [95,] -1.92910344 -4.40984107 [96,] 4.23307128 -1.92910344 [97,] -0.46705863 4.23307128 [98,] -0.36864329 -0.46705863 [99,] 0.91567650 -0.36864329 [100,] 2.27666389 0.91567650 [101,] -0.23041873 2.27666389 [102,] 4.00068714 -0.23041873 [103,] -1.66898290 4.00068714 [104,] -1.59868992 -1.66898290 [105,] -1.61979273 -1.59868992 [106,] 1.14909647 -1.61979273 [107,] 2.38240440 1.14909647 [108,] 2.52759207 2.38240440 [109,] -2.59591713 2.52759207 [110,] 2.90629468 -2.59591713 [111,] 1.87751355 2.90629468 [112,] 1.91202754 1.87751355 [113,] -2.02511242 1.91202754 [114,] 0.17299271 -2.02511242 [115,] -0.36953203 0.17299271 [116,] -1.82589332 -0.36953203 [117,] -0.08620967 -1.82589332 [118,] 0.61220179 -0.08620967 [119,] -1.02932008 0.61220179 [120,] -0.25531060 -1.02932008 [121,] -3.23516396 -0.25531060 [122,] -1.58888139 -3.23516396 [123,] -0.64595081 -1.58888139 [124,] 4.46452901 -0.64595081 [125,] 0.03490748 4.46452901 [126,] 1.45776798 0.03490748 [127,] 1.14970606 1.45776798 [128,] -3.38378736 1.14970606 [129,] 0.04384692 -3.38378736 [130,] -4.00510780 0.04384692 [131,] -1.09129993 -4.00510780 [132,] -5.09468419 -1.09129993 [133,] -2.64969077 -5.09468419 [134,] 0.74377648 -2.64969077 [135,] 3.80882160 0.74377648 [136,] -0.85872977 3.80882160 [137,] -3.76347223 -0.85872977 [138,] -1.18317343 -3.76347223 [139,] 1.31270669 -1.18317343 [140,] 2.07483332 1.31270669 [141,] -0.91634774 2.07483332 [142,] -9.92896240 -0.91634774 [143,] 3.48782066 -9.92896240 [144,] 0.05597293 3.48782066 [145,] 1.52808386 0.05597293 [146,] 1.78383774 1.52808386 [147,] 2.02632326 1.78383774 [148,] -0.37337569 2.02632326 [149,] -0.50071758 -0.37337569 [150,] 0.57253712 -0.50071758 [151,] 1.36193928 0.57253712 [152,] 3.59450697 1.36193928 [153,] 2.31774200 3.59450697 [154,] -0.47631422 2.31774200 [155,] 0.32905473 -0.47631422 [156,] -2.97215776 0.32905473 [157,] -0.32744606 -2.97215776 [158,] 2.38620517 -0.32744606 [159,] 0.11881238 2.38620517 [160,] -1.64358721 0.11881238 [161,] -1.43272966 -1.64358721 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.89073320 2.03479175 2 -2.66261019 -0.89073320 3 0.92951006 -2.66261019 4 0.95847190 0.92951006 5 0.88774508 0.95847190 6 4.56261350 0.88774508 7 2.15438675 4.56261350 8 3.96582660 2.15438675 9 1.58860537 3.96582660 10 -2.80837078 1.58860537 11 -0.56907043 -2.80837078 12 -1.82343935 -0.56907043 13 1.25777266 -1.82343935 14 -0.56472814 1.25777266 15 2.02804012 -0.56472814 16 -3.20863009 2.02804012 17 -1.09578152 -3.20863009 18 -2.26682917 -1.09578152 19 3.24906714 -2.26682917 20 -3.58849668 3.24906714 21 0.73221463 -3.58849668 22 -6.83045778 0.73221463 23 1.38003066 -6.83045778 24 -1.90053105 1.38003066 25 2.59007484 -1.90053105 26 2.03915659 2.59007484 27 2.73842292 2.03915659 28 3.41899371 2.73842292 29 1.81196931 3.41899371 30 -1.74183706 1.81196931 31 0.02359588 -1.74183706 32 3.28368003 0.02359588 33 -2.52107472 3.28368003 34 4.11951950 -2.52107472 35 0.80581888 4.11951950 36 1.02915240 0.80581888 37 -0.71189610 1.02915240 38 0.66168943 -0.71189610 39 -1.71754835 0.66168943 40 -3.23955774 -1.71754835 41 2.24626419 -3.23955774 42 -1.16098043 2.24626419 43 0.42555614 -1.16098043 44 4.15708893 0.42555614 45 0.82608444 4.15708893 46 -0.37899985 0.82608444 47 7.94549429 -0.37899985 48 -1.30287290 7.94549429 49 -2.90643128 -1.30287290 50 -1.85656005 -2.90643128 51 -0.24060409 -1.85656005 52 -0.24348197 -0.24060409 53 -1.42885452 -0.24348197 54 1.18813824 -1.42885452 55 -1.86916988 1.18813824 56 -1.53340759 -1.86916988 57 3.62156910 -1.53340759 58 -3.91277273 3.62156910 59 1.64124790 -3.91277273 60 5.46628580 1.64124790 61 -0.36053181 5.46628580 62 -3.35547962 -0.36053181 63 1.12750234 -3.35547962 64 -1.57483634 1.12750234 65 -0.32076783 -1.57483634 66 -1.25901712 -0.32076783 67 -1.76880281 -1.25901712 68 -0.11824401 -1.76880281 69 -1.24861826 -0.11824401 70 -4.17961955 -1.24861826 71 -1.26300298 -4.17961955 72 2.50704549 -1.26300298 73 1.63873387 2.50704549 74 -0.48496188 1.63873387 75 -2.12243494 -0.48496188 76 -1.66831584 -2.12243494 77 -2.38883352 -1.66831584 78 -0.09644377 -2.38883352 79 -1.92259200 -0.09644377 80 1.76049005 -1.92259200 81 0.14333026 1.76049005 82 2.47481653 0.14333026 83 -1.34375530 2.47481653 84 -3.74880670 -1.34375530 85 0.01730398 -3.74880670 86 1.39706767 0.01730398 87 2.43156898 1.39706767 88 0.13203021 2.43156898 89 -0.94434891 0.13203021 90 -1.70423316 -0.94434891 91 2.11249434 -1.70423316 92 2.35445081 2.11249434 93 -0.08488706 2.35445081 94 -4.40984107 -0.08488706 95 -1.92910344 -4.40984107 96 4.23307128 -1.92910344 97 -0.46705863 4.23307128 98 -0.36864329 -0.46705863 99 0.91567650 -0.36864329 100 2.27666389 0.91567650 101 -0.23041873 2.27666389 102 4.00068714 -0.23041873 103 -1.66898290 4.00068714 104 -1.59868992 -1.66898290 105 -1.61979273 -1.59868992 106 1.14909647 -1.61979273 107 2.38240440 1.14909647 108 2.52759207 2.38240440 109 -2.59591713 2.52759207 110 2.90629468 -2.59591713 111 1.87751355 2.90629468 112 1.91202754 1.87751355 113 -2.02511242 1.91202754 114 0.17299271 -2.02511242 115 -0.36953203 0.17299271 116 -1.82589332 -0.36953203 117 -0.08620967 -1.82589332 118 0.61220179 -0.08620967 119 -1.02932008 0.61220179 120 -0.25531060 -1.02932008 121 -3.23516396 -0.25531060 122 -1.58888139 -3.23516396 123 -0.64595081 -1.58888139 124 4.46452901 -0.64595081 125 0.03490748 4.46452901 126 1.45776798 0.03490748 127 1.14970606 1.45776798 128 -3.38378736 1.14970606 129 0.04384692 -3.38378736 130 -4.00510780 0.04384692 131 -1.09129993 -4.00510780 132 -5.09468419 -1.09129993 133 -2.64969077 -5.09468419 134 0.74377648 -2.64969077 135 3.80882160 0.74377648 136 -0.85872977 3.80882160 137 -3.76347223 -0.85872977 138 -1.18317343 -3.76347223 139 1.31270669 -1.18317343 140 2.07483332 1.31270669 141 -0.91634774 2.07483332 142 -9.92896240 -0.91634774 143 3.48782066 -9.92896240 144 0.05597293 3.48782066 145 1.52808386 0.05597293 146 1.78383774 1.52808386 147 2.02632326 1.78383774 148 -0.37337569 2.02632326 149 -0.50071758 -0.37337569 150 0.57253712 -0.50071758 151 1.36193928 0.57253712 152 3.59450697 1.36193928 153 2.31774200 3.59450697 154 -0.47631422 2.31774200 155 0.32905473 -0.47631422 156 -2.97215776 0.32905473 157 -0.32744606 -2.97215776 158 2.38620517 -0.32744606 159 0.11881238 2.38620517 160 -1.64358721 0.11881238 161 -1.43272966 -1.64358721 > 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/73cru1353168590.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/8h7j81353168590.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/901e01353168590.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/10cfeh1353168590.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/1181zp1353168590.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/12fsb51353168590.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/13y4kx1353168590.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/14eam51353168590.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/15ksl61353168590.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/16n8hk1353168590.tab") + } > > try(system("convert tmp/1amvq1353168590.ps tmp/1amvq1353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/26nth1353168590.ps tmp/26nth1353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/33lxc1353168590.ps tmp/33lxc1353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/4q1in1353168590.ps tmp/4q1in1353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/57fgq1353168590.ps tmp/57fgq1353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/6diii1353168590.ps tmp/6diii1353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/73cru1353168590.ps tmp/73cru1353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/8h7j81353168590.ps tmp/8h7j81353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/901e01353168590.ps tmp/901e01353168590.png",intern=TRUE)) character(0) > try(system("convert tmp/10cfeh1353168590.ps tmp/10cfeh1353168590.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.189 1.274 9.464