Description Usage Arguments Examples
Transforms data, which has been transformed by the function ML_Trans from sequence data into multi-level transitions, into lagged partner and lagged actor effects. This transformation is often required before fitting a multi-level actor-partner-interaction model (APIM).
1 | MLAP_Trans(x)
|
x |
the output of the ML_Trans function |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # Example: Applying a APIM on the example data
# Transforms Sequences into Multi-Level data
ML_data<-ML_Trans(CouplesCope, 2:49, 50:97)
# Transforms transitions into lagged Actor and Partner effects
MLAP_data<-MLAP_Trans(ML_data)
# Data preparation
# In example data first seq referred to females
# and second to males
names(MLAP_data)[1]<-"sex"
MLAP_data$sex<-as.factor(MLAP_data$sex)
levels(MLAP_data$sex)<-c("female", "male")
# Effectcoding
MLAP_data$Partner[MLAP_data$Partner==0]<-(-1)
MLAP_data$Actor[MLAP_data$Actor==0]<-(-1)
# Fits a multi-level APIM using lme4
# Here a random intercept-only model
## Not run:
## make sure lme4 is installed!
## and loaded!
#install.packages("lme4")
# library(lme4)
set.seed(1234)
glmer(DV~1+sex+Actor+Partner+Actor*Partner+
sex*Actor+sex*Partner+sex*Actor*Partner+
(1|ID),
data=MLAP_data,
family=binomial)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.