Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.dynin

Dynamic index plot


Description

Plot of dynamic (i.e. successive) cross-sectional summaries of an individual index. The successive values of the individual index for all sequences should be collected in a dynin table as produced by seqindic.dyn.

Usage

## S3 method for class 'dynin'
plot(x, fstat=weighted.mean, group=NULL,
     main=NULL, col=NULL, lty=NULL, lwd=3.5, ylim=NULL,
     ylab=NULL, xlab=NULL, xtlab=NULL, xtstep=NULL, tick.last=NULL,
     with.legend=TRUE, glabels=NULL, legend.pos="topright",
     horiz=FALSE, cex.legend=1, conf=FALSE, bcol=NULL, na.rm=FALSE, ret=FALSE, ...)

Arguments

x

object of class dynin as produced by seqindic.dyn

fstat

function: summary function to compute the values plotted. Default is weighted.mean with weights taken from the weights attribute of x. When weighted.mean and x has no weights, mean is used instead.

group

factor or discrete vector: group membership; a curve is drawn for each group. If NULL (default) a single curve for the whole set is drawn.

main

character string: Plot title.

col

color vector. Group line colors. If NULL (default), colors are automatically assigned using qualitative_hcl with the 'Dark 3' palette (see hcl_palettes).

lty

string vector. Group line types (see lines). If NULL (default), types are automatically assigned.

lwd

integer vector: Group line widths (see lines). If NULL (default), set as 3.5.

ylim

pair of numerics defining the range for the y-axis. If left NULL, the limits are defined from the data.

ylab

character string: y axis label.

xlab

character string: x axis label.

xtlab

vector of strings defining the x-axis tick labels. If NULL, column names of the x table are used.

xtstep

integer: step between tick marks on the x-axis. If unspecified, attribute xtstep of the x object is used.

tick.last

logical. Should a tick mark be enforced at the last position on the x-axis? If unspecified, attribute tick.last of the x object is used.

glabels

a vector of strings with the curve labels. If NULL curves are labeled with the levels of the group variable

with.legend

logical: Should the legend be plotted. Default is TRUE.

legend.pos

legend position: default is "topright". Seelegend .

horiz

logical: Should the legend be displayed horizontally. Set as FALSE by default, i.e., legend is displayed vertically.

cex.legend

Scale factor for the legend.

conf

logical: Should confidence bands be displayed? Applies only when fstat=mean or fstat=weighted.mean.

bcol

color vector. For confidence bands. If NULL (default), colors are automatically assigned using qualitative_hcl with the 'Pastel 1' palette (see hcl_palettes).

na.rm

logical. When fstat is mean or weighted.mean, should NA's be stripped before computation? Ignored for any other fstat function.

ret

logical: Should the plotted values be returned?

...

additional plot parameters (see par).

Details

Together with seqindic.dyn this function implements the dynamic sequence analysis approach of Pelletier et al. (2020).

The function first computes the summary table using the fstat function. Each row of the summary table is then plotted as a line, except rows that contain NAs. Setting na.rm=TRUE helps sometimes to prevent some NAs in the summary table.

Confidence bands are computed for a confidence level of 95% and assuming a normal distribution.

Value

If ret=TRUE, a matrix with the successive group summaries. One row per group.

Author(s)

Gilbert Ritschard

References

Pelletier, D.; Bignami-Van Assche, S. & Simard-Gendron, A. (2020) Measuring Life Course Complexity with Dynamic Sequence Analysis, Social Indicators Research doi: 10.1007/s11205-020-02464-y.

See Also

See Also seqindic.dyn (with examples)

Examples

## See examples on 'seqindic.dyn' help page

TraMineRextras

TraMineR Extension

v0.6.1
GPL (>= 2)
Authors
Gilbert Ritschard [aut, cre, ths, cph] (<https://orcid.org/0000-0001-7776-0903>), Matthias Studer [aut] (<https://orcid.org/0000-0002-6269-1412>), Reto Buergin [aut], Tim Liao [ctb], Alexis Gabadinho [ctb], Pierre-Alexandre Fonta [ctb], Nicolas Muller [ctb], Patrick Rousset [ctb]
Initial release
2021-01-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.