R version 2.13.0 (2011-04-13) Copyright (C) 2011 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. > par9 = 'COLLES all' > par8 = 'COLLES actuals' > par7 = 'all' > par6 = 'all' > par5 = 'male' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Attaching package: 'Hmisc' The following object(s) are masked from 'package:survival': untangle.specials The following object(s) are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- as.data.frame(read.table(file='http://www.wessa.net/download/utaut.csv',sep=',',header=T)) > x$U25 <- 6-x$U25 > if(par5 == 'female') x <- x[x$Gender==0,] > if(par5 == 'male') x <- x[x$Gender==1,] > if(par6 == 'prep') x <- x[x$Pop==1,] > if(par6 == 'bachelor') x <- x[x$Pop==0,] > if(par7 != 'all') { + x <- x[x$Year==as.numeric(par7),] + } > cAc <- with(x,cbind( A1, A2, A3, A4, A5, A6, A7, A8, A9,A10)) > cAs <- with(x,cbind(A11,A12,A13,A14,A15,A16,A17,A18,A19,A20)) > cA <- cbind(cAc,cAs) > cCa <- with(x,cbind(C1,C3,C5,C7, C9,C11,C13,C15,C17,C19,C21,C23,C25,C27,C29,C31,C33,C35,C37,C39,C41,C43,C45,C47)) > cCp <- with(x,cbind(C2,C4,C6,C8,C10,C12,C14,C16,C18,C20,C22,C24,C26,C28,C30,C32,C34,C36,C38,C40,C42,C44,C46,C48)) > cC <- cbind(cCa,cCp) > cU <- with(x,cbind(U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33)) > cE <- with(x,cbind(BC,NNZFG,MRT,AFL,LPM,LPC,W,WPA)) > cX <- with(x,cbind(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18)) > if (par8=='ATTLES connected') x <- cAc > if (par8=='ATTLES separate') x <- cAs > if (par8=='ATTLES all') x <- cA > if (par8=='COLLES actuals') x <- cCa > if (par8=='COLLES preferred') x <- cCp > if (par8=='COLLES all') x <- cC > if (par8=='CSUQ') x <- cU > if (par8=='Learning Activities') x <- cE > if (par8=='Exam Items') x <- cX > if (par9=='ATTLES connected') y <- cAc > if (par9=='ATTLES separate') y <- cAs > if (par9=='ATTLES all') y <- cA > if (par9=='COLLES actuals') y <- cCa > if (par9=='COLLES preferred') y <- cCp > if (par9=='COLLES all') y <- cC > if (par9=='CSUQ') y <- cU > if (par9=='Learning Activities') y <- cE > if (par9=='Exam Items') y <- cX > if (par1==0) { + nr <- length(y[,1]) + nc <- length(y[1,]) + mysum <- array(0,dim=nr) + for(jjj in 1:nr) { + for(iii in 1:nc) { + mysum[jjj] = mysum[jjj] + y[jjj,iii] + } + } + y <- mysum + } else { + y <- y[,par1] + } > nx <- cbind(y,x) > colnames(nx) <- c('endo',colnames(x)) > x <- nx > par1=1 > ncol <- length(x[1,]) > for (jjj in 1:ncol) { + x <- x[!is.na(x[,jjj]),] + } > x <- as.data.frame(x) > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "endo" > x[,par1] [1] 177 203 180 167 194 166 169 158 146 172 173 159 196 169 188 175 183 195 [19] 191 158 176 151 140 167 140 203 181 163 173 164 179 154 174 196 169 172 [37] 180 162 171 200 169 154 162 195 175 139 164 143 157 197 162 181 132 174 [55] 156 155 151 142 152 147 172 184 157 162 200 166 135 179 192 176 162 161 [73] 168 137 216 196 208 163 149 161 207 151 188 118 174 129 161 155 164 180 [91] 183 199 188 187 189 173 188 216 189 147 195 177 163 180 200 142 200 197 [109] 176 167 214 180 171 176 97 180 171 162 163 193 177 201 159 212 168 149 [127] 199 176 174 176 219 207 176 177 213 193 154 226 202 199 174 201 161 170 [145] 186 141 160 179 171 163 148 181 164 171 162 193 160 187 194 168 123 154 [163] 181 172 189 170 193 170 188 193 178 160 149 145 188 181 161 197 172 169 [181] 201 179 180 177 175 201 171 145 197 208 169 190 199 199 164 144 163 172 [199] 203 172 132 172 196 173 176 137 167 170 164 148 208 145 168 174 172 158 [217] 187 201 144 170 189 177 140 159 198 180 189 204 190 175 140 186 134 184 [235] 168 132 167 164 172 136 154 139 171 203 177 174 198 168 167 183 136 184 [253] 212 163 190 179 189 173 195 193 177 191 175 189 181 175 159 165 176 155 [271] 167 166 192 202 191 194 171 164 145 146 181 202 156 179 177 169 182 142 [289] 212 177 186 156 185 220 196 190 169 174 193 182 190 222 157 197 197 141 [307] 182 206 164 175 144 160 168 193 215 203 130 177 188 154 171 210 195 202 [325] 135 154 148 170 125 167 164 158 191 182 175 183 197 158 189 188 174 176 [343] 192 197 197 175 164 186 190 202 182 153 180 183 168 176 170 199 174 162 [361] 192 207 156 182 219 175 161 190 176 147 158 170 189 189 193 147 188 191 [379] 185 168 154 188 189 200 166 186 207 214 186 180 99 205 174 172 172 163 [397] 158 146 172 185 159 197 164 179 137 177 157 165 200 172 141 157 163 143 [415] 165 167 164 202 143 148 173 170 169 149 175 207 > if (par2 == 'kmeans') { + cl <- kmeans(x[,par1], par3) + print(cl) + clm <- matrix(cbind(cl$centers,1:par3),ncol=2) + clm <- clm[sort.list(clm[,1]),] + for (i in 1:par3) { + cl$cluster[cl$cluster==clm[i,2]] <- paste('C',i,sep='') + } + cl$cluster <- as.factor(cl$cluster) + print(cl$cluster) + x[,par1] <- cl$cluster + } > if (par2 == 'quantiles') { + x[,par1] <- cut2(x[,par1],g=par3) + } > if (par2 == 'hclust') { + hc <- hclust(dist(x[,par1])^2, 'cen') + print(hc) + memb <- cutree(hc, k = par3) + dum <- c(mean(x[memb==1,par1])) + for (i in 2:par3) { + dum <- c(dum, mean(x[memb==i,par1])) + } + hcm <- matrix(cbind(dum,1:par3),ncol=2) + hcm <- hcm[sort.list(hcm[,1]),] + for (i in 1:par3) { + memb[memb==hcm[i,2]] <- paste('C',i,sep='') + } + memb <- as.factor(memb) + print(memb) + x[,par1] <- memb + } > if (par2=='equal') { + ed <- cut(as.numeric(x[,par1]),par3,labels=paste('C',1:par3,sep='')) + x[,par1] <- as.factor(ed) + } > table(x[,par1]) 97 99 118 123 125 129 130 132 134 135 136 137 139 140 141 142 143 144 145 146 1 1 1 1 1 1 1 3 1 2 2 3 2 4 3 3 3 3 4 3 147 148 149 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 4 4 4 3 1 1 8 3 4 5 7 5 4 6 8 9 13 3 4 9 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 9 9 9 9 14 6 11 11 12 12 1 7 10 7 6 5 3 3 6 3 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 10 11 7 5 4 9 3 5 5 10 2 6 6 5 6 5 1 1 1 5 208 210 212 213 214 215 216 219 220 222 226 3 1 3 1 2 1 2 2 1 1 1 > colnames(x) [1] "endo" "C1" "C3" "C5" "C7" "C9" "C11" "C13" "C15" "C17" [11] "C19" "C21" "C23" "C25" "C27" "C29" "C31" "C33" "C35" "C37" [21] "C39" "C41" "C43" "C45" "C47" > colnames(x)[par1] [1] "endo" > x[,par1] [1] 177 203 180 167 194 166 169 158 146 172 173 159 196 169 188 175 183 195 [19] 191 158 176 151 140 167 140 203 181 163 173 164 179 154 174 196 169 172 [37] 180 162 171 200 169 154 162 195 175 139 164 143 157 197 162 181 132 174 [55] 156 155 151 142 152 147 172 184 157 162 200 166 135 179 192 176 162 161 [73] 168 137 216 196 208 163 149 161 207 151 188 118 174 129 161 155 164 180 [91] 183 199 188 187 189 173 188 216 189 147 195 177 163 180 200 142 200 197 [109] 176 167 214 180 171 176 97 180 171 162 163 193 177 201 159 212 168 149 [127] 199 176 174 176 219 207 176 177 213 193 154 226 202 199 174 201 161 170 [145] 186 141 160 179 171 163 148 181 164 171 162 193 160 187 194 168 123 154 [163] 181 172 189 170 193 170 188 193 178 160 149 145 188 181 161 197 172 169 [181] 201 179 180 177 175 201 171 145 197 208 169 190 199 199 164 144 163 172 [199] 203 172 132 172 196 173 176 137 167 170 164 148 208 145 168 174 172 158 [217] 187 201 144 170 189 177 140 159 198 180 189 204 190 175 140 186 134 184 [235] 168 132 167 164 172 136 154 139 171 203 177 174 198 168 167 183 136 184 [253] 212 163 190 179 189 173 195 193 177 191 175 189 181 175 159 165 176 155 [271] 167 166 192 202 191 194 171 164 145 146 181 202 156 179 177 169 182 142 [289] 212 177 186 156 185 220 196 190 169 174 193 182 190 222 157 197 197 141 [307] 182 206 164 175 144 160 168 193 215 203 130 177 188 154 171 210 195 202 [325] 135 154 148 170 125 167 164 158 191 182 175 183 197 158 189 188 174 176 [343] 192 197 197 175 164 186 190 202 182 153 180 183 168 176 170 199 174 162 [361] 192 207 156 182 219 175 161 190 176 147 158 170 189 189 193 147 188 191 [379] 185 168 154 188 189 200 166 186 207 214 186 180 99 205 174 172 172 163 [397] 158 146 172 185 159 197 164 179 137 177 157 165 200 172 141 157 163 143 [415] 165 167 164 202 143 148 173 170 169 149 175 207 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > if (par2 != 'none') { + m <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data = x) + if (par4=='yes') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'10-Fold Cross Validation',3+2*par3,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + a<-table.element(a,'Prediction (training)',par3+1,TRUE) + a<-table.element(a,'Prediction (testing)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Actual',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + a<-table.row.end(a) + for (i in 1:10) { + ind <- sample(2, nrow(x), replace=T, prob=c(0.9,0.1)) + m.ct <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data =x[ind==1,]) + if (i==1) { + m.ct.i.pred <- predict(m.ct, newdata=x[ind==1,]) + m.ct.i.actu <- x[ind==1,par1] + m.ct.x.pred <- predict(m.ct, newdata=x[ind==2,]) + m.ct.x.actu <- x[ind==2,par1] + } else { + m.ct.i.pred <- c(m.ct.i.pred,predict(m.ct, newdata=x[ind==1,])) + m.ct.i.actu <- c(m.ct.i.actu,x[ind==1,par1]) + m.ct.x.pred <- c(m.ct.x.pred,predict(m.ct, newdata=x[ind==2,])) + m.ct.x.actu <- c(m.ct.x.actu,x[ind==2,par1]) + } + } + print(m.ct.i.tab <- table(m.ct.i.actu,m.ct.i.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.i.tab[i,i] / sum(m.ct.i.tab[i,])) + numer <- numer + m.ct.i.tab[i,i] + } + print(m.ct.i.cp <- numer / sum(m.ct.i.tab)) + print(m.ct.x.tab <- table(m.ct.x.actu,m.ct.x.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.x.tab[i,i] / sum(m.ct.x.tab[i,])) + numer <- numer + m.ct.x.tab[i,i] + } + print(m.ct.x.cp <- numer / sum(m.ct.x.tab)) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (jjj in 1:par3) a<-table.element(a,m.ct.i.tab[i,jjj]) + a<-table.element(a,round(m.ct.i.tab[i,i]/sum(m.ct.i.tab[i,]),4)) + for (jjj in 1:par3) a<-table.element(a,m.ct.x.tab[i,jjj]) + a<-table.element(a,round(m.ct.x.tab[i,i]/sum(m.ct.x.tab[i,]),4)) + a<-table.row.end(a) + } + a<-table.row.start(a) + a<-table.element(a,'Overall',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.i.cp,4)) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.x.cp,4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/1ia6g1335466244.tab") + } + } > m Conditional inference tree with 19 terminal nodes Response: endo Inputs: C1, C3, C5, C7, C9, C11, C13, C15, C17, C19, C21, C23, C25, C27, C29, C31, C33, C35, C37, C39, C41, C43, C45, C47 Number of observations: 426 1) C17 <= 3; criterion = 1, statistic = 131.528 2) C31 <= 3; criterion = 1, statistic = 57.691 3) C47 <= 2; criterion = 1, statistic = 23.983 4)* weights = 13 3) C47 > 2 5) C43 <= 3; criterion = 0.999, statistic = 17.21 6) C37 <= 3; criterion = 0.989, statistic = 12.331 7) C21 <= 2; criterion = 0.957, statistic = 9.72 8)* weights = 12 7) C21 > 2 9)* weights = 21 6) C37 > 3 10)* weights = 10 5) C43 > 3 11)* weights = 33 2) C31 > 3 12) C47 <= 2; criterion = 1, statistic = 26.443 13)* weights = 13 12) C47 > 2 14) C35 <= 3; criterion = 0.993, statistic = 13.087 15) C31 <= 4; criterion = 0.955, statistic = 9.646 16)* weights = 51 15) C31 > 4 17)* weights = 14 14) C35 > 3 18)* weights = 43 1) C17 > 3 19) C9 <= 3; criterion = 1, statistic = 68.407 20) C31 <= 3; criterion = 0.996, statistic = 14.285 21)* weights = 26 20) C31 > 3 22) C19 <= 3; criterion = 0.987, statistic = 11.965 23)* weights = 13 22) C19 > 3 24)* weights = 27 19) C9 > 3 25) C27 <= 4; criterion = 1, statistic = 45.086 26) C41 <= 3; criterion = 1, statistic = 23.405 27) C7 <= 3; criterion = 0.995, statistic = 13.763 28)* weights = 13 27) C7 > 3 29)* weights = 14 26) C41 > 3 30) C17 <= 4; criterion = 0.999, statistic = 17.932 31) C39 <= 3; criterion = 0.976, statistic = 10.812 32)* weights = 25 31) C39 > 3 33)* weights = 35 30) C17 > 4 34)* weights = 15 25) C27 > 4 35) C33 <= 4; criterion = 0.998, statistic = 15.869 36)* weights = 34 35) C33 > 4 37)* weights = 14 > postscript(file="/var/wessaorg/rcomp/tmp/2habg1335466244.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3gmm21335466244.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') > dev.off() null device 1 > if (par2 == 'none') { + forec <- predict(m) + result <- as.data.frame(cbind(x[,par1],forec,x[,par1]-forec)) + colnames(result) <- c('Actuals','Forecasts','Residuals') + print(result) + } Actuals Forecasts Residuals 1 177 179.1429 -2.14285714 2 203 189.7143 13.28571429 3 180 179.1200 0.88000000 4 167 179.1200 -12.12000000 5 194 189.7143 4.28571429 6 166 168.0392 -2.03921569 7 169 168.0392 0.96078431 8 158 134.6154 23.38461538 9 146 154.5385 -8.53846154 10 172 163.8846 8.11538462 11 173 164.0303 8.96969697 12 159 181.2963 -22.29629630 13 196 202.0667 -6.06666667 14 169 164.0303 4.96969697 15 188 202.0667 -14.06666667 16 175 164.0303 10.96969697 17 183 179.1200 3.88000000 18 195 195.2941 -0.29411765 19 191 179.1429 11.85714286 20 158 161.6000 -3.60000000 21 176 168.0392 7.96078431 22 151 166.2308 -15.23076923 23 140 142.6667 -2.66666667 24 167 168.0392 -1.03921569 25 140 164.0303 -24.03030303 26 203 208.6429 -5.64285714 27 181 180.0233 0.97674419 28 163 168.0392 -5.03921569 29 173 163.8846 9.11538462 30 164 168.0392 -4.03921569 31 179 195.2941 -16.29411765 32 154 153.5714 0.42857143 33 174 180.0233 -6.02325581 34 196 189.7143 6.28571429 35 169 180.0233 -11.02325581 36 172 189.7143 -17.71428571 37 180 179.1200 0.88000000 38 162 181.2963 -19.29629630 39 171 180.6429 -9.64285714 40 200 189.7143 10.28571429 41 169 164.0303 4.96969697 42 154 166.2308 -12.23076923 43 162 168.0392 -6.03921569 44 195 208.6429 -13.64285714 45 175 180.0233 -5.02325581 46 139 168.0392 -29.03921569 47 164 168.0392 -4.03921569 48 143 154.5385 -11.53846154 49 157 153.5714 3.42857143 50 197 195.2941 1.70588235 51 162 164.0303 -2.03030303 52 181 189.7143 -8.71428571 53 132 142.6667 -10.66666667 54 174 181.2963 -7.29629630 55 156 180.0233 -24.02325581 56 155 166.2308 -11.23076923 57 151 167.5385 -16.53846154 58 142 134.6154 7.38461538 59 152 153.5714 -1.57142857 60 147 164.0303 -17.03030303 61 172 168.0392 3.96078431 62 184 180.0233 3.97674419 63 157 180.0233 -23.02325581 64 162 195.2941 -33.29411765 65 200 202.0667 -2.06666667 66 166 179.1200 -13.12000000 67 135 164.0303 -29.03030303 68 179 163.8846 15.11538462 69 192 195.2941 -3.29411765 70 176 179.1200 -3.12000000 71 162 164.0303 -2.03030303 72 161 168.0392 -7.03921569 73 168 180.0233 -12.02325581 74 137 163.8846 -26.88461538 75 216 208.6429 7.35714286 76 196 208.6429 -12.64285714 77 208 202.0667 5.93333333 78 163 164.0303 -1.03030303 79 149 168.0392 -19.03921569 80 161 164.0303 -3.03030303 81 207 202.0667 4.93333333 82 151 164.0303 -13.03030303 83 188 179.1200 8.88000000 84 118 134.6154 -16.61538462 85 174 181.2963 -7.29629630 86 129 161.6000 -32.60000000 87 161 163.8846 -2.88461538 88 155 166.2308 -11.23076923 89 164 180.0233 -16.02325581 90 180 168.0392 11.96078431 91 183 181.2963 1.70370370 92 199 181.2963 17.70370370 93 188 180.6429 7.35714286 94 187 202.0667 -15.06666667 95 189 189.7143 -0.71428571 96 173 180.6429 -7.64285714 97 188 180.0233 7.97674419 98 216 208.6429 7.35714286 99 189 180.0233 8.97674419 100 147 142.6667 4.33333333 101 195 189.7143 5.28571429 102 177 181.2963 -4.29629630 103 163 180.0233 -17.02325581 104 180 180.6429 -0.64285714 105 200 195.2941 4.70588235 106 142 142.6667 -0.66666667 107 200 189.7143 10.28571429 108 197 195.2941 1.70588235 109 176 181.2963 -5.29629630 110 167 180.6429 -13.64285714 111 214 195.2941 18.70588235 112 180 189.7143 -9.71428571 113 171 168.0392 2.96078431 114 176 164.0303 11.96969697 115 97 134.6154 -37.61538462 116 180 179.1200 0.88000000 117 171 180.6429 -9.64285714 118 162 164.0303 -2.03030303 119 163 163.8846 -0.88461538 120 193 180.0233 12.97674419 121 177 180.0233 -3.02325581 122 201 179.1200 21.88000000 123 159 180.0233 -21.02325581 124 212 208.6429 3.35714286 125 168 164.0303 3.96969697 126 149 163.8846 -14.88461538 127 199 195.2941 3.70588235 128 176 164.0303 11.96969697 129 174 189.7143 -15.71428571 130 176 168.0392 7.96078431 131 219 208.6429 10.35714286 132 207 202.0667 4.93333333 133 176 189.7143 -13.71428571 134 177 168.0392 8.96078431 135 213 208.6429 4.35714286 136 193 189.7143 3.28571429 137 154 166.2308 -12.23076923 138 226 202.0667 23.93333333 139 202 202.0667 -0.06666667 140 199 208.6429 -9.64285714 141 174 179.1200 -5.12000000 142 201 208.6429 -7.64285714 143 161 161.6000 -0.60000000 144 170 161.6000 8.40000000 145 186 189.7143 -3.71428571 146 141 134.6154 6.38461538 147 160 180.0233 -20.02325581 148 179 180.6429 -1.64285714 149 171 181.2963 -10.29629630 150 163 166.2308 -3.23076923 151 148 153.5714 -5.57142857 152 181 179.1429 1.85714286 153 164 163.8846 0.11538462 154 171 189.7143 -18.71428571 155 162 180.0233 -18.02325581 156 193 195.2941 -2.29411765 157 160 180.0233 -20.02325581 158 187 189.7143 -2.71428571 159 194 181.2963 12.70370370 160 168 168.0392 -0.03921569 161 123 134.6154 -11.61538462 162 154 167.5385 -13.53846154 163 181 180.0233 0.97674419 164 172 163.8846 8.11538462 165 189 189.7143 -0.71428571 166 170 179.1200 -9.12000000 167 193 179.1200 13.88000000 168 170 163.8846 6.11538462 169 188 180.0233 7.97674419 170 193 180.0233 12.97674419 171 178 168.0392 9.96078431 172 160 167.5385 -7.53846154 173 149 153.5714 -4.57142857 174 145 163.8846 -18.88461538 175 188 180.0233 7.97674419 176 181 189.7143 -8.71428571 177 161 179.1200 -18.12000000 178 197 189.7143 7.28571429 179 172 189.7143 -17.71428571 180 169 180.0233 -11.02325581 181 201 189.7143 11.28571429 182 179 164.0303 14.96969697 183 180 181.2963 -1.29629630 184 177 181.2963 -4.29629630 185 175 180.0233 -5.02325581 186 201 189.7143 11.28571429 187 171 168.0392 2.96078431 188 145 164.0303 -19.03030303 189 197 202.0667 -5.06666667 190 208 195.2941 12.70588235 191 169 189.7143 -20.71428571 192 190 195.2941 -5.29411765 193 199 202.0667 -3.06666667 194 199 180.6429 18.35714286 195 164 167.5385 -3.53846154 196 144 153.5714 -9.57142857 197 163 164.0303 -1.03030303 198 172 179.1200 -7.12000000 199 203 195.2941 7.70588235 200 172 179.1200 -7.12000000 201 132 167.5385 -35.53846154 202 172 166.2308 5.76923077 203 196 180.0233 15.97674419 204 173 166.2308 6.76923077 205 176 163.8846 12.11538462 206 137 134.6154 2.38461538 207 167 166.2308 0.76923077 208 170 168.0392 1.96078431 209 164 154.5385 9.46153846 210 148 134.6154 13.38461538 211 208 195.2941 12.70588235 212 145 153.5714 -8.57142857 213 168 163.8846 4.11538462 214 174 179.1429 -5.14285714 215 172 167.5385 4.46153846 216 158 163.8846 -5.88461538 217 187 181.2963 5.70370370 218 201 189.7143 11.28571429 219 144 142.6667 1.33333333 220 170 180.0233 -10.02325581 221 189 181.2963 7.70370370 222 177 154.5385 22.46153846 223 140 154.5385 -14.53846154 224 159 168.0392 -9.03921569 225 198 195.2941 2.70588235 226 180 166.2308 13.76923077 227 189 195.2941 -6.29411765 228 204 195.2941 8.70588235 229 190 195.2941 -5.29411765 230 175 179.1429 -4.14285714 231 140 134.6154 5.38461538 232 186 180.0233 5.97674419 233 134 142.6667 -8.66666667 234 184 195.2941 -11.29411765 235 168 168.0392 -0.03921569 236 132 153.5714 -21.57142857 237 167 181.2963 -14.29629630 238 164 154.5385 9.46153846 239 172 167.5385 4.46153846 240 136 153.5714 -17.57142857 241 154 154.5385 -0.53846154 242 139 142.6667 -3.66666667 243 171 168.0392 2.96078431 244 203 181.2963 21.70370370 245 177 163.8846 13.11538462 246 174 153.5714 20.42857143 247 198 180.0233 17.97674419 248 168 164.0303 3.96969697 249 167 161.6000 5.40000000 250 183 168.0392 14.96078431 251 136 154.5385 -18.53846154 252 184 179.1429 4.85714286 253 212 195.2941 16.70588235 254 163 163.8846 -0.88461538 255 190 167.5385 22.46153846 256 179 168.0392 10.96078431 257 189 179.1200 9.88000000 258 173 164.0303 8.96969697 259 195 189.7143 5.28571429 260 193 168.0392 24.96078431 261 177 168.0392 8.96078431 262 191 202.0667 -11.06666667 263 175 166.2308 8.76923077 264 189 189.7143 -0.71428571 265 181 181.2963 -0.29629630 266 175 180.0233 -5.02325581 267 159 179.1429 -20.14285714 268 165 153.5714 11.42857143 269 176 181.2963 -5.29629630 270 155 168.0392 -13.03921569 271 167 164.0303 2.96969697 272 166 168.0392 -2.03921569 273 192 195.2941 -3.29411765 274 202 180.0233 21.97674419 275 191 179.1200 11.88000000 276 194 195.2941 -1.29411765 277 171 164.0303 6.96969697 278 164 153.5714 10.42857143 279 145 154.5385 -9.53846154 280 146 163.8846 -17.88461538 281 181 179.1200 1.88000000 282 202 195.2941 6.70588235 283 156 153.5714 2.42857143 284 179 180.6429 -1.64285714 285 177 189.7143 -12.71428571 286 169 179.1429 -10.14285714 287 182 161.6000 20.40000000 288 142 153.5714 -11.57142857 289 212 195.2941 16.70588235 290 177 154.5385 22.46153846 291 186 195.2941 -9.29411765 292 156 168.0392 -12.03921569 293 185 180.6429 4.35714286 294 220 208.6429 11.35714286 295 196 180.0233 15.97674419 296 190 189.7143 0.28571429 297 169 168.0392 0.96078431 298 174 179.1429 -5.14285714 299 193 180.6429 12.35714286 300 182 180.0233 1.97674419 301 190 167.5385 22.46153846 302 222 208.6429 13.35714286 303 157 164.0303 -7.03030303 304 197 181.2963 15.70370370 305 197 161.6000 35.40000000 306 141 161.6000 -20.60000000 307 182 180.0233 1.97674419 308 206 195.2941 10.70588235 309 164 168.0392 -4.03921569 310 175 179.1200 -4.12000000 311 144 153.5714 -9.57142857 312 160 164.0303 -4.03030303 313 168 168.0392 -0.03921569 314 193 195.2941 -2.29411765 315 215 180.0233 34.97674419 316 203 179.1200 23.88000000 317 130 134.6154 -4.61538462 318 177 195.2941 -18.29411765 319 188 168.0392 19.96078431 320 154 168.0392 -14.03921569 321 171 168.0392 2.96078431 322 210 189.7143 20.28571429 323 195 208.6429 -13.64285714 324 202 202.0667 -0.06666667 325 135 134.6154 0.38461538 326 154 168.0392 -14.03921569 327 148 180.0233 -32.02325581 328 170 161.6000 8.40000000 329 125 154.5385 -29.53846154 330 167 181.2963 -14.29629630 331 164 164.0303 -0.03030303 332 158 168.0392 -10.03921569 333 191 189.7143 1.28571429 334 182 166.2308 15.76923077 335 175 153.5714 21.42857143 336 183 163.8846 19.11538462 337 197 179.1429 17.85714286 338 158 164.0303 -6.03030303 339 189 189.7143 -0.71428571 340 188 168.0392 19.96078431 341 174 179.1429 -5.14285714 342 176 180.0233 -4.02325581 343 192 181.2963 10.70370370 344 197 180.0233 16.97674419 345 197 180.0233 16.97674419 346 175 180.6429 -5.64285714 347 164 168.0392 -4.03921569 348 186 167.5385 18.46153846 349 190 180.6429 9.35714286 350 202 202.0667 -0.06666667 351 182 134.6154 47.38461538 352 153 168.0392 -15.03921569 353 180 166.2308 13.76923077 354 183 180.0233 2.97674419 355 168 164.0303 3.96969697 356 176 181.2963 -5.29629630 357 170 181.2963 -11.29629630 358 199 195.2941 3.70588235 359 174 168.0392 5.96078431 360 162 153.5714 8.42857143 361 192 179.1200 12.88000000 362 207 189.7143 17.28571429 363 156 168.0392 -12.03921569 364 182 179.1200 2.88000000 365 219 202.0667 16.93333333 366 175 163.8846 11.11538462 367 161 164.0303 -3.03030303 368 190 164.0303 25.96969697 369 176 179.1429 -3.14285714 370 147 153.5714 -6.57142857 371 158 153.5714 4.42857143 372 170 167.5385 2.46153846 373 189 163.8846 25.11538462 374 189 195.2941 -6.29411765 375 193 195.2941 -2.29411765 376 147 163.8846 -16.88461538 377 188 181.2963 6.70370370 378 191 189.7143 1.28571429 379 185 168.0392 16.96078431 380 168 163.8846 4.11538462 381 154 163.8846 -9.88461538 382 188 180.0233 7.97674419 383 189 181.2963 7.70370370 384 200 195.2941 4.70588235 385 166 168.0392 -2.03921569 386 186 189.7143 -3.71428571 387 207 189.7143 17.28571429 388 214 208.6429 5.35714286 389 186 195.2941 -9.29411765 390 180 168.0392 11.96078431 391 99 134.6154 -35.61538462 392 205 180.0233 24.97674419 393 174 168.0392 5.96078431 394 172 163.8846 8.11538462 395 172 167.5385 4.46153846 396 163 179.1200 -16.12000000 397 158 153.5714 4.42857143 398 146 142.6667 3.33333333 399 172 179.1200 -7.12000000 400 185 181.2963 3.70370370 401 159 142.6667 16.33333333 402 197 195.2941 1.70588235 403 164 168.0392 -4.03921569 404 179 180.6429 -1.64285714 405 137 142.6667 -5.66666667 406 177 164.0303 12.96969697 407 157 168.0392 -11.03921569 408 165 154.5385 10.46153846 409 200 180.0233 19.97674419 410 172 180.0233 -8.02325581 411 141 161.6000 -20.60000000 412 157 163.8846 -6.88461538 413 163 153.5714 9.42857143 414 143 163.8846 -20.88461538 415 165 167.5385 -2.53846154 416 167 179.1200 -12.12000000 417 164 168.0392 -4.03921569 418 202 181.2963 20.70370370 419 143 142.6667 0.33333333 420 148 164.0303 -16.03030303 421 173 154.5385 18.46153846 422 170 179.1429 -9.14285714 423 169 168.0392 0.96078431 424 149 142.6667 6.33333333 425 175 164.0303 10.96969697 426 207 179.1429 27.85714286 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/wessaorg/rcomp/tmp/4ff121335466244.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if(par2=='none') { + op <- par(mfrow=c(2,2)) + plot(density(result$Actuals),main='Kernel Density Plot of Actuals') + plot(density(result$Residuals),main='Kernel Density Plot of Residuals') + plot(result$Forecasts,result$Actuals,main='Actuals versus Predictions',xlab='Predictions',ylab='Actuals') + plot(density(result$Forecasts),main='Kernel Density Plot of Predictions') + par(op) + } > if(par2!='none') { + plot(myt,main='Confusion Matrix',xlab='Actual',ylab='Predicted') + } > dev.off() null device 1 > if (par2 == 'none') { + detcoef <- cor(result$Forecasts,result$Actuals) + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goodness of Fit',2,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Correlation',1,TRUE) + a<-table.element(a,round(detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'R-squared',1,TRUE) + a<-table.element(a,round(detcoef*detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'RMSE',1,TRUE) + a<-table.element(a,round(sqrt(mean((result$Residuals)^2)),4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/5rs6n1335466244.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Actuals, Predictions, and Residuals',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'#',header=TRUE) + a<-table.element(a,'Actuals',header=TRUE) + a<-table.element(a,'Forecasts',header=TRUE) + a<-table.element(a,'Residuals',header=TRUE) + a<-table.row.end(a) + for (i in 1:length(result$Actuals)) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,result$Actuals[i]) + a<-table.element(a,result$Forecasts[i]) + a<-table.element(a,result$Residuals[i]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/6gf2v1335466244.tab") + } > if (par2 != 'none') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Confusion Matrix (predicted in columns / actuals in rows)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + for (i in 1:par3) { + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + } + a<-table.row.end(a) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (j in 1:par3) { + a<-table.element(a,myt[i,j]) + } + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/70ksn1335466244.tab") + } > > try(system("convert tmp/2habg1335466244.ps tmp/2habg1335466244.png",intern=TRUE)) character(0) > try(system("convert tmp/3gmm21335466244.ps tmp/3gmm21335466244.png",intern=TRUE)) character(0) > try(system("convert tmp/4ff121335466244.ps tmp/4ff121335466244.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.725 0.283 9.041