Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
0 255202 64 92 34 0 135248 59 58 30 0 207223 64 62 42 1 189326 95 108 34 1 141365 46 55 25 0 65295 27 8 31 0 439387 103 134 29 0 33186 19 1 18 0 183696 51 64 30 0 186657 38 77 29 1 276696 99 86 42 1 194414 98 96 50 0 141409 59 44 33 1 306730 68 108 46 1 192691 74 63 38 1 333497 164 160 52 0 261835 59 109 32 1 263451 130 86 35 1 157448 49 93 25 1 232190 73 126 42 0 245725 64 110 40 0 388603 92 86 35 0 156540 34 50 25 0 156189 47 92 46 0 189726 106 123 39 0 192167 106 81 35 1 249893 122 93 38 1 236812 76 113 35 1 143160 47 52 28 0 259667 54 113 37 0 243020 68 113 40 0 176062 67 44 42 0 286683 79 123 44 1 87485 33 38 33 0 329737 88 111 38 1 247082 51 77 37 0 378463 108 102 41 1 191653 75 74 32 0 114673 31 33 17 0 301596 167 107 39 0 284195 73 108 33 1 155568 60 66 35 1 177306 67 69 32 1 144595 51 62 35 0 140319 73 50 45 1 405267 135 91 38 1 78800 42 20 26 1 201970 69 101 45 1 302705 101 129 44 1 164733 50 93 40 1 194221 68 89 33 0 24188 24 8 4 0 346142 288 80 41 0 65029 17 21 18 0 101097 64 30 14 1 253745 51 86 36 0 273513 77 116 49 1 282220 160 106 32 1 280928 120 132 37 1 214872 74 75 32 0 342048 127 139 43 0 273924 108 121 25 1 195726 92 57 42 1 231162 80 67 37 0 209798 61 45 33 1 201345 60 88 28 0 180231 118 79 31 1 204441 129 75 40 0 197813 67 114 32 1 136421 60 127 25 1 216092 59 86 42 1 73566 32 22 23 0 213998 70 67 42 1 181728 50 77 38 0 148758 51 105 34 0 308343 71 121 39 1 251437 78 88 32 0 202388 102 78 37 0 173286 56 122 34 0 155529 58 66 33 0 132672 41 58 25 1 390163 102 134 45 0 145905 66 30 26 0 228012 88 103 40 1 80953 25 49 8 0 130805 47 26 27 1 135163 49 67 32 1 333790 168 59 37 1 271806 95 95 50 1 164235 99 156 41 1 234092 80 74 37 0 207158 69 137 38 0 156583 57 37 28 0 242395 68 111 36 1 261601 70 58 32 1 178489 35 78 32 0 204221 44 88 33 1 268066 69 152 35 1 327622 133 130 58 1 361799 101 145 27 0 247131 107 108 45 1 265849 58 138 37 0 162336 162 62 32 1 43287 14 13 19 0 172244 68 89 22 0 189021 121 86 35 0 227681 43 116 36 0 269329 81 157 36 0 106503 56 28 23 1 117891 77 83 40 1 287201 59 72 40 0 266805 78 134 42 0 23623 11 12 1 1 174954 69 120 36 0 61857 25 23 11 1 144889 43 83 40 1 347988 103 126 34 0 21054 16 4 0 1 224051 46 71 27 1 31414 19 18 8 1 278660 107 98 35 0 209481 58 68 44 0 156870 75 44 40 1 112933 46 29 28 0 38214 34 16 8 0 166011 35 61 36 1 316044 73 117 47 1 181578 56 46 48 1 358903 72 129 45 1 275578 91 139 48 1 368796 106 136 49 1 172464 31 66 35 1 94381 35 42 32 1 250563 290 75 36 1 382499 154 97 42 1 118010 42 49 35 1 365575 122 127 42 1 147989 72 55 34 1 231681 46 101 41 0 193119 77 80 36 0 189020 108 29 32 0 341958 106 95 33 1 222060 79 120 35 0 173260 63 41 21 0 274787 91 128 42 1 130908 52 142 49 0 204009 75 88 33 0 262412 94 170 39 0 1 0 0 0 0 14688 10 4 0 0 98 1 0 0 0 455 2 0 0 1 0 0 0 0 0 0 0 0 0 1 195765 75 56 33 0 334258 129 121 47 0 0 0 0 0 0 203 4 0 0 0 7199 5 7 0 1 46660 20 12 5 1 17547 5 0 1 0 107465 38 37 38 1 969 2 0 0 1 179994 58 47 28
Names of X columns:
Geslacht Time_in_RFC Logins Blogged_computations Reviewed_compendiums
Endogenous Variable (Column Number)
Categorization
none
none
quantiles
hclust
equal
Number of categories (only if categorization<>none)
Cross-Validation? (only if categorization<>none)
no
no
yes
Chart options
R Code
library(party) library(Hmisc) par1 <- as.numeric(par1) par3 <- as.numeric(par3) x <- data.frame(t(y)) is.data.frame(x) x <- x[!is.na(x[,par1]),] k <- length(x[1,]) n <- length(x[,1]) colnames(x)[par1] x[,par1] 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]) colnames(x) colnames(x)[par1] x[,par1] if (par2 == 'none') { m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) } load(file='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='mytable3.tab') } } m bitmap(file='test1.png') plot(m) dev.off() bitmap(file='test1a.png') plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') dev.off() 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) } if (par2 != 'none') { print(cbind(as.factor(x[,par1]),predict(m))) myt <- table(as.factor(x[,par1]),predict(m)) print(myt) } bitmap(file='test2.png') 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() 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='mytable1.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='mytable.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='mytable2.tab') }
Compute
Summary of computational transaction
Raw Input
view raw input (R code)
Raw Output
view raw output of R engine
Computing time
2 seconds
R Server
Big Analytics Cloud Computing Center
Click here to blog (archive) this computation