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' + ,'Depression') + ,1:162)) > y <- array(NA,dim=c(8,162),dimnames=list(c('Gender','Age','Connected','Separate','Learning','Software','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 = '6' > 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 Software Gender Age Connected Separate Learning Happiness Depression 1 12 2 7 41 38 13 14 12 2 11 2 5 39 32 16 18 11 3 15 2 5 30 35 19 11 14 4 6 1 5 31 33 15 12 12 5 13 2 8 34 37 14 16 21 6 10 2 6 35 29 13 18 12 7 12 2 5 39 31 19 14 22 8 14 2 6 34 36 15 14 11 9 12 2 5 36 35 14 15 10 10 6 2 4 37 38 15 15 13 11 10 1 6 38 31 16 17 10 12 12 2 5 36 34 16 19 8 13 12 1 5 38 35 16 10 15 14 11 2 6 39 38 16 16 14 15 15 2 7 33 37 17 18 10 16 12 1 6 32 33 15 14 14 17 10 1 7 36 32 15 14 14 18 12 2 6 38 38 20 17 11 19 11 1 8 39 38 18 14 10 20 12 2 7 32 32 16 16 13 21 11 1 5 32 33 16 18 7 22 12 2 5 31 31 16 11 14 23 13 2 7 39 38 19 14 12 24 11 2 7 37 39 16 12 14 25 9 1 5 39 32 17 17 11 26 13 2 4 41 32 17 9 9 27 10 1 10 36 35 16 16 11 28 14 2 6 33 37 15 14 15 29 12 2 5 33 33 16 15 14 30 10 1 5 34 33 14 11 13 31 12 2 5 31 28 15 16 9 32 8 1 5 27 32 12 13 15 33 10 2 6 37 31 14 17 10 34 12 2 5 34 37 16 15 11 35 12 1 5 34 30 14 14 13 36 7 1 5 32 33 7 16 8 37 6 1 5 29 31 10 9 20 38 12 1 5 36 33 14 15 12 39 10 2 5 29 31 16 17 10 40 10 1 5 35 33 16 13 10 41 10 1 5 37 32 16 15 9 42 12 2 7 34 33 14 16 14 43 15 1 5 38 32 20 16 8 44 10 1 6 35 33 14 12 14 45 10 2 7 38 28 14 12 11 46 12 2 7 37 35 11 11 13 47 13 2 5 38 39 14 15 9 48 11 2 5 33 34 15 15 11 49 11 2 4 36 38 16 17 15 50 12 1 5 38 32 14 13 11 51 14 2 4 32 38 16 16 10 52 10 1 5 32 30 14 14 14 53 12 1 5 32 33 12 11 18 54 13 2 7 34 38 16 12 14 55 5 1 5 32 32 9 12 11 56 6 2 5 37 32 14 15 12 57 12 2 6 39 34 16 16 13 58 12 2 4 29 34 16 15 9 59 11 1 6 37 36 15 12 10 60 10 2 6 35 34 16 12 15 61 7 1 5 30 28 12 8 20 62 12 1 7 38 34 16 13 12 63 14 2 6 34 35 16 11 12 64 11 2 8 31 35 14 14 14 65 12 2 7 34 31 16 15 13 66 13 1 5 35 37 17 10 11 67 14 2 6 36 35 18 11 17 68 11 1 6 30 27 18 12 12 69 12 2 5 39 40 12 15 13 70 12 1 5 35 37 16 15 14 71 8 1 5 38 36 10 14 13 72 11 2 5 31 38 14 16 15 73 14 2 4 34 39 18 15 13 74 14 1 6 38 41 18 15 10 75 12 1 6 34 27 16 13 11 76 9 2 6 39 30 17 12 19 77 13 2 6 37 37 16 17 13 78 11 2 7 34 31 16 13 17 79 12 1 5 28 31 13 15 13 80 12 1 7 37 27 16 13 9 81 12 1 6 33 36 16 15 11 82 12 1 5 37 38 20 16 10 83 12 2 5 35 37 16 15 9 84 12 1 4 37 33 15 16 12 85 11 2 8 32 34 15 15 12 86 10 2 8 33 31 16 14 13 87 9 1 5 38 39 14 15 13 88 12 2 5 33 34 16 14 12 89 12 2 6 29 32 16 13 15 90 12 2 4 33 33 15 7 22 91 9 2 5 31 36 12 17 13 92 15 2 5 36 32 17 13 15 93 12 2 5 35 41 16 15 13 94 12 2 5 32 28 15 14 15 95 12 2 6 29 30 13 13 10 96 10 2 6 39 36 16 16 11 97 13 2 5 37 35 16 12 16 98 9 2 6 35 31 16 14 11 99 12 1 5 37 34 16 17 11 100 10 1 7 32 36 14 15 10 101 14 2 5 38 36 16 17 10 102 11 1 6 37 35 16 12 16 103 15 2 6 36 37 20 16 12 104 11 1 6 32 28 15 11 11 105 11 2 4 33 39 16 15 16 106 12 1 5 40 32 13 9 19 107 12 2 5 38 35 17 16 11 108 12 1 7 41 39 16 15 16 109 11 1 6 36 35 16 10 15 110 7 2 9 43 42 12 10 24 111 12 2 6 30 34 16 15 14 112 14 2 6 31 33 16 11 15 113 11 2 5 32 41 17 13 11 114 11 1 6 32 33 13 14 15 115 10 2 5 37 34 12 18 12 116 13 1 8 37 32 18 16 10 117 13 2 7 33 40 14 14 14 118 8 2 5 34 40 14 14 13 119 11 2 7 33 35 13 14 9 120 12 2 6 38 36 16 14 15 121 11 2 6 33 37 13 12 15 122 13 2 9 31 27 16 14 14 123 12 2 7 38 39 13 15 11 124 14 2 6 37 38 16 15 8 125 13 2 5 33 31 15 15 11 126 15 2 5 31 33 16 13 11 127 10 1 6 39 32 15 17 8 128 11 2 6 44 39 17 17 10 129 9 2 7 33 36 15 19 11 130 11 2 5 35 33 12 15 13 131 10 1 5 32 33 16 13 11 132 11 1 5 28 32 10 9 20 133 8 2 6 40 37 16 15 10 134 11 1 4 27 30 12 15 15 135 12 1 5 37 38 14 15 12 136 12 2 7 32 29 15 16 14 137 9 1 5 28 22 13 11 23 138 11 1 7 34 35 15 14 14 139 10 2 7 30 35 11 11 16 140 8 2 6 35 34 12 15 11 141 9 1 5 31 35 8 13 12 142 8 2 8 32 34 16 15 10 143 9 1 5 30 34 15 16 14 144 15 2 5 30 35 17 14 12 145 11 1 5 31 23 16 15 12 146 8 2 6 40 31 10 16 11 147 13 2 4 32 27 18 16 12 148 12 1 5 36 36 13 11 13 149 12 1 5 32 31 16 12 11 150 9 1 7 35 32 13 9 19 151 7 2 6 38 39 10 16 12 152 13 2 7 42 37 15 13 17 153 9 1 10 34 38 16 16 9 154 6 2 6 35 39 16 12 12 155 8 2 8 35 34 14 9 19 156 8 2 4 33 31 10 13 18 157 15 2 5 36 32 17 13 15 158 6 2 6 32 37 13 14 14 159 9 2 7 33 36 15 19 11 160 11 2 7 34 32 16 13 9 161 8 2 6 32 35 12 12 18 162 8 2 6 34 36 13 13 16 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Gender Age Connected Separate Learning 5.37902 0.51370 -0.16489 -0.03653 0.02044 0.51875 Happiness Depression -0.06574 -0.03620 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.0125 -0.9423 0.0958 1.2489 2.9479 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.37902 2.38776 2.253 0.0257 * Gender 0.51370 0.31204 1.646 0.1017 Age -0.16489 0.12429 -1.327 0.1866 Connected -0.03653 0.04666 -0.783 0.4348 Separate 0.02044 0.04440 0.460 0.6458 Learning 0.51875 0.06652 7.798 8.8e-13 *** Happiness -0.06574 0.07506 -0.876 0.3825 Depression -0.03620 0.05528 -0.655 0.5136 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.802 on 154 degrees of freedom Multiple R-squared: 0.3232, Adjusted R-squared: 0.2924 F-statistic: 10.51 on 7 and 154 DF, p-value: 9.268e-11 > 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.50607609 0.98784783 0.4939239 [2,] 0.33889711 0.67779423 0.6611029 [3,] 0.79242873 0.41514254 0.2075713 [4,] 0.73826922 0.52346157 0.2617308 [5,] 0.65431803 0.69136394 0.3456820 [6,] 0.75134804 0.49730392 0.2486520 [7,] 0.75720676 0.48558649 0.2427932 [8,] 0.81492347 0.37015306 0.1850765 [9,] 0.84187833 0.31624335 0.1581217 [10,] 0.86450642 0.27098717 0.1354936 [11,] 0.86682065 0.26635870 0.1331793 [12,] 0.82879287 0.34241427 0.1712071 [13,] 0.78899304 0.42201393 0.2110070 [14,] 0.77820347 0.44359306 0.2217965 [15,] 0.74156682 0.51686635 0.2584332 [16,] 0.70801734 0.58396533 0.2919827 [17,] 0.74089130 0.51821741 0.2591087 [18,] 0.76424657 0.47150686 0.2357534 [19,] 0.70989677 0.58020645 0.2901032 [20,] 0.65718928 0.68562143 0.3428107 [21,] 0.59840645 0.80318710 0.4015936 [22,] 0.56411287 0.87177425 0.4358871 [23,] 0.52679604 0.94640793 0.4732040 [24,] 0.46488298 0.92976595 0.5351170 [25,] 0.54130290 0.91739420 0.4586971 [26,] 0.48146399 0.96292797 0.5185360 [27,] 0.52940290 0.94119420 0.4705971 [28,] 0.61559799 0.76880401 0.3844020 [29,] 0.63504952 0.72990096 0.3649505 [30,] 0.59611868 0.80776264 0.4038813 [31,] 0.55418362 0.89163277 0.4458164 [32,] 0.51641474 0.96717052 0.4835853 [33,] 0.59922451 0.80155098 0.4007755 [34,] 0.54702573 0.90594853 0.4529743 [35,] 0.52853929 0.94292142 0.4714607 [36,] 0.55367683 0.89264633 0.4463232 [37,] 0.55652323 0.88695354 0.4434768 [38,] 0.50919982 0.98160037 0.4908002 [39,] 0.46241907 0.92483814 0.5375809 [40,] 0.48358104 0.96716209 0.5164190 [41,] 0.48891585 0.97783170 0.5110842 [42,] 0.44372787 0.88745574 0.5562721 [43,] 0.51943419 0.96113162 0.4805658 [44,] 0.48105910 0.96211819 0.5189409 [45,] 0.58275611 0.83448779 0.4172439 [46,] 0.82916999 0.34166003 0.1708300 [47,] 0.79806437 0.40387127 0.2019356 [48,] 0.76395748 0.47208505 0.2360425 [49,] 0.72500875 0.54998250 0.2749912 [50,] 0.73164703 0.53670595 0.2683530 [51,] 0.75550720 0.48898560 0.2444928 [52,] 0.72581900 0.54836201 0.2741810 [53,] 0.72367370 0.55265260 0.2763263 [54,] 0.69594458 0.60811084 0.3040554 [55,] 0.65651595 0.68696810 0.3434841 [56,] 0.61989758 0.76020483 0.3801024 [57,] 0.59393090 0.81213820 0.4060691 [58,] 0.57550944 0.84898111 0.4244906 [59,] 0.58700100 0.82599800 0.4129990 [60,] 0.54863102 0.90273797 0.4513690 [61,] 0.50447909 0.99104181 0.4955209 [62,] 0.45952666 0.91905332 0.5404733 [63,] 0.42202294 0.84404588 0.5779771 [64,] 0.40615880 0.81231760 0.5938412 [65,] 0.38652929 0.77305857 0.6134707 [66,] 0.45491255 0.90982510 0.5450875 [67,] 0.44071915 0.88143830 0.5592809 [68,] 0.39722541 0.79445082 0.6027746 [69,] 0.42216374 0.84432748 0.5778363 [70,] 0.39401600 0.78803200 0.6059840 [71,] 0.35449278 0.70898556 0.6455072 [72,] 0.34151255 0.68302509 0.6584875 [73,] 0.30145339 0.60290679 0.6985466 [74,] 0.28982142 0.57964283 0.7101786 [75,] 0.26184145 0.52368289 0.7381586 [76,] 0.25155944 0.50311889 0.7484406 [77,] 0.24065763 0.48131526 0.7593424 [78,] 0.20555307 0.41110614 0.7944469 [79,] 0.17397460 0.34794920 0.8260254 [80,] 0.15151208 0.30302417 0.8484879 [81,] 0.13191857 0.26383715 0.8680814 [82,] 0.16670001 0.33340003 0.8333000 [83,] 0.14204923 0.28409846 0.8579508 [84,] 0.12335572 0.24671145 0.8766443 [85,] 0.11493364 0.22986729 0.8850664 [86,] 0.11180698 0.22361396 0.8881930 [87,] 0.09767904 0.19535808 0.9023210 [88,] 0.13154215 0.26308431 0.8684578 [89,] 0.11237589 0.22475179 0.8876241 [90,] 0.09264150 0.18528301 0.9073585 [91,] 0.10281830 0.20563659 0.8971817 [92,] 0.08372616 0.16745232 0.9162738 [93,] 0.07809243 0.15618486 0.9219076 [94,] 0.06503975 0.13007950 0.9349602 [95,] 0.05392308 0.10784616 0.9460769 [96,] 0.05610182 0.11220365 0.9438982 [97,] 0.04368487 0.08736975 0.9563151 [98,] 0.03988763 0.07977525 0.9601124 [99,] 0.03121259 0.06242518 0.9687874 [100,] 0.03308808 0.06617617 0.9669119 [101,] 0.02557694 0.05115388 0.9744231 [102,] 0.02721561 0.05443122 0.9727844 [103,] 0.02558034 0.05116067 0.9744197 [104,] 0.02188733 0.04377466 0.9781127 [105,] 0.01654246 0.03308492 0.9834575 [106,] 0.01408864 0.02817728 0.9859114 [107,] 0.02356144 0.04712287 0.9764386 [108,] 0.03260378 0.06520755 0.9673962 [109,] 0.02596310 0.05192620 0.9740369 [110,] 0.02004189 0.04008379 0.9799581 [111,] 0.01576746 0.03153493 0.9842325 [112,] 0.02186892 0.04373784 0.9781311 [113,] 0.03060034 0.06120067 0.9693997 [114,] 0.04174208 0.08348417 0.9582579 [115,] 0.04038476 0.08076951 0.9596152 [116,] 0.08001926 0.16003853 0.9199807 [117,] 0.06342796 0.12685593 0.9365720 [118,] 0.04914400 0.09828801 0.9508560 [119,] 0.04162883 0.08325767 0.9583712 [120,] 0.03763333 0.07526666 0.9623667 [121,] 0.03601689 0.07203379 0.9639831 [122,] 0.03913730 0.07827459 0.9608627 [123,] 0.07890493 0.15780985 0.9210951 [124,] 0.07010893 0.14021785 0.9298911 [125,] 0.05708677 0.11417353 0.9429132 [126,] 0.07021631 0.14043263 0.9297837 [127,] 0.05439653 0.10879306 0.9456035 [128,] 0.04047882 0.08095763 0.9595212 [129,] 0.08686718 0.17373436 0.9131328 [130,] 0.06576291 0.13152581 0.9342371 [131,] 0.12116027 0.24232054 0.8788397 [132,] 0.10874156 0.21748313 0.8912584 [133,] 0.09961663 0.19923325 0.9003834 [134,] 0.40141432 0.80282864 0.5985857 [135,] 0.47099720 0.94199440 0.5290028 [136,] 0.55375628 0.89248744 0.4462437 [137,] 0.60294895 0.79410210 0.3970510 [138,] 0.77657192 0.44685616 0.2234281 [139,] 0.69278742 0.61442515 0.3072126 [140,] 0.63686507 0.72626987 0.3631349 [141,] 0.54623144 0.90753713 0.4537686 > postscript(file="/var/wessaorg/rcomp/tmp/10eqk1354801787.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/wessaorg/rcomp/tmp/2uglf1354801787.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/wessaorg/rcomp/tmp/3r78y1354801787.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/wessaorg/rcomp/tmp/410cp1354801787.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/wessaorg/rcomp/tmp/5p5xj1354801787.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.07973411 -0.52994963 1.17211199 -5.16842895 2.94785820 0.14259694 7 8 9 10 11 12 -0.93053056 2.62630870 1.10321199 -5.49663764 -0.96938185 0.27671221 13 14 15 16 17 18 0.50477250 -0.51060076 2.92348152 1.23686852 -0.43166747 -1.66498806 19 20 21 22 23 24 -0.98088324 0.48503647 -0.43720864 -0.15333138 -0.10582894 -0.70216626 25 26 27 28 29 30 -2.60073984 0.19543123 -0.49418509 2.71412514 0.14179659 -0.56962427 31 32 33 34 35 36 0.57445052 -1.56352975 -0.48211135 -0.01204077 1.68892128 0.13626292 37 38 39 40 41 42 -2.51448534 1.73019329 -1.97675797 -1.54771033 -1.35892514 1.61135382 43 44 45 46 47 48 1.63214670 -0.26626284 -0.51184704 2.87142268 2.05830215 -0.46849108 49 50 51 52 53 54 -0.84804716 1.65602617 1.75909855 -0.34794398 2.57580223 1.20868269 55 56 57 58 59 60 -3.03515169 -4.72652917 0.53497638 -0.37065720 0.08192726 -1.80170644 61 62 63 64 65 66 -2.51986042 0.94362423 1.96698623 0.49428909 0.51280539 0.69074833 67 68 69 70 71 72 1.18353928 -1.47365403 2.25668174 0.64678254 -0.21261505 0.10595047 73 74 75 76 77 78 0.81707384 1.65720430 0.73951247 -2.94776306 1.46631991 -0.47387894 79 80 81 82 83 84 2.03377590 0.94160519 0.65046304 -1.45465165 -0.04790508 1.14881920 85 86 87 88 89 90 0.02585667 -1.42457049 -1.28320819 -0.01678118 0.08572953 0.25933180 91 92 93 94 95 96 -0.82231987 2.65780702 0.01511164 0.69669371 1.50187723 -1.57830708 97 98 99 100 101 102 1.12221715 -2.75369079 0.80405937 -0.21987278 2.24980763 -0.19919120 103 104 105 106 107 108 1.25285238 0.03327930 -1.07336396 2.27447070 -0.27803869 1.22726815 109 110 111 112 113 114 -0.40339692 -1.90901704 0.17665179 2.00687282 -1.81710522 1.31056642 115 116 117 118 119 120 0.46729745 1.20019235 2.30023963 -3.02921432 0.74021870 0.39847698 121 122 123 124 125 126 0.62014893 1.78523315 1.97923563 2.13341021 1.59284024 2.82866335 127 128 129 130 131 132 -0.50693995 -0.94619022 -1.91663873 1.25366174 -1.62110720 2.42853928 133 134 135 136 137 138 -3.66415528 1.44394015 1.66450602 1.10131573 -0.68320287 0.43393798 139 140 141 142 143 144 0.72429529 -1.67428415 1.48767138 -3.56528922 -1.89005613 2.33443025 145 146 147 148 149 150 -0.28552695 -0.32705676 0.01887605 1.96085759 0.35404228 -0.57839974 151 152 153 154 155 156 -1.52747222 2.21446125 -1.70097554 -6.01251919 -2.48684130 -0.85639416 157 158 159 160 161 162 2.65780702 -4.32110448 -1.91663873 -0.78390636 -1.74815129 -2.22093965 > postscript(file="/var/wessaorg/rcomp/tmp/6pafo1354801787.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.07973411 NA 1 -0.52994963 2.07973411 2 1.17211199 -0.52994963 3 -5.16842895 1.17211199 4 2.94785820 -5.16842895 5 0.14259694 2.94785820 6 -0.93053056 0.14259694 7 2.62630870 -0.93053056 8 1.10321199 2.62630870 9 -5.49663764 1.10321199 10 -0.96938185 -5.49663764 11 0.27671221 -0.96938185 12 0.50477250 0.27671221 13 -0.51060076 0.50477250 14 2.92348152 -0.51060076 15 1.23686852 2.92348152 16 -0.43166747 1.23686852 17 -1.66498806 -0.43166747 18 -0.98088324 -1.66498806 19 0.48503647 -0.98088324 20 -0.43720864 0.48503647 21 -0.15333138 -0.43720864 22 -0.10582894 -0.15333138 23 -0.70216626 -0.10582894 24 -2.60073984 -0.70216626 25 0.19543123 -2.60073984 26 -0.49418509 0.19543123 27 2.71412514 -0.49418509 28 0.14179659 2.71412514 29 -0.56962427 0.14179659 30 0.57445052 -0.56962427 31 -1.56352975 0.57445052 32 -0.48211135 -1.56352975 33 -0.01204077 -0.48211135 34 1.68892128 -0.01204077 35 0.13626292 1.68892128 36 -2.51448534 0.13626292 37 1.73019329 -2.51448534 38 -1.97675797 1.73019329 39 -1.54771033 -1.97675797 40 -1.35892514 -1.54771033 41 1.61135382 -1.35892514 42 1.63214670 1.61135382 43 -0.26626284 1.63214670 44 -0.51184704 -0.26626284 45 2.87142268 -0.51184704 46 2.05830215 2.87142268 47 -0.46849108 2.05830215 48 -0.84804716 -0.46849108 49 1.65602617 -0.84804716 50 1.75909855 1.65602617 51 -0.34794398 1.75909855 52 2.57580223 -0.34794398 53 1.20868269 2.57580223 54 -3.03515169 1.20868269 55 -4.72652917 -3.03515169 56 0.53497638 -4.72652917 57 -0.37065720 0.53497638 58 0.08192726 -0.37065720 59 -1.80170644 0.08192726 60 -2.51986042 -1.80170644 61 0.94362423 -2.51986042 62 1.96698623 0.94362423 63 0.49428909 1.96698623 64 0.51280539 0.49428909 65 0.69074833 0.51280539 66 1.18353928 0.69074833 67 -1.47365403 1.18353928 68 2.25668174 -1.47365403 69 0.64678254 2.25668174 70 -0.21261505 0.64678254 71 0.10595047 -0.21261505 72 0.81707384 0.10595047 73 1.65720430 0.81707384 74 0.73951247 1.65720430 75 -2.94776306 0.73951247 76 1.46631991 -2.94776306 77 -0.47387894 1.46631991 78 2.03377590 -0.47387894 79 0.94160519 2.03377590 80 0.65046304 0.94160519 81 -1.45465165 0.65046304 82 -0.04790508 -1.45465165 83 1.14881920 -0.04790508 84 0.02585667 1.14881920 85 -1.42457049 0.02585667 86 -1.28320819 -1.42457049 87 -0.01678118 -1.28320819 88 0.08572953 -0.01678118 89 0.25933180 0.08572953 90 -0.82231987 0.25933180 91 2.65780702 -0.82231987 92 0.01511164 2.65780702 93 0.69669371 0.01511164 94 1.50187723 0.69669371 95 -1.57830708 1.50187723 96 1.12221715 -1.57830708 97 -2.75369079 1.12221715 98 0.80405937 -2.75369079 99 -0.21987278 0.80405937 100 2.24980763 -0.21987278 101 -0.19919120 2.24980763 102 1.25285238 -0.19919120 103 0.03327930 1.25285238 104 -1.07336396 0.03327930 105 2.27447070 -1.07336396 106 -0.27803869 2.27447070 107 1.22726815 -0.27803869 108 -0.40339692 1.22726815 109 -1.90901704 -0.40339692 110 0.17665179 -1.90901704 111 2.00687282 0.17665179 112 -1.81710522 2.00687282 113 1.31056642 -1.81710522 114 0.46729745 1.31056642 115 1.20019235 0.46729745 116 2.30023963 1.20019235 117 -3.02921432 2.30023963 118 0.74021870 -3.02921432 119 0.39847698 0.74021870 120 0.62014893 0.39847698 121 1.78523315 0.62014893 122 1.97923563 1.78523315 123 2.13341021 1.97923563 124 1.59284024 2.13341021 125 2.82866335 1.59284024 126 -0.50693995 2.82866335 127 -0.94619022 -0.50693995 128 -1.91663873 -0.94619022 129 1.25366174 -1.91663873 130 -1.62110720 1.25366174 131 2.42853928 -1.62110720 132 -3.66415528 2.42853928 133 1.44394015 -3.66415528 134 1.66450602 1.44394015 135 1.10131573 1.66450602 136 -0.68320287 1.10131573 137 0.43393798 -0.68320287 138 0.72429529 0.43393798 139 -1.67428415 0.72429529 140 1.48767138 -1.67428415 141 -3.56528922 1.48767138 142 -1.89005613 -3.56528922 143 2.33443025 -1.89005613 144 -0.28552695 2.33443025 145 -0.32705676 -0.28552695 146 0.01887605 -0.32705676 147 1.96085759 0.01887605 148 0.35404228 1.96085759 149 -0.57839974 0.35404228 150 -1.52747222 -0.57839974 151 2.21446125 -1.52747222 152 -1.70097554 2.21446125 153 -6.01251919 -1.70097554 154 -2.48684130 -6.01251919 155 -0.85639416 -2.48684130 156 2.65780702 -0.85639416 157 -4.32110448 2.65780702 158 -1.91663873 -4.32110448 159 -0.78390636 -1.91663873 160 -1.74815129 -0.78390636 161 -2.22093965 -1.74815129 162 NA -2.22093965 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.52994963 2.07973411 [2,] 1.17211199 -0.52994963 [3,] -5.16842895 1.17211199 [4,] 2.94785820 -5.16842895 [5,] 0.14259694 2.94785820 [6,] -0.93053056 0.14259694 [7,] 2.62630870 -0.93053056 [8,] 1.10321199 2.62630870 [9,] -5.49663764 1.10321199 [10,] -0.96938185 -5.49663764 [11,] 0.27671221 -0.96938185 [12,] 0.50477250 0.27671221 [13,] -0.51060076 0.50477250 [14,] 2.92348152 -0.51060076 [15,] 1.23686852 2.92348152 [16,] -0.43166747 1.23686852 [17,] -1.66498806 -0.43166747 [18,] -0.98088324 -1.66498806 [19,] 0.48503647 -0.98088324 [20,] -0.43720864 0.48503647 [21,] -0.15333138 -0.43720864 [22,] -0.10582894 -0.15333138 [23,] -0.70216626 -0.10582894 [24,] -2.60073984 -0.70216626 [25,] 0.19543123 -2.60073984 [26,] -0.49418509 0.19543123 [27,] 2.71412514 -0.49418509 [28,] 0.14179659 2.71412514 [29,] -0.56962427 0.14179659 [30,] 0.57445052 -0.56962427 [31,] -1.56352975 0.57445052 [32,] -0.48211135 -1.56352975 [33,] -0.01204077 -0.48211135 [34,] 1.68892128 -0.01204077 [35,] 0.13626292 1.68892128 [36,] -2.51448534 0.13626292 [37,] 1.73019329 -2.51448534 [38,] -1.97675797 1.73019329 [39,] -1.54771033 -1.97675797 [40,] -1.35892514 -1.54771033 [41,] 1.61135382 -1.35892514 [42,] 1.63214670 1.61135382 [43,] -0.26626284 1.63214670 [44,] -0.51184704 -0.26626284 [45,] 2.87142268 -0.51184704 [46,] 2.05830215 2.87142268 [47,] -0.46849108 2.05830215 [48,] -0.84804716 -0.46849108 [49,] 1.65602617 -0.84804716 [50,] 1.75909855 1.65602617 [51,] -0.34794398 1.75909855 [52,] 2.57580223 -0.34794398 [53,] 1.20868269 2.57580223 [54,] -3.03515169 1.20868269 [55,] -4.72652917 -3.03515169 [56,] 0.53497638 -4.72652917 [57,] -0.37065720 0.53497638 [58,] 0.08192726 -0.37065720 [59,] -1.80170644 0.08192726 [60,] -2.51986042 -1.80170644 [61,] 0.94362423 -2.51986042 [62,] 1.96698623 0.94362423 [63,] 0.49428909 1.96698623 [64,] 0.51280539 0.49428909 [65,] 0.69074833 0.51280539 [66,] 1.18353928 0.69074833 [67,] -1.47365403 1.18353928 [68,] 2.25668174 -1.47365403 [69,] 0.64678254 2.25668174 [70,] -0.21261505 0.64678254 [71,] 0.10595047 -0.21261505 [72,] 0.81707384 0.10595047 [73,] 1.65720430 0.81707384 [74,] 0.73951247 1.65720430 [75,] -2.94776306 0.73951247 [76,] 1.46631991 -2.94776306 [77,] -0.47387894 1.46631991 [78,] 2.03377590 -0.47387894 [79,] 0.94160519 2.03377590 [80,] 0.65046304 0.94160519 [81,] -1.45465165 0.65046304 [82,] -0.04790508 -1.45465165 [83,] 1.14881920 -0.04790508 [84,] 0.02585667 1.14881920 [85,] -1.42457049 0.02585667 [86,] -1.28320819 -1.42457049 [87,] -0.01678118 -1.28320819 [88,] 0.08572953 -0.01678118 [89,] 0.25933180 0.08572953 [90,] -0.82231987 0.25933180 [91,] 2.65780702 -0.82231987 [92,] 0.01511164 2.65780702 [93,] 0.69669371 0.01511164 [94,] 1.50187723 0.69669371 [95,] -1.57830708 1.50187723 [96,] 1.12221715 -1.57830708 [97,] -2.75369079 1.12221715 [98,] 0.80405937 -2.75369079 [99,] -0.21987278 0.80405937 [100,] 2.24980763 -0.21987278 [101,] -0.19919120 2.24980763 [102,] 1.25285238 -0.19919120 [103,] 0.03327930 1.25285238 [104,] -1.07336396 0.03327930 [105,] 2.27447070 -1.07336396 [106,] -0.27803869 2.27447070 [107,] 1.22726815 -0.27803869 [108,] -0.40339692 1.22726815 [109,] -1.90901704 -0.40339692 [110,] 0.17665179 -1.90901704 [111,] 2.00687282 0.17665179 [112,] -1.81710522 2.00687282 [113,] 1.31056642 -1.81710522 [114,] 0.46729745 1.31056642 [115,] 1.20019235 0.46729745 [116,] 2.30023963 1.20019235 [117,] -3.02921432 2.30023963 [118,] 0.74021870 -3.02921432 [119,] 0.39847698 0.74021870 [120,] 0.62014893 0.39847698 [121,] 1.78523315 0.62014893 [122,] 1.97923563 1.78523315 [123,] 2.13341021 1.97923563 [124,] 1.59284024 2.13341021 [125,] 2.82866335 1.59284024 [126,] -0.50693995 2.82866335 [127,] -0.94619022 -0.50693995 [128,] -1.91663873 -0.94619022 [129,] 1.25366174 -1.91663873 [130,] -1.62110720 1.25366174 [131,] 2.42853928 -1.62110720 [132,] -3.66415528 2.42853928 [133,] 1.44394015 -3.66415528 [134,] 1.66450602 1.44394015 [135,] 1.10131573 1.66450602 [136,] -0.68320287 1.10131573 [137,] 0.43393798 -0.68320287 [138,] 0.72429529 0.43393798 [139,] -1.67428415 0.72429529 [140,] 1.48767138 -1.67428415 [141,] -3.56528922 1.48767138 [142,] -1.89005613 -3.56528922 [143,] 2.33443025 -1.89005613 [144,] -0.28552695 2.33443025 [145,] -0.32705676 -0.28552695 [146,] 0.01887605 -0.32705676 [147,] 1.96085759 0.01887605 [148,] 0.35404228 1.96085759 [149,] -0.57839974 0.35404228 [150,] -1.52747222 -0.57839974 [151,] 2.21446125 -1.52747222 [152,] -1.70097554 2.21446125 [153,] -6.01251919 -1.70097554 [154,] -2.48684130 -6.01251919 [155,] -0.85639416 -2.48684130 [156,] 2.65780702 -0.85639416 [157,] -4.32110448 2.65780702 [158,] -1.91663873 -4.32110448 [159,] -0.78390636 -1.91663873 [160,] -1.74815129 -0.78390636 [161,] -2.22093965 -1.74815129 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.52994963 2.07973411 2 1.17211199 -0.52994963 3 -5.16842895 1.17211199 4 2.94785820 -5.16842895 5 0.14259694 2.94785820 6 -0.93053056 0.14259694 7 2.62630870 -0.93053056 8 1.10321199 2.62630870 9 -5.49663764 1.10321199 10 -0.96938185 -5.49663764 11 0.27671221 -0.96938185 12 0.50477250 0.27671221 13 -0.51060076 0.50477250 14 2.92348152 -0.51060076 15 1.23686852 2.92348152 16 -0.43166747 1.23686852 17 -1.66498806 -0.43166747 18 -0.98088324 -1.66498806 19 0.48503647 -0.98088324 20 -0.43720864 0.48503647 21 -0.15333138 -0.43720864 22 -0.10582894 -0.15333138 23 -0.70216626 -0.10582894 24 -2.60073984 -0.70216626 25 0.19543123 -2.60073984 26 -0.49418509 0.19543123 27 2.71412514 -0.49418509 28 0.14179659 2.71412514 29 -0.56962427 0.14179659 30 0.57445052 -0.56962427 31 -1.56352975 0.57445052 32 -0.48211135 -1.56352975 33 -0.01204077 -0.48211135 34 1.68892128 -0.01204077 35 0.13626292 1.68892128 36 -2.51448534 0.13626292 37 1.73019329 -2.51448534 38 -1.97675797 1.73019329 39 -1.54771033 -1.97675797 40 -1.35892514 -1.54771033 41 1.61135382 -1.35892514 42 1.63214670 1.61135382 43 -0.26626284 1.63214670 44 -0.51184704 -0.26626284 45 2.87142268 -0.51184704 46 2.05830215 2.87142268 47 -0.46849108 2.05830215 48 -0.84804716 -0.46849108 49 1.65602617 -0.84804716 50 1.75909855 1.65602617 51 -0.34794398 1.75909855 52 2.57580223 -0.34794398 53 1.20868269 2.57580223 54 -3.03515169 1.20868269 55 -4.72652917 -3.03515169 56 0.53497638 -4.72652917 57 -0.37065720 0.53497638 58 0.08192726 -0.37065720 59 -1.80170644 0.08192726 60 -2.51986042 -1.80170644 61 0.94362423 -2.51986042 62 1.96698623 0.94362423 63 0.49428909 1.96698623 64 0.51280539 0.49428909 65 0.69074833 0.51280539 66 1.18353928 0.69074833 67 -1.47365403 1.18353928 68 2.25668174 -1.47365403 69 0.64678254 2.25668174 70 -0.21261505 0.64678254 71 0.10595047 -0.21261505 72 0.81707384 0.10595047 73 1.65720430 0.81707384 74 0.73951247 1.65720430 75 -2.94776306 0.73951247 76 1.46631991 -2.94776306 77 -0.47387894 1.46631991 78 2.03377590 -0.47387894 79 0.94160519 2.03377590 80 0.65046304 0.94160519 81 -1.45465165 0.65046304 82 -0.04790508 -1.45465165 83 1.14881920 -0.04790508 84 0.02585667 1.14881920 85 -1.42457049 0.02585667 86 -1.28320819 -1.42457049 87 -0.01678118 -1.28320819 88 0.08572953 -0.01678118 89 0.25933180 0.08572953 90 -0.82231987 0.25933180 91 2.65780702 -0.82231987 92 0.01511164 2.65780702 93 0.69669371 0.01511164 94 1.50187723 0.69669371 95 -1.57830708 1.50187723 96 1.12221715 -1.57830708 97 -2.75369079 1.12221715 98 0.80405937 -2.75369079 99 -0.21987278 0.80405937 100 2.24980763 -0.21987278 101 -0.19919120 2.24980763 102 1.25285238 -0.19919120 103 0.03327930 1.25285238 104 -1.07336396 0.03327930 105 2.27447070 -1.07336396 106 -0.27803869 2.27447070 107 1.22726815 -0.27803869 108 -0.40339692 1.22726815 109 -1.90901704 -0.40339692 110 0.17665179 -1.90901704 111 2.00687282 0.17665179 112 -1.81710522 2.00687282 113 1.31056642 -1.81710522 114 0.46729745 1.31056642 115 1.20019235 0.46729745 116 2.30023963 1.20019235 117 -3.02921432 2.30023963 118 0.74021870 -3.02921432 119 0.39847698 0.74021870 120 0.62014893 0.39847698 121 1.78523315 0.62014893 122 1.97923563 1.78523315 123 2.13341021 1.97923563 124 1.59284024 2.13341021 125 2.82866335 1.59284024 126 -0.50693995 2.82866335 127 -0.94619022 -0.50693995 128 -1.91663873 -0.94619022 129 1.25366174 -1.91663873 130 -1.62110720 1.25366174 131 2.42853928 -1.62110720 132 -3.66415528 2.42853928 133 1.44394015 -3.66415528 134 1.66450602 1.44394015 135 1.10131573 1.66450602 136 -0.68320287 1.10131573 137 0.43393798 -0.68320287 138 0.72429529 0.43393798 139 -1.67428415 0.72429529 140 1.48767138 -1.67428415 141 -3.56528922 1.48767138 142 -1.89005613 -3.56528922 143 2.33443025 -1.89005613 144 -0.28552695 2.33443025 145 -0.32705676 -0.28552695 146 0.01887605 -0.32705676 147 1.96085759 0.01887605 148 0.35404228 1.96085759 149 -0.57839974 0.35404228 150 -1.52747222 -0.57839974 151 2.21446125 -1.52747222 152 -1.70097554 2.21446125 153 -6.01251919 -1.70097554 154 -2.48684130 -6.01251919 155 -0.85639416 -2.48684130 156 2.65780702 -0.85639416 157 -4.32110448 2.65780702 158 -1.91663873 -4.32110448 159 -0.78390636 -1.91663873 160 -1.74815129 -0.78390636 161 -2.22093965 -1.74815129 > 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/wessaorg/rcomp/tmp/7ui2g1354801787.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/wessaorg/rcomp/tmp/8dn7k1354801787.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/wessaorg/rcomp/tmp/94kob1354801787.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/wessaorg/rcomp/tmp/10am331354801787.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11axv61354801787.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/wessaorg/rcomp/tmp/12f9ln1354801787.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/wessaorg/rcomp/tmp/13f1n11354801787.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/wessaorg/rcomp/tmp/142ftm1354801787.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/wessaorg/rcomp/tmp/15pn1w1354801787.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/wessaorg/rcomp/tmp/16ea7c1354801788.tab") + } > > try(system("convert tmp/10eqk1354801787.ps tmp/10eqk1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/2uglf1354801787.ps tmp/2uglf1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/3r78y1354801787.ps tmp/3r78y1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/410cp1354801787.ps tmp/410cp1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/5p5xj1354801787.ps tmp/5p5xj1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/6pafo1354801787.ps tmp/6pafo1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/7ui2g1354801787.ps tmp/7ui2g1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/8dn7k1354801787.ps tmp/8dn7k1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/94kob1354801787.ps tmp/94kob1354801787.png",intern=TRUE)) character(0) > try(system("convert tmp/10am331354801787.ps tmp/10am331354801787.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 14.478 1.900 16.436