sequential {LagSequential}R Documentation

sequential

Description

Computes a variety of lag sequential analysis statistics for one series of codes.

Usage

sequential(data, labels = NULL, lag = 1, adjacent = TRUE,
           onezero = NULL, tailed = 2, permtest = FALSE, nperms = 10)

Arguments

data

A one-column dataframe, or a vector of code sequences, or a square frequency transition matrix. If data is not a frequency transition matrix, then data must be either (a) a series of string (non-numeric) code values, or (b) a series of integer codes with values ranging from "1" to what ever value the user specifies in the "ncodes" argument. There should be no code values with zero frequencies. Missing values are not permitted.

labels

Optional argument for providing labels to the code values. Accepts a list of string variables. If unspecified, codes will be labeled "Code1", "Code2", etc.

lag

The lag number for the analyses.

adjacent

Can adjacent values be coded the same? Enter "FALSE" if adjacent events can never be the same. Enter "TRUE" if any adjacent events can be the same. If some adjacent events can, and others cannot, be the same, then enter the appropriate onezero matrix for your data using the onezero argument.

onezero

Optional argument for specifying the one-zero matrix for the data. Accepts a square matrix of ones and zeros with length ncodes. A "1" indicates that the expected frequency for a given cell is to be estimated, whereas a "0" indicates that the expected frequency for the cell should NOT be estimated, typically because it is a structural zero (codes that cannot follow one another). By default, the matrix that is created by the above commands has zeros along the main diagonal, and ones everywhere else, which will be appropriate for most data sets. However, if your data happen to involve structural zeros that occur in cells other than the cells along the main diagonal, then you must create a onezero matrix with ones and zeros that is appropriate for your data.

tailed

Specify whether significance tests are one-tailed or two-tailed. Options are "1" or "2".

permtest

Do you want to run permutation tests of significance? Options are "FALSE" for no, or "TRUE" for yes. Warning: these computations can be time consuming.

nperms

The number of permutations per block.

Details

Tests unidirectional dependence of states (codes). Specifically, this function tests the hypothesis that state i (the antecedent) follows state j (the consequence) with a greater than chance probability. Computes a variety of statistics including two indices of effect size with corresponding significance tests. The larger the effect the more like the consequence is to follow the antecedent.

Value

Displays the transitional frequency matrix, expected frequencies, transitional probabilities, adjusted residuals and significance levels, Yule's Q values, transformed Kappas (Wampold, 1989, 1992, 1995), z values for the kappas, and significance levels.

Returns a list with the following elements:

freqs

The transitional frequency matrix

expfreqs

The expected frequencies

probs

The transitional probabilities

chi

The overall chi-square test of the difference between the observed and expected transitional frequencies

adjres

The adjusted residuals

p

The statistical significance levels

YulesQ

Yule's Q values, indicating the strength of the relationships between the antecedent and the consequence transitions

kappas

The nonparallel dominance kappas

z

The z values for the kappas

pk

The p-values for the kappas

Author(s)

Zakary A. Draper & Brian P. O'Connor

References

O'Connor, B. P. (1999). Simple and flexible SAS and SPSS programs for analyzing lag-sequential categorical data. Behavior Research Methods, Instrumentation, and Computers, 31, 718-726.

Wampold, B. E. (1989). Kappa as a measure of pattern in sequential data. Quality & Quantity, 23, 171-187.

Wampold, B. E. (1992). The intensive examination of social interactions. In T. Kratochwill & J. Levin (Eds.), Single-case research design and analysis: New directions for psychology and education (pp. 93-131). Hillsdale, NJ: Erlbaum.

Wampold, B. E. (1995). Analysis of behavior sequences in psychotherapy. In J. Siegfried (Ed.), Therapeutic and everyday discourse as behavior change: Towards a micro-analysis in psychotherapy process research (pp. 189-214). Norwood, NJ: Ablex.

Examples

# data is a one-column dataframe of code sequences
sequential(data_sequential, permtest = TRUE, nperms = 100)


# in this case, data is the frequency transition matrix from 
# Griffin, W. A., & Gottman, J. M. (1990). Statistical methods for analyzing family 
# interaction. In G. R. Patterson (Ed.), Family social interaction: Content and methodology
# issues in the study of aggression and depression (p. 137). Hillsdale, NJ: Erlbaum.
freqs <- t(matrix(c(
0, 0, 0, 0, 2, 2,
0,10, 5, 5,60,20,
0, 9, 2, 1, 3, 0,
0, 3, 0, 1, 5, 0,
3,54, 6, 2,24, 8,
1,24, 2, 1, 3, 12  ), 6, 6) )

sequential(freqs, adjacent = 1, 
		   labels = c('H+','Ho','H-','W+','Wo','W-'))


# Data from p 159 of Bakeman & Quera (2011), Sequential Analysis and Observational 
# Methods for the Behavioral Sciences. Cambridge University Press.
data_BQ2011 <- t(matrix(c(
2,1,4,3,3,4,3,4,2,1,4,4,5,4,1,3,4,5,3,2,2,1,4,1,2,
5,2,1,2,3,3,1,4,4,1,4,1,3,3,3,1,5,2,1,1,3,1,4,1,2,
3,3,4,5,5,2,3,3,5,2,5,4,4,2,3,1,5,5,2,2,1,3,3,3,3 )) )

sequential(data_BQ2011, labels=c('Chat','Write','Read','Ask','Attentive'),
           permtest = TRUE, nperms = 1000, tailed = 1)

[Package LagSequential version 0.1.1 Index]