sta_stats: Statistics for state-Trace Analysis

Description Usage Arguments Value References

View source: R/staSTATS.R

Description

Calculates statistics for state trace analysis. This function is mainly for internal use, but the print and summary method for the returned objects of class sta_stats also provide a convenient overview of the data point of the state-trace analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sta_stats(
  data,
  col_value,
  col_participant,
  col_dv,
  col_within,
  col_between,
  shrink = -1,
  warning = FALSE
)

Arguments

data

data.frame containing data aggregated by participant and relevant variables in columns.

col_value

character. Name of column in data containing numerical values for analysis (i.e., responses).

col_participant

character. Name of column in data containing the participant identifier.

col_dv

character. Name of column in data containing the dependent variable(s) spanning the state-trace axes.

col_within

character, optional. Name of column(s) in data containing the within-subjects variables.

col_between

character, optional. Name of column(s) in data containing the between-subjects variables.

shrink

numeric indicating amount of shrinkage to apply to the estimated covariance matrix. Generally, the covariance matrix needs to be shrunk during the bootstrap cycle to avoid ill-conditioning. If shrink = 0 then no shrinkage is applied. If shrink = 1 then maximum shrinkage is applied. This means that the covariance matrix is diagonalized with all off-diagonal entries set to zero. If shrink < 0 (the default) then an optimal shrinkage value is estimated for each within-participant block and applied according to an algorithm developed by Ledoit and Wolf (2004).

warning

if warning is TRUE then a warning is thrown if NAs are detected. Default is FALSE.

Value

A list of lists with additional class sta_stats. The length of the outer lists corresponds to the number of dvs in the data (i.e., each slot corresponds to one dv and is named accordingly). Each of the inner lists contains the following slots:

The summary method returns a data.frame giving means, conditions, and mean N. The print method prints this data.frame with specified digits.

References

Ledoit, O. & Wolf, M. (2004). Honey, I shrunk the sample covariance matrix. The Journal of Portfolio Management, 30(4), 110-119.


monotonicity/stacmr documentation built on Jan. 28, 2020, 3:29 a.m.