Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
0 129988 81 20 18 0 130358 46 38 17 0 7215 18 0 0 1 112914 86 49 22 1 219904 126 76 30 1 402036 218 104 31 1 117604 50 37 19 0 131822 50 57 25 1 99729 38 42 30 1 256310 86 62 26 1 113066 69 50 20 1 165392 62 66 30 0 78240 90 38 15 0 152673 84 48 22 0 134368 47 42 17 0 125769 67 47 19 0 123467 50 71 28 1 56232 47 0 12 1 108458 79 50 28 0 22762 21 12 13 0 48633 50 16 14 0 182081 83 77 27 1 140857 59 29 25 0 93773 46 38 30 0 133398 78 50 21 0 113933 23 33 17 0 153851 139 49 22 1 140711 75 59 28 0 303844 105 55 26 1 163810 38 42 17 1 123344 40 40 23 0 157640 39 51 20 1 103274 90 45 16 0 193500 105 73 20 0 178768 43 51 21 0 0 1 0 0 1 181412 55 46 27 1 92342 47 44 14 1 100023 41 31 29 1 178277 50 71 31 1 145067 58 61 19 1 114146 50 28 30 0 86039 25 21 23 1 125481 66 42 21 1 95535 42 44 22 1 129221 78 40 21 0 61554 26 15 32 0 168048 82 46 20 1 159121 75 43 26 0 129362 51 47 25 1 48188 28 12 22 0 95461 56 46 19 0 229864 64 56 24 0 191094 68 47 26 1 161082 51 50 27 0 111388 47 35 10 1 172614 58 45 26 1 63205 18 25 23 1 109102 56 47 21 1 137303 74 28 34 1 125304 50 48 29 1 88620 65 32 19 0 95808 48 28 19 1 83419 29 31 23 0 101723 25 13 22 0 94982 37 38 29 0 143566 61 48 31 1 113325 63 68 21 0 81518 32 32 21 1 31970 15 5 21 1 192268 102 53 15 1 91261 55 33 9 0 80820 56 54 23 1 85829 59 37 18 1 116322 53 52 31 1 56544 32 0 25 0 118838 52 52 25 1 118781 80 51 22 1 60138 23 16 21 0 73422 66 33 26 0 67751 58 48 22 1 225857 54 35 26 1 51185 24 24 20 0 97181 32 37 25 0 45100 39 17 19 1 115801 43 32 22 1 186310 190 55 25 0 71960 86 39 22 0 80105 48 31 21 0 107728 42 26 21 1 98707 33 37 23 1 136234 67 66 22 0 136781 52 35 21 1 105863 52 24 12 1 49164 33 22 13 0 189493 93 42 32 0 169406 50 86 24 0 19349 12 13 1 1 160819 87 21 24 0 109510 53 32 25 0 43803 25 8 4 1 47062 19 38 15 1 110845 44 45 21 0 92517 52 24 23 1 58660 36 23 12 1 27676 22 2 16 1 98550 32 52 24 0 43646 24 5 9 0 0 0 0 0 0 75566 28 43 25 0 57359 48 18 17 1 104330 36 44 18 1 70369 47 45 21 0 65494 56 29 17 0 3616 5 0 0 1 0 0 0 0 1 143931 37 32 20 1 117946 66 65 26 0 137332 85 26 27 0 84336 33 24 20 1 43410 19 7 1 0 137585 60 62 25 1 79015 34 30 14 1 101354 46 49 27 1 57586 38 3 12 1 19764 12 10 2 1 105757 42 42 16 0 103651 25 23 23 0 113402 35 40 28 0 11796 9 1 2 0 7627 9 0 0 1 121085 49 29 17 1 6836 3 0 1 0 139563 46 46 17 0 5118 3 5 0 1 40248 16 8 4 0 0 0 0 0 1 95079 42 21 25 0 80763 32 21 26 1 7131 4 0 0 1 4194 11 0 0 0 60378 20 15 15 1 109173 44 47 20 1 83484 16 17 19
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