rep_auto_id_mods: Individual level Moderators (automatic)

Description Usage Arguments Details Value Examples

View source: R/id_mods.R

Description

This is a wrapper function around the Individual-level moderator functions.

Usage

1
2
3
4
5
rep_auto_id_mods(data, target_self = NULL, p1_reports = NULL,
  p2_reports = NULL, id_mod_variable = NULL, interaction_term = NULL,
  n_triads = NULL, n_ts_per_p2s = 1, n_p2s_per_ts = 1,
  n_p1s_per_p2s = 1, n_p2s_per_p1s = 1, n_r1_per_r2 = 1,
  n_r2_per_r1 = 1)

Arguments

data

The dataframe that contains the ratings, moderator variable, and the interaction term. Data should be wide, with a row for every group of participants. At a minimum, it must contain four columns: two ratings (one which is mean-centered), one for the mean-centered moderator variable, and one for the interaction term.

target_self

Quoted column names that contain target self-reports. If more than one is supplied, the target-wise order must match the other rating types.

p1_reports

Quoted column names that contain P1 reports, or ratings made by the person that knows the target directly. If more than one is supplied, the target-wise order must match the other rating types.

p2_reports

Quoted column names that contain P2 reports, or ratings made by the person that knows the target indirectly through the corresponding P1. Ratings should be grand-mean-centered to increase the interpretibility of the model parameters. If more than one is supplied, the target-wise order must match the other rating types.

id_mod_variable

Quoted column names that contain the individual-level moderator of interest. If more than one is supplied from multiple exchangeable triads, the order must match the order of the ratings. Like P2-reports, the variable should be mean-centered to facilitate interpretability.

interaction_term

Quoted column names that contain the interaction term, or the product of the mean-centered rating (often P2-reports) and the mean-centered moderator variable. If more than one is supplied from multiple exchangeable triads, the target-wise order must match the order of the ratings.

n_triads

The number of exchangeable triads in each group. By default, this is determined by the method used by whichever specific model funciton is called. For consensus, this is done by counting P1-reports; foraccuracy, this is done by counting target self-reports. This parameter rarely needs to be changed.

n_ts_per_p2s

The number of targets that each P2 rated. This defaults to 1. Currently, only values of 1 are supported.

n_p2s_per_ts

The number of P2s that rated each target;. This defaults to 1. Currently, only values of 1 are supported.

n_p1s_per_p2s

The number of P1s for every P2. This defaults to 1. Currently, only values of 1 are supported.

n_p2s_per_p1s

The number of P2s for every P1;. This defaults to 1. Currently, only values of 1 are supported.

n_r1_per_r2

The number of first ratings for each second rating. Currently, only 1:1 is supported.

n_r2_per_r1

The number of second ratings for each first rating. Currently, only 1:1 is supported.

Details

This chooses a function depending on which variables are supplied. At a minimum, it requires two ratings, an individual-level moderator variable, and the interaction term.

The estimated parameters depend upon which variables are supplied.

The function can handle up to n exchangeable triads.

Value

The function returns an object of class lavaan.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data("rep_sim_data")
# Prepare data
moderator_data <- rep_sim_data %>%
dplyr::mutate(B_C_agreeableness_cent = scale(B_C_agreeableness, scale = FALSE),
       D_A_agreeableness_cent = scale(D_A_agreeableness, scale = FALSE),
       B_iri_perspective_cent = scale(B_iri_perspective, scale = FALSE),
       D_iri_perspective_cent = scale(D_iri_perspective, scale = FALSE),
       B_ptXagree_interaction = B_C_agreeableness_cent*B_iri_perspective_cent,
       D_ptXagree_interaction = D_A_agreeableness_cent*D_iri_perspective_cent)

# Example for hearsay accuracy
rep_auto_id_mods(data = moderator_data,
                 target_self = c("C_C_agreeableness", "A_A_agreeableness"),
                 p2_reports = c("B_C_agreeableness_cent", "D_A_agreeableness_cent"),
                 id_mod_variable = c("B_iri_perspective_cent", "D_iri_perspective_cent"),
                 interaction_term = c("B_ptXagree_interaction", "D_ptXagree_interaction"))

# Example for hearsay consensus
rep_auto_id_mods(data = moderator_data,
                 p1_reports = c("A_C_agreeableness", "C_A_agreeableness"),
                 p2_reports = c("B_C_agreeableness_cent", "D_A_agreeableness_cent"),
                 id_mod_variable = c("B_iri_perspective_cent", "D_iri_perspective_cent"),
                 interaction_term = c("B_ptXagree_interaction", "D_ptXagree_interaction"))

Coryc3133/ReputationAnalyses documentation built on July 31, 2019, 8:35 a.m.