R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(12 + ,2 + ,53 + ,10 + ,7 + ,6 + ,0 + ,9 + ,11 + ,2 + ,86 + ,12 + ,5 + ,6 + ,0 + ,9 + ,14 + ,4 + ,66 + ,11 + ,7 + ,11 + ,0 + ,9 + ,12 + ,3 + ,67 + ,10 + ,3 + ,7 + ,1 + ,9 + ,21 + ,4 + ,76 + ,12 + ,7 + ,12 + ,0 + ,9 + ,12 + ,3 + ,78 + ,12 + ,7 + ,8 + ,0 + ,9 + ,22 + ,3 + ,53 + ,14 + ,7 + ,7 + ,0 + ,9 + ,11 + ,4 + ,80 + ,14 + ,1 + ,11 + ,0 + ,9 + ,10 + ,3 + ,74 + ,11 + ,4 + ,8 + ,0 + ,9 + ,13 + ,4 + ,76 + ,11 + ,5 + ,9 + ,0 + ,9 + ,10 + ,3 + ,79 + ,13 + ,6 + ,9 + ,1 + ,9 + ,8 + ,2 + ,54 + ,11 + ,4 + ,6 + ,0 + ,9 + ,15 + ,3 + ,67 + ,10 + ,7 + ,9 + ,1 + ,9 + ,10 + ,3 + ,87 + ,14 + ,6 + ,5 + ,0 + ,9 + ,14 + ,3 + ,58 + ,14 + ,2 + ,9 + ,1 + ,9 + ,14 + ,2 + ,75 + ,12 + ,2 + ,4 + ,1 + ,9 + ,11 + ,3 + ,88 + ,11 + ,6 + ,9 + ,0 + ,9 + ,10 + ,2 + ,64 + ,10 + ,7 + ,6 + ,1 + ,9 + ,13 + ,4 + ,57 + ,12 + ,5 + ,8 + ,0 + ,9 + ,7 + ,5 + ,66 + ,10 + ,2 + ,12 + ,1 + ,9 + ,12 + ,3 + ,54 + ,14 + ,7 + ,7 + ,0 + ,9 + ,14 + ,3 + ,56 + ,12 + ,4 + ,8 + ,0 + ,9 + ,11 + ,1 + ,86 + ,13 + ,5 + ,3 + ,1 + ,9 + ,9 + ,4 + ,80 + ,13 + ,5 + ,9 + ,0 + ,9 + ,11 + ,3 + ,76 + ,12 + ,5 + ,7 + ,1 + ,9 + ,15 + ,4 + ,69 + ,14 + ,3 + ,9 + ,0 + ,9 + ,13 + ,3 + ,67 + ,11 + ,5 + ,9 + ,1 + ,9 + ,9 + ,3 + ,80 + ,12 + ,1 + ,7 + ,0 + ,9 + ,15 + ,1 + ,54 + ,13 + ,1 + ,5 + ,1 + ,9 + ,10 + ,4 + ,71 + ,11 + ,3 + ,8 + ,0 + ,9 + ,11 + ,4 + ,84 + ,11 + ,2 + ,7 + ,0 + ,9 + ,13 + ,2 + ,74 + ,14 + ,3 + ,6 + ,1 + ,9 + ,8 + ,2 + ,71 + ,12 + ,2 + ,6 + ,1 + ,9 + ,20 + ,1 + ,63 + ,13 + ,5 + ,4 + ,1 + ,9 + ,12 + ,3 + ,71 + ,11 + ,2 + ,8 + ,1 + ,9 + ,10 + ,4 + ,76 + ,13 + ,3 + ,8 + ,0 + ,9 + ,10 + ,1 + ,69 + ,13 + ,4 + ,3 + ,1 + ,9 + ,9 + ,3 + ,74 + ,13 + ,6 + ,8 + ,1 + ,9 + ,14 + ,3 + ,75 + ,12 + ,2 + ,9 + ,0 + ,9 + ,8 + ,2 + ,54 + ,14 + ,7 + ,6 + ,1 + ,9 + ,14 + ,4 + ,52 + ,14 + ,6 + ,9 + ,1 + ,9 + ,11 + ,3 + ,69 + ,8 + ,5 + ,5 + ,0 + ,9 + ,13 + ,3 + ,68 + ,13 + ,3 + ,8 + ,0 + ,9 + ,11 + ,2 + ,75 + ,11 + ,3 + ,6 + ,0 + ,9 + ,11 + ,3 + ,75 + ,13 + ,4 + ,9 + ,1 + ,9 + ,10 + ,2 + ,72 + ,10 + ,5 + ,8 + ,0 + ,9 + ,14 + ,1 + ,67 + ,10 + ,2 + ,5 + ,1 + ,9 + ,18 + ,3 + ,63 + ,13 + ,7 + ,9 + ,1 + ,9 + ,14 + ,3 + ,62 + ,12 + ,6 + ,8 + ,0 + ,9 + ,11 + ,5 + ,63 + ,16 + ,5 + ,11 + ,1 + ,9 + ,12 + ,1 + ,76 + ,13 + ,6 + ,7 + ,0 + ,9 + ,13 + ,3 + ,74 + ,12 + ,5 + ,9 + ,0 + ,9 + ,9 + ,4 + ,67 + ,11 + ,2 + ,11 + ,0 + ,9 + ,10 + ,3 + ,73 + ,12 + ,3 + ,9 + ,1 + ,9 + ,15 + ,4 + ,70 + ,12 + ,5 + ,10 + ,0 + ,9 + ,20 + ,2 + ,53 + ,14 + ,7 + ,6 + ,1 + ,9 + ,12 + ,3 + ,77 + ,13 + ,4 + ,9 + ,1 + ,9 + ,12 + ,4 + ,77 + ,13 + ,7 + ,9 + ,0 + ,9 + ,14 + ,1 + ,52 + ,12 + ,5 + ,3 + ,0 + ,9 + ,13 + ,1 + ,54 + ,13 + ,6 + ,3 + ,0 + ,9 + ,11 + ,1 + ,80 + ,12 + ,6 + ,3 + ,1 + ,10 + ,17 + ,4 + ,66 + ,13 + ,3 + ,12 + ,0 + ,10 + ,12 + ,2 + ,73 + ,14 + ,5 + ,8 + ,1 + ,10 + ,13 + ,3 + ,63 + ,13 + ,7 + ,9 + ,0 + ,10 + ,14 + ,4 + ,69 + ,13 + ,7 + ,10 + ,1 + ,10 + ,13 + ,2 + ,67 + ,12 + ,5 + ,4 + ,1 + ,10 + ,15 + ,5 + ,54 + ,10 + ,6 + ,14 + ,0 + ,10 + ,13 + ,3 + ,81 + ,13 + ,5 + ,8 + ,0 + ,10 + ,10 + ,3 + ,69 + ,11 + ,5 + ,6 + ,1 + ,10 + ,11 + ,3 + ,84 + ,11 + ,2 + ,9 + ,1 + ,10 + ,13 + ,4 + ,70 + ,13 + ,5 + ,10 + ,0 + ,10 + ,17 + ,4 + ,69 + ,11 + ,4 + ,10 + ,0 + ,10 + ,13 + ,3 + ,77 + ,15 + ,6 + ,7 + ,1 + ,10 + ,9 + ,1 + ,54 + ,13 + ,5 + ,3 + ,1 + ,10 + ,11 + ,3 + ,79 + ,13 + ,3 + ,6 + ,1 + ,10 + ,10 + ,1 + ,30 + ,12 + ,3 + ,4 + ,1 + ,10 + ,9 + ,3 + ,71 + ,11 + ,4 + ,9 + ,0 + ,10 + ,12 + ,5 + ,73 + ,12 + ,2 + ,11 + ,1 + ,10 + ,12 + ,3 + ,72 + ,13 + ,2 + ,6 + ,0 + ,10 + ,13 + ,3 + ,77 + ,12 + ,5 + ,7 + ,0 + ,10 + ,13 + ,4 + ,75 + ,13 + ,4 + ,8 + ,1 + ,10 + ,22 + ,5 + ,70 + ,15 + ,6 + ,11 + ,0 + ,10 + ,13 + ,4 + ,73 + ,13 + ,4 + ,9 + ,0 + ,10 + ,15 + ,4 + ,54 + ,11 + ,6 + ,12 + ,0 + ,10 + ,13 + ,4 + ,77 + ,11 + ,4 + ,7 + ,0 + ,10 + ,15 + ,4 + ,82 + ,14 + ,2 + ,9 + ,0 + ,10 + ,10 + ,4 + ,80 + ,15 + ,5 + ,10 + ,0 + ,10 + ,11 + ,3 + ,80 + ,12 + ,2 + ,8 + ,0 + ,10 + ,16 + ,4 + ,69 + ,10 + ,7 + ,9 + ,0 + ,10 + ,11 + ,3 + ,78 + ,12 + ,1 + ,9 + ,0 + ,10 + ,11 + ,3 + ,81 + ,11 + ,3 + ,9 + ,1 + ,10 + ,10 + ,3 + ,76 + ,11 + ,5 + ,9 + ,1 + ,10 + ,10 + ,4 + ,76 + ,11 + ,6 + ,9 + ,0 + ,10 + ,16 + ,3 + ,73 + ,14 + ,6 + ,7 + ,1 + ,10 + ,12 + ,4 + ,85 + ,14 + ,2 + ,11 + ,0 + ,10 + ,11 + ,2 + ,66 + ,13 + ,5 + ,6 + ,1 + ,10 + ,16 + ,5 + ,79 + ,13 + ,5 + ,11 + ,0 + ,10 + ,19 + ,3 + ,68 + ,13 + ,3 + ,9 + ,1 + ,10 + ,11 + ,4 + ,76 + ,12 + ,6 + ,7 + ,0 + ,10 + ,15 + ,2 + ,54 + ,12 + ,5 + ,5 + ,1 + ,10 + ,24 + ,4 + ,46 + ,16 + ,7 + ,9 + ,0 + ,10 + ,14 + ,3 + ,82 + ,13 + ,1 + ,7 + ,0 + ,10 + ,15 + ,4 + ,74 + ,15 + ,6 + ,9 + ,0 + ,10 + ,11 + ,3 + ,88 + ,11 + ,4 + ,9 + ,0 + ,10 + ,15 + ,1 + ,38 + ,14 + ,7 + ,3 + ,1 + ,10 + ,12 + ,4 + ,76 + ,14 + ,2 + ,11 + ,0 + ,10 + ,10 + ,4 + ,86 + ,10 + ,6 + ,7 + ,1 + ,10 + ,14 + ,2 + ,54 + ,12 + ,7 + ,6 + ,0 + ,10 + ,9 + ,5 + ,69 + ,12 + ,5 + ,10 + ,0 + ,10 + ,15 + ,4 + ,90 + ,14 + ,2 + ,8 + ,0 + ,10 + ,15 + ,4 + ,54 + ,10 + ,1 + ,9 + ,0 + ,10 + ,14 + ,3 + ,76 + ,10 + ,3 + ,8 + ,0 + ,10 + ,11 + ,4 + ,89 + ,13 + ,3 + ,10 + ,0 + ,10 + ,8 + ,4 + ,76 + ,13 + ,3 + ,10 + ,0 + ,10 + ,11 + ,4 + ,79 + ,11 + ,5 + ,9 + ,0 + ,10 + ,8 + ,3 + ,90 + ,11 + ,2 + ,9 + ,1 + ,10 + ,10 + ,5 + ,74 + ,13 + ,4 + ,7 + ,0 + ,10 + ,11 + ,3 + ,81 + ,13 + ,6 + ,9 + ,0 + ,10 + ,13 + ,4 + ,72 + ,13 + ,5 + ,12 + ,0 + ,10 + ,11 + ,4 + ,71 + ,13 + ,5 + ,10 + ,1 + ,10 + ,20 + ,4 + ,66 + ,13 + ,2 + ,9 + ,1 + ,10 + ,10 + ,4 + ,77 + ,13 + ,3 + ,12 + ,0 + ,10 + ,12 + ,4 + ,74 + ,13 + ,2 + ,10 + ,1 + ,10 + ,14 + ,5 + ,82 + ,14 + ,6 + ,10 + ,0 + ,10 + ,23 + ,3 + ,54 + ,13 + ,5 + ,9 + ,1 + ,10 + ,14 + ,1 + ,63 + ,14 + ,4 + ,3 + ,1 + ,10 + ,16 + ,4 + ,54 + ,11 + ,6 + ,7 + ,0 + ,10 + ,11 + ,4 + ,64 + ,13 + ,4 + ,10 + ,0 + ,10 + ,12 + ,3 + ,69 + ,11 + ,6 + ,9 + ,1 + ,10 + ,10 + ,4 + ,54 + ,11 + ,2 + ,9 + ,0 + ,10 + ,14 + ,4 + ,84 + ,16 + ,0 + ,11 + ,1 + ,10 + ,12 + ,4 + ,86 + ,8 + ,1 + ,10 + ,0 + ,10 + ,12 + ,4 + ,77 + ,11 + ,5 + ,11 + ,1 + ,10 + ,11 + ,4 + ,89 + ,14 + ,2 + ,7 + ,0 + ,10 + ,12 + ,4 + ,76 + ,12 + ,5 + ,10 + ,0 + ,10 + ,13 + ,3 + ,60 + ,13 + ,6 + ,5 + ,1 + ,10 + ,17 + ,5 + ,79 + ,13 + ,7 + ,8 + ,0 + ,10 + ,9 + ,3 + ,71 + ,14 + ,5 + ,7 + ,1 + ,9 + ,12 + ,4 + ,72 + ,14 + ,5 + ,10 + ,0 + ,10 + ,19 + ,4 + ,69 + ,11 + ,5 + ,11 + ,0 + ,9 + ,15 + ,4 + ,54 + ,11 + ,6 + ,12 + ,0 + ,10 + ,14 + ,4 + ,69 + ,14 + ,6 + ,8 + ,0 + ,10 + ,11 + ,3 + ,81 + ,13 + ,6 + ,9 + ,0 + ,10 + ,9 + ,4 + ,84 + ,15 + ,1 + ,7 + ,0 + ,10 + ,18 + ,4 + ,84 + ,14 + ,3 + ,12 + ,0 + ,10) + ,dim=c(8 + ,145) + ,dimnames=list(c('Depressie' + ,'Leeftijd' + ,'Sportgerelateerde_groep' + ,'Stress' + ,'Veranderingen_verleden' + ,'Alcoholgebruik' + ,'Depressie_mannen' + ,'Depressie_oktober') + ,1:145)) > y <- array(NA,dim=c(8,145),dimnames=list(c('Depressie','Leeftijd','Sportgerelateerde_groep','Stress','Veranderingen_verleden','Alcoholgebruik','Depressie_mannen','Depressie_oktober'),1:145)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo > 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 Depressie Leeftijd Sportgerelateerde_groep Stress Veranderingen_verleden 1 12 2 53 10 7 2 11 2 86 12 5 3 14 4 66 11 7 4 12 3 67 10 3 5 21 4 76 12 7 6 12 3 78 12 7 7 22 3 53 14 7 8 11 4 80 14 1 9 10 3 74 11 4 10 13 4 76 11 5 11 10 3 79 13 6 12 8 2 54 11 4 13 15 3 67 10 7 14 10 3 87 14 6 15 14 3 58 14 2 16 14 2 75 12 2 17 11 3 88 11 6 18 10 2 64 10 7 19 13 4 57 12 5 20 7 5 66 10 2 21 12 3 54 14 7 22 14 3 56 12 4 23 11 1 86 13 5 24 9 4 80 13 5 25 11 3 76 12 5 26 15 4 69 14 3 27 13 3 67 11 5 28 9 3 80 12 1 29 15 1 54 13 1 30 10 4 71 11 3 31 11 4 84 11 2 32 13 2 74 14 3 33 8 2 71 12 2 34 20 1 63 13 5 35 12 3 71 11 2 36 10 4 76 13 3 37 10 1 69 13 4 38 9 3 74 13 6 39 14 3 75 12 2 40 8 2 54 14 7 41 14 4 52 14 6 42 11 3 69 8 5 43 13 3 68 13 3 44 11 2 75 11 3 45 11 3 75 13 4 46 10 2 72 10 5 47 14 1 67 10 2 48 18 3 63 13 7 49 14 3 62 12 6 50 11 5 63 16 5 51 12 1 76 13 6 52 13 3 74 12 5 53 9 4 67 11 2 54 10 3 73 12 3 55 15 4 70 12 5 56 20 2 53 14 7 57 12 3 77 13 4 58 12 4 77 13 7 59 14 1 52 12 5 60 13 1 54 13 6 61 11 1 80 12 6 62 17 4 66 13 3 63 12 2 73 14 5 64 13 3 63 13 7 65 14 4 69 13 7 66 13 2 67 12 5 67 15 5 54 10 6 68 13 3 81 13 5 69 10 3 69 11 5 70 11 3 84 11 2 71 13 4 70 13 5 72 17 4 69 11 4 73 13 3 77 15 6 74 9 1 54 13 5 75 11 3 79 13 3 76 10 1 30 12 3 77 9 3 71 11 4 78 12 5 73 12 2 79 12 3 72 13 2 80 13 3 77 12 5 81 13 4 75 13 4 82 22 5 70 15 6 83 13 4 73 13 4 84 15 4 54 11 6 85 13 4 77 11 4 86 15 4 82 14 2 87 10 4 80 15 5 88 11 3 80 12 2 89 16 4 69 10 7 90 11 3 78 12 1 91 11 3 81 11 3 92 10 3 76 11 5 93 10 4 76 11 6 94 16 3 73 14 6 95 12 4 85 14 2 96 11 2 66 13 5 97 16 5 79 13 5 98 19 3 68 13 3 99 11 4 76 12 6 100 15 2 54 12 5 101 24 4 46 16 7 102 14 3 82 13 1 103 15 4 74 15 6 104 11 3 88 11 4 105 15 1 38 14 7 106 12 4 76 14 2 107 10 4 86 10 6 108 14 2 54 12 7 109 9 5 69 12 5 110 15 4 90 14 2 111 15 4 54 10 1 112 14 3 76 10 3 113 11 4 89 13 3 114 8 4 76 13 3 115 11 4 79 11 5 116 8 3 90 11 2 117 10 5 74 13 4 118 11 3 81 13 6 119 13 4 72 13 5 120 11 4 71 13 5 121 20 4 66 13 2 122 10 4 77 13 3 123 12 4 74 13 2 124 14 5 82 14 6 125 23 3 54 13 5 126 14 1 63 14 4 127 16 4 54 11 6 128 11 4 64 13 4 129 12 3 69 11 6 130 10 4 54 11 2 131 14 4 84 16 0 132 12 4 86 8 1 133 12 4 77 11 5 134 11 4 89 14 2 135 12 4 76 12 5 136 13 3 60 13 6 137 17 5 79 13 7 138 9 3 71 14 5 139 12 4 72 14 5 140 19 4 69 11 5 141 15 4 54 11 6 142 14 4 69 14 6 143 11 3 81 13 6 144 9 4 84 15 1 145 18 4 84 14 3 Alcoholgebruik Depressie_mannen Depressie_oktober t 1 6 0 9 1 2 6 0 9 2 3 11 0 9 3 4 7 1 9 4 5 12 0 9 5 6 8 0 9 6 7 7 0 9 7 8 11 0 9 8 9 8 0 9 9 10 9 0 9 10 11 9 1 9 11 12 6 0 9 12 13 9 1 9 13 14 5 0 9 14 15 9 1 9 15 16 4 1 9 16 17 9 0 9 17 18 6 1 9 18 19 8 0 9 19 20 12 1 9 20 21 7 0 9 21 22 8 0 9 22 23 3 1 9 23 24 9 0 9 24 25 7 1 9 25 26 9 0 9 26 27 9 1 9 27 28 7 0 9 28 29 5 1 9 29 30 8 0 9 30 31 7 0 9 31 32 6 1 9 32 33 6 1 9 33 34 4 1 9 34 35 8 1 9 35 36 8 0 9 36 37 3 1 9 37 38 8 1 9 38 39 9 0 9 39 40 6 1 9 40 41 9 1 9 41 42 5 0 9 42 43 8 0 9 43 44 6 0 9 44 45 9 1 9 45 46 8 0 9 46 47 5 1 9 47 48 9 1 9 48 49 8 0 9 49 50 11 1 9 50 51 7 0 9 51 52 9 0 9 52 53 11 0 9 53 54 9 1 9 54 55 10 0 9 55 56 6 1 9 56 57 9 1 9 57 58 9 0 9 58 59 3 0 9 59 60 3 0 9 60 61 3 1 10 61 62 12 0 10 62 63 8 1 10 63 64 9 0 10 64 65 10 1 10 65 66 4 1 10 66 67 14 0 10 67 68 8 0 10 68 69 6 1 10 69 70 9 1 10 70 71 10 0 10 71 72 10 0 10 72 73 7 1 10 73 74 3 1 10 74 75 6 1 10 75 76 4 1 10 76 77 9 0 10 77 78 11 1 10 78 79 6 0 10 79 80 7 0 10 80 81 8 1 10 81 82 11 0 10 82 83 9 0 10 83 84 12 0 10 84 85 7 0 10 85 86 9 0 10 86 87 10 0 10 87 88 8 0 10 88 89 9 0 10 89 90 9 0 10 90 91 9 1 10 91 92 9 1 10 92 93 9 0 10 93 94 7 1 10 94 95 11 0 10 95 96 6 1 10 96 97 11 0 10 97 98 9 1 10 98 99 7 0 10 99 100 5 1 10 100 101 9 0 10 101 102 7 0 10 102 103 9 0 10 103 104 9 0 10 104 105 3 1 10 105 106 11 0 10 106 107 7 1 10 107 108 6 0 10 108 109 10 0 10 109 110 8 0 10 110 111 9 0 10 111 112 8 0 10 112 113 10 0 10 113 114 10 0 10 114 115 9 0 10 115 116 9 1 10 116 117 7 0 10 117 118 9 0 10 118 119 12 0 10 119 120 10 1 10 120 121 9 1 10 121 122 12 0 10 122 123 10 1 10 123 124 10 0 10 124 125 9 1 10 125 126 3 1 10 126 127 7 0 10 127 128 10 0 10 128 129 9 1 10 129 130 9 0 10 130 131 11 1 10 131 132 10 0 10 132 133 11 1 10 133 134 7 0 10 134 135 10 0 10 135 136 5 1 10 136 137 8 0 10 137 138 7 1 9 138 139 10 0 10 139 140 11 0 9 140 141 12 0 10 141 142 8 0 10 142 143 9 0 10 143 144 7 0 10 144 145 12 0 10 145 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Leeftijd Sportgerelateerde_groep 6.838200 -0.114673 -0.093746 Stress Veranderingen_verleden Alcoholgebruik 0.466816 0.260748 0.297659 Depressie_mannen Depressie_oktober t -0.357603 0.369370 0.002356 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.7541 -1.5481 -0.3388 1.2766 7.8863 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.838200 7.734283 0.884 0.378180 Leeftijd -0.114673 0.411141 -0.279 0.780734 Sportgerelateerde_groep -0.093746 0.023830 -3.934 0.000133 *** Stress 0.466816 0.165556 2.820 0.005526 ** Veranderingen_verleden 0.260748 0.138261 1.886 0.061440 . Alcoholgebruik 0.297659 0.173245 1.718 0.088046 . Depressie_mannen -0.357603 0.537147 -0.666 0.506702 Depressie_oktober 0.369370 0.820422 0.450 0.653269 t 0.002356 0.009820 0.240 0.810772 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.882 on 136 degrees of freedom Multiple R-squared: 0.221, Adjusted R-squared: 0.1752 F-statistic: 4.823 on 8 and 136 DF, p-value: 3.041e-05 > 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.91764949 0.16470103 0.08235051 [2,] 0.92736672 0.14526657 0.07263328 [3,] 0.88673230 0.22653540 0.11326770 [4,] 0.82397613 0.35204774 0.17602387 [5,] 0.95121353 0.09757294 0.04878647 [6,] 0.93104237 0.13791527 0.06895763 [7,] 0.90477727 0.19044545 0.09522273 [8,] 0.86804446 0.26391107 0.13195554 [9,] 0.88818954 0.22362092 0.11181046 [10,] 0.87789568 0.24420864 0.12210432 [11,] 0.88399916 0.23200169 0.11600084 [12,] 0.85356472 0.29287056 0.14643528 [13,] 0.82492755 0.35014491 0.17507245 [14,] 0.77442331 0.45115338 0.22557669 [15,] 0.78464479 0.43071041 0.21535521 [16,] 0.75125963 0.49748073 0.24874037 [17,] 0.70922151 0.58155697 0.29077849 [18,] 0.69983750 0.60032500 0.30016250 [19,] 0.65273319 0.69453363 0.34726681 [20,] 0.66596375 0.66807251 0.33403625 [21,] 0.60904942 0.78190115 0.39095058 [22,] 0.58848444 0.82303112 0.41151556 [23,] 0.81752805 0.36494391 0.18247195 [24,] 0.78565078 0.42869845 0.21434922 [25,] 0.74787232 0.50425537 0.25212768 [26,] 0.72508648 0.54982703 0.27491352 [27,] 0.75202957 0.49594085 0.24797043 [28,] 0.74685917 0.50628165 0.25314083 [29,] 0.88003814 0.23992371 0.11996186 [30,] 0.85586491 0.28827017 0.14413509 [31,] 0.84310484 0.31379031 0.15689516 [32,] 0.80858848 0.38282303 0.19141152 [33,] 0.76842595 0.46314810 0.23157405 [34,] 0.72860636 0.54278729 0.27139364 [35,] 0.69301537 0.61396926 0.30698463 [36,] 0.71528503 0.56942993 0.28471497 [37,] 0.76762629 0.46474741 0.23237371 [38,] 0.72693242 0.54613516 0.27306758 [39,] 0.75471319 0.49057362 0.24528681 [40,] 0.72239470 0.55521061 0.27760530 [41,] 0.67959272 0.64081456 0.32040728 [42,] 0.68928553 0.62142894 0.31071447 [43,] 0.66330651 0.67338698 0.33669349 [44,] 0.65364423 0.69271154 0.34635577 [45,] 0.73917526 0.52164947 0.26082474 [46,] 0.69694443 0.60611114 0.30305557 [47,] 0.66135481 0.67729038 0.33864519 [48,] 0.61569781 0.76860438 0.38430219 [49,] 0.57268700 0.85462601 0.42731300 [50,] 0.52997190 0.94005619 0.47002810 [51,] 0.51249363 0.97501274 0.48750637 [52,] 0.48598694 0.97197388 0.51401306 [53,] 0.45412273 0.90824545 0.54587727 [54,] 0.40866455 0.81732911 0.59133545 [55,] 0.37095640 0.74191279 0.62904360 [56,] 0.33064109 0.66128219 0.66935891 [57,] 0.28987727 0.57975454 0.71012273 [58,] 0.25918448 0.51836895 0.74081552 [59,] 0.22199186 0.44398372 0.77800814 [60,] 0.19037848 0.38075695 0.80962152 [61,] 0.22721264 0.45442529 0.77278736 [62,] 0.19135074 0.38270149 0.80864926 [63,] 0.23254241 0.46508482 0.76745759 [64,] 0.19693379 0.39386758 0.80306621 [65,] 0.27352474 0.54704947 0.72647526 [66,] 0.29124183 0.58248366 0.70875817 [67,] 0.26869306 0.53738613 0.73130694 [68,] 0.23238650 0.46477301 0.76761350 [69,] 0.20068823 0.40137646 0.79931177 [70,] 0.17418272 0.34836544 0.82581728 [71,] 0.32083129 0.64166257 0.67916871 [72,] 0.27772587 0.55545175 0.72227413 [73,] 0.24131851 0.48263703 0.75868149 [74,] 0.21347154 0.42694307 0.78652846 [75,] 0.20176314 0.40352627 0.79823686 [76,] 0.23684844 0.47369688 0.76315156 [77,] 0.19977236 0.39954471 0.80022764 [78,] 0.20098036 0.40196071 0.79901964 [79,] 0.16890370 0.33780741 0.83109630 [80,] 0.13852301 0.27704602 0.86147699 [81,] 0.12660070 0.25320141 0.87339930 [82,] 0.11956542 0.23913084 0.88043458 [83,] 0.11047727 0.22095454 0.88952273 [84,] 0.08983629 0.17967258 0.91016371 [85,] 0.08385125 0.16770250 0.91614875 [86,] 0.07584431 0.15168861 0.92415569 [87,] 0.12265749 0.24531497 0.87734251 [88,] 0.10166655 0.20333309 0.89833345 [89,] 0.08292786 0.16585571 0.91707214 [90,] 0.17429641 0.34859283 0.82570359 [91,] 0.17138547 0.34277095 0.82861453 [92,] 0.15412391 0.30824782 0.84587609 [93,] 0.12524363 0.25048726 0.87475637 [94,] 0.09932704 0.19865408 0.90067296 [95,] 0.07913636 0.15827272 0.92086364 [96,] 0.05997415 0.11994829 0.94002585 [97,] 0.04529715 0.09059430 0.95470285 [98,] 0.05839551 0.11679101 0.94160449 [99,] 0.08534541 0.17069082 0.91465459 [100,] 0.07050348 0.14100696 0.92949652 [101,] 0.08172620 0.16345241 0.91827380 [102,] 0.06640782 0.13281564 0.93359218 [103,] 0.07622121 0.15244242 0.92377879 [104,] 0.05636373 0.11272746 0.94363627 [105,] 0.04489646 0.08979292 0.95510354 [106,] 0.03665793 0.07331585 0.96334207 [107,] 0.02616478 0.05232956 0.97383522 [108,] 0.01784227 0.03568453 0.98215773 [109,] 0.02004661 0.04009322 0.97995339 [110,] 0.05488202 0.10976404 0.94511798 [111,] 0.06491415 0.12982831 0.93508585 [112,] 0.04816594 0.09633187 0.95183406 [113,] 0.03491308 0.06982616 0.96508692 [114,] 0.22636525 0.45273051 0.77363475 [115,] 0.46626654 0.93253308 0.53373346 [116,] 0.56381414 0.87237171 0.43618586 [117,] 0.47425497 0.94850994 0.52574503 [118,] 0.38934106 0.77868211 0.61065894 [119,] 0.31219853 0.62439706 0.68780147 [120,] 0.30882382 0.61764763 0.69117618 [121,] 0.20767171 0.41534342 0.79232829 [122,] 0.22178059 0.44356118 0.77821941 > postscript(file="/var/www/rcomp/tmp/1c8jo1293289483.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/250jr1293289483.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/350jr1293289483.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/450jr1293289483.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/5f9iu1293289483.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 = 145 Frequency = 1 1 2 3 4 5 6 -1.246345012 0.432784397 0.241876009 1.276640543 7.410150117 -0.328749205 7 8 9 10 11 12 6.689271191 -1.293417410 -1.461741770 1.279660298 -2.392906813 -4.863085272 13 14 15 16 17 18 2.617127315 -1.283786571 0.205178203 4.103760565 0.012701175 -1.897585229 19 20 21 22 23 24 -0.691874199 -4.853002166 -3.249964868 0.353386980 1.052403304 -3.311968676 25 26 27 28 29 30 -0.384244958 1.706793005 0.638825453 -1.330939211 2.486066574 -1.417032219 31 32 33 34 35 36 1.357718218 1.182622814 -2.906592213 7.572669608 1.074865967 -1.896068179 37 38 39 40 41 42 -1.313514236 -3.627586247 2.318349211 -6.754137380 -1.346869437 1.024461121 43 44 45 46 47 48 0.222799061 0.290942550 -1.326494752 -1.645006420 3.802058784 3.759240937 49 50 51 52 53 54 0.330759192 -4.490394266 -0.760009793 0.411733089 -3.478431637 -1.807626212 55 56 57 58 59 60 1.846694879 5.114422671 -0.167272999 -1.194802235 0.889438352 -0.652988858 61 62 63 64 65 66 0.237101504 2.545211007 -1.470339753 -2.005425635 -0.270688668 1.084384782 67 68 69 70 71 72 -0.453963975 0.491735516 -1.749020749 0.544080237 -1.027184605 4.071092524 73 74 75 76 77 78 -0.434145178 -4.436990446 -0.237830470 -5.000955994 -3.570208358 -0.338761725 79 80 81 82 83 84 -0.000331222 0.852955739 0.631656431 6.569535489 -0.215809485 -0.480183627 85 86 87 88 89 90 1.683412970 2.675517891 -4.061048844 -0.400068553 3.013273951 -0.629183882 91 92 93 94 95 96 -0.047379127 -2.039961233 -2.545994620 2.608212878 -0.659765405 -2.142171606 97 98 99 100 101 102 2.572291261 5.783799641 -1.431626669 1.487926928 6.027950305 2.846033180 103 104 105 106 107 108 0.375692256 -0.040133438 -0.998270994 -1.529394644 -0.221779012 -0.707677883 109 110 111 112 113 114 -4.628964985 3.666605073 2.119741254 2.841289553 -0.823459683 -5.044514565 115 116 117 118 119 120 -1.055837534 -2.001813173 -2.492171088 -2.184465119 -1.548092789 -2.691273344 121 122 123 124 125 126 6.917543536 -3.564934150 -0.634858937 0.360016953 7.886250291 1.078151526 127 128 129 130 131 132 1.906810914 -3.463197564 -1.044098781 -3.652583716 1.107144670 2.706114332 133 134 135 136 137 138 -0.523451360 -0.186022448 -1.148668045 -0.647298246 3.849538826 -4.052819461 139 140 141 142 143 144 -2.466706975 5.721856322 -0.614468042 -0.420442006 -2.243361793 -2.884379157 145 4.570287882 > postscript(file="/var/www/rcomp/tmp/6f9iu1293289483.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 = 145 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.246345012 NA 1 0.432784397 -1.246345012 2 0.241876009 0.432784397 3 1.276640543 0.241876009 4 7.410150117 1.276640543 5 -0.328749205 7.410150117 6 6.689271191 -0.328749205 7 -1.293417410 6.689271191 8 -1.461741770 -1.293417410 9 1.279660298 -1.461741770 10 -2.392906813 1.279660298 11 -4.863085272 -2.392906813 12 2.617127315 -4.863085272 13 -1.283786571 2.617127315 14 0.205178203 -1.283786571 15 4.103760565 0.205178203 16 0.012701175 4.103760565 17 -1.897585229 0.012701175 18 -0.691874199 -1.897585229 19 -4.853002166 -0.691874199 20 -3.249964868 -4.853002166 21 0.353386980 -3.249964868 22 1.052403304 0.353386980 23 -3.311968676 1.052403304 24 -0.384244958 -3.311968676 25 1.706793005 -0.384244958 26 0.638825453 1.706793005 27 -1.330939211 0.638825453 28 2.486066574 -1.330939211 29 -1.417032219 2.486066574 30 1.357718218 -1.417032219 31 1.182622814 1.357718218 32 -2.906592213 1.182622814 33 7.572669608 -2.906592213 34 1.074865967 7.572669608 35 -1.896068179 1.074865967 36 -1.313514236 -1.896068179 37 -3.627586247 -1.313514236 38 2.318349211 -3.627586247 39 -6.754137380 2.318349211 40 -1.346869437 -6.754137380 41 1.024461121 -1.346869437 42 0.222799061 1.024461121 43 0.290942550 0.222799061 44 -1.326494752 0.290942550 45 -1.645006420 -1.326494752 46 3.802058784 -1.645006420 47 3.759240937 3.802058784 48 0.330759192 3.759240937 49 -4.490394266 0.330759192 50 -0.760009793 -4.490394266 51 0.411733089 -0.760009793 52 -3.478431637 0.411733089 53 -1.807626212 -3.478431637 54 1.846694879 -1.807626212 55 5.114422671 1.846694879 56 -0.167272999 5.114422671 57 -1.194802235 -0.167272999 58 0.889438352 -1.194802235 59 -0.652988858 0.889438352 60 0.237101504 -0.652988858 61 2.545211007 0.237101504 62 -1.470339753 2.545211007 63 -2.005425635 -1.470339753 64 -0.270688668 -2.005425635 65 1.084384782 -0.270688668 66 -0.453963975 1.084384782 67 0.491735516 -0.453963975 68 -1.749020749 0.491735516 69 0.544080237 -1.749020749 70 -1.027184605 0.544080237 71 4.071092524 -1.027184605 72 -0.434145178 4.071092524 73 -4.436990446 -0.434145178 74 -0.237830470 -4.436990446 75 -5.000955994 -0.237830470 76 -3.570208358 -5.000955994 77 -0.338761725 -3.570208358 78 -0.000331222 -0.338761725 79 0.852955739 -0.000331222 80 0.631656431 0.852955739 81 6.569535489 0.631656431 82 -0.215809485 6.569535489 83 -0.480183627 -0.215809485 84 1.683412970 -0.480183627 85 2.675517891 1.683412970 86 -4.061048844 2.675517891 87 -0.400068553 -4.061048844 88 3.013273951 -0.400068553 89 -0.629183882 3.013273951 90 -0.047379127 -0.629183882 91 -2.039961233 -0.047379127 92 -2.545994620 -2.039961233 93 2.608212878 -2.545994620 94 -0.659765405 2.608212878 95 -2.142171606 -0.659765405 96 2.572291261 -2.142171606 97 5.783799641 2.572291261 98 -1.431626669 5.783799641 99 1.487926928 -1.431626669 100 6.027950305 1.487926928 101 2.846033180 6.027950305 102 0.375692256 2.846033180 103 -0.040133438 0.375692256 104 -0.998270994 -0.040133438 105 -1.529394644 -0.998270994 106 -0.221779012 -1.529394644 107 -0.707677883 -0.221779012 108 -4.628964985 -0.707677883 109 3.666605073 -4.628964985 110 2.119741254 3.666605073 111 2.841289553 2.119741254 112 -0.823459683 2.841289553 113 -5.044514565 -0.823459683 114 -1.055837534 -5.044514565 115 -2.001813173 -1.055837534 116 -2.492171088 -2.001813173 117 -2.184465119 -2.492171088 118 -1.548092789 -2.184465119 119 -2.691273344 -1.548092789 120 6.917543536 -2.691273344 121 -3.564934150 6.917543536 122 -0.634858937 -3.564934150 123 0.360016953 -0.634858937 124 7.886250291 0.360016953 125 1.078151526 7.886250291 126 1.906810914 1.078151526 127 -3.463197564 1.906810914 128 -1.044098781 -3.463197564 129 -3.652583716 -1.044098781 130 1.107144670 -3.652583716 131 2.706114332 1.107144670 132 -0.523451360 2.706114332 133 -0.186022448 -0.523451360 134 -1.148668045 -0.186022448 135 -0.647298246 -1.148668045 136 3.849538826 -0.647298246 137 -4.052819461 3.849538826 138 -2.466706975 -4.052819461 139 5.721856322 -2.466706975 140 -0.614468042 5.721856322 141 -0.420442006 -0.614468042 142 -2.243361793 -0.420442006 143 -2.884379157 -2.243361793 144 4.570287882 -2.884379157 145 NA 4.570287882 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.432784397 -1.246345012 [2,] 0.241876009 0.432784397 [3,] 1.276640543 0.241876009 [4,] 7.410150117 1.276640543 [5,] -0.328749205 7.410150117 [6,] 6.689271191 -0.328749205 [7,] -1.293417410 6.689271191 [8,] -1.461741770 -1.293417410 [9,] 1.279660298 -1.461741770 [10,] -2.392906813 1.279660298 [11,] -4.863085272 -2.392906813 [12,] 2.617127315 -4.863085272 [13,] -1.283786571 2.617127315 [14,] 0.205178203 -1.283786571 [15,] 4.103760565 0.205178203 [16,] 0.012701175 4.103760565 [17,] -1.897585229 0.012701175 [18,] -0.691874199 -1.897585229 [19,] -4.853002166 -0.691874199 [20,] -3.249964868 -4.853002166 [21,] 0.353386980 -3.249964868 [22,] 1.052403304 0.353386980 [23,] -3.311968676 1.052403304 [24,] -0.384244958 -3.311968676 [25,] 1.706793005 -0.384244958 [26,] 0.638825453 1.706793005 [27,] -1.330939211 0.638825453 [28,] 2.486066574 -1.330939211 [29,] -1.417032219 2.486066574 [30,] 1.357718218 -1.417032219 [31,] 1.182622814 1.357718218 [32,] -2.906592213 1.182622814 [33,] 7.572669608 -2.906592213 [34,] 1.074865967 7.572669608 [35,] -1.896068179 1.074865967 [36,] -1.313514236 -1.896068179 [37,] -3.627586247 -1.313514236 [38,] 2.318349211 -3.627586247 [39,] -6.754137380 2.318349211 [40,] -1.346869437 -6.754137380 [41,] 1.024461121 -1.346869437 [42,] 0.222799061 1.024461121 [43,] 0.290942550 0.222799061 [44,] -1.326494752 0.290942550 [45,] -1.645006420 -1.326494752 [46,] 3.802058784 -1.645006420 [47,] 3.759240937 3.802058784 [48,] 0.330759192 3.759240937 [49,] -4.490394266 0.330759192 [50,] -0.760009793 -4.490394266 [51,] 0.411733089 -0.760009793 [52,] -3.478431637 0.411733089 [53,] -1.807626212 -3.478431637 [54,] 1.846694879 -1.807626212 [55,] 5.114422671 1.846694879 [56,] -0.167272999 5.114422671 [57,] -1.194802235 -0.167272999 [58,] 0.889438352 -1.194802235 [59,] -0.652988858 0.889438352 [60,] 0.237101504 -0.652988858 [61,] 2.545211007 0.237101504 [62,] -1.470339753 2.545211007 [63,] -2.005425635 -1.470339753 [64,] -0.270688668 -2.005425635 [65,] 1.084384782 -0.270688668 [66,] -0.453963975 1.084384782 [67,] 0.491735516 -0.453963975 [68,] -1.749020749 0.491735516 [69,] 0.544080237 -1.749020749 [70,] -1.027184605 0.544080237 [71,] 4.071092524 -1.027184605 [72,] -0.434145178 4.071092524 [73,] -4.436990446 -0.434145178 [74,] -0.237830470 -4.436990446 [75,] -5.000955994 -0.237830470 [76,] -3.570208358 -5.000955994 [77,] -0.338761725 -3.570208358 [78,] -0.000331222 -0.338761725 [79,] 0.852955739 -0.000331222 [80,] 0.631656431 0.852955739 [81,] 6.569535489 0.631656431 [82,] -0.215809485 6.569535489 [83,] -0.480183627 -0.215809485 [84,] 1.683412970 -0.480183627 [85,] 2.675517891 1.683412970 [86,] -4.061048844 2.675517891 [87,] -0.400068553 -4.061048844 [88,] 3.013273951 -0.400068553 [89,] -0.629183882 3.013273951 [90,] -0.047379127 -0.629183882 [91,] -2.039961233 -0.047379127 [92,] -2.545994620 -2.039961233 [93,] 2.608212878 -2.545994620 [94,] -0.659765405 2.608212878 [95,] -2.142171606 -0.659765405 [96,] 2.572291261 -2.142171606 [97,] 5.783799641 2.572291261 [98,] -1.431626669 5.783799641 [99,] 1.487926928 -1.431626669 [100,] 6.027950305 1.487926928 [101,] 2.846033180 6.027950305 [102,] 0.375692256 2.846033180 [103,] -0.040133438 0.375692256 [104,] -0.998270994 -0.040133438 [105,] -1.529394644 -0.998270994 [106,] -0.221779012 -1.529394644 [107,] -0.707677883 -0.221779012 [108,] -4.628964985 -0.707677883 [109,] 3.666605073 -4.628964985 [110,] 2.119741254 3.666605073 [111,] 2.841289553 2.119741254 [112,] -0.823459683 2.841289553 [113,] -5.044514565 -0.823459683 [114,] -1.055837534 -5.044514565 [115,] -2.001813173 -1.055837534 [116,] -2.492171088 -2.001813173 [117,] -2.184465119 -2.492171088 [118,] -1.548092789 -2.184465119 [119,] -2.691273344 -1.548092789 [120,] 6.917543536 -2.691273344 [121,] -3.564934150 6.917543536 [122,] -0.634858937 -3.564934150 [123,] 0.360016953 -0.634858937 [124,] 7.886250291 0.360016953 [125,] 1.078151526 7.886250291 [126,] 1.906810914 1.078151526 [127,] -3.463197564 1.906810914 [128,] -1.044098781 -3.463197564 [129,] -3.652583716 -1.044098781 [130,] 1.107144670 -3.652583716 [131,] 2.706114332 1.107144670 [132,] -0.523451360 2.706114332 [133,] -0.186022448 -0.523451360 [134,] -1.148668045 -0.186022448 [135,] -0.647298246 -1.148668045 [136,] 3.849538826 -0.647298246 [137,] -4.052819461 3.849538826 [138,] -2.466706975 -4.052819461 [139,] 5.721856322 -2.466706975 [140,] -0.614468042 5.721856322 [141,] -0.420442006 -0.614468042 [142,] -2.243361793 -0.420442006 [143,] -2.884379157 -2.243361793 [144,] 4.570287882 -2.884379157 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.432784397 -1.246345012 2 0.241876009 0.432784397 3 1.276640543 0.241876009 4 7.410150117 1.276640543 5 -0.328749205 7.410150117 6 6.689271191 -0.328749205 7 -1.293417410 6.689271191 8 -1.461741770 -1.293417410 9 1.279660298 -1.461741770 10 -2.392906813 1.279660298 11 -4.863085272 -2.392906813 12 2.617127315 -4.863085272 13 -1.283786571 2.617127315 14 0.205178203 -1.283786571 15 4.103760565 0.205178203 16 0.012701175 4.103760565 17 -1.897585229 0.012701175 18 -0.691874199 -1.897585229 19 -4.853002166 -0.691874199 20 -3.249964868 -4.853002166 21 0.353386980 -3.249964868 22 1.052403304 0.353386980 23 -3.311968676 1.052403304 24 -0.384244958 -3.311968676 25 1.706793005 -0.384244958 26 0.638825453 1.706793005 27 -1.330939211 0.638825453 28 2.486066574 -1.330939211 29 -1.417032219 2.486066574 30 1.357718218 -1.417032219 31 1.182622814 1.357718218 32 -2.906592213 1.182622814 33 7.572669608 -2.906592213 34 1.074865967 7.572669608 35 -1.896068179 1.074865967 36 -1.313514236 -1.896068179 37 -3.627586247 -1.313514236 38 2.318349211 -3.627586247 39 -6.754137380 2.318349211 40 -1.346869437 -6.754137380 41 1.024461121 -1.346869437 42 0.222799061 1.024461121 43 0.290942550 0.222799061 44 -1.326494752 0.290942550 45 -1.645006420 -1.326494752 46 3.802058784 -1.645006420 47 3.759240937 3.802058784 48 0.330759192 3.759240937 49 -4.490394266 0.330759192 50 -0.760009793 -4.490394266 51 0.411733089 -0.760009793 52 -3.478431637 0.411733089 53 -1.807626212 -3.478431637 54 1.846694879 -1.807626212 55 5.114422671 1.846694879 56 -0.167272999 5.114422671 57 -1.194802235 -0.167272999 58 0.889438352 -1.194802235 59 -0.652988858 0.889438352 60 0.237101504 -0.652988858 61 2.545211007 0.237101504 62 -1.470339753 2.545211007 63 -2.005425635 -1.470339753 64 -0.270688668 -2.005425635 65 1.084384782 -0.270688668 66 -0.453963975 1.084384782 67 0.491735516 -0.453963975 68 -1.749020749 0.491735516 69 0.544080237 -1.749020749 70 -1.027184605 0.544080237 71 4.071092524 -1.027184605 72 -0.434145178 4.071092524 73 -4.436990446 -0.434145178 74 -0.237830470 -4.436990446 75 -5.000955994 -0.237830470 76 -3.570208358 -5.000955994 77 -0.338761725 -3.570208358 78 -0.000331222 -0.338761725 79 0.852955739 -0.000331222 80 0.631656431 0.852955739 81 6.569535489 0.631656431 82 -0.215809485 6.569535489 83 -0.480183627 -0.215809485 84 1.683412970 -0.480183627 85 2.675517891 1.683412970 86 -4.061048844 2.675517891 87 -0.400068553 -4.061048844 88 3.013273951 -0.400068553 89 -0.629183882 3.013273951 90 -0.047379127 -0.629183882 91 -2.039961233 -0.047379127 92 -2.545994620 -2.039961233 93 2.608212878 -2.545994620 94 -0.659765405 2.608212878 95 -2.142171606 -0.659765405 96 2.572291261 -2.142171606 97 5.783799641 2.572291261 98 -1.431626669 5.783799641 99 1.487926928 -1.431626669 100 6.027950305 1.487926928 101 2.846033180 6.027950305 102 0.375692256 2.846033180 103 -0.040133438 0.375692256 104 -0.998270994 -0.040133438 105 -1.529394644 -0.998270994 106 -0.221779012 -1.529394644 107 -0.707677883 -0.221779012 108 -4.628964985 -0.707677883 109 3.666605073 -4.628964985 110 2.119741254 3.666605073 111 2.841289553 2.119741254 112 -0.823459683 2.841289553 113 -5.044514565 -0.823459683 114 -1.055837534 -5.044514565 115 -2.001813173 -1.055837534 116 -2.492171088 -2.001813173 117 -2.184465119 -2.492171088 118 -1.548092789 -2.184465119 119 -2.691273344 -1.548092789 120 6.917543536 -2.691273344 121 -3.564934150 6.917543536 122 -0.634858937 -3.564934150 123 0.360016953 -0.634858937 124 7.886250291 0.360016953 125 1.078151526 7.886250291 126 1.906810914 1.078151526 127 -3.463197564 1.906810914 128 -1.044098781 -3.463197564 129 -3.652583716 -1.044098781 130 1.107144670 -3.652583716 131 2.706114332 1.107144670 132 -0.523451360 2.706114332 133 -0.186022448 -0.523451360 134 -1.148668045 -0.186022448 135 -0.647298246 -1.148668045 136 3.849538826 -0.647298246 137 -4.052819461 3.849538826 138 -2.466706975 -4.052819461 139 5.721856322 -2.466706975 140 -0.614468042 5.721856322 141 -0.420442006 -0.614468042 142 -2.243361793 -0.420442006 143 -2.884379157 -2.243361793 144 4.570287882 -2.884379157 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/7qihe1293289483.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/8qihe1293289483.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/919gi1293289483.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/www/rcomp/tmp/1019gi1293289483.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/114ax51293289483.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/127tdt1293289483.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/13l2b21293289483.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/14p3a81293289483.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/15slqe1293289483.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/16w47k1293289483.tab") + } > > try(system("convert tmp/1c8jo1293289483.ps tmp/1c8jo1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/250jr1293289483.ps tmp/250jr1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/350jr1293289483.ps tmp/350jr1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/450jr1293289483.ps tmp/450jr1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/5f9iu1293289483.ps tmp/5f9iu1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/6f9iu1293289483.ps tmp/6f9iu1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/7qihe1293289483.ps tmp/7qihe1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/8qihe1293289483.ps tmp/8qihe1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/919gi1293289483.ps tmp/919gi1293289483.png",intern=TRUE)) character(0) > try(system("convert tmp/1019gi1293289483.ps tmp/1019gi1293289483.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.490 1.490 5.998