kmedrange: Compute 'wcKMedoids' clustering for different number of...

Description Usage Arguments Details See Also Examples

Description

Compute wcKMedoids clustering for different number of clusters.

Usage

1
wcKMedRange(diss, kvals, weights=NULL, R=1,  samplesize=NULL, ...)

Arguments

diss

A dissimilarity matrix or a dist object (see dist).

kvals

A numeric vector containing the number of cluster to compute.

weights

Numeric. Optional numerical vector containing case weights.

R

Optional number of bootstrap that can be used to build confidence intervals.

samplesize

Size of bootstrap sample. Default to sum of weights.

...

Additionnal parameters passed to wcKMedoids.

Details

Compute a clustrange object using the wcKMedoids method. clustrange objects contains a list of clustering solution with associated statistics and can be used to find the optimal clustering solution.

See as.clustrange for more details.

See Also

See as.clustrange.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(mvad)
## Aggregating state sequence
aggMvad <- wcAggregateCases(mvad[, 17:86], weights=mvad$weight)

## Creating state sequence object
mvad.seq <- seqdef(mvad[aggMvad$aggIndex, 17:86], weights=aggMvad$aggWeights)

## Compute distance using Hamming distance
diss <- seqdist(mvad.seq, method="HAM")

## Pam clustering
pamRange <- wcKMedRange(diss, 2:15)

## Plot all statistics (standardized)
plot(pamRange, stat="all", norm="zscoremed", lwd=3)

## Plotting sequences in 3 groups
seqdplot(mvad.seq, group=pamRange$clustering$cluster3)

Example output

Loading required package: TraMineR

TraMineR stable version 2.0-7 (Built: "Sat,)
Website: http://traminer.unige.ch
Please type 'citation("TraMineR")' for citation information.

Loading required package: cluster
This is WeightedCluster stable version 1.2-1 (Built: 2017-09-21)

To get the manuals, please run:
   vignette("WeightedCluster") ## Complete manual in English
   vignette("WeightedClusterFR") ## Complete manual in French
   vignette("WeightedClusterPreview") ## Short preview in English

To cite WeightedCluster in publications please use:
Studer, Matthias (2013). WeightedCluster Library Manual: A practical
   guide to creating typologies of trajectories in the social sciences
   with R. LIVES Working Papers, 24. doi:
   10.12682/lives.2296-1658.2013.24
 [>] 6 distinct states appear in the data: 
     1 = FE
     2 = HE
     3 = employment
     4 = joblessness
     5 = school
     6 = training
 [>] state coding:
       [alphabet]  [label]     [long label] 
     1  FE          FE          FE
     2  HE          HE          HE
     3  employment  employment  employment
     4  joblessness joblessness joblessness
     5  school      school      school
     6  training    training    training
 [>] sum of weights: 711.57 - min/max: 0.13/33.43
 [>] 490 sequences in the data set
 [>] min/max sequence length: 70/70
 [>] 490 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 490 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.1 secs

WeightedCluster documentation built on June 20, 2017, 9:04 a.m.