
Observed Actor-Partner Interdependence Model (lavaan syntax)
Source:R/scriptObsAPIM.R
scriptObsAPIM.RdWrites lavaan syntax for an APIM with one observed (or composite) X and Y per
partner. Structural constraints mirror scriptAPIM() (dyadic variances/means,
actor/partner paths, optional orthogonal dyadic covariances).
Usage
scriptObsAPIM(
X1 = NULL,
Y1 = NULL,
X2 = NULL,
Y2 = NULL,
constr_dy_x_struct = c("variances", "means"),
constr_dy_y_struct = c("variances", "means"),
constr_dy_xy_struct = c("actors", "partners"),
includeMeanStruct = FALSE,
equate = lifecycle::deprecated(),
k = lifecycle::deprecated(),
est_k = FALSE,
writeTo = NULL,
fileName = NULL
)Arguments
- X1, X2, Y1, Y2
Character names of variables for partners 1 and 2.
- constr_dy_x_struct
Character vector: any of
"variances","means","orthogonal", and/or"none". Defaults matchscriptAPIM()."means"is applied only whenincludeMeanStructisTRUE(same behavior asscriptAPIM())."orthogonal"fixes the dyadic covariance betweenX1andX2to zero.- constr_dy_y_struct
Same allowed values as
constr_dy_x_struct, for the Y side."variances"equates residual variances ofY1andY2;"orthogonal"fixes the residual covariance betweenY1andY2to zero.- constr_dy_xy_struct
Character vector:
"actors","partners","all","actors_zero","partners_zero", and/or"none"(same semantics asscriptAPIM()).- includeMeanStruct
Logical; if
TRUE, mean structure is included and"means"inconstr_dy_x_struct/constr_dy_y_structequates exogenous means and regression intercepts, respectively.- equate
Use
constr_dy_xy_structinstead. If supplied, mapsnone→"none",actor→c("actors"),partner→c("partners"),all→c("actors", "partners").- k
- est_k
Logical; if
TRUE, Kenny & Ledermann's (2010) k ratio(s) are defined in the syntax (seescriptAPIM()).- writeTo
A character string specifying a directory path to where the output file(s) should be saved. If set to
".", the file(s) will be written to the current working directory. The default isNULL, and examples use a temporary directory created bytempdir(). When dealing with tabular output,writeTois only relevant ifgtTab = TRUE.- fileName
A character string specifying a desired base name for the output file. The default is
NULL. The specified name will be automatically appended with the appropriate file extension (e.g.,.txtforlavaanscripts,.rtffor tabular output whengtTab = TRUE, or other extensions as appropriate for the output type). If a file with the same name already exists in the user's chosen directory, it will be overwritten.
See also
Other bi-construct script-writing functions:
scriptAPIM(),
scriptBiDy(),
scriptCFM(),
scriptMIM(),
scriptTwoCross()
Examples
scriptObsAPIM(
X1 = "SexSatA", Y1 = "RelSatA",
X2 = "SexSatB", Y2 = "RelSatB",
constr_dy_xy_struct = "none",
constr_dy_x_struct = "none",
constr_dy_y_struct = "none",
writeTo = tempdir(),
fileName = "obsAPIM_script"
)
#> [1] "# Actor and partner effects\nRelSatA ~ a1*SexSatA + p1*SexSatB\nRelSatB ~ a2*SexSatB + p2*SexSatA\n\n# Dyadic X covariance\nSexSatA ~~ SexSatB\n\n# Residual covariance between Y\nRelSatA ~~ RelSatB"