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(2 + ,7 + ,41 + ,38 + ,13 + ,12 + ,14 + ,12 + ,2 + ,5 + ,39 + ,32 + ,16 + ,11 + ,18 + ,11 + ,2 + ,5 + ,30 + ,35 + ,19 + ,15 + ,11 + ,14 + ,1 + ,5 + ,31 + ,33 + ,15 + ,6 + ,12 + ,12 + ,2 + ,8 + ,34 + ,37 + ,14 + ,13 + ,16 + ,21 + ,2 + ,6 + ,35 + ,29 + ,13 + ,10 + ,18 + ,12 + ,2 + ,5 + ,39 + ,31 + ,19 + ,12 + ,14 + ,22 + ,2 + ,6 + ,34 + ,36 + ,15 + ,14 + ,14 + ,11 + ,2 + ,5 + ,36 + ,35 + ,14 + ,12 + ,15 + ,10 + ,2 + ,4 + ,37 + ,38 + ,15 + ,6 + ,15 + ,13 + ,1 + ,6 + ,38 + ,31 + ,16 + ,10 + ,17 + ,10 + ,2 + ,5 + ,36 + ,34 + ,16 + ,12 + ,19 + ,8 + ,1 + ,5 + ,38 + ,35 + ,16 + ,12 + ,10 + ,15 + ,2 + ,6 + ,39 + ,38 + ,16 + ,11 + ,16 + ,14 + ,2 + ,7 + ,33 + ,37 + ,17 + ,15 + ,18 + ,10 + ,1 + ,6 + ,32 + ,33 + ,15 + ,12 + ,14 + ,14 + ,1 + ,7 + ,36 + ,32 + ,15 + ,10 + ,14 + ,14 + ,2 + ,6 + ,38 + ,38 + ,20 + ,12 + ,17 + ,11 + ,1 + ,8 + ,39 + ,38 + ,18 + ,11 + ,14 + ,10 + ,2 + ,7 + ,32 + ,32 + ,16 + ,12 + ,16 + ,13 + ,1 + ,5 + ,32 + ,33 + ,16 + ,11 + ,18 + ,7 + ,2 + ,5 + ,31 + ,31 + ,16 + ,12 + ,11 + ,14 + ,2 + ,7 + ,39 + ,38 + ,19 + ,13 + ,14 + ,12 + ,2 + ,7 + ,37 + ,39 + ,16 + ,11 + ,12 + ,14 + ,1 + ,5 + ,39 + ,32 + ,17 + ,9 + ,17 + ,11 + ,2 + ,4 + ,41 + ,32 + ,17 + ,13 + ,9 + ,9 + ,1 + ,10 + ,36 + ,35 + ,16 + ,10 + ,16 + ,11 + ,2 + ,6 + ,33 + ,37 + ,15 + ,14 + ,14 + ,15 + ,2 + ,5 + ,33 + ,33 + ,16 + ,12 + ,15 + ,14 + ,1 + ,5 + ,34 + ,33 + ,14 + ,10 + ,11 + ,13 + ,2 + ,5 + ,31 + ,28 + ,15 + ,12 + ,16 + ,9 + ,1 + ,5 + ,27 + ,32 + ,12 + ,8 + ,13 + ,15 + ,2 + ,6 + ,37 + ,31 + ,14 + ,10 + ,17 + ,10 + ,2 + ,5 + ,34 + ,37 + ,16 + ,12 + ,15 + ,11 + ,1 + ,5 + ,34 + ,30 + ,14 + ,12 + ,14 + ,13 + ,1 + ,5 + ,32 + ,33 + ,7 + ,7 + ,16 + ,8 + ,1 + ,5 + ,29 + ,31 + ,10 + ,6 + ,9 + ,20 + ,1 + ,5 + ,36 + ,33 + ,14 + ,12 + ,15 + ,12 + ,2 + ,5 + ,29 + ,31 + ,16 + ,10 + ,17 + ,10 + ,1 + ,5 + ,35 + ,33 + ,16 + ,10 + ,13 + ,10 + ,1 + ,5 + ,37 + ,32 + ,16 + ,10 + ,15 + ,9 + ,2 + ,7 + ,34 + ,33 + ,14 + ,12 + ,16 + ,14 + ,1 + ,5 + ,38 + ,32 + ,20 + ,15 + ,16 + ,8 + ,1 + ,6 + ,35 + ,33 + ,14 + ,10 + ,12 + ,14 + ,2 + ,7 + ,38 + ,28 + ,14 + ,10 + ,12 + ,11 + ,2 + ,7 + ,37 + ,35 + ,11 + ,12 + ,11 + ,13 + ,2 + ,5 + ,38 + ,39 + ,14 + ,13 + ,15 + ,9 + ,2 + ,5 + ,33 + ,34 + ,15 + ,11 + ,15 + ,11 + ,2 + ,4 + ,36 + ,38 + ,16 + ,11 + ,17 + ,15 + ,1 + ,5 + ,38 + ,32 + ,14 + ,12 + ,13 + ,11 + ,2 + ,4 + ,32 + ,38 + ,16 + ,14 + ,16 + ,10 + ,1 + ,5 + ,32 + ,30 + ,14 + ,10 + ,14 + ,14 + ,1 + ,5 + ,32 + ,33 + ,12 + ,12 + ,11 + ,18 + ,2 + ,7 + ,34 + ,38 + ,16 + ,13 + ,12 + ,14 + ,1 + ,5 + ,32 + ,32 + ,9 + ,5 + ,12 + ,11 + ,2 + ,5 + ,37 + ,32 + ,14 + ,6 + ,15 + ,12 + ,2 + ,6 + ,39 + ,34 + ,16 + ,12 + ,16 + ,13 + ,2 + ,4 + ,29 + ,34 + ,16 + ,12 + ,15 + ,9 + ,1 + ,6 + ,37 + ,36 + ,15 + ,11 + ,12 + ,10 + ,2 + ,6 + ,35 + ,34 + ,16 + ,10 + ,12 + ,15 + ,1 + ,5 + ,30 + ,28 + ,12 + ,7 + ,8 + ,20 + ,1 + ,7 + ,38 + ,34 + ,16 + ,12 + ,13 + ,12 + ,2 + ,6 + ,34 + ,35 + ,16 + ,14 + ,11 + ,12 + ,2 + ,8 + ,31 + ,35 + ,14 + ,11 + ,14 + ,14 + ,2 + ,7 + ,34 + ,31 + ,16 + ,12 + ,15 + ,13 + ,1 + ,5 + ,35 + ,37 + ,17 + ,13 + ,10 + ,11 + ,2 + ,6 + ,36 + ,35 + ,18 + ,14 + ,11 + ,17 + ,1 + ,6 + ,30 + ,27 + ,18 + ,11 + ,12 + ,12 + ,2 + ,5 + ,39 + ,40 + ,12 + ,12 + ,15 + ,13 + ,1 + ,5 + ,35 + ,37 + ,16 + ,12 + ,15 + ,14 + ,1 + ,5 + ,38 + ,36 + ,10 + ,8 + ,14 + ,13 + ,2 + ,5 + ,31 + ,38 + ,14 + ,11 + ,16 + ,15 + ,2 + ,4 + ,34 + ,39 + ,18 + ,14 + ,15 + ,13 + ,1 + ,6 + ,38 + ,41 + ,18 + ,14 + ,15 + ,10 + ,1 + ,6 + ,34 + ,27 + ,16 + ,12 + ,13 + ,11 + ,2 + ,6 + ,39 + ,30 + ,17 + ,9 + ,12 + ,19 + ,2 + ,6 + ,37 + ,37 + ,16 + ,13 + ,17 + ,13 + ,2 + ,7 + ,34 + ,31 + ,16 + ,11 + ,13 + ,17 + ,1 + ,5 + ,28 + ,31 + ,13 + ,12 + ,15 + ,13 + ,1 + ,7 + ,37 + ,27 + ,16 + ,12 + ,13 + ,9 + ,1 + ,6 + ,33 + ,36 + ,16 + ,12 + ,15 + ,11 + ,1 + ,5 + ,37 + ,38 + ,20 + ,12 + ,16 + ,10 + ,2 + ,5 + ,35 + ,37 + ,16 + ,12 + ,15 + ,9 + ,1 + ,4 + ,37 + ,33 + ,15 + ,12 + ,16 + ,12 + ,2 + ,8 + ,32 + ,34 + ,15 + ,11 + ,15 + ,12 + ,2 + ,8 + ,33 + ,31 + ,16 + ,10 + ,14 + ,13 + ,1 + ,5 + ,38 + ,39 + ,14 + ,9 + ,15 + ,13 + ,2 + ,5 + ,33 + ,34 + ,16 + ,12 + ,14 + ,12 + ,2 + ,6 + ,29 + ,32 + ,16 + ,12 + ,13 + ,15 + ,2 + ,4 + ,33 + ,33 + ,15 + ,12 + ,7 + ,22 + ,2 + ,5 + ,31 + ,36 + ,12 + ,9 + ,17 + ,13 + ,2 + ,5 + ,36 + ,32 + ,17 + ,15 + ,13 + ,15 + ,2 + ,5 + ,35 + ,41 + ,16 + ,12 + ,15 + ,13 + ,2 + ,5 + ,32 + ,28 + ,15 + ,12 + ,14 + ,15 + ,2 + ,6 + ,29 + ,30 + ,13 + ,12 + ,13 + ,10 + ,2 + ,6 + ,39 + ,36 + ,16 + ,10 + ,16 + ,11 + ,2 + ,5 + ,37 + ,35 + ,16 + ,13 + ,12 + ,16 + ,2 + ,6 + ,35 + ,31 + ,16 + ,9 + ,14 + ,11 + ,1 + ,5 + ,37 + ,34 + ,16 + ,12 + ,17 + ,11 + ,1 + ,7 + ,32 + ,36 + ,14 + ,10 + ,15 + ,10 + ,2 + ,5 + ,38 + ,36 + ,16 + ,14 + ,17 + ,10 + ,1 + ,6 + ,37 + ,35 + ,16 + ,11 + ,12 + ,16 + ,2 + ,6 + ,36 + ,37 + ,20 + ,15 + ,16 + ,12 + ,1 + ,6 + ,32 + ,28 + ,15 + ,11 + ,11 + ,11 + ,2 + ,4 + ,33 + ,39 + ,16 + ,11 + ,15 + ,16 + ,1 + ,5 + ,40 + ,32 + ,13 + ,12 + ,9 + ,19 + ,2 + ,5 + ,38 + ,35 + ,17 + ,12 + ,16 + ,11 + ,1 + ,7 + ,41 + ,39 + ,16 + ,12 + ,15 + ,16 + ,1 + ,6 + ,36 + ,35 + ,16 + ,11 + ,10 + ,15 + ,2 + ,9 + ,43 + ,42 + ,12 + ,7 + ,10 + ,24 + ,2 + ,6 + ,30 + ,34 + ,16 + ,12 + ,15 + ,14 + ,2 + ,6 + ,31 + ,33 + ,16 + ,14 + ,11 + ,15 + ,2 + ,5 + ,32 + ,41 + ,17 + ,11 + ,13 + ,11 + ,1 + ,6 + ,32 + ,33 + ,13 + ,11 + ,14 + ,15 + ,2 + ,5 + ,37 + ,34 + ,12 + ,10 + ,18 + ,12 + ,1 + ,8 + ,37 + ,32 + ,18 + ,13 + ,16 + ,10 + ,2 + ,7 + ,33 + ,40 + ,14 + ,13 + ,14 + ,14 + ,2 + ,5 + ,34 + ,40 + ,14 + ,8 + ,14 + ,13 + ,2 + ,7 + ,33 + ,35 + ,13 + ,11 + ,14 + ,9 + ,2 + ,6 + ,38 + ,36 + ,16 + ,12 + ,14 + ,15 + ,2 + ,6 + ,33 + ,37 + ,13 + ,11 + ,12 + ,15 + ,2 + ,9 + ,31 + ,27 + ,16 + ,13 + ,14 + ,14 + ,2 + ,7 + ,38 + ,39 + ,13 + ,12 + ,15 + ,11 + ,2 + ,6 + ,37 + ,38 + ,16 + ,14 + ,15 + ,8 + ,2 + ,5 + ,33 + ,31 + ,15 + ,13 + ,15 + ,11 + ,2 + ,5 + ,31 + ,33 + ,16 + ,15 + ,13 + ,11 + ,1 + ,6 + ,39 + ,32 + ,15 + ,10 + ,17 + ,8 + ,2 + ,6 + ,44 + ,39 + ,17 + ,11 + ,17 + ,10 + ,2 + ,7 + ,33 + ,36 + ,15 + ,9 + ,19 + ,11 + ,2 + ,5 + ,35 + ,33 + ,12 + ,11 + ,15 + ,13 + ,1 + ,5 + ,32 + ,33 + ,16 + ,10 + ,13 + ,11 + ,1 + ,5 + ,28 + ,32 + ,10 + ,11 + ,9 + ,20 + ,2 + ,6 + ,40 + ,37 + ,16 + ,8 + ,15 + ,10 + ,1 + ,4 + ,27 + ,30 + ,12 + ,11 + ,15 + ,15 + ,1 + ,5 + ,37 + ,38 + ,14 + ,12 + ,15 + ,12 + ,2 + ,7 + ,32 + ,29 + ,15 + ,12 + ,16 + ,14 + ,1 + ,5 + ,28 + ,22 + ,13 + ,9 + ,11 + ,23 + ,1 + ,7 + ,34 + ,35 + ,15 + ,11 + ,14 + ,14 + ,2 + ,7 + ,30 + ,35 + ,11 + ,10 + ,11 + ,16 + ,2 + ,6 + ,35 + ,34 + ,12 + ,8 + ,15 + ,11 + ,1 + ,5 + ,31 + ,35 + ,8 + ,9 + ,13 + ,12 + ,2 + ,8 + ,32 + ,34 + ,16 + ,8 + ,15 + ,10 + ,1 + ,5 + ,30 + ,34 + ,15 + ,9 + ,16 + ,14 + ,2 + ,5 + ,30 + ,35 + ,17 + ,15 + ,14 + ,12 + ,1 + ,5 + ,31 + ,23 + ,16 + ,11 + ,15 + ,12 + ,2 + ,6 + ,40 + ,31 + ,10 + ,8 + ,16 + ,11 + ,2 + ,4 + ,32 + ,27 + ,18 + ,13 + ,16 + ,12 + ,1 + ,5 + ,36 + ,36 + ,13 + ,12 + ,11 + ,13 + ,1 + ,5 + ,32 + ,31 + ,16 + ,12 + ,12 + ,11 + ,1 + ,7 + ,35 + ,32 + ,13 + ,9 + ,9 + ,19 + ,2 + ,6 + ,38 + ,39 + ,10 + ,7 + ,16 + ,12 + ,2 + ,7 + ,42 + ,37 + ,15 + ,13 + ,13 + ,17 + ,1 + ,10 + ,34 + ,38 + ,16 + ,9 + ,16 + ,9 + ,2 + ,6 + ,35 + ,39 + ,16 + ,6 + ,12 + ,12 + ,2 + ,8 + ,35 + ,34 + ,14 + ,8 + ,9 + ,19 + ,2 + ,4 + ,33 + ,31 + ,10 + ,8 + ,13 + ,18 + ,2 + ,5 + ,36 + ,32 + ,17 + ,15 + ,13 + ,15 + ,2 + ,6 + ,32 + ,37 + ,13 + ,6 + ,14 + ,14 + ,2 + ,7 + ,33 + ,36 + ,15 + ,9 + ,19 + ,11 + ,2 + ,7 + ,34 + ,32 + ,16 + ,11 + ,13 + ,9 + ,2 + ,6 + ,32 + ,35 + ,12 + ,8 + ,12 + ,18 + ,2 + ,6 + ,34 + ,36 + ,13 + ,8 + ,13 + ,16) + ,dim=c(8 + ,162) + ,dimnames=list(c('gender' + ,'age' + ,'Connected' + ,'Separate' + ,'Learning' + ,'Software' + ,'Happiness' + ,'Depressionss') + ,1:162)) > y <- array(NA,dim=c(8,162),dimnames=list(c('gender','age','Connected','Separate','Learning','Software','Happiness','Depressionss'),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 = '8' > 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 Depressionss gender age Connected Separate Learning Software Happiness 1 12 2 7 41 38 13 12 14 2 11 2 5 39 32 16 11 18 3 14 2 5 30 35 19 15 11 4 12 1 5 31 33 15 6 12 5 21 2 8 34 37 14 13 16 6 12 2 6 35 29 13 10 18 7 22 2 5 39 31 19 12 14 8 11 2 6 34 36 15 14 14 9 10 2 5 36 35 14 12 15 10 13 2 4 37 38 15 6 15 11 10 1 6 38 31 16 10 17 12 8 2 5 36 34 16 12 19 13 15 1 5 38 35 16 12 10 14 14 2 6 39 38 16 11 16 15 10 2 7 33 37 17 15 18 16 14 1 6 32 33 15 12 14 17 14 1 7 36 32 15 10 14 18 11 2 6 38 38 20 12 17 19 10 1 8 39 38 18 11 14 20 13 2 7 32 32 16 12 16 21 7 1 5 32 33 16 11 18 22 14 2 5 31 31 16 12 11 23 12 2 7 39 38 19 13 14 24 14 2 7 37 39 16 11 12 25 11 1 5 39 32 17 9 17 26 9 2 4 41 32 17 13 9 27 11 1 10 36 35 16 10 16 28 15 2 6 33 37 15 14 14 29 14 2 5 33 33 16 12 15 30 13 1 5 34 33 14 10 11 31 9 2 5 31 28 15 12 16 32 15 1 5 27 32 12 8 13 33 10 2 6 37 31 14 10 17 34 11 2 5 34 37 16 12 15 35 13 1 5 34 30 14 12 14 36 8 1 5 32 33 7 7 16 37 20 1 5 29 31 10 6 9 38 12 1 5 36 33 14 12 15 39 10 2 5 29 31 16 10 17 40 10 1 5 35 33 16 10 13 41 9 1 5 37 32 16 10 15 42 14 2 7 34 33 14 12 16 43 8 1 5 38 32 20 15 16 44 14 1 6 35 33 14 10 12 45 11 2 7 38 28 14 10 12 46 13 2 7 37 35 11 12 11 47 9 2 5 38 39 14 13 15 48 11 2 5 33 34 15 11 15 49 15 2 4 36 38 16 11 17 50 11 1 5 38 32 14 12 13 51 10 2 4 32 38 16 14 16 52 14 1 5 32 30 14 10 14 53 18 1 5 32 33 12 12 11 54 14 2 7 34 38 16 13 12 55 11 1 5 32 32 9 5 12 56 12 2 5 37 32 14 6 15 57 13 2 6 39 34 16 12 16 58 9 2 4 29 34 16 12 15 59 10 1 6 37 36 15 11 12 60 15 2 6 35 34 16 10 12 61 20 1 5 30 28 12 7 8 62 12 1 7 38 34 16 12 13 63 12 2 6 34 35 16 14 11 64 14 2 8 31 35 14 11 14 65 13 2 7 34 31 16 12 15 66 11 1 5 35 37 17 13 10 67 17 2 6 36 35 18 14 11 68 12 1 6 30 27 18 11 12 69 13 2 5 39 40 12 12 15 70 14 1 5 35 37 16 12 15 71 13 1 5 38 36 10 8 14 72 15 2 5 31 38 14 11 16 73 13 2 4 34 39 18 14 15 74 10 1 6 38 41 18 14 15 75 11 1 6 34 27 16 12 13 76 19 2 6 39 30 17 9 12 77 13 2 6 37 37 16 13 17 78 17 2 7 34 31 16 11 13 79 13 1 5 28 31 13 12 15 80 9 1 7 37 27 16 12 13 81 11 1 6 33 36 16 12 15 82 10 1 5 37 38 20 12 16 83 9 2 5 35 37 16 12 15 84 12 1 4 37 33 15 12 16 85 12 2 8 32 34 15 11 15 86 13 2 8 33 31 16 10 14 87 13 1 5 38 39 14 9 15 88 12 2 5 33 34 16 12 14 89 15 2 6 29 32 16 12 13 90 22 2 4 33 33 15 12 7 91 13 2 5 31 36 12 9 17 92 15 2 5 36 32 17 15 13 93 13 2 5 35 41 16 12 15 94 15 2 5 32 28 15 12 14 95 10 2 6 29 30 13 12 13 96 11 2 6 39 36 16 10 16 97 16 2 5 37 35 16 13 12 98 11 2 6 35 31 16 9 14 99 11 1 5 37 34 16 12 17 100 10 1 7 32 36 14 10 15 101 10 2 5 38 36 16 14 17 102 16 1 6 37 35 16 11 12 103 12 2 6 36 37 20 15 16 104 11 1 6 32 28 15 11 11 105 16 2 4 33 39 16 11 15 106 19 1 5 40 32 13 12 9 107 11 2 5 38 35 17 12 16 108 16 1 7 41 39 16 12 15 109 15 1 6 36 35 16 11 10 110 24 2 9 43 42 12 7 10 111 14 2 6 30 34 16 12 15 112 15 2 6 31 33 16 14 11 113 11 2 5 32 41 17 11 13 114 15 1 6 32 33 13 11 14 115 12 2 5 37 34 12 10 18 116 10 1 8 37 32 18 13 16 117 14 2 7 33 40 14 13 14 118 13 2 5 34 40 14 8 14 119 9 2 7 33 35 13 11 14 120 15 2 6 38 36 16 12 14 121 15 2 6 33 37 13 11 12 122 14 2 9 31 27 16 13 14 123 11 2 7 38 39 13 12 15 124 8 2 6 37 38 16 14 15 125 11 2 5 33 31 15 13 15 126 11 2 5 31 33 16 15 13 127 8 1 6 39 32 15 10 17 128 10 2 6 44 39 17 11 17 129 11 2 7 33 36 15 9 19 130 13 2 5 35 33 12 11 15 131 11 1 5 32 33 16 10 13 132 20 1 5 28 32 10 11 9 133 10 2 6 40 37 16 8 15 134 15 1 4 27 30 12 11 15 135 12 1 5 37 38 14 12 15 136 14 2 7 32 29 15 12 16 137 23 1 5 28 22 13 9 11 138 14 1 7 34 35 15 11 14 139 16 2 7 30 35 11 10 11 140 11 2 6 35 34 12 8 15 141 12 1 5 31 35 8 9 13 142 10 2 8 32 34 16 8 15 143 14 1 5 30 34 15 9 16 144 12 2 5 30 35 17 15 14 145 12 1 5 31 23 16 11 15 146 11 2 6 40 31 10 8 16 147 12 2 4 32 27 18 13 16 148 13 1 5 36 36 13 12 11 149 11 1 5 32 31 16 12 12 150 19 1 7 35 32 13 9 9 151 12 2 6 38 39 10 7 16 152 17 2 7 42 37 15 13 13 153 9 1 10 34 38 16 9 16 154 12 2 6 35 39 16 6 12 155 19 2 8 35 34 14 8 9 156 18 2 4 33 31 10 8 13 157 15 2 5 36 32 17 15 13 158 14 2 6 32 37 13 6 14 159 11 2 7 33 36 15 9 19 160 9 2 7 34 32 16 11 13 161 18 2 6 32 35 12 8 12 162 16 2 6 34 36 13 8 13 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) gender age Connected Separate Learning 25.57830 1.10354 0.09479 -0.02193 -0.01544 -0.16906 Software Happiness -0.07670 -0.73647 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.272 -1.837 -0.026 1.501 9.518 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 25.57830 2.86896 8.916 1.32e-15 *** gender 1.10354 0.44949 2.455 0.0152 * age 0.09479 0.18179 0.521 0.6028 Connected -0.02193 0.06803 -0.322 0.7476 Separate -0.01544 0.06466 -0.239 0.8116 Learning -0.16906 0.11355 -1.489 0.1386 Software -0.07670 0.11714 -0.655 0.5136 Happiness -0.73647 0.09206 -8.000 2.78e-13 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.622 on 154 degrees of freedom Multiple R-squared: 0.3438, Adjusted R-squared: 0.314 F-statistic: 11.53 on 7 and 154 DF, p-value: 9.964e-12 > 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.7855714 0.42885721 0.21442861 [2,] 0.6878578 0.62428442 0.31214221 [3,] 0.9225829 0.15483411 0.07741705 [4,] 0.8858590 0.22828194 0.11414097 [5,] 0.8565219 0.28695629 0.14347814 [6,] 0.9113350 0.17732996 0.08866498 [7,] 0.9010915 0.19781699 0.09890850 [8,] 0.9200060 0.15998794 0.07999397 [9,] 0.9562714 0.08745712 0.04372856 [10,] 0.9560434 0.08791323 0.04395662 [11,] 0.9400200 0.11996002 0.05998001 [12,] 0.9430354 0.11392930 0.05696465 [13,] 0.9434476 0.11310479 0.05655239 [14,] 0.9256872 0.14862567 0.07431283 [15,] 0.9008159 0.19836826 0.09918413 [16,] 0.9799510 0.04009797 0.02004898 [17,] 0.9826683 0.03466332 0.01733166 [18,] 0.9799533 0.04009336 0.02004668 [19,] 0.9729548 0.05409034 0.02704517 [20,] 0.9635779 0.07284419 0.03642209 [21,] 0.9710093 0.05798141 0.02899071 [22,] 0.9658752 0.06824954 0.03412477 [23,] 0.9599941 0.08001176 0.04000588 [24,] 0.9484403 0.10311941 0.05155970 [25,] 0.9365555 0.12688893 0.06344446 [26,] 0.9406087 0.11878254 0.05939127 [27,] 0.9539668 0.09206642 0.04603321 [28,] 0.9441824 0.11163518 0.05581759 [29,] 0.9354429 0.12911414 0.06455707 [30,] 0.9319329 0.13613424 0.06806712 [31,] 0.9224296 0.15514076 0.07757038 [32,] 0.9072633 0.18547331 0.09273665 [33,] 0.8864563 0.22708747 0.11354374 [34,] 0.8593264 0.28134710 0.14067355 [35,] 0.9036277 0.19274452 0.09637226 [36,] 0.9013303 0.19733943 0.09866972 [37,] 0.9019955 0.19600897 0.09800448 [38,] 0.8853519 0.22929616 0.11464808 [39,] 0.9224361 0.15512789 0.07756394 [40,] 0.9103932 0.17921356 0.08960678 [41,] 0.8930278 0.21394446 0.10697223 [42,] 0.8802469 0.23950623 0.11975312 [43,] 0.9077434 0.18451319 0.09225660 [44,] 0.8871064 0.22578728 0.11289364 [45,] 0.9108964 0.17820729 0.08910364 [46,] 0.8940508 0.21189838 0.10594919 [47,] 0.8787703 0.24245934 0.12122967 [48,] 0.8937142 0.21257155 0.10628578 [49,] 0.9087444 0.18251115 0.09125557 [50,] 0.8880413 0.22391750 0.11195875 [51,] 0.8934260 0.21314793 0.10657397 [52,] 0.8716412 0.25671754 0.12835877 [53,] 0.8789775 0.24204500 0.12102250 [54,] 0.8554644 0.28907121 0.14453561 [55,] 0.8276676 0.34466481 0.17233241 [56,] 0.8509277 0.29814457 0.14907229 [57,] 0.8454174 0.30916521 0.15458261 [58,] 0.8326681 0.33466388 0.16733194 [59,] 0.8088037 0.38239261 0.19119630 [60,] 0.8165608 0.36687831 0.18343916 [61,] 0.7920326 0.41593488 0.20796744 [62,] 0.8017921 0.39641575 0.19820787 [63,] 0.7768586 0.44628285 0.22314143 [64,] 0.7431019 0.51379630 0.25689815 [65,] 0.7273874 0.54522512 0.27261256 [66,] 0.7879412 0.42411757 0.21205878 [67,] 0.7822081 0.43558384 0.21779192 [68,] 0.7887233 0.42255343 0.21127671 [69,] 0.7612189 0.47756217 0.23878109 [70,] 0.8123417 0.37531653 0.18765827 [71,] 0.7798459 0.44030828 0.22015414 [72,] 0.7436099 0.51278030 0.25639015 [73,] 0.7644135 0.47117290 0.23558645 [74,] 0.7444521 0.51109572 0.25554786 [75,] 0.7150035 0.56999309 0.28499654 [76,] 0.6785603 0.64287940 0.32143970 [77,] 0.6438220 0.71235596 0.35617798 [78,] 0.6061766 0.78764683 0.39382342 [79,] 0.5692503 0.86149937 0.43074969 [80,] 0.6168746 0.76625088 0.38312544 [81,] 0.5843389 0.83132218 0.41566109 [82,] 0.5573830 0.88523391 0.44261696 [83,] 0.5178313 0.96433747 0.48216874 [84,] 0.4897027 0.97940549 0.51029725 [85,] 0.5773534 0.84529310 0.42264655 [86,] 0.5337494 0.93250114 0.46625057 [87,] 0.5035418 0.99291638 0.49645819 [88,] 0.4997233 0.99944652 0.50027674 [89,] 0.4618632 0.92372647 0.53813676 [90,] 0.4396203 0.87924061 0.56037969 [91,] 0.3934153 0.78683056 0.60658472 [92,] 0.3799049 0.75980979 0.62009511 [93,] 0.3620293 0.72405851 0.63797075 [94,] 0.4447566 0.88951318 0.55524341 [95,] 0.5428626 0.91427481 0.45713740 [96,] 0.5415570 0.91688593 0.45844296 [97,] 0.4942848 0.98856970 0.50571515 [98,] 0.6279985 0.74400310 0.37200155 [99,] 0.5809666 0.83806683 0.41903341 [100,] 0.8500256 0.29994874 0.14997437 [101,] 0.8359520 0.32809596 0.16404798 [102,] 0.8011924 0.39761521 0.19880760 [103,] 0.7853809 0.42923814 0.21461907 [104,] 0.7709309 0.45813816 0.22906908 [105,] 0.7400506 0.51989879 0.25994940 [106,] 0.6953839 0.60923224 0.30461612 [107,] 0.6789675 0.64206495 0.32103247 [108,] 0.6341389 0.73172225 0.36586113 [109,] 0.7392835 0.52143299 0.26071650 [110,] 0.7553093 0.48938148 0.24469074 [111,] 0.7094377 0.58112468 0.29056234 [112,] 0.6600607 0.67987852 0.33993926 [113,] 0.6160075 0.76798498 0.38399249 [114,] 0.6317639 0.73647226 0.36823613 [115,] 0.6001644 0.79967116 0.39983558 [116,] 0.6201277 0.75974466 0.37987233 [117,] 0.5953678 0.80926445 0.40463223 [118,] 0.5616988 0.87660233 0.43830116 [119,] 0.5382419 0.92351624 0.46175812 [120,] 0.4781732 0.95634649 0.52182675 [121,] 0.4586589 0.91731775 0.54134113 [122,] 0.4228149 0.84562979 0.57718510 [123,] 0.3816059 0.76321172 0.61839414 [124,] 0.3465895 0.69317891 0.65341054 [125,] 0.2987140 0.59742791 0.70128604 [126,] 0.2588192 0.51763832 0.74118084 [127,] 0.5274441 0.94511172 0.47255586 [128,] 0.5000800 0.99983992 0.49991996 [129,] 0.4241937 0.84838736 0.57580632 [130,] 0.4021211 0.80424213 0.59787893 [131,] 0.4411392 0.88227848 0.55886076 [132,] 0.4079413 0.81588252 0.59205874 [133,] 0.5044701 0.99105986 0.49552993 [134,] 0.4536629 0.90732573 0.54633713 [135,] 0.4110406 0.82208126 0.58895937 [136,] 0.4402990 0.88059790 0.55970105 [137,] 0.3637628 0.72752565 0.63623717 [138,] 0.3557843 0.71156855 0.64421572 [139,] 0.3270992 0.65419844 0.67290078 [140,] 0.2484951 0.49699022 0.75150489 [141,] 0.4451098 0.89021957 0.55489021 > postscript(file="/var/fisher/rcomp/tmp/1cvqt1355570351.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/2zm571355570351.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/331bj1355570351.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/4q2hf1355570351.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/5o0uy1355570351.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 -1.534443837 0.895049542 -0.597305633 -2.132816701 8.920543586 1.082346638 7 8 9 10 11 12 9.517618389 -2.132488456 -2.595272479 0.276600391 0.053256469 -1.326690149 13 14 15 16 17 18 0.207885318 2.419924132 0.126947417 1.727480854 1.551562981 0.887425878 19 20 21 22 23 24 -1.800938879 1.155727550 -2.139477199 -1.374416461 -0.487215326 -0.649178072 25 26 27 28 29 30 1.277771865 -7.272086499 -0.044495654 1.861018334 1.646200090 -1.665757990 31 32 33 34 35 36 -2.907423046 1.146721418 -1.410335411 -1.270131391 0.650759297 -4.440806049 37 38 39 40 41 42 2.737720448 0.477393497 -1.152843239 -2.832757268 -2.331390845 1.876891647 43 44 45 46 47 48 -1.513222435 -0.002148086 -4.211865518 -3.216007031 -3.412973158 -1.584131132 49 50 51 52 53 54 4.280193465 -1.967129963 -1.313884503 1.453497693 3.105663018 -0.576992889 55 56 57 58 59 60 -4.217408546 -1.079864573 1.434886415 -3.331287096 -3.666220073 0.247878384 61 62 63 64 65 66 2.391701102 -0.787714009 -3.188277177 0.197538644 0.447676561 -3.581263090 67 68 69 70 71 72 2.193706875 -1.451442270 0.209560137 2.855332981 -0.151982382 3.001161288 73 74 75 76 77 78 1.347062140 -0.620400227 -1.888681690 4.366212449 2.250510058 2.898029089 79 80 81 82 83 84 1.102033445 -3.917687713 -0.298749464 0.327352074 -3.248203119 1.499648833 85 86 87 88 89 90 -0.890431920 -0.558920081 1.383752821 -1.074837319 0.975316160 3.680147407 91 92 93 94 95 96 1.215231067 1.622776246 0.813537128 1.641560284 -4.562745226 -0.687648521 97 98 99 100 101 102 1.632068419 -2.402184389 1.325829281 -1.907001143 -0.571503363 2.487408619 103 104 105 106 107 108 1.321769392 -3.635814398 3.756898770 2.961772943 -0.307752202 4.828191058 109 110 111 112 113 114 -0.007464594 6.883104988 1.501059498 -0.284932116 -2.632831405 2.312650816 115 116 117 118 119 120 1.129105575 -0.311055792 0.566766396 -0.605236305 -4.832877727 1.970883325 121 122 123 124 125 126 -0.180161707 0.470799880 -1.848321120 -4.130297292 -1.477031257 -2.640493805 127 128 129 130 131 132 -2.078443952 -0.549463221 1.049642138 -0.062900913 -1.898542084 3.114739888 133 134 135 136 137 138 -2.540162718 2.913694665 0.576497078 1.940358610 7.787120415 1.630714153 139 140 141 142 143 144 -0.522909994 -2.372364280 -2.318812796 -2.951475756 3.036687563 -0.726015728 145 146 147 148 149 150 0.474826498 -1.910683143 0.777754796 -1.591254955 -2.512479618 2.432442316 151 152 153 154 155 156 -0.907761723 3.150406940 -2.118749542 -2.981756427 1.357346725 2.915983218 157 158 159 160 161 162 1.622776246 -0.112657687 1.049642138 -5.086535849 2.367868554 1.332696384 > postscript(file="/var/fisher/rcomp/tmp/6so6y1355570351.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 -1.534443837 NA 1 0.895049542 -1.534443837 2 -0.597305633 0.895049542 3 -2.132816701 -0.597305633 4 8.920543586 -2.132816701 5 1.082346638 8.920543586 6 9.517618389 1.082346638 7 -2.132488456 9.517618389 8 -2.595272479 -2.132488456 9 0.276600391 -2.595272479 10 0.053256469 0.276600391 11 -1.326690149 0.053256469 12 0.207885318 -1.326690149 13 2.419924132 0.207885318 14 0.126947417 2.419924132 15 1.727480854 0.126947417 16 1.551562981 1.727480854 17 0.887425878 1.551562981 18 -1.800938879 0.887425878 19 1.155727550 -1.800938879 20 -2.139477199 1.155727550 21 -1.374416461 -2.139477199 22 -0.487215326 -1.374416461 23 -0.649178072 -0.487215326 24 1.277771865 -0.649178072 25 -7.272086499 1.277771865 26 -0.044495654 -7.272086499 27 1.861018334 -0.044495654 28 1.646200090 1.861018334 29 -1.665757990 1.646200090 30 -2.907423046 -1.665757990 31 1.146721418 -2.907423046 32 -1.410335411 1.146721418 33 -1.270131391 -1.410335411 34 0.650759297 -1.270131391 35 -4.440806049 0.650759297 36 2.737720448 -4.440806049 37 0.477393497 2.737720448 38 -1.152843239 0.477393497 39 -2.832757268 -1.152843239 40 -2.331390845 -2.832757268 41 1.876891647 -2.331390845 42 -1.513222435 1.876891647 43 -0.002148086 -1.513222435 44 -4.211865518 -0.002148086 45 -3.216007031 -4.211865518 46 -3.412973158 -3.216007031 47 -1.584131132 -3.412973158 48 4.280193465 -1.584131132 49 -1.967129963 4.280193465 50 -1.313884503 -1.967129963 51 1.453497693 -1.313884503 52 3.105663018 1.453497693 53 -0.576992889 3.105663018 54 -4.217408546 -0.576992889 55 -1.079864573 -4.217408546 56 1.434886415 -1.079864573 57 -3.331287096 1.434886415 58 -3.666220073 -3.331287096 59 0.247878384 -3.666220073 60 2.391701102 0.247878384 61 -0.787714009 2.391701102 62 -3.188277177 -0.787714009 63 0.197538644 -3.188277177 64 0.447676561 0.197538644 65 -3.581263090 0.447676561 66 2.193706875 -3.581263090 67 -1.451442270 2.193706875 68 0.209560137 -1.451442270 69 2.855332981 0.209560137 70 -0.151982382 2.855332981 71 3.001161288 -0.151982382 72 1.347062140 3.001161288 73 -0.620400227 1.347062140 74 -1.888681690 -0.620400227 75 4.366212449 -1.888681690 76 2.250510058 4.366212449 77 2.898029089 2.250510058 78 1.102033445 2.898029089 79 -3.917687713 1.102033445 80 -0.298749464 -3.917687713 81 0.327352074 -0.298749464 82 -3.248203119 0.327352074 83 1.499648833 -3.248203119 84 -0.890431920 1.499648833 85 -0.558920081 -0.890431920 86 1.383752821 -0.558920081 87 -1.074837319 1.383752821 88 0.975316160 -1.074837319 89 3.680147407 0.975316160 90 1.215231067 3.680147407 91 1.622776246 1.215231067 92 0.813537128 1.622776246 93 1.641560284 0.813537128 94 -4.562745226 1.641560284 95 -0.687648521 -4.562745226 96 1.632068419 -0.687648521 97 -2.402184389 1.632068419 98 1.325829281 -2.402184389 99 -1.907001143 1.325829281 100 -0.571503363 -1.907001143 101 2.487408619 -0.571503363 102 1.321769392 2.487408619 103 -3.635814398 1.321769392 104 3.756898770 -3.635814398 105 2.961772943 3.756898770 106 -0.307752202 2.961772943 107 4.828191058 -0.307752202 108 -0.007464594 4.828191058 109 6.883104988 -0.007464594 110 1.501059498 6.883104988 111 -0.284932116 1.501059498 112 -2.632831405 -0.284932116 113 2.312650816 -2.632831405 114 1.129105575 2.312650816 115 -0.311055792 1.129105575 116 0.566766396 -0.311055792 117 -0.605236305 0.566766396 118 -4.832877727 -0.605236305 119 1.970883325 -4.832877727 120 -0.180161707 1.970883325 121 0.470799880 -0.180161707 122 -1.848321120 0.470799880 123 -4.130297292 -1.848321120 124 -1.477031257 -4.130297292 125 -2.640493805 -1.477031257 126 -2.078443952 -2.640493805 127 -0.549463221 -2.078443952 128 1.049642138 -0.549463221 129 -0.062900913 1.049642138 130 -1.898542084 -0.062900913 131 3.114739888 -1.898542084 132 -2.540162718 3.114739888 133 2.913694665 -2.540162718 134 0.576497078 2.913694665 135 1.940358610 0.576497078 136 7.787120415 1.940358610 137 1.630714153 7.787120415 138 -0.522909994 1.630714153 139 -2.372364280 -0.522909994 140 -2.318812796 -2.372364280 141 -2.951475756 -2.318812796 142 3.036687563 -2.951475756 143 -0.726015728 3.036687563 144 0.474826498 -0.726015728 145 -1.910683143 0.474826498 146 0.777754796 -1.910683143 147 -1.591254955 0.777754796 148 -2.512479618 -1.591254955 149 2.432442316 -2.512479618 150 -0.907761723 2.432442316 151 3.150406940 -0.907761723 152 -2.118749542 3.150406940 153 -2.981756427 -2.118749542 154 1.357346725 -2.981756427 155 2.915983218 1.357346725 156 1.622776246 2.915983218 157 -0.112657687 1.622776246 158 1.049642138 -0.112657687 159 -5.086535849 1.049642138 160 2.367868554 -5.086535849 161 1.332696384 2.367868554 162 NA 1.332696384 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.895049542 -1.534443837 [2,] -0.597305633 0.895049542 [3,] -2.132816701 -0.597305633 [4,] 8.920543586 -2.132816701 [5,] 1.082346638 8.920543586 [6,] 9.517618389 1.082346638 [7,] -2.132488456 9.517618389 [8,] -2.595272479 -2.132488456 [9,] 0.276600391 -2.595272479 [10,] 0.053256469 0.276600391 [11,] -1.326690149 0.053256469 [12,] 0.207885318 -1.326690149 [13,] 2.419924132 0.207885318 [14,] 0.126947417 2.419924132 [15,] 1.727480854 0.126947417 [16,] 1.551562981 1.727480854 [17,] 0.887425878 1.551562981 [18,] -1.800938879 0.887425878 [19,] 1.155727550 -1.800938879 [20,] -2.139477199 1.155727550 [21,] -1.374416461 -2.139477199 [22,] -0.487215326 -1.374416461 [23,] -0.649178072 -0.487215326 [24,] 1.277771865 -0.649178072 [25,] -7.272086499 1.277771865 [26,] -0.044495654 -7.272086499 [27,] 1.861018334 -0.044495654 [28,] 1.646200090 1.861018334 [29,] -1.665757990 1.646200090 [30,] -2.907423046 -1.665757990 [31,] 1.146721418 -2.907423046 [32,] -1.410335411 1.146721418 [33,] -1.270131391 -1.410335411 [34,] 0.650759297 -1.270131391 [35,] -4.440806049 0.650759297 [36,] 2.737720448 -4.440806049 [37,] 0.477393497 2.737720448 [38,] -1.152843239 0.477393497 [39,] -2.832757268 -1.152843239 [40,] -2.331390845 -2.832757268 [41,] 1.876891647 -2.331390845 [42,] -1.513222435 1.876891647 [43,] -0.002148086 -1.513222435 [44,] -4.211865518 -0.002148086 [45,] -3.216007031 -4.211865518 [46,] -3.412973158 -3.216007031 [47,] -1.584131132 -3.412973158 [48,] 4.280193465 -1.584131132 [49,] -1.967129963 4.280193465 [50,] -1.313884503 -1.967129963 [51,] 1.453497693 -1.313884503 [52,] 3.105663018 1.453497693 [53,] -0.576992889 3.105663018 [54,] -4.217408546 -0.576992889 [55,] -1.079864573 -4.217408546 [56,] 1.434886415 -1.079864573 [57,] -3.331287096 1.434886415 [58,] -3.666220073 -3.331287096 [59,] 0.247878384 -3.666220073 [60,] 2.391701102 0.247878384 [61,] -0.787714009 2.391701102 [62,] -3.188277177 -0.787714009 [63,] 0.197538644 -3.188277177 [64,] 0.447676561 0.197538644 [65,] -3.581263090 0.447676561 [66,] 2.193706875 -3.581263090 [67,] -1.451442270 2.193706875 [68,] 0.209560137 -1.451442270 [69,] 2.855332981 0.209560137 [70,] -0.151982382 2.855332981 [71,] 3.001161288 -0.151982382 [72,] 1.347062140 3.001161288 [73,] -0.620400227 1.347062140 [74,] -1.888681690 -0.620400227 [75,] 4.366212449 -1.888681690 [76,] 2.250510058 4.366212449 [77,] 2.898029089 2.250510058 [78,] 1.102033445 2.898029089 [79,] -3.917687713 1.102033445 [80,] -0.298749464 -3.917687713 [81,] 0.327352074 -0.298749464 [82,] -3.248203119 0.327352074 [83,] 1.499648833 -3.248203119 [84,] -0.890431920 1.499648833 [85,] -0.558920081 -0.890431920 [86,] 1.383752821 -0.558920081 [87,] -1.074837319 1.383752821 [88,] 0.975316160 -1.074837319 [89,] 3.680147407 0.975316160 [90,] 1.215231067 3.680147407 [91,] 1.622776246 1.215231067 [92,] 0.813537128 1.622776246 [93,] 1.641560284 0.813537128 [94,] -4.562745226 1.641560284 [95,] -0.687648521 -4.562745226 [96,] 1.632068419 -0.687648521 [97,] -2.402184389 1.632068419 [98,] 1.325829281 -2.402184389 [99,] -1.907001143 1.325829281 [100,] -0.571503363 -1.907001143 [101,] 2.487408619 -0.571503363 [102,] 1.321769392 2.487408619 [103,] -3.635814398 1.321769392 [104,] 3.756898770 -3.635814398 [105,] 2.961772943 3.756898770 [106,] -0.307752202 2.961772943 [107,] 4.828191058 -0.307752202 [108,] -0.007464594 4.828191058 [109,] 6.883104988 -0.007464594 [110,] 1.501059498 6.883104988 [111,] -0.284932116 1.501059498 [112,] -2.632831405 -0.284932116 [113,] 2.312650816 -2.632831405 [114,] 1.129105575 2.312650816 [115,] -0.311055792 1.129105575 [116,] 0.566766396 -0.311055792 [117,] -0.605236305 0.566766396 [118,] -4.832877727 -0.605236305 [119,] 1.970883325 -4.832877727 [120,] -0.180161707 1.970883325 [121,] 0.470799880 -0.180161707 [122,] -1.848321120 0.470799880 [123,] -4.130297292 -1.848321120 [124,] -1.477031257 -4.130297292 [125,] -2.640493805 -1.477031257 [126,] -2.078443952 -2.640493805 [127,] -0.549463221 -2.078443952 [128,] 1.049642138 -0.549463221 [129,] -0.062900913 1.049642138 [130,] -1.898542084 -0.062900913 [131,] 3.114739888 -1.898542084 [132,] -2.540162718 3.114739888 [133,] 2.913694665 -2.540162718 [134,] 0.576497078 2.913694665 [135,] 1.940358610 0.576497078 [136,] 7.787120415 1.940358610 [137,] 1.630714153 7.787120415 [138,] -0.522909994 1.630714153 [139,] -2.372364280 -0.522909994 [140,] -2.318812796 -2.372364280 [141,] -2.951475756 -2.318812796 [142,] 3.036687563 -2.951475756 [143,] -0.726015728 3.036687563 [144,] 0.474826498 -0.726015728 [145,] -1.910683143 0.474826498 [146,] 0.777754796 -1.910683143 [147,] -1.591254955 0.777754796 [148,] -2.512479618 -1.591254955 [149,] 2.432442316 -2.512479618 [150,] -0.907761723 2.432442316 [151,] 3.150406940 -0.907761723 [152,] -2.118749542 3.150406940 [153,] -2.981756427 -2.118749542 [154,] 1.357346725 -2.981756427 [155,] 2.915983218 1.357346725 [156,] 1.622776246 2.915983218 [157,] -0.112657687 1.622776246 [158,] 1.049642138 -0.112657687 [159,] -5.086535849 1.049642138 [160,] 2.367868554 -5.086535849 [161,] 1.332696384 2.367868554 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.895049542 -1.534443837 2 -0.597305633 0.895049542 3 -2.132816701 -0.597305633 4 8.920543586 -2.132816701 5 1.082346638 8.920543586 6 9.517618389 1.082346638 7 -2.132488456 9.517618389 8 -2.595272479 -2.132488456 9 0.276600391 -2.595272479 10 0.053256469 0.276600391 11 -1.326690149 0.053256469 12 0.207885318 -1.326690149 13 2.419924132 0.207885318 14 0.126947417 2.419924132 15 1.727480854 0.126947417 16 1.551562981 1.727480854 17 0.887425878 1.551562981 18 -1.800938879 0.887425878 19 1.155727550 -1.800938879 20 -2.139477199 1.155727550 21 -1.374416461 -2.139477199 22 -0.487215326 -1.374416461 23 -0.649178072 -0.487215326 24 1.277771865 -0.649178072 25 -7.272086499 1.277771865 26 -0.044495654 -7.272086499 27 1.861018334 -0.044495654 28 1.646200090 1.861018334 29 -1.665757990 1.646200090 30 -2.907423046 -1.665757990 31 1.146721418 -2.907423046 32 -1.410335411 1.146721418 33 -1.270131391 -1.410335411 34 0.650759297 -1.270131391 35 -4.440806049 0.650759297 36 2.737720448 -4.440806049 37 0.477393497 2.737720448 38 -1.152843239 0.477393497 39 -2.832757268 -1.152843239 40 -2.331390845 -2.832757268 41 1.876891647 -2.331390845 42 -1.513222435 1.876891647 43 -0.002148086 -1.513222435 44 -4.211865518 -0.002148086 45 -3.216007031 -4.211865518 46 -3.412973158 -3.216007031 47 -1.584131132 -3.412973158 48 4.280193465 -1.584131132 49 -1.967129963 4.280193465 50 -1.313884503 -1.967129963 51 1.453497693 -1.313884503 52 3.105663018 1.453497693 53 -0.576992889 3.105663018 54 -4.217408546 -0.576992889 55 -1.079864573 -4.217408546 56 1.434886415 -1.079864573 57 -3.331287096 1.434886415 58 -3.666220073 -3.331287096 59 0.247878384 -3.666220073 60 2.391701102 0.247878384 61 -0.787714009 2.391701102 62 -3.188277177 -0.787714009 63 0.197538644 -3.188277177 64 0.447676561 0.197538644 65 -3.581263090 0.447676561 66 2.193706875 -3.581263090 67 -1.451442270 2.193706875 68 0.209560137 -1.451442270 69 2.855332981 0.209560137 70 -0.151982382 2.855332981 71 3.001161288 -0.151982382 72 1.347062140 3.001161288 73 -0.620400227 1.347062140 74 -1.888681690 -0.620400227 75 4.366212449 -1.888681690 76 2.250510058 4.366212449 77 2.898029089 2.250510058 78 1.102033445 2.898029089 79 -3.917687713 1.102033445 80 -0.298749464 -3.917687713 81 0.327352074 -0.298749464 82 -3.248203119 0.327352074 83 1.499648833 -3.248203119 84 -0.890431920 1.499648833 85 -0.558920081 -0.890431920 86 1.383752821 -0.558920081 87 -1.074837319 1.383752821 88 0.975316160 -1.074837319 89 3.680147407 0.975316160 90 1.215231067 3.680147407 91 1.622776246 1.215231067 92 0.813537128 1.622776246 93 1.641560284 0.813537128 94 -4.562745226 1.641560284 95 -0.687648521 -4.562745226 96 1.632068419 -0.687648521 97 -2.402184389 1.632068419 98 1.325829281 -2.402184389 99 -1.907001143 1.325829281 100 -0.571503363 -1.907001143 101 2.487408619 -0.571503363 102 1.321769392 2.487408619 103 -3.635814398 1.321769392 104 3.756898770 -3.635814398 105 2.961772943 3.756898770 106 -0.307752202 2.961772943 107 4.828191058 -0.307752202 108 -0.007464594 4.828191058 109 6.883104988 -0.007464594 110 1.501059498 6.883104988 111 -0.284932116 1.501059498 112 -2.632831405 -0.284932116 113 2.312650816 -2.632831405 114 1.129105575 2.312650816 115 -0.311055792 1.129105575 116 0.566766396 -0.311055792 117 -0.605236305 0.566766396 118 -4.832877727 -0.605236305 119 1.970883325 -4.832877727 120 -0.180161707 1.970883325 121 0.470799880 -0.180161707 122 -1.848321120 0.470799880 123 -4.130297292 -1.848321120 124 -1.477031257 -4.130297292 125 -2.640493805 -1.477031257 126 -2.078443952 -2.640493805 127 -0.549463221 -2.078443952 128 1.049642138 -0.549463221 129 -0.062900913 1.049642138 130 -1.898542084 -0.062900913 131 3.114739888 -1.898542084 132 -2.540162718 3.114739888 133 2.913694665 -2.540162718 134 0.576497078 2.913694665 135 1.940358610 0.576497078 136 7.787120415 1.940358610 137 1.630714153 7.787120415 138 -0.522909994 1.630714153 139 -2.372364280 -0.522909994 140 -2.318812796 -2.372364280 141 -2.951475756 -2.318812796 142 3.036687563 -2.951475756 143 -0.726015728 3.036687563 144 0.474826498 -0.726015728 145 -1.910683143 0.474826498 146 0.777754796 -1.910683143 147 -1.591254955 0.777754796 148 -2.512479618 -1.591254955 149 2.432442316 -2.512479618 150 -0.907761723 2.432442316 151 3.150406940 -0.907761723 152 -2.118749542 3.150406940 153 -2.981756427 -2.118749542 154 1.357346725 -2.981756427 155 2.915983218 1.357346725 156 1.622776246 2.915983218 157 -0.112657687 1.622776246 158 1.049642138 -0.112657687 159 -5.086535849 1.049642138 160 2.367868554 -5.086535849 161 1.332696384 2.367868554 > 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/7rdb61355570351.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/8p50q1355570351.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/9ao9c1355570351.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/10op2w1355570351.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/11ngdx1355570351.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/12x6tv1355570351.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/13ue921355570351.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/14atzj1355570351.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/15fl7n1355570351.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/16ztxy1355570351.tab") + } > > try(system("convert tmp/1cvqt1355570351.ps tmp/1cvqt1355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/2zm571355570351.ps tmp/2zm571355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/331bj1355570351.ps tmp/331bj1355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/4q2hf1355570351.ps tmp/4q2hf1355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/5o0uy1355570351.ps tmp/5o0uy1355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/6so6y1355570351.ps tmp/6so6y1355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/7rdb61355570351.ps tmp/7rdb61355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/8p50q1355570351.ps tmp/8p50q1355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/9ao9c1355570351.ps tmp/9ao9c1355570351.png",intern=TRUE)) character(0) > try(system("convert tmp/10op2w1355570351.ps tmp/10op2w1355570351.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.090 1.596 9.684