R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(93.55,94.11,94.47,94.38,94.42,94.39,94.42,94.34,94.59,94.63,94.84,94.98,95.19,95.76,96.08,96.04,96.2,96.31,96.3,96.29,96.46,96.66,96.83,97,97.1,97.33,97.31,97.16,97.4,97.4,97.52,97.77,98,98.2,98.48,98.53,98.71,99.03,99.52,99.65,99.98,99.94,100.12,100.17,100.38,100.75,100.84,100.91,100.9,101.15,101.4,101.39,101.55,101.73,101.7,101.65,101.73,101.53,101.58,101.58,101.71,101.71,101.98,101.99,101.95,102.11,102.28,102.32,102.18,102.14,102.29,102.33,102.33,101.75,102.36,101.25,102.03,101.84,103.01,102.79,101.95,102.54,102.2,102.58),dim=c(1,84),dimnames=list(c('Lichaamsverzorgingsindex'),1:84)) > y <- array(NA,dim=c(1,84),dimnames=list(c('Lichaamsverzorgingsindex'),1:84)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par5 = '0' > par4 = '0' > par3 = 'Geen lineaire trend' > par2 = 'Neem geen Seasonal Dummies' > par1 = '1' > par5 <- '0' > par4 <- '0' > par3 <- 'Geen lineaire trend' > par2 <- 'Neem geen Seasonal Dummies' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Wed, 08 Jun 2016 16:18:16 +0100) > #Author: root > #To cite this work: Wessa P., (2015), Multiple Regression (v1.0.38) 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 > mywarning <- '' > par1 <- as.numeric(par1) > if(is.na(par1)) { + par1 <- 1 + mywarning = 'Warning: you did not specify the column number of the endogenous series! The first column was selected by default.' + } > if (par4=='') par4 <- 0 > par4 <- as.numeric(par4) > if (par5=='') par5 <- 0 > par5 <- as.numeric(par5) > x <- na.omit(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'){ + (n <- n -1) + x2 <- array(0, dim=c(n,k), dimnames=list(1:n, paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par3 == 'Seasonal Differences (s=12)'){ + (n <- n - 12) + x2 <- array(0, dim=c(n,k), dimnames=list(1:n, paste('(1-B12)',colnames(x),sep=''))) + for (i in 1:n) { + for (j in 1:k) { + x2[i,j] <- x[i+12,j] - x[i,j] + } + } + x <- x2 + } > if (par3 == 'First and Seasonal Differences (s=12)'){ + (n <- n -1) + x2 <- array(0, dim=c(n,k), dimnames=list(1:n, paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + (n <- n - 12) + x2 <- array(0, dim=c(n,k), dimnames=list(1:n, paste('(1-B12)',colnames(x),sep=''))) + for (i in 1:n) { + for (j in 1:k) { + x2[i,j] <- x[i+12,j] - x[i,j] + } + } + x <- x2 + } > if(par4 > 0) { + x2 <- array(0, dim=c(n-par4,par4), dimnames=list(1:(n-par4), paste(colnames(x)[par1],'(t-',1:par4,')',sep=''))) + for (i in 1:(n-par4)) { + for (j in 1:par4) { + x2[i,j] <- x[i+par4-j,par1] + } + } + x <- cbind(x[(par4+1):n,], x2) + n <- n - par4 + } > if(par5 > 0) { + x2 <- array(0, dim=c(n-par5*12,par5), dimnames=list(1:(n-par5*12), paste(colnames(x)[par1],'(t-',1:par5,'s)',sep=''))) + for (i in 1:(n-par5*12)) { + for (j in 1:par5) { + x2[i,j] <- x[i+par5*12-j*12,par1] + } + } + x <- cbind(x[(par5*12+1):n,], x2) + n <- n - par5*12 + } > 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[n,])) [1] 1 > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Lichaamsverzorgingsindex 1 93.55 2 94.11 3 94.47 4 94.38 5 94.42 6 94.39 7 94.42 8 94.34 9 94.59 10 94.63 11 94.84 12 94.98 13 95.19 14 95.76 15 96.08 16 96.04 17 96.20 18 96.31 19 96.30 20 96.29 21 96.46 22 96.66 23 96.83 24 97.00 25 97.10 26 97.33 27 97.31 28 97.16 29 97.40 30 97.40 31 97.52 32 97.77 33 98.00 34 98.20 35 98.48 36 98.53 37 98.71 38 99.03 39 99.52 40 99.65 41 99.98 42 99.94 43 100.12 44 100.17 45 100.38 46 100.75 47 100.84 48 100.91 49 100.90 50 101.15 51 101.40 52 101.39 53 101.55 54 101.73 55 101.70 56 101.65 57 101.73 58 101.53 59 101.58 60 101.58 61 101.71 62 101.71 63 101.98 64 101.99 65 101.95 66 102.11 67 102.28 68 102.32 69 102.18 70 102.14 71 102.29 72 102.33 73 102.33 74 101.75 75 102.36 76 101.25 77 102.03 78 101.84 79 103.01 80 102.79 81 101.95 82 102.54 83 102.20 84 102.58 > (k <- length(x[n,])) [1] 1 > head(x) Lichaamsverzorgingsindex 1 93.55 2 94.11 3 94.47 4 94.38 5 94.42 6 94.39 > 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