R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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. Natural language support but running in an English locale 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(40399 + ,44164 + ,44496 + ,43110 + ,43880 + ,195722 + ,198563 + ,229139 + ,229527 + ,211868 + ,36763 + ,40399 + ,44164 + ,44496 + ,43110 + ,202196 + ,195722 + ,198563 + ,229139 + ,229527 + ,37903 + ,36763 + ,40399 + ,44164 + ,44496 + ,205816 + ,202196 + ,195722 + ,198563 + ,229139 + ,35532 + ,37903 + ,36763 + ,40399 + ,44164 + ,212588 + ,205816 + ,202196 + ,195722 + ,198563 + ,35533 + ,35532 + ,37903 + ,36763 + ,40399 + ,214320 + ,212588 + ,205816 + ,202196 + ,195722 + ,32110 + ,35533 + ,35532 + ,37903 + ,36763 + ,220375 + ,214320 + ,212588 + ,205816 + ,202196 + ,33374 + ,32110 + ,35533 + ,35532 + ,37903 + ,204442 + ,220375 + ,214320 + ,212588 + ,205816 + ,35462 + ,33374 + ,32110 + ,35533 + ,35532 + ,206903 + ,204442 + ,220375 + ,214320 + ,212588 + ,33508 + ,35462 + ,33374 + ,32110 + ,35533 + ,214126 + ,206903 + ,204442 + ,220375 + ,214320 + ,36080 + ,33508 + ,35462 + ,33374 + ,32110 + ,226899 + ,214126 + ,206903 + ,204442 + ,220375 + ,34560 + ,36080 + ,33508 + ,35462 + ,33374 + ,223532 + ,226899 + ,214126 + ,206903 + ,204442 + ,38737 + ,34560 + ,36080 + ,33508 + ,35462 + ,195309 + ,223532 + ,226899 + ,214126 + ,206903 + ,38144 + ,38737 + ,34560 + ,36080 + ,33508 + ,186005 + ,195309 + ,223532 + ,226899 + ,214126 + ,37594 + ,38144 + ,38737 + ,34560 + ,36080 + ,188906 + ,186005 + ,195309 + ,223532 + ,226899 + ,36424 + ,37594 + ,38144 + ,38737 + ,34560 + ,191563 + ,188906 + ,186005 + ,195309 + ,223532 + ,36843 + ,36424 + ,37594 + ,38144 + ,38737 + ,189226 + ,191563 + ,188906 + ,186005 + ,195309 + ,37246 + ,36843 + ,36424 + ,37594 + ,38144 + ,186413 + ,189226 + ,191563 + ,188906 + ,186005 + ,38661 + ,37246 + ,36843 + ,36424 + ,37594 + ,178037 + ,186413 + ,189226 + ,191563 + ,188906 + ,40454 + ,38661 + ,37246 + ,36843 + ,36424 + ,166827 + ,178037 + ,186413 + ,189226 + ,191563 + ,44928 + ,40454 + ,38661 + ,37246 + ,36843 + ,169362 + ,166827 + ,178037 + ,186413 + ,189226 + ,48441 + ,44928 + ,40454 + ,38661 + ,37246 + ,174330 + ,169362 + ,166827 + ,178037 + ,186413 + ,48140 + ,48441 + ,44928 + ,40454 + ,38661 + ,187069 + ,174330 + ,169362 + ,166827 + ,178037 + ,45998 + ,48140 + ,48441 + ,44928 + ,40454 + ,186530 + ,187069 + ,174330 + ,169362 + ,166827 + ,47369 + ,45998 + ,48140 + ,48441 + ,44928 + ,158114 + ,186530 + ,187069 + ,174330 + ,169362 + ,49554 + ,47369 + ,45998 + ,48140 + ,48441 + ,151001 + ,158114 + ,186530 + ,187069 + ,174330 + ,47510 + ,49554 + ,47369 + ,45998 + ,48140 + ,159612 + ,151001 + ,158114 + ,186530 + ,187069 + ,44873 + ,47510 + ,49554 + ,47369 + ,45998 + ,161914 + ,159612 + ,151001 + ,158114 + ,186530 + ,45344 + ,44873 + ,47510 + ,49554 + ,47369 + ,164182 + ,161914 + ,159612 + ,151001 + ,158114 + ,42413 + ,45344 + ,44873 + ,47510 + ,49554 + ,169701 + ,164182 + ,161914 + ,159612 + ,151001 + ,36912 + ,42413 + ,45344 + ,44873 + ,47510 + ,171297 + ,169701 + ,164182 + ,161914 + ,159612 + ,43452 + ,36912 + ,42413 + ,45344 + ,44873 + ,166444 + ,171297 + ,169701 + ,164182 + ,161914 + ,42142 + ,43452 + ,36912 + ,42413 + ,45344 + ,173476 + ,166444 + ,171297 + ,169701 + ,164182 + ,44382 + ,42142 + ,43452 + ,36912 + ,42413 + ,182516 + ,173476 + ,166444 + ,171297 + ,169701 + ,43636 + ,44382 + ,42142 + ,43452 + ,36912 + ,202388 + ,182516 + ,173476 + ,166444 + ,171297 + ,44167 + ,43636 + ,44382 + ,42142 + ,43452 + ,202300 + ,202388 + ,182516 + ,173476 + ,166444 + ,44423 + ,44167 + ,43636 + ,44382 + ,42142 + ,168053 + ,202300 + ,202388 + ,182516 + ,173476 + ,42868 + ,44423 + ,44167 + ,43636 + ,44382 + ,167302 + ,168053 + ,202300 + ,202388 + ,182516 + ,43908 + ,42868 + ,44423 + ,44167 + ,43636 + ,172608 + ,167302 + ,168053 + ,202300 + ,202388 + ,42013 + ,43908 + ,42868 + ,44423 + ,44167 + ,178106 + ,172608 + ,167302 + ,168053 + ,202300 + ,38846 + ,42013 + ,43908 + ,42868 + ,44423 + ,185686 + ,178106 + ,172608 + ,167302 + ,168053 + ,35087 + ,38846 + ,42013 + ,43908 + ,42868 + ,194581 + ,185686 + ,178106 + ,172608 + ,167302 + ,33026 + ,35087 + ,38846 + ,42013 + ,43908 + ,194596 + ,194581 + ,185686 + ,178106 + ,172608 + ,34646 + ,33026 + ,35087 + ,38846 + ,42013 + ,197922 + ,194596 + ,194581 + ,185686 + ,178106 + ,37135 + ,34646 + ,33026 + ,35087 + ,38846 + ,208795 + ,197922 + ,194596 + ,194581 + ,185686 + ,37985 + ,37135 + ,34646 + ,33026 + ,35087 + ,230580 + ,208795 + ,197922 + ,194596 + ,194581 + ,43121 + ,37985 + ,37135 + ,34646 + ,33026 + ,240636 + ,230580 + ,208795 + ,197922 + ,194596 + ,43722 + ,43121 + ,37985 + ,37135 + ,34646 + ,240048 + ,240636 + ,230580 + ,208795 + ,197922 + ,43630 + ,43722 + ,43121 + ,37985 + ,37135 + ,211457 + ,240048 + ,240636 + ,230580 + ,208795 + ,42234 + ,43630 + ,43722 + ,43121 + ,37985 + ,211142 + ,211457 + ,240048 + ,240636 + ,230580 + ,39351 + ,42234 + ,43630 + ,43722 + ,43121 + ,214771 + ,211142 + ,211457 + ,240048 + ,240636 + ,39327 + ,39351 + ,42234 + ,43630 + ,43722 + ,212610 + ,214771 + ,211142 + ,211457 + ,240048 + ,35704 + ,39327 + ,39351 + ,42234 + ,43630 + ,219313 + ,212610 + ,214771 + ,211142 + ,211457 + ,30466 + ,35704 + ,39327 + ,39351 + ,42234 + ,219277 + ,219313 + ,212610 + ,214771 + ,211142 + ,28155 + ,30466 + ,35704 + ,39327 + ,39351 + ,231805 + ,219277 + ,219313 + ,212610 + ,214771 + ,29257 + ,28155 + ,30466 + ,35704 + ,39327 + ,229245 + ,231805 + ,219277 + ,219313 + ,212610 + ,29998 + ,29257 + ,28155 + ,30466 + ,35704 + ,241114 + ,229245 + ,231805 + ,219277 + ,219313 + ,32529 + ,29998 + ,29257 + ,28155 + ,30466 + ,248624 + ,241114 + ,229245 + ,231805 + ,219277 + ,34787 + ,32529 + ,29998 + ,29257 + ,28155 + ,265845 + ,248624 + ,241114 + ,229245 + ,231805 + ,33855 + ,34787 + ,32529 + ,29998 + ,29257 + ,256446 + ,265845 + ,248624 + ,241114 + ,229245 + ,34556 + ,33855 + ,34787 + ,32529 + ,29998 + ,219452 + ,256446 + ,265845 + ,248624 + ,241114 + ,31348 + ,34556 + ,33855 + ,34787 + ,32529 + ,217142 + ,219452 + ,256446 + ,265845 + ,248624 + ,30805 + ,31348 + ,34556 + ,33855 + ,34787 + ,221678 + ,217142 + ,219452 + ,256446 + ,265845 + ,28353 + ,30805 + ,31348 + ,34556 + ,33855 + ,227184 + ,221678 + ,217142 + ,219452 + ,256446 + ,24514 + ,28353 + ,30805 + ,31348 + ,34556 + ,230354 + ,227184 + ,221678 + ,217142 + ,219452 + ,21106 + ,24514 + ,28353 + ,30805 + ,31348 + ,235243 + ,230354 + ,227184 + ,221678 + ,217142 + ,21346 + ,21106 + ,24514 + ,28353 + ,30805 + ,237217 + ,235243 + ,230354 + ,227184 + ,221678 + ,23335 + ,21346 + ,21106 + ,24514 + ,28353 + ,233575 + ,237217 + ,235243 + ,230354 + ,227184 + ,24379 + ,23335 + ,21346 + ,21106 + ,24514 + ,244460 + ,233575 + ,237217 + ,235243 + ,230354 + ,26290 + ,24379 + ,23335 + ,21346 + ,21106 + ,243324 + ,244460 + ,233575 + ,237217 + ,235243 + ,30084 + ,26290 + ,24379 + ,23335 + ,21346 + ,260307 + ,243324 + ,244460 + ,233575 + ,237217 + ,29429 + ,30084 + ,26290 + ,24379 + ,23335 + ,241476 + ,260307 + ,243324 + ,244460 + ,233575 + ,30632 + ,29429 + ,30084 + ,26290 + ,24379 + ,203666 + ,241476 + ,260307 + ,243324 + ,244460 + ,27349 + ,30632 + ,29429 + ,30084 + ,26290 + ,200237 + ,203666 + ,241476 + ,260307 + ,243324 + ,27264 + ,27349 + ,30632 + ,29429 + ,30084 + ,204045 + ,200237 + ,203666 + ,241476 + ,260307 + ,27474 + ,27264 + ,27349 + ,30632 + ,29429 + ,209465 + ,204045 + ,200237 + ,203666 + ,241476 + ,24482 + ,27474 + ,27264 + ,27349 + ,30632 + ,213586 + ,209465 + ,204045 + ,200237 + ,203666 + ,21453 + ,24482 + ,27474 + ,27264 + ,27349 + ,216234 + ,213586 + ,209465 + ,204045 + ,200237 + ,18788 + ,21453 + ,24482 + ,27474 + ,27264 + ,213188 + ,216234 + ,213586 + ,209465 + ,204045 + ,19282 + ,18788 + ,21453 + ,24482 + ,27474 + ,208679 + ,213188 + ,216234 + ,213586 + ,209465 + ,19713 + ,19282 + ,18788 + ,21453 + ,24482 + ,217859 + ,208679 + ,213188 + ,216234 + ,213586 + ,21917 + ,19713 + ,19282 + ,18788 + ,21453 + ,227247 + ,217859 + ,208679 + ,213188 + ,216234 + ,23812 + ,21917 + ,19713 + ,19282 + ,18788 + ,243477 + ,227247 + ,217859 + ,208679 + ,213188 + ,23785 + ,23812 + ,21917 + ,19713 + ,19282 + ,232571 + ,243477 + ,227247 + ,217859 + ,208679 + ,24696 + ,23785 + ,23812 + ,21917 + ,19713 + ,191531 + ,232571 + ,243477 + ,227247 + ,217859 + ,24562 + ,24696 + ,23785 + ,23812 + ,21917 + ,186029 + ,191531 + ,232571 + ,243477 + ,227247 + ,23580 + ,24562 + ,24696 + ,23785 + ,23812 + ,189733 + ,186029 + ,191531 + ,232571 + ,243477 + ,24939 + ,23580 + ,24562 + ,24696 + ,23785 + ,190420 + ,189733 + ,186029 + ,191531 + ,232571 + ,23899 + ,24939 + ,23580 + ,24562 + ,24696 + ,194163 + ,190420 + ,189733 + ,186029 + ,191531 + ,21454 + ,23899 + ,24939 + ,23580 + ,24562 + ,198770 + ,194163 + ,190420 + ,189733 + ,186029 + ,19761 + ,21454 + ,23899 + ,24939 + ,23580 + ,195198 + ,198770 + ,194163 + ,190420 + ,189733 + ,19815 + ,19761 + ,21454 + ,23899 + ,24939 + ,193111 + ,195198 + ,198770 + ,194163 + ,190420 + ,20780 + ,19815 + ,19761 + ,21454 + ,23899 + ,195411 + ,193111 + ,195198 + ,198770 + ,194163 + ,23462 + ,20780 + ,19815 + ,19761 + ,21454 + ,202108 + ,195411 + ,193111 + ,195198 + ,198770 + ,25005 + ,23462 + ,20780 + ,19815 + ,19761 + ,215706 + ,202108 + ,195411 + ,193111 + ,195198 + ,24725 + ,25005 + ,23462 + ,20780 + ,19815 + ,206348 + ,215706 + ,202108 + ,195411 + ,193111 + ,26198 + ,24725 + ,25005 + ,23462 + ,20780 + ,166972 + ,206348 + ,215706 + ,202108 + ,195411 + ,27543 + ,26198 + ,24725 + ,25005 + ,23462 + ,166070 + ,166972 + ,206348 + ,215706 + ,202108 + ,26471 + ,27543 + ,26198 + ,24725 + ,25005 + ,169292 + ,166070 + ,166972 + ,206348 + ,215706 + ,26558 + ,26471 + ,27543 + ,26198 + ,24725 + ,175041 + ,169292 + ,166070 + ,166972 + ,206348 + ,25317 + ,26558 + ,26471 + ,27543 + ,26198 + ,177876 + ,175041 + ,169292 + ,166070 + ,166972 + ,22896 + ,25317 + ,26558 + ,26471 + ,27543 + ,181140 + ,177876 + ,175041 + ,169292 + ,166070 + ,22248 + ,22896 + ,25317 + ,26558 + ,26471 + ,179566 + ,181140 + ,177876 + ,175041 + ,169292 + ,23406 + ,22248 + ,22896 + ,25317 + ,26558 + ,175335 + ,179566 + ,181140 + ,177876 + ,175041 + ,25073 + ,23406 + ,22248 + ,22896 + ,25317 + ,184128 + ,175335 + ,179566 + ,181140 + ,177876 + ,27691 + ,25073 + ,23406 + ,22248 + ,22896 + ,189917 + ,184128 + ,175335 + ,179566 + ,181140 + ,30599 + ,27691 + ,25073 + ,23406 + ,22248 + ,194690 + ,189917 + ,184128 + ,175335 + ,179566 + ,31948 + ,30599 + ,27691 + ,25073 + ,23406 + ,179612 + ,194690 + ,189917 + ,184128 + ,175335 + ,32946 + ,31948 + ,30599 + ,27691 + ,25073 + ,150605 + ,179612 + ,194690 + ,189917 + ,184128 + ,34012 + ,32946 + ,31948 + ,30599 + ,27691 + ,150569 + ,150605 + ,179612 + ,194690 + ,189917 + ,32936 + ,34012 + ,32946 + ,31948 + ,30599 + ,153745 + ,150569 + ,150605 + ,179612 + ,194690 + ,32974 + ,32936 + ,34012 + ,32946 + ,31948 + ,155511 + ,153745 + ,150569 + ,150605 + ,179612 + ,30951 + ,32974 + ,32936 + ,34012 + ,32946 + ,159044 + ,155511 + ,153745 + ,150569 + ,150605 + ,29812 + ,30951 + ,32974 + ,32936 + ,34012 + ,163095 + ,159044 + ,155511 + ,153745 + ,150569 + ,29010 + ,29812 + ,30951 + ,32974 + ,32936 + ,159585 + ,163095 + ,159044 + ,155511 + ,153745 + ,31068 + ,29010 + ,29812 + ,30951 + ,32974 + ,158644 + ,159585 + ,163095 + ,159044 + ,155511 + ,32447 + ,31068 + ,29010 + ,29812 + ,30951 + ,166618 + ,158644 + ,159585 + ,163095 + ,159044 + ,34844 + ,32447 + ,31068 + ,29010 + ,29812 + ,176512 + ,166618 + ,158644 + ,159585 + ,163095 + ,35676 + ,34844 + ,32447 + ,31068 + ,29010 + ,200765 + ,176512 + ,166618 + ,158644 + ,159585 + ,35387 + ,35676 + ,34844 + ,32447 + ,31068 + ,182698 + ,200765 + ,176512 + ,166618 + ,158644 + ,36488 + ,35387 + ,35676 + ,34844 + ,32447 + ,153730 + ,182698 + ,200765 + ,176512 + ,166618 + ,35652 + ,36488 + ,35387 + ,35676 + ,34844 + ,156145 + ,153730 + ,182698 + ,200765 + ,176512 + ,33488 + ,35652 + ,36488 + ,35387 + ,35676 + ,161570 + ,156145 + ,153730 + ,182698 + ,200765 + ,32914 + ,33488 + ,35652 + ,36488 + ,35387 + ,165688 + ,161570 + ,156145 + ,153730 + ,182698 + ,29781 + ,32914 + ,33488 + ,35652 + ,36488 + ,173666 + ,165688 + ,161570 + ,156145 + ,153730 + ,27951 + ,29781 + ,32914 + ,33488 + ,35652 + ,180144 + ,173666 + ,165688 + ,161570 + ,156145) + ,dim=c(10 + ,125) + ,dimnames=list(c('OPENVAC' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4' + ,'NWWZ' + ,'X1' + ,'X2' + ,'X3' + ,'X4') + ,1:125)) > y <- array(NA,dim=c(10,125),dimnames=list(c('OPENVAC','Y1','Y2','Y3','Y4','NWWZ','X1','X2','X3','X4'),1:125)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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 Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric 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 <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "OPENVAC" > x[,par1] [1] 40399 36763 37903 35532 35533 32110 33374 35462 33508 36080 34560 38737 [13] 38144 37594 36424 36843 37246 38661 40454 44928 48441 48140 45998 47369 [25] 49554 47510 44873 45344 42413 36912 43452 42142 44382 43636 44167 44423 [37] 42868 43908 42013 38846 35087 33026 34646 37135 37985 43121 43722 43630 [49] 42234 39351 39327 35704 30466 28155 29257 29998 32529 34787 33855 34556 [61] 31348 30805 28353 24514 21106 21346 23335 24379 26290 30084 29429 30632 [73] 27349 27264 27474 24482 21453 18788 19282 19713 21917 23812 23785 24696 [85] 24562 23580 24939 23899 21454 19761 19815 20780 23462 25005 24725 26198 [97] 27543 26471 26558 25317 22896 22248 23406 25073 27691 30599 31948 32946 [109] 34012 32936 32974 30951 29812 29010 31068 32447 34844 35676 35387 36488 [121] 35652 33488 32914 29781 27951 > 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]) 18788 19282 19713 19761 19815 20780 21106 21346 21453 21454 21917 22248 22896 1 1 1 1 1 1 1 1 1 1 1 1 1 23335 23406 23462 23580 23785 23812 23899 24379 24482 24514 24562 24696 24725 1 1 1 1 1 1 1 1 1 1 1 1 1 24939 25005 25073 25317 26198 26290 26471 26558 27264 27349 27474 27543 27691 1 1 1 1 1 1 1 1 1 1 1 1 1 27951 28155 28353 29010 29257 29429 29781 29812 29998 30084 30466 30599 30632 1 1 1 1 1 1 1 1 1 1 1 1 1 30805 30951 31068 31348 31948 32110 32447 32529 32914 32936 32946 32974 33026 1 1 1 1 1 1 1 1 1 1 1 1 1 33374 33488 33508 33855 34012 34556 34560 34646 34787 34844 35087 35387 35462 1 1 1 1 1 1 1 1 1 1 1 1 1 35532 35533 35652 35676 35704 36080 36424 36488 36763 36843 36912 37135 37246 1 1 1 1 1 1 1 1 1 1 1 1 1 37594 37903 37985 38144 38661 38737 38846 39327 39351 40399 40454 42013 42142 1 1 1 1 1 1 1 1 1 1 1 1 1 42234 42413 42868 43121 43452 43630 43636 43722 43908 44167 44382 44423 44873 1 1 1 1 1 1 1 1 1 1 1 1 1 44928 45344 45998 47369 47510 48140 48441 49554 1 1 1 1 1 1 1 1 > colnames(x) [1] "OPENVAC" "Y1" "Y2" "Y3" "Y4" "NWWZ" "X1" [8] "X2" "X3" "X4" > colnames(x)[par1] [1] "OPENVAC" > x[,par1] [1] 40399 36763 37903 35532 35533 32110 33374 35462 33508 36080 34560 38737 [13] 38144 37594 36424 36843 37246 38661 40454 44928 48441 48140 45998 47369 [25] 49554 47510 44873 45344 42413 36912 43452 42142 44382 43636 44167 44423 [37] 42868 43908 42013 38846 35087 33026 34646 37135 37985 43121 43722 43630 [49] 42234 39351 39327 35704 30466 28155 29257 29998 32529 34787 33855 34556 [61] 31348 30805 28353 24514 21106 21346 23335 24379 26290 30084 29429 30632 [73] 27349 27264 27474 24482 21453 18788 19282 19713 21917 23812 23785 24696 [85] 24562 23580 24939 23899 21454 19761 19815 20780 23462 25005 24725 26198 [97] 27543 26471 26558 25317 22896 22248 23406 25073 27691 30599 31948 32946 [109] 34012 32936 32974 30951 29812 29010 31068 32447 34844 35676 35387 36488 [121] 35652 33488 32914 29781 27951 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/www/html/freestat/rcomp/tmp/1hvnl1291972502.tab") + } + } > m Conditional inference tree with 7 terminal nodes Response: OPENVAC Inputs: Y1, Y2, Y3, Y4, NWWZ, X1, X2, X3, X4 Number of observations: 125 1) Y1 <= 31348; criterion = 1, statistic = 114.635 2) Y1 <= 25317; criterion = 1, statistic = 40.859 3) Y1 <= 21454; criterion = 0.997, statistic = 13.091 4)* weights = 10 3) Y1 > 21454 5)* weights = 20 2) Y1 > 25317 6)* weights = 25 1) Y1 > 31348 7) Y1 <= 40399; criterion = 1, statistic = 53.627 8) Y1 <= 36080; criterion = 0.999, statistic = 14.943 9)* weights = 28 8) Y1 > 36080 10)* weights = 17 7) Y1 > 40399 11) Y1 <= 44423; criterion = 0.985, statistic = 9.934 12)* weights = 16 11) Y1 > 44423 13)* weights = 9 > postscript(file="/var/www/html/freestat/rcomp/tmp/2hvnl1291972502.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/www/html/freestat/rcomp/tmp/3sm561291972502.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 40399 42347.56 -1948.562500 2 36763 37993.65 -1230.647059 3 37903 37993.65 -90.647059 4 35532 37993.65 -2461.647059 5 35533 33985.00 1548.000000 6 32110 33985.00 -1875.000000 7 33374 33985.00 -611.000000 8 35462 33985.00 1477.000000 9 33508 33985.00 -477.000000 10 36080 33985.00 2095.000000 11 34560 33985.00 575.000000 12 38737 33985.00 4752.000000 13 38144 37993.65 150.352941 14 37594 37993.65 -399.647059 15 36424 37993.65 -1569.647059 16 36843 37993.65 -1150.647059 17 37246 37993.65 -747.647059 18 38661 37993.65 667.352941 19 40454 37993.65 2460.352941 20 44928 42347.56 2580.437500 21 48441 46626.89 1814.111111 22 48140 46626.89 1513.111111 23 45998 46626.89 -628.888889 24 47369 46626.89 742.111111 25 49554 46626.89 2927.111111 26 47510 46626.89 883.111111 27 44873 46626.89 -1753.888889 28 45344 46626.89 -1282.888889 29 42413 46626.89 -4213.888889 30 36912 42347.56 -5435.562500 31 43452 37993.65 5458.352941 32 42142 42347.56 -205.562500 33 44382 42347.56 2034.437500 34 43636 42347.56 1288.437500 35 44167 42347.56 1819.437500 36 44423 42347.56 2075.437500 37 42868 42347.56 520.437500 38 43908 42347.56 1560.437500 39 42013 42347.56 -334.562500 40 38846 42347.56 -3501.562500 41 35087 37993.65 -2906.647059 42 33026 33985.00 -959.000000 43 34646 33985.00 661.000000 44 37135 33985.00 3150.000000 45 37985 37993.65 -8.647059 46 43121 37993.65 5127.352941 47 43722 42347.56 1374.437500 48 43630 42347.56 1282.437500 49 42234 42347.56 -113.562500 50 39351 42347.56 -2996.562500 51 39327 37993.65 1333.352941 52 35704 37993.65 -2289.647059 53 30466 33985.00 -3519.000000 54 28155 28761.96 -606.960000 55 29257 28761.96 495.040000 56 29998 28761.96 1236.040000 57 32529 28761.96 3767.040000 58 34787 33985.00 802.000000 59 33855 33985.00 -130.000000 60 34556 33985.00 571.000000 61 31348 33985.00 -2637.000000 62 30805 28761.96 2043.040000 63 28353 28761.96 -408.960000 64 24514 28761.96 -4247.960000 65 21106 24059.85 -2953.850000 66 21346 20819.90 526.100000 67 23335 20819.90 2515.100000 68 24379 24059.85 319.150000 69 26290 24059.85 2230.150000 70 30084 28761.96 1322.040000 71 29429 28761.96 667.040000 72 30632 28761.96 1870.040000 73 27349 28761.96 -1412.960000 74 27264 28761.96 -1497.960000 75 27474 28761.96 -1287.960000 76 24482 28761.96 -4279.960000 77 21453 24059.85 -2606.850000 78 18788 20819.90 -2031.900000 79 19282 20819.90 -1537.900000 80 19713 20819.90 -1106.900000 81 21917 20819.90 1097.100000 82 23812 24059.85 -247.850000 83 23785 24059.85 -274.850000 84 24696 24059.85 636.150000 85 24562 24059.85 502.150000 86 23580 24059.85 -479.850000 87 24939 24059.85 879.150000 88 23899 24059.85 -160.850000 89 21454 24059.85 -2605.850000 90 19761 20819.90 -1058.900000 91 19815 20819.90 -1004.900000 92 20780 20819.90 -39.900000 93 23462 20819.90 2642.100000 94 25005 24059.85 945.150000 95 24725 24059.85 665.150000 96 26198 24059.85 2138.150000 97 27543 28761.96 -1218.960000 98 26471 28761.96 -2290.960000 99 26558 28761.96 -2203.960000 100 25317 28761.96 -3444.960000 101 22896 24059.85 -1163.850000 102 22248 24059.85 -1811.850000 103 23406 24059.85 -653.850000 104 25073 24059.85 1013.150000 105 27691 24059.85 3631.150000 106 30599 28761.96 1837.040000 107 31948 28761.96 3186.040000 108 32946 33985.00 -1039.000000 109 34012 33985.00 27.000000 110 32936 33985.00 -1049.000000 111 32974 33985.00 -1011.000000 112 30951 33985.00 -3034.000000 113 29812 28761.96 1050.040000 114 29010 28761.96 248.040000 115 31068 28761.96 2306.040000 116 32447 28761.96 3685.040000 117 34844 33985.00 859.000000 118 35676 33985.00 1691.000000 119 35387 33985.00 1402.000000 120 36488 33985.00 2503.000000 121 35652 37993.65 -2341.647059 122 33488 33985.00 -497.000000 123 32914 33985.00 -1071.000000 124 29781 33985.00 -4204.000000 125 27951 28761.96 -810.960000 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/43em91291972502.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/www/html/freestat/rcomp/tmp/56w2x1291972502.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/www/html/freestat/rcomp/tmp/6rx131291972502.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/www/html/freestat/rcomp/tmp/7vfhr1291972502.tab") + } > > try(system("convert tmp/2hvnl1291972502.ps tmp/2hvnl1291972502.png",intern=TRUE)) character(0) > try(system("convert tmp/3sm561291972502.ps tmp/3sm561291972502.png",intern=TRUE)) character(0) > try(system("convert tmp/43em91291972502.ps tmp/43em91291972502.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.995 0.797 6.066