makeCrossCorBiVar | R Documentation |
Takes typical time-series wide-format data (e.g., multiple time-varying variables for each person in wide format) and calculates cross-correlations for two user-specified variables within a specified maximum number of lags. It returns a dataframe with the largest absolute cross-correlation and its lag added for each person (e.g., it returns either the most negative or most positive cross-correlation, whichever is larger in absolute terms – the sign is retained).
makeCrossCorBiVar(basedata, personId, obs1_name, obs2_name, maxLag)
basedata |
The original dataframe provided by the user that includes at least two time-series variables nested within-person |
personId |
The name of the column in the dataframe that has the person-level identifier. |
obs1_name |
The name of the column in the dataframe that has the first time-series variable to be stacked. |
obs2_name |
The name of the column in the dataframe that has the second time-series variable to be stacked. |
time_name |
The name of the column in the dataframe that indicates sequential temporal observations. |
A cross-sectional version of the original dataframe with maximal absolute-value cross-correlations and their lags added for each person.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.