R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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(56,55,54,52,72,71,56,46,47,47,48,50,44,38,33,33,52,54,39,22,31,31,38,42,41,31,36,34,51,47,31,19,30,33,36,40,32,25,28,29,55,55,40,38,44,41,49,59,61,47,43,39,66,68,63,68,67,59,68,78,82,70,62,68,94,102,100,104,103,93,110,114,120,102,95,103,122,139,135,135,137,130,148,148,145,128,131,133,146,163,151,157,152,149,172,167,160,150,160,165,171,179,171,176,170,169,194,196,188,174,186,191,197,206,197,204,201,190,213,213),dim=c(1,120),dimnames=list(c('Omzet'),1:120)) > y <- array(NA,dim=c(1,120),dimnames=list(c('Omzet'),1:120)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > par3 <- 'No Linear Trend' > par2 <- 'Do not include Seasonal Dummies' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., (2013), Multiple Regression (v1.0.29) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_multipleregression.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following objects 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 Omzet 1 56 2 55 3 54 4 52 5 72 6 71 7 56 8 46 9 47 10 47 11 48 12 50 13 44 14 38 15 33 16 33 17 52 18 54 19 39 20 22 21 31 22 31 23 38 24 42 25 41 26 31 27 36 28 34 29 51 30 47 31 31 32 19 33 30 34 33 35 36 36 40 37 32 38 25 39 28 40 29 41 55 42 55 43 40 44 38 45 44 46 41 47 49 48 59 49 61 50 47 51 43 52 39 53 66 54 68 55 63 56 68 57 67 58 59 59 68 60 78 61 82 62 70 63 62 64 68 65 94 66 102 67 100 68 104 69 103 70 93 71 110 72 114 73 120 74 102 75 95 76 103 77 122 78 139 79 135 80 135 81 137 82 130 83 148 84 148 85 145 86 128 87 131 88 133 89 146 90 163 91 151 92 157 93 152 94 149 95 172 96 167 97 160 98 150 99 160 100 165 101 171 102 179 103 171 104 176 105 170 106 169 107 194 108 196 109 188 110 174 111 186 112 191 113 197 114 206 115 197 116 204 117 201 118 190 119 213 120 213 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : incompatible dimensions Calls: lm -> lm.fit Execution halted