sequential: sequential

Description Usage Arguments Details Value Author(s) References Examples

Description

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

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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)

Example output

Lag Sequential Analysis


The code frequencies:

data
 1  2  3  4  5  6 
 4 21 36 11  9 41 


Requested 'tail' (1 or 2) for Significance Tests = 2 


Cell Frequencies, Row & Column Totals, & N

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6 Totals
 Code 1       0       0       0       0       0       3      3
 Code 2       0       0       1       1       2      17     21
 Code 3       0       0       8       8       7      13     36
 Code 4       1       4       3       2       0       1     11
 Code 5       0       0       9       0       0       0      9
 Code 6       3      17      14       0       0       7     41
Totals        4      21      35      11       9      41    121


Expected Values/Frequencies

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1    0.10    0.52    0.87    0.27    0.22    1.02
 Code 2    0.69    3.64    6.07    1.91    1.56    7.12
 Code 3    1.19    6.25   10.41    3.27    2.68   12.20
 Code 4    0.36    1.91    3.18    1.00    0.82    3.73
 Code 5    0.30    1.56    2.60    0.82    0.67    3.05
 Code 6    1.36    7.12   11.86    3.73    3.05   13.89


Transitional Probabilities

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1    0.00    0.00    0.00    0.00    0.00    1.00
 Code 2    0.00    0.00    0.05    0.05    0.10    0.81
 Code 3    0.00    0.00    0.22    0.22    0.19    0.36
 Code 4    0.09    0.36    0.27    0.18    0.00    0.09
 Code 5    0.00    0.00    1.00    0.00    0.00    0.00
 Code 6    0.07    0.41    0.34    0.00    0.00    0.17


Tablewise Likelihood Ratio (Chi-Square) test = 116.87,  df = 25,  p = 0


Adjusted Residuals

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1   -0.32   -0.80   -1.12   -0.55   -0.50    2.45
 Code 2   -0.93   -2.31   -2.69   -0.76    0.40    5.01
 Code 3   -1.32   -3.28   -1.06    3.27    3.28    0.34
 Code 4    1.13    1.75   -0.13    1.10   -0.99   -1.82
 Code 5   -0.58   -1.43    4.89   -0.99   -0.88   -2.23
 Code 6    1.77    5.01    0.91   -2.49   -2.23   -2.80


Significance Levels for the Adjusted Residuals

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1  0.7457  0.4215  0.2632  0.5791  0.6191  0.0143
 Code 2  0.3513  0.0209  0.0072  0.4478  0.6886  0.0000
 Code 3  0.1856  0.0010  0.2899  0.0011  0.0011  0.7363
 Code 4  0.2604  0.0808  0.8991  0.2713  0.3241  0.0684
 Code 5  0.5642  0.1530  0.0000  0.3241  0.3767  0.0256
 Code 6  0.0773  0.0000  0.3646  0.0128  0.0256  0.0052


Yule's Q Values

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1   -1.00   -1.00   -1.00   -1.00   -1.00    1.00
 Code 2   -1.00   -1.00   -0.82   -0.38    0.17    0.86
 Code 3   -1.00   -1.00   -0.24    0.77    0.82    0.07
 Code 4    0.56    0.52   -0.04    0.43   -1.00   -0.70
 Code 5   -1.00   -1.00    1.00   -1.00   -1.00   -1.00
 Code 6    0.72    0.86    0.19   -1.00   -1.00   -0.56


Unidirectional Kappas

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1   -1.00   -1.00   -1.00   -1.00   -1.00    0.62
 Code 2   -1.00   -1.00   -0.84   -0.47    0.06    0.71
 Code 3   -1.00   -1.00   -0.25    0.61    0.68    0.04
 Code 4    0.18    0.23   -0.08    0.10   -1.00   -0.73
 Code 5   -1.00   -1.00    1.00   -1.00   -1.00   -1.00
 Code 6    0.62    0.71    0.08   -1.00   -1.00   -0.49


z values for the Unidirectional Kappas

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1   -0.37   -0.92   -1.31   -0.64   -0.57    1.77
 Code 2   -0.92   -2.29   -2.72   -0.75    0.41    5.03
 Code 3   -1.31   -3.25   -1.14    3.28    3.29    0.38
 Code 4    1.13    1.76   -0.17    1.11   -0.98   -1.80
 Code 5   -0.57   -1.42    4.80   -0.98   -0.88   -2.21
 Code 6    1.77    5.03    0.80   -2.46   -2.21   -2.74


Significance Levels for the Unidirectional Kappas

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1  0.7092  0.3558  0.1901  0.5238  0.5676  0.0759
 Code 2  0.3558  0.0222  0.0065  0.4562  0.6804  0.0000
 Code 3  0.1901  0.0012  0.2556  0.0010  0.0010  0.7059
 Code 4  0.2584  0.0790  0.8652  0.2678  0.3284  0.0723
 Code 5  0.5676  0.1569  0.0000  0.3284  0.3810  0.0272
 Code 6  0.0759  0.0000  0.4261  0.0138  0.0272  0.0062


Data Permutation Significance Levels (number of permutations = 100)

         Code 1  Code 2  Code 3  Code 4  Code 5  Code 6
 Code 1    0.91    0.42    0.21    0.73    0.79    0.08
 Code 2    0.51    0.02    0.00    0.44    0.52    0.00
 Code 3    0.27    0.00    0.22    0.01    0.00    0.46
 Code 4    0.37    0.08    0.53    0.17    0.49    0.11
 Code 5    0.69    0.10    0.00    0.38    0.54    0.03
 Code 6    0.16    0.00    0.24    0.02    0.03    0.00


Lag Sequential Analysis


Requested 'tail' (1 or 2) for Significance Tests = 2 


Cell Frequencies, Row & Column Totals, & N

       H+  Ho H- W+ Wo W- Totals
H+      0   0  0  0  2  2      4
Ho      0  10  5  5 60 20    100
H-      0   9  2  1  3  0     15
W+      0   3  0  1  5  0      9
Wo      3  54  6  2 24  8     97
W-      1  24  2  1  3 12     43
Totals  4 100 15 10 97 42    268


Expected Values/Frequencies

     H+    Ho   H-   W+    Wo    W-
H+ 0.06  1.49 0.22 0.15  1.45  0.63
Ho 1.49 37.31 5.60 3.73 36.19 15.67
H- 0.22  5.60 0.84 0.56  5.43  2.35
W+ 0.13  3.36 0.50 0.34  3.26  1.41
Wo 1.45 36.19 5.43 3.62 35.11 15.20
W- 0.64 16.04 2.41 1.60 15.56  6.74


Transitional Probabilities

     H+   Ho   H-   W+   Wo   W-
H+ 0.00 0.00 0.00 0.00 0.50 0.50
Ho 0.00 0.10 0.05 0.05 0.60 0.20
H- 0.00 0.60 0.13 0.07 0.20 0.00
W+ 0.00 0.33 0.00 0.11 0.56 0.00
Wo 0.03 0.56 0.06 0.02 0.25 0.08
W- 0.02 0.56 0.05 0.02 0.07 0.28


Tablewise Likelihood Ratio (Chi-Square) test = 107.6,  df = 25,  p = 0


Adjusted Residuals

      H+    Ho    H-    W+    Wo    W-
H+ -0.25 -1.55 -0.49 -0.40  0.58  1.90
Ho -1.55 -7.13 -0.33  0.85  6.26  1.50
H- -0.49  1.87  1.34  0.62 -1.34 -1.72
W+ -0.38 -0.25 -0.74  1.19  1.23 -1.32
Wo  1.63  4.68  0.32 -1.09 -2.94 -2.52
W-  0.49  2.74 -0.29 -0.53 -4.35  2.41


Significance Levels for the Adjusted Residuals

       H+     Ho     H-     W+     Wo     W-
H+ 0.8041 0.1200 0.6237 0.6916 0.5626 0.0571
Ho 0.1200 0.0000 0.7429 0.3979 0.0000 0.1326
H- 0.6237 0.0615 0.1797 0.5370 0.1792 0.0857
W+ 0.7072 0.8017 0.4574 0.2347 0.2189 0.1883
Wo 0.1037 0.0000 0.7522 0.2774 0.0033 0.0118
W- 0.6229 0.0062 0.7684 0.5955 0.0000 0.0160


Yule's Q Values

      H+    Ho    H-    W+    Wo    W-
H+ -1.00 -1.00 -1.00 -1.00  0.28  0.70
Ho -1.00 -0.82 -0.09  0.26  0.68  0.25
H- -1.00  0.46  0.48  0.32 -0.41 -1.00
W+ -1.00 -0.09 -1.00  0.55  0.39 -1.00
Wo  0.69  0.55  0.09 -0.40 -0.39 -0.47
W-  0.28  0.42 -0.11 -0.27 -0.81  0.43


Unidirectional Kappas

      H+    Ho    H-    W+    Wo    W-
H+ -1.00 -1.00 -1.00 -1.00  0.22  0.40
Ho -1.00 -0.73 -0.10  0.29  0.39  0.15
H- -1.00  0.36  0.08  0.06 -0.45 -1.00
W+ -1.00 -0.10 -1.00  0.08  0.30 -1.00
Wo  0.61  0.29  0.06 -0.38 -0.31 -0.48
W-  0.11  0.30 -0.17 -0.30 -0.81  0.14


z values for the Unidirectional Kappas

      H+    Ho    H-    W+    Wo    W-
H+ -0.25 -1.55 -0.49 -0.37  0.58  1.87
Ho -1.55 -7.08 -0.32  1.16  6.28  1.38
H- -0.49  1.88  1.34  0.73 -1.33 -1.74
W+ -0.37 -0.24 -0.74  1.32  1.24 -1.33
Wo  1.63  4.71  0.33 -0.88 -2.90 -2.60
W-  0.49  2.75 -0.29 -0.41 -4.32  2.32


Significance Levels for the Unidirectional Kappas

       H+     Ho     H-     W+     Wo     W-
H+ 0.8048 0.1218 0.6250 0.7083 0.5593 0.0619
Ho 0.1218 0.0000 0.7518 0.2467 0.0000 0.1677
H- 0.6250 0.0602 0.1787 0.4625 0.1833 0.0827
W+ 0.7083 0.8087 0.4592 0.1884 0.2162 0.1840
Wo 0.1029 0.0000 0.7441 0.3801 0.0038 0.0094
W- 0.6208 0.0059 0.7734 0.6854 0.0000 0.0202


Lag Sequential Analysis


The code frequencies:

data
 1  2  3  4  5 
16 14 20 15 10 


Requested 'tail' (1 or 2) for Significance Tests = 1 


Cell Frequencies, Row & Column Totals, & N

          Chat Write Read Ask Attentive Totals
Chat         1     3    4   6         2     16
Write        6     2    4   0         2     14
Read         4     1    9   4         1     19
Ask          5     2    2   3         3     15
Attentive    0     5    1   2         2     10
Totals      16    13   20  15        10     74


Expected Values/Frequencies

          Chat Write Read  Ask Attentive
Chat      3.46  2.81 4.32 3.24      2.16
Write     3.03  2.46 3.78 2.84      1.89
Read      4.11  3.34 5.14 3.85      2.57
Ask       3.24  2.64 4.05 3.04      2.03
Attentive 2.16  1.76 2.70 2.03      1.35


Transitional Probabilities

          Chat Write Read  Ask Attentive
Chat      0.06  0.19 0.25 0.38      0.12
Write     0.43  0.14 0.29 0.00      0.14
Read      0.21  0.05 0.47 0.21      0.05
Ask       0.33  0.13 0.13 0.20      0.20
Attentive 0.00  0.50 0.10 0.20      0.20


Tablewise Likelihood Ratio (Chi-Square) test = 30.95,  df = 16,  p = 0.01364


Adjusted Residuals

           Chat Write  Read   Ask Attentive
Chat      -1.69  0.14 -0.21  1.94     -0.13
Write      2.14 -0.36  0.14 -2.10      0.09
Read      -0.07 -1.63  2.32  0.10     -1.22
Ask        1.23 -0.48 -1.34 -0.03      0.82
Attentive -1.79  2.90 -1.30 -0.02      0.65


Significance Levels for the Adjusted Residuals

            Chat  Write   Read    Ask Attentive
Chat      0.0458 0.4442 0.4183 0.0264    0.4467
Write     0.0160 0.3600 0.4426 0.0181    0.4626
Read      0.4721 0.0510 0.0103 0.4608    0.1112
Ask       0.1086 0.3147 0.0905 0.4884    0.2053
Attentive 0.0371 0.0019 0.0962 0.4909    0.2594


Yule's Q Values

           Chat Write  Read   Ask Attentive
Chat      -0.68  0.05 -0.07  0.53     -0.06
Write      0.58 -0.15  0.05 -1.00      0.04
Read      -0.02 -0.67  0.57  0.03     -0.56
Ask        0.37 -0.20 -0.48 -0.01      0.30
Attentive -1.00  0.75 -0.58 -0.01      0.27


Unidirectional Kappas

           Chat Write  Read   Ask Attentive
Chat      -0.71  0.00 -0.06  0.24     -0.06
Write      0.27 -0.23  0.03 -1.00      0.02
Read      -0.06 -0.73  0.25  0.00     -0.62
Ask        0.15 -0.29 -0.50  0.00      0.12
Attentive -1.00  0.39 -0.62  0.00      0.08


z values for the Unidirectional Kappas

           Chat Write  Read   Ask Attentive
Chat      -1.65  0.01 -0.17  1.96     -0.11
Write      2.17 -0.46  0.18 -2.06      0.12
Read      -0.17 -1.82  2.15  0.00     -1.27
Ask        1.26 -0.59 -1.30  0.00      0.84
Attentive -1.76  2.71 -1.27  0.00      0.66


Significance Levels for the Unidirectional Kappas

            Chat  Write   Read    Ask Attentive
Chat      0.0495 0.4962 0.4330 0.0250    0.4563
Write     0.0152 0.3216 0.4296 0.0197    0.4540
Read      0.4330 0.0344 0.0158 0.5000    0.1017
Ask       0.1038 0.2780 0.0973 0.5000    0.1995
Attentive 0.0395 0.0033 0.1017 0.5000    0.2541


Data Permutation Significance Levels (number of permutations = 1000)

           Chat Write  Read   Ask Attentive
Chat      0.106 0.616 0.570 0.067     0.623
Write     0.033 0.538 0.541 0.035     0.614
Read      0.586 0.076 0.035 0.633     0.177
Ask       0.171 0.416 0.158 0.683     0.267
Attentive 0.071 0.024 0.208 0.724     0.343

LagSequential documentation built on May 16, 2019, 5:09 p.m.