dissrf  R Documentation 
Relative Frequency (RF) groups are equally sized groups obtained by partitioning sorted cases into k
consecutive groups. Function dissrf
returns the medoid indexes of the RF groups and related statistics. Function seqrf
is for sequence data and returns in addition the RF medoid sequences.
dissrf(diss,
k=NULL,
sortv="mds",
weights=NULL,
grp.meth = "prop",
squared = FALSE,
pow = NULL)
seqrf(seqdata,
diss,
k=NULL,
sortv="mds",
weights=NULL,
weighted=TRUE,
grp.meth = "prop",
squared = FALSE,
pow = NULL)
## S3 method for class 'dissrf'
summary(object, dist.idx = 1:10, ...)
## S3 method for class 'seqrf'
summary(object, format="SPS", dist.idx = 1:10, ...)
diss 
Matrix or distance object. Pairwise dissimilarities between analyzed cases. 
seqdata 
State sequence 
k 
Integer: Number of groupings (RF groups). When 
sortv 
Real vector (of length 
weights 
Vector (of length 
weighted 
Logical. Should weights be used when there are weights in 
grp.meth 
Character string. One of 
squared 
Logical. Should medoids (and computation of 
pow 
Double. Dissimilarity power exponent (typically 1 or 2) for computation of pseudo R2 and F. When 
... 
further arguments passed to or from other methods such as 
object 
Object of class 
format 
String. One of 
dist.idx 
Indexes of RF groups for which summary statistics of distances to the medoids are displayed. Default is 
Function dissrf
partitions the n
cases (rows of the diss
matrix) into k
equally sized groups (RF groups). First, the cases are sorted according to the sortv
variable. Then the groups are built by consecutively grouping the first n/k
cases, then the next n/k
cases, and so on. In seqrf
, one of sort methods "from.start"
and "from.end"
can be specified as sortv
argument.
Ties in the sortv
variable are handled by order
using the default method, which produces stable outcome. To use a different method, compute a suited variable without ties (e.g. using order
with the wanted method for ties) and pass it as sortv
argument.
The grp.meth
argument applies when the group size (n/k
) is not integer. With grp.meth="first"
, the integer part of n/k
is used as basic group size and the size of the first groups is augmented by one unit so that the sum of the group sizes equals n
. With grp.meth="random"
, randomly selected groups have their size augmented by one unit, and with grp.meth="prop"
(default), cases at the limit between groups are proportionally assigned to each of the two groups.
For seqrf
, when weights=NULL
and weighted=TRUE
, weights
is set as the weights
attribute of seqdata
.
When weights
is nonnull (dissrf
) or when wheighted=TRUE
and there are weights in seqdata
(seqrf
), only grp.meth="prop"
applies.
The function computes indicative statistics of the resulting partition, namely a pseudo R2 and a pseudo F statistics. These statistics compare the mean distance to the group medoid with the mean distance to the overall medoid. When pow
is 2
, mean squared dissimilarities are used and when pow
is 1 the R2 and F ratios are based on mean of nonsquared dissimilarities. An indicative pvalue of the F statistics is computed using the F distribution. This pvalue should be interpreted with caution since F is not a true F value.
dissrf
returns a list of class dissrfprop
when grp.meth="prop"
and of class dissrfcrisp
otherwise. In both cases the list also receives class "dissrf"
. The elements of the list are:
medoids 
index of the group medoids 
med.names 
names (diss colnames) of the group medoids 
wg 
working matrix used by the 
dist.list 
list with for each successive group the distances from its elements to the group medoid 
index.list 
list with for each successive group the index of its elements 
weights.list 
list with for each successive group the weights of its elements in the group 
heights 
relative group size, which may be different when 
kmedoid.index 
vector with for each case the index of its group medoid (class 
kmedoid.dist 
vector with for each case the distance to its group medoid (class 
mdsk 
vector of group membership (class 
at 
positions for the boxplots of distances to group medoids 
R2 
Pseudo R2: Mean distance to the group medoids over mean distance to the overall medoid 
Fstat 
Pseudo F statistics 
pvalue 
pvalue of the pseudo F (to be used with caution since F is not a true F value) 
sizes 

grp.meth 
grouping method used 
seqrf
returns a list of class seqrfprop
when grp.meth="prop"
and of class seqrfcrisp
otherwise. In both cases the list also receives class "seqrf"
. The elements of the list are:
seqtoplot 
RF medoid sequences as a state sequence 
rf 
the associated 
There are print and summary methods for objects of class dissrf
and seqrf
, and a plot method for objects of class seqrf
Gilbert Ritschard.
Fasang, Anette Eva and Tim F. Liao. 2014. "Visualizing Sequences in the Social Sciences: Relative Frequency Sequence Plots." Sociological Methods & Research 43(4):643676.
plot.seqrf
, seqrfplot
, dissrep
, and seqrep
## Defining a sequence object with the data in columns 10 to 25
## (family status from age 15 to 30) in the biofam data set
data(biofam)
biofam.lab < c("Parent", "Left", "Married", "Left+Marr",
"Child", "Left+Child", "Left+Marr+Child", "Divorced")
## Here, we use only 100 cases selected such that all elements
## of the alphabet be present.
## (More cases and a larger k would be necessary to get a meaningful example.)
biofam.seq < seqdef(biofam[501:600, 10:25], labels=biofam.lab,
weights=biofam[501:600,"wp00tbgs"])
diss < seqdist(biofam.seq, method="LCS")
## Using 12 groups, default MDS sorting,
## and original method by Fasang and Liao (2014)
dissrf(diss=diss, k=12, grp.meth="first")
## Using 12 groups, weights, default MDS sorting,
## and default "prop" method
w < attr(biofam.seq, "weights")
dissrf(diss=diss, k=12, weights=w)
## With a user specified sorting variable
## Here time spent in parental home, which has ties
parentTime < seqistatd(biofam.seq)[, 1]
b.srf < seqrf(biofam.seq, diss=diss, k=12, sortv=parentTime)
## print, summary, and plot methods
b.srf
summary(b.srf)
plot(b.srf)
plot(b.srf, which.plot="both")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.