Description Usage Arguments Details Value Examples
View source: R/core_functions.R
This function fits the social relations models response surface analysis. It requires a dataframe that contains columns for percever, target, and group ID variables and rating variables for the X, Y, Z variables for a response surface analysis (Z ~ X * Y). The Z variable will be treated as the rating in the social relations model, and the response surface analysis will be conducted on the relationship effect of that rating (i.e., after partialling out target, perceiver, and group effects).
1 2 3 4 5 6 7 8 9 10 11 | fit_srm_rsa(
data,
perceiver_id,
target_id,
group_id,
rating_x,
rating_y,
rating_z,
design = NULL,
...
)
|
data |
The dataframe. It must contain columns for percever, target, and group ID variables and X, Y, and Z rating variables. Note that X and Y can be the same variable. It should be in long format such that each row is a rating by a perceiver for a given target in a given group. |
perceiver_id |
A quoted string with the name of the column containing perceiver IDs. Perceiver IDs should be recycled across groups (i.e., each group should have perceiver 1 to i where i is the number of participants per group). Perceiver and Target id should match such that perceiver i is target i and vice versa. It can either be a number of a character string. |
target_id |
A quoted string with the name of the column containing target IDs. target IDs should be recycled across groups (i.e., each group should have target 1 to i where i is the number of participants per group). Perceiver and Target id should match such that perceiver i is target i and vice versa. It can either be a number of a character string. |
group_id |
A quoted string with the name of the column containing group IDs.It can either be a number of a character string. |
rating_x |
A quoted string with the name of the column that contains ratings for the x variable in the RSA. |
rating_y |
A quoted string with the name of the column that contains ratings for the y variable in the RSA. Note that this can be the same variable as x as long as design is not pxp. |
rating_z |
A quoted string with the name of the column that contains ratings for the z variable (the outcome/DV) in the RSA. |
design |
A quoted string specifying the design of the RSA. Valid entries include:
|
... |
Optional additional arguments passed directly to lavaan as it fits each model. For example, it can be used to specify bootstrapped or robust standard errors. Note this will affect all three of the fitted models. |
This function will mean-center the X and Y variables for you before it runs the analyses. It also creates the cross-products for you based on the rating variables and design specified. It will then fit 3 models:
This is a basic Social Relations model Estimating Target, Perceiver, Relationship effects, and the Target-Perceiver and relationship Covariances
This is the SRM RSA model where slopes for the interation and polynomial terms are set to zero, to test whether and RSA is appropriate.
This is the full SRM RSA model with b1 through b5 and surface parameters a1 through a5
For each model, it returns a string for the model (as lavaan syntax), fitted lavaan models, and a model comparison table comparing model 2 to 3.
The function returns a list containing the following elements:
string. SRM model in lavaan syntax treating z as rating.
string. regression paths, intercepts, and variances for rsa in lavaan syntax.
string. SRM RSA model in lavaan syntax.
fitted lavaan model. Contains basic SRM (on Z variable).
fitted lavaan model. Contains SRM RSA Null model where interaction and polynomial are set to zero. Preimarily used for model comparison.
fitted lavaan model. Contains full SRM RSA Model including surface parameters.
a tibble. Contains the model comparison results from comparing the SRM RSA Null model to the full SRM RSA model.
a tibble. Contains the wide version of the data created by the fit_srm_rsa function. It should be a row for each group, and a column for every rating in the format rating_perceiverid_targetid; squared terms are in the format rating_sq_perceiverid_targetid; interaction terms when x and y are the same variable (with different perceiver-target combos) are in the format rating_perceiverid_targetid_x_perceiverid_targetid; interaction terms when x and y are different variables are in the format ratingx_perceiverid_targetid_x_ratingy_perceiverid_targetid.
1 | #NEED TO SIMULATE DATA
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.