# NOT RUN {
# The example data are taken from the "Mainz Freshman Study" and consist
# of ratings of liking as well as ratings of the metaperception of
# liking at zero-acquaintance using a Round-Robin group of 54 participants
#------------------------------------------------------------
# ---- Single group --------------------------------------
#------------------------------------------------------------
# Load data frame in long format - it contains 4 variables:
#liking ratings indicator a (liking_a, "How likeable do you find this person?")
#liking ratings indicator b (liking_b, "Would you like to get to know this person?")
#metaliking ratings indicator a (metaliking_a, "How likeable does this person find you?")
#metaliking ratings indicator b (metaliking_b, "Would this person like to get to know you?")
data("likingLong")
#manifest univariate SRM analysis
RR1 <- RR(liking_a ~ perceiver.id*target.id, data=likingLong)
# }
# NOT RUN {
#manifest bivariate SRM analysis
RR2 <- RR(liking_a + metaliking_a ~ perceiver.id*target.id, data=likingLong)
#latent (construct-level) univariate SRM analysis
RR3 <- RR(liking_a / liking_b ~ perceiver.id*target.id, data=likingLong)
#latent (construct-level) univariate SRM analysis, define new variable name for the latent construct
RR3b <- RR(liking_a / liking_b ~ perceiver.id*target.id, data=likingLong, varname="liking")
# compare:
head(RR3$effects)
head(RR3b$effects)
#latent (construct-level) bivariate SRM analysis
RR4 <- RR(liking_a/liking_b + metaliking_a/metaliking_b ~ perceiver.id*target.id, data=likingLong)
# prints output of the manifest univariate analysis
# in terms of actor and partner variance (default output labels)
print(RR1, measure1="behavior")
# prints output of the manifest univariate analysis
# in terms of perceiver and target variance (appropriate for perception data)
print(RR1, measure1="perception")
# prints output of the manifest bivariate SRM analysis appropriate
# for perception-metaperception data
print(RR2, measure1="perception", measure2="metaperception")
#prints output of the latent univariate SRM analysis
# appropriate for perception data
print(RR3, measure1="perception")
#prints output of the latent bivariate SRM analysis
# appropriate for perception-perception data
# Note: you can use abbreviations of the strings "behavior", "perception", and "metaperception"
print(RR4, measure1="p", measure2="p")
# }
# NOT RUN {
#------------------------------------------------------------
# ---- Multiple groups --------------------------------------
#------------------------------------------------------------
# data("multiLikingLong") is a variant of the liking data set (see above) with multiple groups
data("multiLikingLong")
# set RR.style to "perception" (affects subsequent printing of objects)
RR.style("perception")
#manifest univariate SRM analysis
RR1m <- RR(liking_a ~ perceiver.id*target.id|group.id, data=multiLikingLong)
# }
# NOT RUN {
#manifest bivariate SRM analysis
RR2m <- RR(liking_a + metaliking_a ~ perceiver.id*target.id|group.id, data=multiLikingLong)
#latent (construct-level) univariate SRM analysis
RR3m <- RR(liking_a / liking_b ~ perceiver.id*target.id|group.id, data=multiLikingLong)
#latent (construct-level) bivariate SRM analysis
RR4m <- RR(liking_a/liking_b + metaliking_a/metaliking_b ~ perceiver.id*target.id|group.id,
data=multiLikingLong)
# prints output of the manifest univariate analysis
# in terms of actor and partner variance (default output labels)
print(RR1m, measure1="behavior")
# prints output of the manifest univariate analysis
# in terms of perceiver and target variance (appropriate for perception data)
print(RR1m, measure1="perception")
#------------------------------------------------------------
# ---- Multiple groups with missing values --------------------------------------
#------------------------------------------------------------
# a multi group data set with two variables:
# ex = extraversion ratings, and ne = neurotizism ratings
data("multiGroup")
#manifest univariate SRM analysis, data set with missings
RR1miss <- RR(ex~perceiver.id*target.id|group.id, data=multiGroup, na.rm=TRUE)
#manifest univariate SRM analysis, data set with missings,
# minimum 10 data points are requested for each participant
RR1miss <- RR(ex~perceiver.id*target.id|group.id, data=multiGroup, na.rm=TRUE, minData=10)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab