makeCrossCorr: Calculates cross-correlations for a given variable and...

Description Usage Arguments Value Examples

View source: R/rtiesShared.R

Description

Calculates cross-correlations for a given variable and returns a dataframe with the largest absolute cross-correlation and its lag added for each dyad (e.g., it returns either the most negative or most positive cross-correlation, whichever is larger in absolute terms).

Usage

1
makeCrossCorr(basedata, dyadId, personId, obs_name, dist_name)

Arguments

basedata

The original dataframe provided by the user that includes all variables needed for an rties analysis, including potential system and control variables, etc.

dyadId

The name of the column in the dataframe that has the couple-level identifier.

personId

The name of the column in the dataframe that has the person-level identifier.

obs_name

The name of the column in the dataframe that has the time-varying observable (e.g., the variable for which dynamics will be assessed).

dist_name

The name of the column in the dataframe that has a variable that distinguishes the partners (e.g., sex, mother/daughter, etc) that is numeric and scored 0/1.

Value

A cross-sectional version of the original dataframe with maximal absolute-value cross-correlations and their lags added for each dyad.

Examples

1
2
3
4
data <- rties_ExampleDataShort
newData <- makeCrossCorr(basedata=data, dyadId="couple", personId="person", 
obs_name="dial", dist_name="female")
head(newData)

rties documentation built on July 2, 2020, 4:11 a.m.