R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), 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. 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 a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("fpc-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('fpc') Loading required package: MASS Loading required package: cluster > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "adcoord" > > ### * adcoord > > flush(stderr()); flush(stdout()) > > ### Name: adcoord > ### Title: Asymmetric discriminant coordinates > ### Aliases: adcoord > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0) > grface <- as.integer(attr(face,"grouping")) > adcf <- adcoord(face,grface==2) > adcf2 <- adcoord(face,grface==4) > plot(adcf$proj,col=1+(grface==2)) > plot(adcf2$proj,col=1+(grface==4)) > # ...done in one step by function plotcluster. > > > > cleanEx(); ..nameEx <- "ancoord" > > ### * ancoord > > flush(stderr()); flush(stdout()) > > ### Name: ancoord > ### Title: Asymmetric neighborhood based discriminant coordinates > ### Aliases: ancoord > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0) > grface <- as.integer(attr(face,"grouping")) > ancf2 <- ancoord(face,grface==4) > plot(ancf2$proj,col=1+(grface==4)) > # ...done in one step by function plotcluster. > > > > cleanEx(); ..nameEx <- "awcoord" > > ### * awcoord > > flush(stderr()); flush(stdout()) > > ### Name: awcoord > ### Title: Asymmetric weighted discriminant coordinates > ### Aliases: awcoord > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0) > grface <- as.integer(attr(face,"grouping")) > awcf <- awcoord(face,grface==1) > # awcf2 <- ancoord(face,grface==1, method="mcd") > plot(awcf$proj,col=1+(grface==1)) > # plot(awcf2$proj,col=1+(grface==1)) > # ...done in one step by function plotcluster. > > > > cleanEx(); ..nameEx <- "batcoord" > > ### * batcoord > > flush(stderr()); flush(stdout()) > > ### Name: batcoord > ### Title: Bhattacharyya discriminant projection > ### Aliases: batcoord batvarcoord > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0) > grface <- as.integer(attr(face,"grouping")) > bcf2 <- batcoord(face,grface==2) > plot(bcf2$proj,col=1+(grface==2)) > bcfv2 <- batcoord(face,grface==2,dom="variance") > plot(bcfv2$proj,col=1+(grface==2)) > bcfvv2 <- batvarcoord(face,grface==2) > plot(bcfvv2$proj,col=1+(grface==2)) > > > > cleanEx(); ..nameEx <- "c.weight" > > ### * c.weight > > flush(stderr()); flush(stdout()) > > ### Name: c.weight > ### Title: Weight function for AWC > ### Aliases: c.weight > ### Keywords: arith > > ### ** Examples > > c.weight(4,1) [1] 0.25 > > > > cleanEx(); ..nameEx <- "can" > > ### * can > > flush(stderr()); flush(stdout()) > > ### Name: can > ### Title: Generation of the tuning constant for regression fixed point > ### clusters > ### Aliases: can > ### Keywords: arith > > ### ** Examples > > can(429,3) [1] 8.806634 > > > > cleanEx(); ..nameEx <- "clusexpect" > > ### * clusexpect > > flush(stderr()); flush(stdout()) > > ### Name: clusexpect > ### Title: Expected value of the number of times a fixed point cluster is > ### found > ### Aliases: clusexpect > ### Keywords: univar cluster > > ### ** Examples > > clusexpect(500,4,150,2000) [1] 1.357889 > > > > cleanEx(); ..nameEx <- "cluster.stats" > > ### * cluster.stats > > flush(stderr()); flush(stdout()) > > ### Name: cluster.stats > ### Title: Cluster validation statistics > ### Aliases: cluster.stats > ### Keywords: cluster multivariate > > ### ** Examples > > set.seed(20000) > face <- rFace(200,dMoNo=2,dNoEy=0,p=2) > dface <- dist(face) > complete3 <- cutree(hclust(dface),3) > cluster.stats(dface,complete3, + alt.clustering=as.integer(attr(face,"grouping"))) Warning in as.dist.default(separation) : non-square matrix $n [1] 200 $cluster.number [1] 3 $cluster.size [1] 136 60 4 $diameter [1] 10.795191 5.756704 9.000000 $average.distance [1] 3.032856 2.205095 7.047772 $median.distance [1] 2.842125 1.478951 8.321658 $separation [1] 5.874239 5.874239 7.222125 $average.toother [1] 13.77209 13.02913 20.75148 $separation.matrix [,1] [,2] [,3] [1,] 0.000000 5.874239 14.975187 [2,] 5.874239 0.000000 7.222125 [3,] 14.975187 7.222125 0.000000 $average.between [1] 13.72910 $average.within [1] 2.901325 $n.between [1] 8944 $n.within [1] 10956 $clus.avg.silwidths 1 2 3 0.7522817 0.8179603 0.3548236 $avg.silwidth [1] 0.7640361 $g2 NULL $g3 NULL $hubertgamma [1] 0.8834354 $dunn [1] 0.5441534 $wb.ratio [1] 0.2113267 $corrected.rand [1] 0.345064 > > > > > cleanEx(); ..nameEx <- "cmahal" > > ### * cmahal > > flush(stderr()); flush(stdout()) > > ### Name: cmahal > ### Title: Generation of tuning constant for Mahalanobis fixed point > ### clusters. > ### Aliases: cmahal > ### Keywords: cluster > > ### ** Examples > > plot(1:100,cmahal(100,3,nmin=5,cmin=qchisq(0.99,3),nc1=90), + xlab="FPC size", ylab="cmahal") > > > > cleanEx(); ..nameEx <- "concomp" > > ### * concomp > > flush(stderr()); flush(stdout()) > > ### Name: con.comp > ### Title: Connectivity components of an undirected graph > ### Aliases: con.comp > ### Keywords: array cluster > > ### ** Examples > > set.seed(1000) > x <- rnorm(20) > m <- matrix(0,nrow=20,ncol=20) > for(i in 1:20) + for(j in 1:20) + m[i,j] <- abs(x[i]-x[j]) > d <- m<0.2 > cc <- con.comp(d) > max(cc) # number of connectivity components [1] 6 > plot(x,cc) > # The same should be produced by > # cutree(hclust(as.dist(m),method="single"),h=0.2). > > > > cleanEx(); ..nameEx <- "cov.wml" > > ### * cov.wml > > flush(stderr()); flush(stdout()) > > ### Name: cov.wml > ### Title: Weighted Covariance Matrices (Maximum Likelihood) > ### Aliases: cov.wml > ### Keywords: multivariate > > ### ** Examples > > x <- c(1,2,3,4,5,6,7,8,9,10) > y <- c(1,2,3,8,7,6,5,8,9,10) > cov.wml(cbind(x,y),wt=c(0,0,0,1,1,1,1,1,0,0)) $cov x y x 2.0 -0.40 y -0.4 1.36 $center x y 6.0 6.8 $n.obs [1] 10 $wt [1] 0.0 0.0 0.0 0.2 0.2 0.2 0.2 0.2 0.0 0.0 > cov.wt(cbind(x,y),wt=c(0,0,0,1,1,1,1,1,0,0)) $cov x y x 2.5 -0.5 y -0.5 1.7 $center x y 6.0 6.8 $n.obs [1] 10 $wt [1] 0.0 0.0 0.0 0.2 0.2 0.2 0.2 0.2 0.0 0.0 > > > > cleanEx(); ..nameEx <- "discrcoord" > > ### * discrcoord > > flush(stderr()); flush(stdout()) > > ### Name: discrcoord > ### Title: Discriminant coordinates/canonical variates > ### Aliases: discrcoord > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0) > grface <- as.integer(attr(face,"grouping")) > dcf <- discrcoord(face,grface) > plot(dcf$proj,col=grface) > # ...done in one step by function plotcluster. > > > > cleanEx(); ..nameEx <- "discrproj" > > ### * discrproj > > flush(stderr()); flush(stdout()) > > ### Name: discrproj > ### Title: Linear dimension reduction for classification > ### Aliases: discrproj > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(300,dMoNo=2,dNoEy=0,p=3) > grface <- as.integer(attr(face,"grouping")) > discrproj(face,grface, method="nc")$units [,1] [,2] [,3] [1,] 0.84359426 1.14608710 -0.02209846 [2,] -0.33649001 0.27903245 -0.01187219 [3,] -0.06808816 0.03965075 1.00303099 > discrproj(face,grface, method="wnc")$units [,1] [,2] [,3] [1,] -0.07433352 1.420772600 0.039179197 [2,] -0.43725296 0.002745807 -0.005281343 [3,] -0.03831248 0.001676168 -1.005389819 > discrproj(face,grface==1, method="arc")$units [,1] [,2] [,3] [1,] -1.2952782 0.50007753 -0.33960121 [2,] 0.6533164 0.05164296 -0.08010673 [3,] -0.0805180 -0.66005066 -0.46509088 > > > > cleanEx(); ..nameEx <- "fixmahal" > > ### * fixmahal > > flush(stderr()); flush(stdout()) > > ### Name: fixmahal > ### Title: Mahalanobis Fixed Point Clusters > ### Aliases: fixmahal summary.mfpc plot.mfpc fpclusters.mfpc > ### print.summary.mfpc print.mfpc fpmi > ### Keywords: cluster multivariate robust > > ### ** Examples > > set.seed(20000) > face <- rFace(400,dMoNo=2,dNoEy=0, p=3) > # The first example uses grouping information via init.group. > initg <- list() > grface <- as.integer(attr(face,"grouping")) > for (i in 1:5) initg[[i]] <- (grface==i) > ff0 <- fixmahal(face, pointit=FALSE, init.group=initg) > summary(ff0) * Mahalanobis Fixed Point Clusters * Often a clear cluster in the data leads to several similar FPCs. The summary shows the representative FPCs of groups of similar FPCs. Method fuzzy was used. Number of representative FPCs: 5 FPCs with less than 16 points were skipped. 0 iteration runs led to 0 skipped clusters. Weight 1 for r^2<= 6.251389 weight 0 for r^2> 11.34487 Constant ca= 6.251389 corresponding to alpha= 0.9 FPC 1 Times found (group members): 1 Mean: [1] -2.059856 17.120851 1.144176 Covariance matrix: [,1] [,2] [,3] [1,] 0.1380273772 -0.0005850577 -0.02221587 [2,] -0.0005850577 0.1493604214 0.05120692 [3,] -0.0222158688 0.0512069203 0.99970636 Number of points (sum of weights): 38.26940 FPC 2 Times found (group members): 1 Mean: [1] 1.990335 16.990115 1.168523 Covariance matrix: [,1] [,2] [,3] [1,] 0.155013896 0.002647451 0.04614691 [2,] 0.002647451 0.102943657 0.04792916 [3,] 0.046146913 0.047929158 1.19384338 Number of points (sum of weights): 73.87413 FPC 3 Times found (group members): 1 Mean: [1] -0.01706032 3.08725211 0.47432734 Covariance matrix: [,1] [,2] [,3] [1,] 0.188194114 0.001181821 0.009039074 [2,] 0.001181821 0.042873492 0.004792551 [3,] 0.009039074 0.004792551 0.124434523 Number of points (sum of weights): 88.37003 FPC 4 Times found (group members): 2 Mean: [1] 0.01031798 3.84049017 0.57963428 Covariance matrix: [,1] [,2] [,3] [1,] 0.17635831 0.01533119 0.02026135 [2,] 0.01533119 4.36327556 0.11767498 [3,] 0.02026135 0.11767498 0.22623388 Number of points (sum of weights): 183.4207 FPC 5 Times found (group members): 1 Mean: [1] 0.4248803 6.8480685 0.5883182 Covariance matrix: [,1] [,2] [,3] [1,] 0.8496890 4.53978778 0.01344090 [2,] 4.5397878 33.51962628 0.07652022 [3,] 0.0134409 0.07652022 0.23095281 Number of points (sum of weights): 245.1377 Number of points (rounded weights) in intersection of representative FPCs [,1] [,2] [,3] [,4] [,5] [1,] 38 0 0 0 0 [2,] 0 74 0 0 54 [3,] 0 0 88 88 88 [4,] 0 0 88 183 182 [5,] 0 54 88 182 245 > cff0 <- fpclusters(ff0) > plot(face, col=1+cff0[[1]]) > plot(face, col=1+cff0[[4]]) # Why does this come out as a cluster? > plot(ff0, face, 4) # A bit clearer... > # Without grouping information, examples need more time: > # ff1 <- fixmahal(face) > # summary(ff1) > # cff1 <- fpclusters(ff1) > # plot(face, col=1+cff1[[1]]) > # plot(face, col=1+cff1[[6]]) # Why does this come out as a cluster? > # plot(ff1, face, 6) # A bit clearer... > # ff2 <- fixmahal(face,method="ml") > # summary(ff2) > # ff3 <- fixmahal(face,method="ml",calpha=0.95,subset=50) > # summary(ff3) > ## ...fast, but lots of clusters. mer=0.3 may be useful here. > # set.seed(3000) > # face2 <- rFace(400,dMoNo=2,dNoEy=0) > # ff5 <- fixmahal(face2) > # summary(ff5) > ## misses right eye of face data; with p=6, > ## initial configurations are too large for 40 point clusters > # ff6 <- fixmahal(face2, startn=30) > # summary(ff6) > # cff6 <- fpclusters(ff6) > # plot(face2, col=1+cff6[[3]]) > # plot(ff6, face2, 3) > # x <- c(1,2,3,6,6,7,8,120) > # ff8 <- fixmahal(x) > # summary(ff8) > # ...dataset a bit too small for the defaults... > # ff9 <- fixmahal(x, mnc=3, startn=3) > # summary(ff9) > > > > cleanEx(); ..nameEx <- "fixreg" > > ### * fixreg > > flush(stderr()); flush(stdout()) > > ### Name: fixreg > ### Title: Linear Regression Fixed Point Clusters > ### Aliases: fixreg summary.rfpc plot.rfpc fpclusters.rfpc > ### print.summary.rfpc print.rfpc rfpi > ### Keywords: cluster robust regression > > ### ** Examples > > set.seed(190000) > data(tonedata) > # Note: If you do not use the installed package, replace this by > # tonedata <- read.table("(path/)tonedata.txt", header=TRUE) > attach(tonedata) > tonefix <- fixreg(stretchratio,tuned,mtf=1,ir=20) > summary(tonefix) * Fixed Point Clusters * Often a clear cluster in the data leads to several similar FPCs. The summary shows the representative FPCs of groups of similar FPCs, which were found at least 1 times. Constant ca= 10.07010 Number of representative FPCs: 3 FPCs with less than 50 points were skipped. 0 iterations led to skipped FPCs. FPC 1 Times found (group members): 17 Ratio to estimated expectation: 1.587200 Regression parameters: Intercept X 1.90507095 0.04772128 Error variance: 0.002815126 Number of points: 122 FPC 2 Times found (group members): 3 Ratio to estimated expectation: 2.082420 Regression parameters: Intercept X 0.003507292 0.998653704 Error variance: 3.688176e-05 Number of points: 63 FPC 3 Times found (group members): 1 Ratio to estimated expectation: 0.602382 Regression parameters: Intercept X 0.7941830 0.6018805 Error variance: 0.001118718 Number of points: 66 Number of points in intersection of representative FPCs [,1] [,2] [,3] [1,] 122 46 61 [2,] 46 63 47 [3,] 61 47 66 > # This is designed to have a fast example; default setting would be better. > # If you want to see more (and you have a bit more time), > # try out the following: > # set.seed(1000) > # tonefix <- fixreg(stretchratio,tuned) > ## Default - good for these data > # summary(tonefix) > # plot(tonefix,stretchratio,tuned,1) > # plot(tonefix,stretchratio,tuned,2) > # plot(tonefix,stretchratio,tuned,3,bw=FALSE,pch=5) > # toneclus <- fpclusters(tonefix,stretchratio,tuned) > # plot(stretchratio,tuned,col=1+toneclus[[2]]) > # tonefix2 <- fixreg(stretchratio,tuned,distcut=1,mtf=1,countmode=50) > ## Every found fixed point cluster is reported, > ## no matter how instable it may be. > # summary(tonefix2) > # tonefix3 <- fixreg(stretchratio,tuned,ca=7) > ## ca defaults to 10.07 for these data. > # summary(tonefix3) > # subset <- c(rep(FALSE,5),rep(TRUE,24),rep(FALSE,121)) > # tonefix4 <- fixreg(stretchratio,tuned, > # mtf=1,ir=0,init.group=list(subset)) > # summary(tonefix4) > > > > cleanEx(); ..nameEx <- "itnumber" > > ### * itnumber > > flush(stderr()); flush(stdout()) > > ### Name: itnumber > ### Title: Number of regression fixed point cluster iterations > ### Aliases: itnumber > ### Keywords: univar cluster > > ### ** Examples > > itnumber(500,4,150,2) [1] 6985 > > > > cleanEx(); ..nameEx <- "mahalanodisc" > > ### * mahalanodisc > > flush(stderr()); flush(stdout()) > > ### Name: mahalanodisc > ### Title: Mahalanobis for AWC > ### Aliases: mahalanodisc > ### Keywords: multivariate > > ### ** Examples > > x <- cbind(rnorm(50),rnorm(50)) > mahalanodisc(x,c(0,0),cov(x)) [1] 0.71349606 0.43761908 1.10821206 4.87324972 2.39439438 5.00225901 [7] 0.47073953 1.87819557 0.85857646 0.15860222 9.81873721 0.22036263 [13] 1.02517555 7.10170674 2.34179377 0.04013201 3.47942431 3.71699879 [19] 1.01446502 5.67306063 1.50739543 1.37019793 0.41046506 6.84584566 [25] 2.15804831 0.09360798 0.25155881 3.13406307 0.33370927 0.59996983 [31] 2.94471138 0.03615695 1.74305241 2.48897888 3.04452624 0.35439149 [37] 1.39043569 0.10557988 1.93895136 0.93985318 0.36194844 1.61998071 [43] 2.21921981 1.01003313 3.26790679 1.01966858 1.88625521 1.16363811 [49] 1.63183882 1.32346790 > mahalanodisc(x,c(0,0),matrix(0,ncol=2,nrow=2)) [1] 5509326690 4083011766 8146378218 38203818405 21621323013 45951521273 [7] 3724386939 16353404881 6561046188 1115018130 80532501689 1535175268 [13] 8616802470 49056797112 18179246336 376615616 32581377766 30386778449 [19] 6978908370 50729602495 10706287216 11157611277 3785466156 48300585553 [25] 19557806599 880913436 2207799248 21631137965 2341541077 5222100937 [31] 21693942514 288385749 15381782499 23241507778 22490650969 2830764373 [37] 12856458316 960459384 13469697387 6537789871 3213959978 15231367777 [43] 18322921772 8001730717 29924248192 8124564847 17626076738 9192760912 [49] 15122977280 10004589882 > > > > cleanEx(); ..nameEx <- "mahalanofix" > > ### * mahalanofix > > flush(stderr()); flush(stdout()) > > ### Name: mahalanofix > ### Title: Mahalanobis distances from center of indexed points > ### Aliases: mahalanofix mahalanofuz > ### Keywords: multivariate > > ### ** Examples > > x <- c(1,2,3,4,5,6,7,8,9,10) > y <- c(1,2,3,8,7,6,5,8,9,10) > mahalanofix(cbind(x,y),gv=c(0,0,0,1,1,1,1,1,0,0)) > mahalanofix(cbind(x,y),gv=c(0,0,0,1,1,1,1,0,0,0)) > mahalanofix(cbind(x,y),gv=c(0,0,0,1,1,1,1,1,0,0),method="mcd") > mahalanofuz(cbind(x,y),gv=c(0,0,0.5,0.5,1,1,1,0.5,0.5,0)) > > > > cleanEx(); ..nameEx <- "mahalconf" > > ### * mahalconf > > flush(stderr()); flush(stdout()) > > ### Name: mahalconf > ### Title: Mahalanobis fixed point clusters initial configuration > ### Aliases: mahalconf > ### Keywords: multivariate cluster > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0,p=2) > mahalconf(face,no=200,startn=20,covall=cov(face),plot="start") [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [49] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [61] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [73] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [97] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [109] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [121] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [133] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE [145] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [157] FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [169] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [181] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE [193] TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE [205] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [217] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [229] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [241] TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [253] FALSE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE [265] FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [277] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [289] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE [301] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [313] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [325] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [337] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [349] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [361] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [373] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [385] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [397] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [409] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [421] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [433] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [445] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [457] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [469] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [481] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [493] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [505] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [517] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [529] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [541] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [553] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [565] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [577] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [589] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > > > > cleanEx(); ..nameEx <- "minsize" > > ### * minsize > > flush(stderr()); flush(stdout()) > > ### Name: minsize > ### Title: Minimum size of regression fixed point cluster > ### Aliases: minsize > ### Keywords: univar cluster > > ### ** Examples > > minsize(500,4,7000,2) [1] 127 > > > > cleanEx(); ..nameEx <- "mvdcoord" > > ### * mvdcoord > > flush(stderr()); flush(stdout()) > > ### Name: mvdcoord > ### Title: Mean/variance differences discriminant coordinates > ### Aliases: mvdcoord > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(300,dMoNo=2,dNoEy=0,p=3) > grface <- as.integer(attr(face,"grouping")) > mcf <- mvdcoord(face,grface) > plot(mcf$proj,col=grface) > # ...done in one step by function plotcluster. > > > > cleanEx(); ..nameEx <- "ncoord" > > ### * ncoord > > flush(stderr()); flush(stdout()) > > ### Name: ncoord > ### Title: Neighborhood based discriminant coordinates > ### Aliases: ncoord > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(200,dMoNo=2,dNoEy=0,p=3) > grface <- as.integer(attr(face,"grouping")) > ncf <- ncoord(face,grface) > plot(ncf$proj,col=grface) > ncf2 <- ncoord(face,grface,weighted=TRUE) > plot(ncf2$proj,col=grface) > # ...done in one step by function plotcluster. > > > > cleanEx(); ..nameEx <- "plotcluster" > > ### * plotcluster > > flush(stderr()); flush(stdout()) > > ### Name: plotcluster > ### Title: Discriminant projection plot. > ### Aliases: plotcluster > ### Keywords: multivariate classif > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0) > grface <- as.integer(attr(face,"grouping")) > plotcluster(face,grface) > plotcluster(face,grface==1) > > > > cleanEx(); ..nameEx <- "rFace" > > ### * rFace > > flush(stderr()); flush(stdout()) > > ### Name: rFace > ### Title: "Face-shaped" clustered benchmark datasets > ### Aliases: rFace > ### Keywords: data > > ### ** Examples > > set.seed(4634) > face <- rFace(600,dMoNo=2,dNoEy=0) > grface <- as.integer(attr(face,"grouping")) > plot(face, col = grface) > pairs(face, col = grface, main ="rFace(600,dMoNo=2,dNoEy=0)") > > > > cleanEx(); ..nameEx <- "randcmatrix" > > ### * randcmatrix > > flush(stderr()); flush(stdout()) > > ### Name: randcmatrix > ### Title: Random partition matrix > ### Aliases: randcmatrix > ### Keywords: cluster > > ### ** Examples > > set.seed(111) > randcmatrix(10,2,1) [,1] [,2] [1,] 0 1 [2,] 0 1 [3,] 1 0 [4,] 0 1 [5,] 1 0 [6,] 1 0 [7,] 1 0 [8,] 0 1 [9,] 1 0 [10,] 1 0 > > > > cleanEx(); ..nameEx <- "randconf" > > ### * randconf > > flush(stderr()); flush(stdout()) > > ### Name: randconf > ### Title: Generate a sample indicator vector > ### Aliases: randconf > ### Keywords: distribution > > ### ** Examples > > randconf(10,3) [1] FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE > > > > cleanEx(); ..nameEx <- "regmix" > > ### * regmix > > flush(stderr()); flush(stdout()) > > ### Name: regmix > ### Title: Mixture Model ML for Clusterwise Linear Regression > ### Aliases: regmix regem > ### Keywords: cluster regression > > ### ** Examples > > set.seed(12234) > data(tonedata) > # Note: If you do not use the installed package, replace this by > # tonedata <- read.table("(path/)tonedata.txt", header=TRUE) > attach(tonedata) > rmt1 <- regmix(stretchratio,tuned,nclust=1:2) Iteration 1 for 1 clusters. Iteration 1 for 2 clusters. > # nclust=1:2 makes the example fast; > # a more serious application would rather use the default. > rmt1$g [1] 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 [38] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 1 1 1 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 [75] 2 2 2 1 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [112] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 [149] 2 1 > rmt1$bic [1] 3.732369 225.809992 > # start with initial parameter values > cln <- 3 > n <- 150 > initcoef <- cbind(c(2,0),c(0,1),c(0,2.5)) > initvar <- c(0.001,0.0001,0.5) > initeps <- c(0.4,0.3,0.3) > # computation of m from initial parameters > m <- matrix(nrow=n, ncol=cln) > stm <- numeric(0) > for (i in 1:cln) + for (j in 1:n){ + m[j,i] <- initeps[i]*dnorm(tuned[j],mean=initcoef[1,i]+ + initcoef[2,i]*stretchratio[j], sd=sqrt(initvar[i])) + } > for (j in 1:n){ + stm[j] <- sum(m[j,]) + for (i in 1:cln) + m[j,i] <- m[j,i]/stm[j] + } > rmt2 <- regem(stretchratio, tuned, m, cln) > rmt2bic <- 2*rmt2$loglik - log(150)*(4*cln-1) > rmt2bic [1] 422.4743 > > > > cleanEx(); ..nameEx <- "simmatrix" > > ### * simmatrix > > flush(stderr()); flush(stdout()) > > ### Name: simmatrix > ### Title: Extracting intersections between clusters from fpc-object > ### Aliases: simmatrix > ### Keywords: utilities > > ### ** Examples > > set.seed(190000) > data(tonedata) > # Note: If you do not use the installed package, replace this by > # tonedata <- read.table("(path/)tonedata.txt", header=TRUE) > attach(tonedata) > tonefix <- fixreg(stretchratio,tuned,mtf=1,ir=20) > simmatrix(tonefix)[sseg(2,3)] [1] 47 > > > > cleanEx(); ..nameEx <- "solvecov" > > ### * solvecov > > flush(stderr()); flush(stdout()) > > ### Name: solvecov > ### Title: Inversion of (possibly singular) symmetric matrices > ### Aliases: solvecov > ### Keywords: array > > ### ** Examples > > x <- c(1,0,0,1,0,1,0,0,1) > dim(x) <- c(3,3) > solvecov(x) > > > > cleanEx(); ..nameEx <- "sseg" > > ### * sseg > > flush(stderr()); flush(stdout()) > > ### Name: sseg > ### Title: Position in a similarity vector > ### Aliases: sseg > ### Keywords: utilities > > ### ** Examples > > sseg(3,4) [1] 9 > > > > cleanEx(); ..nameEx <- "tdecomp" > > ### * tdecomp > > flush(stderr()); flush(stdout()) > > ### Name: tdecomp > ### Title: Root of singularity-corrected eigenvalue decomposition > ### Aliases: tdecomp > ### Keywords: array > > ### ** Examples > > x <- rnorm(10) > y <- rnorm(10) > z <- cov(cbind(x,y)) > tdecomp(z) [,1] [,2] [1,] -0.4766383 1.0305950 [2,] 0.6181669 0.2858951 > > > > cleanEx(); ..nameEx <- "wfu" > > ### * wfu > > flush(stderr()); flush(stdout()) > > ### Name: wfu > ### Title: Weight function (for Mahalabobis distances) > ### Aliases: wfu > ### Keywords: arith > > ### ** Examples > > md <- seq(0,10,by=0.1) > wfu(md,ca=5,ca2=8) [1] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [7] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [13] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [19] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [25] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [31] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [37] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [43] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 [49] 1.00000000 1.00000000 1.00000000 0.96666667 0.93333333 0.90000000 [55] 0.86666667 0.83333333 0.80000000 0.76666667 0.73333333 0.70000000 [61] 0.66666667 0.63333333 0.60000000 0.56666667 0.53333333 0.50000000 [67] 0.46666667 0.43333333 0.40000000 0.36666667 0.33333333 0.30000000 [73] 0.26666667 0.23333333 0.20000000 0.16666667 0.13333333 0.10000000 [79] 0.06666667 0.03333333 0.00000000 0.00000000 0.00000000 0.00000000 [85] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 [91] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 [97] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 > > > > ### *