Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
0.01244 0.00149 0.01848 0.00338 0.00099 -0.01826 -0.01025 0.04860 0.04399 -0.03429 0.00779 0.01150 0.01244 0.00149 0.01848 0.00338 0.00099 -0.03086 -0.01025 0.04860 0.04399 -0.03429 -0.00793 0.01150 0.01244 0.00149 0.01848 0.00338 0.04033 -0.03086 -0.01025 0.04860 0.04399 -0.01514 -0.00793 0.01150 0.01244 0.00149 0.01848 -0.02352 0.04033 -0.03086 -0.01025 0.04860 0.01778 -0.01514 -0.00793 0.01150 0.01244 0.00149 0.00573 -0.02352 0.04033 -0.03086 -0.01025 0.00634 0.01778 -0.01514 -0.00793 0.01150 0.01244 0.01805 0.00573 -0.02352 0.04033 -0.03086 0.00770 0.00634 0.01778 -0.01514 -0.00793 0.01150 -0.01887 0.01805 0.00573 -0.02352 0.04033 0.00692 0.00770 0.00634 0.01778 -0.01514 -0.00793 0.04363 -0.01887 0.01805 0.00573 -0.02352 0.00029 0.00692 0.00770 0.00634 0.01778 -0.01514 0.02875 0.04363 -0.01887 0.01805 0.00573 0.02487 0.00029 0.00692 0.00770 0.00634 0.01778 -0.00393 0.02875 0.04363 -0.01887 0.01805 0.01708 0.02487 0.00029 0.00692 0.00770 0.00634 0.05280 -0.00393 0.02875 0.04363 -0.01887 0.02540 0.01708 0.02487 0.00029 0.00692 0.00770 -0.00351 0.05280 -0.00393 0.02875 0.04363 0.02935 0.02540 0.01708 0.02487 0.00029 0.00692 0.05407 -0.00351 0.05280 -0.00393 0.02875 0.02615 0.02935 0.02540 0.01708 0.02487 0.00029 -0.01299 0.05407 -0.00351 0.05280 -0.00393 0.00424 0.02615 0.02935 0.02540 0.01708 0.02487 0.00747 -0.01299 0.05407 -0.00351 0.05280 -0.00032 0.00424 0.02615 0.02935 0.02540 0.01708 -0.03288 0.00747 -0.01299 0.05407 -0.00351 -0.02353 -0.00032 0.00424 0.02615 0.02935 0.02540 -0.05013 -0.03288 0.00747 -0.01299 0.05407 0.01387 -0.02353 -0.00032 0.00424 0.02615 0.02935 0.03715 -0.05013 -0.03288 0.00747 -0.01299 0.01286 0.01387 -0.02353 -0.00032 0.00424 0.02615 0.00205 0.03715 -0.05013 -0.03288 0.00747 -0.00609 0.01286 0.01387 -0.02353 -0.00032 0.00424 0.02912 0.00205 0.03715 -0.05013 -0.03288 0.00635 -0.00609 0.01286 0.01387 -0.02353 -0.00032 -0.00832 0.02912 0.00205 0.03715 -0.05013 0.02049 0.00635 -0.00609 0.01286 0.01387 -0.02353 0.02908 -0.00832 0.02912 0.00205 0.03715 0.00332 0.02049 0.00635 -0.00609 0.01286 0.01387 -0.00942 0.02908 -0.00832 0.02912 0.00205 0.00409 0.00332 0.02049 0.00635 -0.00609 0.01286 0.04381 -0.00942 0.02908 -0.00832 0.02912 0.02753 0.00409 0.00332 0.02049 0.00635 -0.00609 0.00603 0.04381 -0.00942 0.02908 -0.00832 0.01205 0.02753 0.00409 0.00332 0.02049 0.00635 0.02253 0.00603 0.04381 -0.00942 0.02908 0.01773 0.01205 0.02753 0.00409 0.00332 0.02049 0.05789 0.02253 0.00603 0.04381 -0.00942 -0.00897 0.01773 0.01205 0.02753 0.00409 0.00332 -0.03783 0.05789 0.02253 0.00603 0.04381 -0.01226 -0.00897 0.01773 0.01205 0.02753 0.00409 -0.03176 -0.03783 0.05789 0.02253 0.00603 0.00644 -0.01226 -0.00897 0.01773 0.01205 0.02753 -0.00572 -0.03176 -0.03783 0.05789 0.02253 -0.00059 0.00644 -0.01226 -0.00897 0.01773 0.01205 0.01040 -0.00572 -0.03176 -0.03783 0.05789 0.01707 -0.00059 0.00644 -0.01226 -0.00897 0.01773 0.03662 0.01040 -0.00572 -0.03176 -0.03783 -0.00104 0.01707 -0.00059 0.00644 -0.01226 -0.00897 0.03771 0.03662 0.01040 -0.00572 -0.03176 0.01272 -0.00104 0.01707 -0.00059 0.00644 -0.01226 0.05981 0.03771 0.03662 0.01040 -0.00572 0.01859 0.01272 -0.00104 0.01707 -0.00059 0.00644 -0.03204 0.05981 0.03771 0.03662 0.01040 0.03238 0.01859 0.01272 -0.00104 0.01707 -0.00059 0.02837 -0.03204 0.05981 0.03771 0.03662 0.03132 0.03238 0.01859 0.01272 -0.00104 0.01707 0.05003 0.02837 -0.03204 0.05981 0.03771 0.01412 0.03132 0.03238 0.01859 0.01272 -0.00104 0.04980 0.05003 0.02837 -0.03204 0.05981 0.00588 0.01412 0.03132 0.03238 0.01859 0.01272 -0.02299 0.04980 0.05003 0.02837 -0.03204 0.05686 0.00588 0.01412 0.03132 0.03238 0.01859 0.04030 -0.02299 0.04980 0.05003 0.02837 0.05681 0.05686 0.00588 0.01412 0.03132 0.03238 0.03176 0.04030 -0.02299 0.04980 0.05003 -0.04078 0.05681 0.05686 0.00588 0.01412 0.03132 -0.00135 0.03176 0.04030 -0.02299 0.04980 0.02507 -0.04078 0.05681 0.05686 0.00588 0.01412 -0.02473 -0.00135 0.03176 0.04030 -0.02299 0.00600 0.02507 -0.04078 0.05681 0.05686 0.00588 -0.00171 -0.02473 -0.00135 0.03176 0.04030 0.00249 0.00600 0.02507 -0.04078 0.05681 0.05686 -0.01575 -0.00171 -0.02473 -0.00135 0.03176 0.01885 0.00249 0.00600 0.02507 -0.04078 0.05681 -0.02624 -0.01575 -0.00171 -0.02473 -0.00135 0.00125 0.01885 0.00249 0.00600 0.02507 -0.04078 0.06724 -0.02624 -0.01575 -0.00171 -0.02473 0.00695 0.00125 0.01885 0.00249 0.00600 0.02507 -0.01362 0.06724 -0.02624 -0.01575 -0.00171 -0.01563 0.00695 0.00125 0.01885 0.00249 0.00600 -0.00422 -0.01362 0.06724 -0.02624 -0.01575 0.00814 -0.01563 0.00695 0.00125 0.01885 0.00249 0.00754 -0.00422 -0.01362 0.06724 -0.02624 0.02368 0.00814 -0.01563 0.00695 0.00125 0.01885 0.00087 0.00754 -0.00422 -0.01362 0.06724 0.04099 0.02368 0.00814 -0.01563 0.00695 0.00125 0.02715 0.00087 0.00754 -0.00422 -0.01362 0.00731 0.04099 0.02368 0.00814 -0.01563 0.00695 0.02976 0.02715 0.00087 0.00754 -0.00422 -0.01730 0.00731 0.04099 0.02368 0.00814 -0.01563 0.07946 0.02976 0.02715 0.00087 0.00754 -0.00183 -0.01730 0.00731 0.04099 0.02368 0.00814 0.01909 0.07946 0.02976 0.02715 0.00087 -0.03830 -0.00183 -0.01730 0.00731 0.04099 0.02368 -0.02483 0.01909 0.07946 0.02976 0.02715 -0.01249 -0.03830 -0.00183 -0.01730 0.00731 0.04099 -0.01870 -0.02483 0.01909 0.07946 0.02976 0.01229 -0.01249 -0.03830 -0.00183 -0.01730 0.00731 0.09682 -0.01870 -0.02483 0.01909 0.07946 -0.01747 0.01229 -0.01249 -0.03830 -0.00183 -0.01730 0.03823 0.09682 -0.01870 -0.02483 0.01909 -0.02645 -0.01747 0.01229 -0.01249 -0.03830 -0.00183 0.09571 0.03823 0.09682 -0.01870 -0.02483 0.04038 -0.02645 -0.01747 0.01229 -0.01249 -0.03830 -0.04663 0.09571 0.03823 0.09682 -0.01870 0.02925 0.04038 -0.02645 -0.01747 0.01229 -0.01249 -0.01359 -0.04663 0.09571 0.03823 0.09682 0.02270 0.02925 0.04038 -0.02645 -0.01747 0.01229 0.05114 -0.01359 -0.04663 0.09571 0.03823 -0.00460 0.02270 0.02925 0.04038 -0.02645 -0.01747 -0.04275 0.05114 -0.01359 -0.04663 0.09571 -0.01894 -0.00460 0.02270 0.02925 0.04038 -0.02645 0.05739 -0.04275 0.05114 -0.01359 -0.04663 -0.00966 -0.01894 -0.00460 0.02270 0.02925 0.04038 0.01186 0.05739 -0.04275 0.05114 -0.01359 0.00392 -0.00966 -0.01894 -0.00460 0.02270 0.02925 0.01066 0.01186 0.05739 -0.04275 0.05114 -0.03105 0.00392 -0.00966 -0.01894 -0.00460 0.02270 -0.07387 0.01066 0.01186 0.05739 -0.04275 -0.02790 -0.03105 0.00392 -0.00966 -0.01894 -0.00460 -0.04131 -0.07387 0.01066 0.01186 0.05739 -0.09625 -0.02790 -0.03105 0.00392 -0.00966 -0.01894 -0.17889 -0.04131 -0.07387 0.01066 0.01186 -0.05388 -0.09625 -0.02790 -0.03105 0.00392 -0.00966 -0.12781 -0.17889 -0.04131 -0.07387 0.01066 -0.05034 -0.05388 -0.09625 -0.02790 -0.03105 0.00392 -0.26933 -0.12781 -0.17889 -0.04131 -0.07387 -0.02846 -0.05034 -0.05388 -0.09625 -0.02790 -0.03105 -0.05095 -0.26933 -0.12781 -0.17889 -0.04131 -0.01454 -0.02846 -0.05034 -0.05388 -0.09625 -0.02790 -0.01074 -0.05095 -0.26933 -0.12781 -0.17889 0.01284 -0.01454 -0.02846 -0.05034 -0.05388 -0.09625 0.08172 -0.01074 -0.05095 -0.26933 -0.12781 0.03762 0.01284 -0.01454 -0.02846 -0.05034 -0.05388 0.11870 0.08172 -0.01074 -0.05095 -0.26933 0.01973 0.03762 0.01284 -0.01454 -0.02846 -0.05034 0.08475 0.11870 0.08172 -0.01074 -0.05095 0.03178 0.01973 0.03762 0.01284 -0.01454 -0.02846 0.04663 0.08475 0.11870 0.08172 -0.01074 0.01329 0.03178 0.01973 0.03762 0.01284 -0.01454 -0.04415 0.04663 0.08475 0.11870 0.08172 0.05094 0.01329 0.03178 0.01973 0.03762 0.01284 0.00970 -0.04415 0.04663 0.08475 0.11870 -0.00804 0.05094 0.01329 0.03178 0.01973 0.03762 -0.03341 0.00970 -0.04415 0.04663 0.08475 0.01116 -0.00804 0.05094 0.01329 0.03178 0.01973 0.04031 -0.03341 0.00970 -0.04415 0.04663 0.01128 0.01116 -0.00804 0.05094 0.01329 0.03178 0.01938 0.04031 -0.03341 0.00970 -0.04415 0.02227 0.01128 0.01116 -0.00804 0.05094 0.01329 0.05928 0.01938 0.04031 -0.03341 0.00970 0.01494 0.02227 0.01128 0.01116 -0.00804 0.05094 0.02343 0.05928 0.01938 0.04031 -0.03341 -0.02514 0.01494 0.02227 0.01128 0.01116 -0.00804 -0.04536 0.02343 0.05928 0.01938 0.04031 0.02975 -0.02514 0.01494 0.02227 0.01128 0.01116 0.03355 -0.04536 0.02343 0.05928 0.01938 0.05216 0.02975 -0.02514 0.01494 0.02227 0.01128 0.05659 0.03355 -0.04536 0.02343 0.05928 -0.04459 0.05216 0.02975 -0.02514 0.01494 0.02227 -0.06579 0.05659 0.03355 -0.04536 0.02343 -0.02212 -0.04459 0.05216 0.02975 -0.02514 0.01494 -0.04267 -0.06579 0.05659 0.03355 -0.04536 0.03171 -0.02212 -0.04459 0.05216 0.02975 -0.02514 -0.02422 -0.04267 -0.06579 0.05659 0.03355 0.02985 0.03171 -0.02212 -0.04459 0.05216 0.02975 0.07584 -0.02422 -0.04267 -0.06579 0.05659 0.01545 0.02985 0.03171 -0.02212 -0.04459 0.05216 -0.00903 0.07584 -0.02422 -0.04267 -0.06579 0.01140 0.01545 0.02985 0.03171 -0.02212 -0.04459 0.06617 -0.00903 0.07584 -0.02422 -0.04267 0.00238 0.01140 0.01545 0.02985 0.03171 -0.02212 0.04485 0.06617 -0.00903 0.07584 -0.02422
Names of X columns:
PCYt PCYt1 PCYt2 PCYt3 PCYt4 PCYt5 PCXt1 PCXt2 PCXt3 PCXt4 PCXt5
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