test page

custom html embed vimeo video

cPanel

.out file

Mplus VERSION 8.3
MUTHEN & MUTHEN
05/20/2021  11:01 AM

INPUT INSTRUCTIONS

  TITLE:
     Example Model;

  DATA:
    FILE = ecls_acad.dat;

  VARIABLE:
    NAMES = read1 math1 gk1 lrn_p1
            read2 math2 gk2 lrn_p2;
    MISSING = .;
    USEVAR = read1 math1 gk1
             read2 math2 gk2;

  MODEL:
  ! Factor Loadings (Lambda)
      eta_1 BY math1@1
               read1
               gk1;
      eta_2 BY math2@1
               read2
               gk2;

  ! Factor Variances (Psi)
      eta_1 eta_2;

  ! Latent Variable Regressions (Beta)
      eta_2 ON eta_1*.8;

  ! Factor Means (alpha)
     [eta_1@0 eta_2@0];

  ! Unique Variances & Covariances (Theta)
      math1 read1 gk1 math2 read2 gk2;
      math1 WITH math2;
      read1 WITH read2;
      gk1 WITH gk2;

  ! Measurement Intercepts (tau)
     [math1 read1 gk1 math2 read2 gk2];

  OUTPUT: SAMPSTAT STANDARDIZED TECH1;



INPUT READING TERMINATED NORMALLY




Example Model;

SUMMARY OF ANALYSIS

Number of groups                                                 1
Number of observations                                       20601

Number of dependent variables                                    6
Number of independent variables                                  0
Number of continuous latent variables                            2

Observed dependent variables

  Continuous
   READ1       MATH1       GK1         READ2       MATH2       GK2

Continuous latent variables
   ETA_1       ETA_2


Estimator                                                       ML
Information matrix                                        OBSERVED
Maximum number of iterations                                  1000
Convergence criterion                                    0.500D-04
Maximum number of steepest descent iterations                   20
Maximum number of iterations for H1                           2000
Convergence criterion for H1                             0.100D-03

Input data file(s)
  ecls_acad.dat

Input data format  FREE


SUMMARY OF DATA

     Number of missing data patterns            29


COVARIANCE COVERAGE OF DATA

Minimum covariance coverage value   0.100


     PROPORTION OF DATA PRESENT


           Covariance Coverage
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
 READ1          0.855
 MATH1          0.854         0.905
 GK1            0.852         0.852         0.853
 READ2          0.813         0.828         0.811         0.919
 MATH2          0.813         0.859         0.811         0.918         0.954
 GK2            0.812         0.827         0.810         0.917         0.917


           Covariance Coverage
              GK2
              ________
 GK2            0.918


SAMPLE STATISTICS


     ESTIMATED SAMPLE STATISTICS


           Means
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
               34.779        25.822        21.758        45.958        36.131


           Means
              GK2
              ________
               26.807


           Covariances
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
 READ1        103.977
 MATH1         66.918        82.464
 GK1           39.491        42.933        57.779
 READ2        119.385        86.454        49.686       198.551
 MATH2         79.019        90.512        54.606       116.313       144.225
 GK2           39.870        43.417        51.801        54.418        59.383


           Covariances
              GK2
              ________
 GK2           62.350


           Correlations
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
 READ1          1.000
 MATH1          0.723         1.000
 GK1            0.510         0.622         1.000
 READ2          0.831         0.676         0.464         1.000
 MATH2          0.645         0.830         0.598         0.687         1.000
 GK2            0.495         0.605         0.863         0.489         0.626


           Correlations
              GK2
              ________
 GK2            1.000


     MAXIMUM LOG-LIKELIHOOD VALUE FOR THE UNRESTRICTED (H1) MODEL IS -367574.510


UNIVARIATE SAMPLE STATISTICS


     UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS

         Variable/         Mean/     Skewness/   Minimum/ % with                Percentiles
        Sample Size      Variance    Kurtosis    Maximum  Min/Max      20%/60%    40%/80%    Median

     READ1                35.215       2.936      21.010    0.01%      27.390     31.840     33.460
           17622.000     104.009      16.301     138.510    0.01%      35.210     40.830
     MATH1                25.905       1.410      10.510    0.01%      18.560     22.430     24.440
           18636.000      82.791       4.186     115.650    0.01%      26.400     32.130
     GK1                  22.231       0.257       6.985    0.03%      15.218     19.676     21.872
           17564.000      56.382      -0.570      47.691    0.01%      24.072     28.938
     READ2                46.459       2.268      22.230    0.01%      36.520     41.860     44.340
           18937.000     196.977       8.841     156.850    0.03%      46.640     52.850
     MATH2                36.273       1.058      11.570    0.01%      26.300     31.710     34.610
           19649.000     144.100       2.351     113.800    0.01%      37.920     45.030
     GK2                  27.079      -0.066       7.274    0.01%      19.741     25.140     27.291
           18903.000      62.186      -0.638      48.345    0.01%      29.491     34.237


THE MODEL ESTIMATION TERMINATED NORMALLY



MODEL FIT INFORMATION

Number of Free Parameters                       22

Loglikelihood

          H0 Value                     -367709.517
          H1 Value                     -367574.510

Information Criteria

          Akaike (AIC)                  735463.035
          Bayesian (BIC)                735637.563
          Sample-Size Adjusted BIC      735567.648
            (n* = (n + 2) / 24)

Chi-Square Test of Model Fit

          Value                            270.014
          Degrees of Freedom                     5
          P-Value                           0.0000

RMSEA (Root Mean Square Error Of Approximation)

          Estimate                           0.051
          90 Percent C.I.                    0.046  0.056
          Probability RMSEA <= .05           0.397

CFI/TLI

          CFI                                0.997
          TLI                                0.991

Chi-Square Test of Model Fit for the Baseline Model

          Value                          91489.282
          Degrees of Freedom                    15
          P-Value                           0.0000

SRMR (Standardized Root Mean Square Residual)

          Value                              0.010



MODEL RESULTS

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

 ETA_1    BY
    MATH1              1.000      0.000    999.000    999.000
    READ1              0.892      0.009    102.554      0.000
    GK1                0.575      0.006     89.703      0.000

 ETA_2    BY
    MATH2              1.000      0.000    999.000    999.000
    READ2              0.951      0.009    101.979      0.000
    GK2                0.470      0.005     90.199      0.000

 ETA_2    ON
    ETA_1              1.224      0.007    175.086      0.000

 MATH1    WITH
    MATH2             -0.570      0.645     -0.884      0.377

 READ1    WITH
    READ2             43.113      0.782     55.166      0.000

 GK1      WITH
    GK2               26.202      0.356     73.594      0.000

 Means
    ETA_1              0.000      0.000    999.000    999.000

 Intercepts
    READ1             34.791      0.073    475.674      0.000
    MATH1             25.821      0.064    402.153      0.000
    GK1               21.761      0.054    401.270      0.000
    READ2             45.954      0.100    458.478      0.000
    MATH2             36.131      0.084    428.596      0.000
    GK2               26.811      0.056    480.977      0.000
    ETA_2              0.000      0.000    999.000    999.000

 Variances
    ETA_1             74.575      0.994     75.048      0.000

 Residual Variances
    READ1             44.894      0.647     69.433      0.000
    MATH1              7.887      0.558     14.122      0.000
    GK1               32.447      0.389     83.515      0.000
    READ2             88.564      1.198     73.928      0.000
    MATH2             20.957      0.982     21.337      0.000
    GK2               34.343      0.406     84.684      0.000
    ETA_2             11.649      0.359     32.447      0.000


STANDARDIZED MODEL RESULTS


STDYX Standardization

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

 ETA_1    BY
    MATH1              0.951      0.004    265.078      0.000
    READ1              0.755      0.004    180.531      0.000
    GK1                0.657      0.005    136.770      0.000

 ETA_2    BY
    MATH2              0.925      0.004    247.206      0.000
    READ2              0.746      0.004    183.342      0.000
    GK2                0.665      0.005    141.235      0.000

 ETA_2    ON
    ETA_1              0.952      0.001    641.371      0.000

 MATH1    WITH
    MATH2             -0.044      0.052     -0.846      0.398

 READ1    WITH
    READ2              0.684      0.005    134.659      0.000

 GK1      WITH
    GK2                0.785      0.003    239.758      0.000

 Means
    ETA_1              0.000      0.000    999.000    999.000

 Intercepts
    READ1              3.407      0.019    178.583      0.000
    MATH1              2.843      0.016    177.473      0.000
    GK1                2.880      0.017    172.620      0.000
    READ2              3.249      0.018    179.622      0.000
    MATH2              3.008      0.017    181.181      0.000
    GK2                3.415      0.019    182.316      0.000
    ETA_2              0.000      0.000    999.000    999.000

 Variances
    ETA_1              1.000      0.000    999.000    999.000

 Residual Variances
    READ1              0.431      0.006     68.255      0.000
    MATH1              0.096      0.007     14.017      0.000
    GK1                0.568      0.006     90.035      0.000
    READ2              0.443      0.006     72.855      0.000
    MATH2              0.145      0.007     21.003      0.000
    GK2                0.557      0.006     88.919      0.000
    ETA_2              0.094      0.003     33.448      0.000


STDY Standardization

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

 ETA_1    BY
    MATH1              0.951      0.004    265.078      0.000
    READ1              0.755      0.004    180.531      0.000
    GK1                0.657      0.005    136.770      0.000

 ETA_2    BY
    MATH2              0.925      0.004    247.206      0.000
    READ2              0.746      0.004    183.342      0.000
    GK2                0.665      0.005    141.235      0.000

 ETA_2    ON
    ETA_1              0.952      0.001    641.371      0.000

 MATH1    WITH
    MATH2             -0.044      0.052     -0.846      0.398

 READ1    WITH
    READ2              0.684      0.005    134.659      0.000

 GK1      WITH
    GK2                0.785      0.003    239.758      0.000

 Means
    ETA_1              0.000      0.000    999.000    999.000

 Intercepts
    READ1              3.407      0.019    178.583      0.000
    MATH1              2.843      0.016    177.473      0.000
    GK1                2.880      0.017    172.620      0.000
    READ2              3.249      0.018    179.622      0.000
    MATH2              3.008      0.017    181.181      0.000
    GK2                3.415      0.019    182.316      0.000
    ETA_2              0.000      0.000    999.000    999.000

 Variances
    ETA_1              1.000      0.000    999.000    999.000

 Residual Variances
    READ1              0.431      0.006     68.255      0.000
    MATH1              0.096      0.007     14.017      0.000
    GK1                0.568      0.006     90.035      0.000
    READ2              0.443      0.006     72.855      0.000
    MATH2              0.145      0.007     21.003      0.000
    GK2                0.557      0.006     88.919      0.000
    ETA_2              0.094      0.003     33.448      0.000


STD Standardization

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

 ETA_1    BY
    MATH1              8.636      0.058    150.097      0.000
    READ1              7.705      0.068    112.922      0.000
    GK1                4.964      0.052     96.175      0.000

 ETA_2    BY
    MATH2             11.105      0.077    143.630      0.000
    READ2             10.556      0.093    113.955      0.000
    GK2                5.223      0.053     98.489      0.000

 ETA_2    ON
    ETA_1              0.952      0.001    641.371      0.000

 MATH1    WITH
    MATH2             -0.570      0.645     -0.884      0.377

 READ1    WITH
    READ2             43.113      0.782     55.166      0.000

 GK1      WITH
    GK2               26.202      0.356     73.594      0.000

 Means
    ETA_1              0.000      0.000    999.000    999.000

 Intercepts
    READ1             34.791      0.073    475.674      0.000
    MATH1             25.821      0.064    402.153      0.000
    GK1               21.761      0.054    401.270      0.000
    READ2             45.954      0.100    458.478      0.000
    MATH2             36.131      0.084    428.596      0.000
    GK2               26.811      0.056    480.977      0.000
    ETA_2              0.000      0.000    999.000    999.000

 Variances
    ETA_1              1.000      0.000    999.000    999.000

 Residual Variances
    READ1             44.894      0.647     69.433      0.000
    MATH1              7.887      0.558     14.122      0.000
    GK1               32.447      0.389     83.515      0.000
    READ2             88.564      1.198     73.928      0.000
    MATH2             20.957      0.982     21.337      0.000
    GK2               34.343      0.406     84.684      0.000
    ETA_2              0.094      0.003     33.448      0.000


R-SQUARE

    Observed                                        Two-Tailed
    Variable        Estimate       S.E.  Est./S.E.    P-Value

    READ1              0.569      0.006     90.266      0.000
    MATH1              0.904      0.007    132.539      0.000
    GK1                0.432      0.006     68.385      0.000
    READ2              0.557      0.006     91.671      0.000
    MATH2              0.855      0.007    123.603      0.000
    GK2                0.443      0.006     70.617      0.000

     Latent                                         Two-Tailed
    Variable        Estimate       S.E.  Est./S.E.    P-Value

    ETA_2              0.906      0.003    320.685      0.000


QUALITY OF NUMERICAL RESULTS

     Condition Number for the Information Matrix              0.646E-05
       (ratio of smallest to largest eigenvalue)


TECHNICAL 1 OUTPUT


     PARAMETER SPECIFICATION


           NU
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
                  1             2             3             4             5


           NU
              GK2
              ________
                  6


           LAMBDA
              ETA_1         ETA_2
              ________      ________
 READ1              7             0
 MATH1              0             0
 GK1                8             0
 READ2              0             9
 MATH2              0             0
 GK2                0            10


           THETA
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
 READ1             11
 MATH1              0            12
 GK1                0             0            13
 READ2             14             0             0            15
 MATH2              0            16             0             0            17
 GK2                0             0            18             0             0


           THETA
              GK2
              ________
 GK2               19


           ALPHA
              ETA_1         ETA_2
              ________      ________
                  0             0


           BETA
              ETA_1         ETA_2
              ________      ________
 ETA_1              0             0
 ETA_2             20             0


           PSI
              ETA_1         ETA_2
              ________      ________
 ETA_1             21
 ETA_2              0            22


     STARTING VALUES


           NU
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
               35.215        25.905        22.231        46.459        36.273


           NU
              GK2
              ________
               27.079


           LAMBDA
              ETA_1         ETA_2
              ________      ________
 READ1          0.920         0.000
 MATH1          1.000         0.000
 GK1            0.590         0.000
 READ2          0.000         0.916
 MATH2          0.000         1.000
 GK2            0.000         0.468


           THETA
              READ1         MATH1         GK1           READ2         MATH2
              ________      ________      ________      ________      ________
 READ1         52.005
 MATH1          0.000        41.395
 GK1            0.000         0.000        28.191
 READ2          0.000         0.000         0.000        98.488
 MATH2          0.000         0.000         0.000         0.000        72.050
 GK2            0.000         0.000         0.000         0.000         0.000


           THETA
              GK2
              ________
 GK2           31.093


           ALPHA
              ETA_1         ETA_2
              ________      ________
                0.000         0.000


           BETA
              ETA_1         ETA_2
              ________      ________
 ETA_1          0.000         0.000
 ETA_2          0.800         0.000


           PSI
              ETA_1         ETA_2
              ________      ________
 ETA_1          0.050
 ETA_2          0.000         0.050


DIAGRAM INFORMATION

  Use View Diagram under the Diagram menu in the Mplus Editor to view the diagram.
  If running Mplus from the Mplus Diagrammer, the diagram opens automatically.

  Diagram output
    e:\kjgrimm\documents\ucd\organization\workshops\ati\apa-ati lsem 2021\finalfiles\a.reviewsemmplus.dgm

     Beginning Time:  11:01:54
        Ending Time:  11:01:55
       Elapsed Time:  00:00:01



MUTHEN & MUTHEN
3463 Stoner Ave.
Los Angeles, CA  90066

Tel: (310) 391-9971
Fax: (310) 391-8971
Web: www.StatModel.com
Support: Support@StatModel.com

Copyright (c) 1998-2019 Muthen & Muthen

custom html embed html file

Intensive Longitudinal Data

Intensive Longitudinal Data

Intraindividual Variability Metrics Computation

Overview

This tutorial illustrates calculation of intraindividual variability metrics. Specifically, this tutorial demonstrates calculation of a few univariate metrics, a few bivariate metrics, and a few multivariate metrics - as well as how these metrics are related to other individual differences.

Outline

A. Univariate IIV Metrics

  • iCount, iMean, iSD, iSkew, iKurtosis, iEntropy

B. Bivariate IIV Metrics

  • iCor, iCov, iReg

C. Multivariate IIV Metrics

  • Determinant of a matrix, Frobenius Norm

D. Selected Readings

  • Benson, L., Ram, N., Almeida, D. M., Zautra, A. J., & Ong, A. D. (2017). Fusing biodiversity metrics into investigations of daily life: Illustrations and recommendations with emodiversity. The Journals of Gerontology: Series B, 73(1), 75-86.
  • Deboeck, P. R., Montpetit, M. A., Bergeman, C. S., & Boker, S. M. (2009). Using derivative estimates to describe intraindividual variability at multiple time scales. Psychological methods, 14(4), 367.
  • Jahng, S., Wood, P. K., & Trull, T. J. (2008). Analysis of affective instability in ecological momentary assessment: Indices using successive difference and group comparison via multilevel modeling. Psychological methods, 13(4), 354.
  • Ram, N., Benson, L., Brick, T. R., Conroy, D. E., & Pincus, A. L. (2017). Behavioral landscapes and earth mover’s distance: A new approach for studying individual differences in density distributions. Journal of research in personality, 69, 191-205.
  • Ram, N., & Gerstorf, D. (2009). Time-structured and net intraindividual variability: tools for examining the development of dynamic characteristics and processes. Psychology and aging, 24(4), 778.

Preliminaries

Loading Libraries

Loading libraries used in this script.

library(psych) # for describing the data
library(plyr) #for data manipulation
library(ggplot2) # for data visualization
library(entropy) #for entropy calculation
library(nFactors) #factor analysis

Loading Data

Our example makes use of the person-level and interaction-level (EMA-type) AMIB data files. We make use of person-level personality variables and a small set of interaction-level variables.

Loading person-level file and subsetting to variables of interest

#set filepath for data file
filepath <- "https://quantdev.ssri.psu.edu/sites/qdev/files/AMIBshare_persons_2019_0501.csv"
#read in the .csv file using the url() function
AMIB_persons <- read.csv(file=url(filepath),header=TRUE)
#subsetting to variables of interest
AMIB_persons <- AMIB_persons[ ,c("id","bfi_o","bfi_c","bfi_e","bfi_a","bfi_n")]

Loading day-level file (T = 21) and subsetting to variables of interest.

#set filepath for data file
filepath <- "https://quantdev.ssri.psu.edu/sites/qdev/files/AMIBshare_phase2_daily_2019_0501.csv"
#read in the .csv file using the url() function
AMIB_daily <- read.csv(file=url(filepath),header=TRUE)

1. Univariate IIV Metrics

There are several types of univariate IIV metrics that differ based on the type of data (continuous, binary, count), and conceptual meanings. For example, the iMean, iSD, iSkew, and iKurtosis are the first four distribution moments, utilize continuous data, and are unstructured with respect to time. iMSSD and iPAC also utilize continuous data, but do acount for time dependencies in the data. iEntropy and iTurbulence pertain to categorical data.

We illustrate just a few. The general principle is to use the functions in the plyr package to split the data by “id” and summarize each person’s data using a specifci fucntion (e.g., mean, sd). We will use this same approach when preparing data in later analyses.

Calculating univariate IIV metrics.

istats_univariate <- ddply(AMIB_daily, "id", summarize,
                            icount_posaff = sum(!is.na(posaff)),  #count of observations
                            imean_posaff  = mean(posaff, na.rm=TRUE), #imean (continuous)
                            isd_posaff    = sd(posaff, na.rm=TRUE),   #isd   (continuous)
                            iskew_posaff  = skew(posaff, na.rm=TRUE), #iskew (continuous)
                            ikurt_posaff  = kurtosi(posaff, na.rm=TRUE), # ikurtosis (continuous)
                            ientropy_stress= entropy(table(stress,
                                                             useNA="no")))  #(categorical)

Look at univariate IIV metrics data

round(head(istats_univariate),2)
##    id icount_posaff imean_posaff isd_posaff iskew_posaff ikurt_posaff
## 1 203            22         4.42       0.84        -0.70         0.13
## 2 204            22         3.10       1.17        -0.58        -1.19
## 3 205            22         4.32       0.68        -0.73        -0.53
## 4 208            22         3.92       0.67         0.11        -0.86
## 5 211            22         2.81       0.85         0.70        -0.15
## 6 214            15         4.16       1.01        -0.46        -0.82
##   ientropy_stress
## 1            1.00
## 2            1.49
## 3            1.67
## 4            1.02
## 5            1.36
## 6            1.90

Describe the bivariate IIV metrics

describe(istats_univariate[-1])
##                 vars  n  mean   sd median trimmed  mad   min   max range  skew
## icount_posaff      1 30 20.90 2.58  22.00   21.58 0.00 14.00 22.00  8.00 -2.02
## imean_posaff       2 30  3.78 0.71   3.91    3.76 0.56  2.61  5.62  3.01  0.29
## isd_posaff         3 30  0.88 0.26   0.87    0.87 0.26  0.32  1.52  1.20  0.17
## iskew_posaff       4 30 -0.15 0.46  -0.24   -0.19 0.46 -0.74  0.97  1.71  0.69
## ikurt_posaff       5 30 -0.79 0.50  -0.88   -0.84 0.47 -1.43  0.58  2.01  0.94
## ientropy_stress    6 30  1.47 0.28   1.50    1.48 0.28  0.84  1.90  1.06 -0.39
##                 kurtosis   se
## icount_posaff       2.28 0.47
## imean_posaff       -0.17 0.13
## isd_posaff         -0.19 0.05
## iskew_posaff       -0.45 0.08
## ikurt_posaff        0.01 0.09
## ientropy_stress    -0.77 0.05

Examine correlations

round(cor(istats_univariate[ ,-1], use="pairwise.complete.obs"),2)
##                 icount_posaff imean_posaff isd_posaff iskew_posaff ikurt_posaff
## icount_posaff            1.00         0.08      -0.32         0.16         0.24
## imean_posaff             0.08         1.00      -0.45        -0.38         0.14
## isd_posaff              -0.32        -0.45       1.00         0.21        -0.07
## iskew_posaff             0.16        -0.38       0.21         1.00         0.29
## ikurt_posaff             0.24         0.14      -0.07         0.29         1.00
## ientropy_stress         -0.06        -0.24       0.29        -0.21        -0.11
##                 ientropy_stress
## icount_posaff             -0.06
## imean_posaff              -0.24
## isd_posaff                 0.29
## iskew_posaff              -0.21
## ikurt_posaff              -0.11
## ientropy_stress            1.00

Merge the univariate IIV metrics with other person-level data.

AMIB_univariate <- merge(istats_univariate, AMIB_persons, by="id")

Examine relation between positive affect variability and neuroticism.

Look at association between isd_posaff and bfi_n:

#pdf("Figure1_UnivariateIIV.pdf",height=5.75, width=9)
ggplot(data=AMIB_univariate, aes(x=bfi_n, y=isd_posaff)) +
  geom_point(colour="gray40") +
  geom_smooth(aes(group=1), method=lm, se=TRUE, fullrange=TRUE, lty=1, size=2, color="#9A23DE") +
  scale_y_continuous(breaks=c(0.4, 0.8, 1.2, 1.6), limits=c(0.32,1.6)) +
  xlab("Neuroticism") + ylab("Positive Affect Variability") +
  theme_classic() +
  theme(axis.title=element_text(size=16),
        axis.text=element_text(size=12),
        plot.title=element_text(size=16, hjust=.5, face="bold")) +
  ggtitle("Between-Person Association Univariate IIV")
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

#dev.off()

And the formal model test (cross-sectional regression).

reg_univariate <- lm(isd_posaff ~ bfi_n, 
                     data=AMIB_univariate,
                     na.action = na.exclude) 
summary(reg_univariate)
## 
## Call:
## lm(formula = isd_posaff ~ bfi_n, data = AMIB_univariate, na.action = na.exclude)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.49597 -0.14662 -0.00169  0.18189  0.49217 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.59383    0.15329   3.874 0.000589 ***
## bfi_n        0.08654    0.04499   1.923 0.064654 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.252 on 28 degrees of freedom
## Multiple R-squared:  0.1167, Adjusted R-squared:  0.08516 
## F-statistic: 3.699 on 1 and 28 DF,  p-value: 0.06465
  • For the prototypical person, positive affect variability is expected to be 0.59
  • Individuals who are higher on neuroticism tend to have more variability in their positive affect. For every unit increase in neuroticism, characteristic positive affect is expected to increase by 0.09 (however, this association is not statistically significantly different from zero p = 0.06).

B. Bivariate IIV Metrics

There are are also several types of bivariate IIV metrics, including the iCorr, iCov, iPulse, iSpin, and iEntropy. The slope parameter from a within-person regression can, along with the iCorr and iCov also be considered a measure of intraindividual covariation.

We illustrate just a few of these. Again, the general principle is to use the functions in the plyr package to split the data by “id” and summarize each person’s data using a specific fucntion (e.g., cor, lm).

Calculate intraindiviudal correlation (iCor) and intraindividual covariance (iCov) and intraindividual regression (iReg):

istats_bivariate <- ddply(AMIB_daily, "id", summarize, 
                        icor_affect = cor(x=posaff,y=negaff,           
                                         use="pairwise.complete.obs", method="pearson"),
                        icov_affect = cov(x=posaff,y=negaff,          
                                         use="pairwise.complete.obs", method="pearson"),
                        ireg_affect = coef(lm(posaff ~ negaff, na.action=na.exclude))[2])

Look at bivariate IIV metrics data

round(head(istats_bivariate),2)
##    id icor_affect icov_affect ireg_affect
## 1 203       -0.63       -0.29       -0.98
## 2 204       -0.77       -1.18       -0.70
## 3 205       -0.44       -0.17       -0.53
## 4 208       -0.35       -0.06       -0.88
## 5 211       -0.08       -0.02       -0.17
## 6 214       -0.85       -0.83       -0.89

Describe the bivariate IIV metrics

describe(istats_bivariate[ ,-1])
##             vars  n  mean   sd median trimmed  mad   min  max range  skew
## icor_affect    1 30 -0.49 0.27  -0.54   -0.50 0.32 -0.90 0.01  0.91  0.30
## icov_affect    2 30 -0.39 0.41  -0.25   -0.32 0.31 -1.73 0.01  1.74 -1.61
## ireg_affect    3 30 -0.58 0.35  -0.62   -0.58 0.43 -1.21 0.03  1.24  0.03
##             kurtosis   se
## icor_affect    -1.24 0.05
## icov_affect     2.28 0.07
## ireg_affect    -1.20 0.06

Correlations among the bivariate IIV metrics

round(cor(istats_bivariate[ ,-1], use="pairwise.complete.obs"),2)
##             icor_affect icov_affect ireg_affect
## icor_affect        1.00        0.73        0.84
## icov_affect        0.73        1.00        0.51
## ireg_affect        0.84        0.51        1.00

Note the overlap between the iCor, iCov, and iReg metrics. This will be relevant when extending the iReg into the multilevel modeling framework - to examine between-person differences in intraindividual covariation.

Merge the bivariate IIV metrics with other person-level data.

AMIB_bivariate <- merge(istats_bivariate, AMIB_persons, by="id")

Examine relation between Affect Bipolarity and neuroticism.

Look at association between isd_posaff and bfi_e:

#pdf("Figure2_BivariateIIV.pdf",height=3, width=9)
ggplot(data=AMIB_bivariate, aes(x=bfi_n, y=icor_affect)) +
  geom_point(colour="gray40") +
  geom_smooth(aes(group=1), method=lm, se=TRUE, fullrange=TRUE, lty=1, size=2, color="#9A23DE") +
  xlab("Neuroticism") + ylab("Affect Bipolarity") +
  theme_classic() +
  theme(axis.title=element_text(size=16),
        axis.text=element_text(size=12),
        plot.title=element_text(size=16, hjust=.5, face="bold")) +
  ggtitle("Between-Person Association Bivariate IIV")
## `geom_smooth()` using formula 'y ~ x'

#dev.off()

Fit model with the neuroticism predicting the individual slope score for the association between positive and negative affect.

reg_bivariate <- lm(icor_affect ~ bfi_n, 
                     data=AMIB_bivariate,
                     na.action = na.exclude) 
summary(reg_bivariate)
## 
## Call:
## lm(formula = icor_affect ~ bfi_n, data = AMIB_bivariate, na.action = na.exclude)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.42499 -0.20524 -0.05017  0.24066  0.51684 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept) -0.42619    0.16959  -2.513    0.018 *
## bfi_n       -0.01979    0.04978  -0.398    0.694  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2788 on 28 degrees of freedom
## Multiple R-squared:  0.005616,   Adjusted R-squared:  -0.0299 
## F-statistic: 0.1581 on 1 and 28 DF,  p-value: 0.6939
  • For the prototypical person, affect bipolarity score for the sample is -0.43
  • Individuals who are higher on neuroticism tend to have stronger affect bipolarity (scores further from zero). For every unit increase in neuroticism, affect bipolarity is expected to change by -0.02 (however, this association is not statistically significantly different from zero p = 0.69).

C. Multivariate IIV Metrics

Calculation of intraindividual variability metrics can be extended to multivariate time-series. Continuous measures can be summarized as a correlation/covariance matrix (and vector of means) - which in turn is summarized using metrics such as the determinant, Frobenius norm, or number of eigenvalues > 1 (Kaiser rule). Categorical measures can be summarized as a frequency table - which is, in turn, summarized using metrics such as Gini coefficient, richness, Shannon’s entropy, and Simpson’s index.

Calculating multivariate IIV metrics.

First, set the variables of interest (be sure the id variable is included in the first position)

vars <- c("id", "enthusiastic", "happy", "proud", "relaxed", "calm",
          "sluggish", "sad", "disappointed", "angry", "nervous") 

Calculate the metrics. Each one takes a few steps

# remove ID 218 (due to zero variance in several items)
AMIB_daily_sub <- AMIB_daily[AMIB_daily$id!=218, ]
#calculating the determinant for each individual
istat_idet <- ddply(AMIB_daily_sub[ ,vars], "id",
                  function(x) {
                    det(cor(x[,-1],use="pairwise.complete.obs",
                            method="pearson"))} )
#renaming columns
colnames(istat_idet) <- c("id","idet")
#calculating Frobenius norm for each individual
istat_iFnorm <- ddply(AMIB_daily_sub[ ,vars], "id",
                  function(x) {
                    norm(cor(x[,-1],use="pairwise.complete.obs",
                             method="pearson"),type="F")} )
#renaming columns
colnames(istat_iFnorm) <- c("id","iFnorm")

Merging all together

istats_multivar <- merge(istat_idet,istat_iFnorm, by="id")

Look at multivariate IIV metrics data

round(head(istats_multivar),2)
##    id idet iFnorm
## 1 203 0.00   5.64
## 2 204 0.00   5.11
## 3 205 0.03   4.01
## 4 208 0.00   4.43
## 5 211 0.00   4.72
## 6 214 0.00   4.92

Describe the bivariate IIV metrics.

describe(istats_multivar[ ,-1])
##        vars  n mean   sd median trimmed  mad  min  max range skew kurtosis   se
## idet      1 29 0.01 0.01   0.00    0.00 0.00 0.00 0.04  0.04 2.00     2.94 0.00
## iFnorm    2 29 4.89 0.65   4.89    4.83 0.56 3.97 6.98  3.01 1.04     1.66 0.12

Correlations among the bivariate IIV metrics

round(cor(istats_multivar[ ,-1], use="pairwise.complete.obs"),2)
##         idet iFnorm
## idet    1.00  -0.64
## iFnorm -0.64   1.00

Merge the multivariate IIV metrics with other person-level data.

AMIB_multivariate <- merge(istats_multivar, AMIB_persons, by="id")

Examine relation between emotion system variability and neuroticism.

Look at association between idet and bfi_n:

#pdf("Figure3_MultivariateIIV.pdf",height=3, width=5.45)
ggplot(data=AMIB_multivariate, aes(x=bfi_n, y=idet)) +
  geom_point(colour="gray40") +
  geom_smooth(aes(group=1), method="lm", se=TRUE, fullrange=TRUE, lty=1, size=2, color="#9A23DE") +
  xlab("Neuroticism") + ylab("Emotion System\nVariability") +
  theme_classic() +
  theme(axis.title=element_text(size=16),
        axis.text=element_text(size=12),
        plot.title=element_text(size=16, hjust=.5)) +
  ggtitle("Between-Person Association Multivariate IIV")
## `geom_smooth()` using formula 'y ~ x'