seqimplic | R Documentation |
Visualization and identification of the states that best characterize a group of sequences versus the others at each position (time point). The typical states are identified at each position as those for which we have a high implication strength to be in when belonging to the group.
seqimplic(seqdata, group, with.missing = FALSE, weighted = TRUE, na.rm = TRUE)
## S3 method for class 'seqimplic'
plot(x, main = NULL, ylim = NULL, xaxis = TRUE,
ylab = "Implication", yaxis = TRUE, axes = "all", xtlab = NULL,
xtstep = NULL, tick.last = NULL, cex.axis = 1, with.legend = "auto",
ltext = NULL, cex.legend = 1, legend.prop = NA, rows = NA, cols = NA,
conf.level = 0.95, lwd = 1, only.levels = NULL, ...)
## S3 method for class 'seqimplic'
print(x, xtstep = NULL, tick.last = NULL, round = NULL,
conf.level = NULL, na.print = "", ...)
seqdata |
a state sequence object (see |
group |
a factor giving the group membership of each sequence in |
with.missing |
Logical. If |
weighted |
Logical. If |
na.rm |
Logical. If |
x |
A sequence of typical state object as generated by |
xtstep |
Integer. Optional interval at which the tick-marks and labels of the x-axis are displayed. For example, with |
tick.last |
Logical. Should a tick mark be enforced at the last position on the x-axis? If unspecified, the |
main |
title for the graphic. Default is |
ylim |
the y limits of the plot. |
xaxis |
Logical. Should the x-axis (time) be plotted?. |
ylab |
Optional label for the y-axis. If set as |
yaxis |
Logical. Should the y axis be plotted?. When set as |
axes |
If set as |
xtlab |
optional labels for the x-axis ticks labels. If unspecified, the column names of the |
cex.axis |
expansion factor for setting the size of the font for the axis labels and names. The default value is 1. Values lesser than 1 will reduce the size of the font, values greater than 1 will increase the size. |
with.legend |
One of |
ltext |
optional description of the states to appear in the legend. Must be a vector of character strings with number of elements equal to the size of the alphabet. If unspecified, the |
cex.legend |
expansion factor for setting the size of the font for the labels in the legend. The default value is 1. Values smaller than 1 reduce the size of the font, values greater than 1 increase the size. |
legend.prop |
Proportion (between 0 and 1) of the graphic area used for plotting the legend when |
rows , cols |
optional arguments to arrange plots when |
lwd |
The line width, a positive number. See |
only.levels |
Optional list of levels of the |
round |
Optional number of decimals when printing a |
conf.level |
Confidence levels thresholds (default is 0.95). |
na.print |
Character string (or |
... |
further arguments passed to |
The seqimplic
function builds an object with the position wise typical states. It can be used to visualize or identify the differences between each group of trajectories and the other ones.
It presents at each time point the typical states of a subpopulation (for instance women, as opposed to men).
A state at a given time point is considered to be typical of a group if the rule "Being in this group implies to be in that state at this time point" is relevant according to the implicative statistic.
The implicative statistic assesses the statistical relevance of a rule of the form "A implies B" (Gras et al., 2008).
It does so by measuring the gap between the expected and observed numbers of counter examples.
The rule is considered to be strongly implicative if we observe much less counter examples than expected under the independence assumption.
This gap and its significance are computed using adjusted residuals of a contingency table with continuity correction as proposed by Ritschard (2005).
In order to improve the readability of the graphs, we use here the opposite of the implicative statistic, which is highly negative for significant rules.
The statistic I(A\rightarrow B)
measuring the relevance of the rule "A implies B" reads as follows:
I(A\rightarrow B)=-\frac{n_{\bar{B}A}+0.5-n^e_{\bar{B}A}}{\sqrt{n^{e}_{\bar{B}A}(n_{B.}/n)(1-n_{.A}/n)}}
Where n_{\bar{B}A}
is the observed number of counter-examples, n^{e}_{\bar{B}A}
the expected number of counter-examples under the independence assumption,
n_{B.}
the number of times that B is observed, n_{.A}
the number of times that A is observed and n
the total number of cases.
The plot function can be used to visualize the results. It produces a separate plot for each level of the group
variable.
In each plot, it presents at each time point t
, the relevance of the rule "Being in this group implies to be in this state at this time point".
The higher the plotted value, the higher the relevance of the rule.
The horizontal dashed lines indicate the confidence thresholds. A rule is considered as statistically significant at the 5% level if it exceeds the 95% confidence horizontal line.
The strength of rules with negative implicative statistic are not displayed because they have no meaningful interpretation.
seqimplic
returns a "seqimplic"
object that can be plotted and printed. The values of the implicative statistics at each time point are in the element indices
of the object.
Matthias Studer.
Studer, Matthias (2015), Comment: On the Use of Globally Interdependent Multiple Sequence Analysis, Sociological Methodology 45, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0081175015588095")}.
Gras, Régis and Kuntz, Pascale. (2008), An overview of the Statistical Implicative Analysis (SIA) development, in Gras, R., Suzuki, E., Guillet, F. and Spagnolo, F. (eds), Statistical Implicative Analysis: Theory and application, Series Studies in Computational Intelligence, Vol 127, Berlin: Springer-Verlag, pp 11-40.
Ritschard, G. (2005). De l'usage de la statistique implicative dans les arbres de classification. In Gras, R., Spagnolo, F., and David, J., editors, Actes des Troisièmes Rencontres Internationale ASI Analyse Statistique Implicative, volume Secondo supplemento al N.15 of Quaderni di Ricerca in Didattica, pages 305–314. Università a degli Studi di Palermo, Palermo.
data(mvad)
## Building a state sequence object
mvad.seq <- seqdef(mvad, 17:86)
## Sequence of typical states
mvad.si.gcse5eq <- seqimplic(mvad.seq, group=mvad$gcse5eq)
##Plotting the typical states
plot(mvad.si.gcse5eq, lwd=3, conf.level=c(0.95, 0.99))
## Printing the results
print(mvad.si.gcse5eq, xtstep=12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.