[R-sig-ME] Correlations among random variables

d@luedecke m@ili@g off uke@de d@luedecke m@ili@g off uke@de
Sat Jan 12 10:28:01 CET 2019


Hi Avi,

You can find some of the numbers from the covariance parameters from the
SPSS output also in the "summary()" from your model. Other parameters don't
match, maybe the random effects structure needs to be specified in a
different way? However, I'm not sure how to translate the rather "confusing"
SPSS notation into R-syntax.

Best
Daniel

-----Ursprüngliche Nachricht-----
Von: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> Im
Auftrag von Avraham Kluger
Gesendet: Samstag, 12. Januar 2019 08:01
An: r-sig-mixed-models using r-project.org
Cc: Michal Lehmann <chikush using gmail.com>; Kenny, David
<david.kenny using uconn.edu>; Sarit Pery <sarit using peryjoy.com>
Betreff: [R-sig-ME] Correlations among random variables

Hi,

I am struggling to analyze, in R, MLM models that specify correlations among
random variables, as can be done with SPSS, SAS, or MlWin.

Consider the following code in SPSS
-----------------------------
MIXED
   Outcome  BY role  WITH focalcode partcode
   /FIXED = focalcode partcode | NOINT
   /PRINT = SOLUTION TESTCOV
   /RANDOM focalcode partcode | SUBJECT(focalid) COVTYPE(UNR)
   /REPEATED = role | SUBJECT(focalid*dyadid) COVTYPE(UNR).
-----------------------------
And a minimal code (with data) in R

-----------------------------
df <-
read.csv("https://raw.githubusercontent.com/avi-kluger/RCompanion4DDABook/ma
ster/Chapter%2010/Chapter10_df.csv")
head(df)
library(lme4)

mlm <- lmer(outcome   ~ 0 + focalcode + partcode + role +
                       (0 + focalcode + partcode|| focalid/ dyadid),
                       data = df)
summary(mlm)
-----------------------------

These SPSS and R codes produce the same variance estimates.  However, SPSS
also produces a correlation among "focalcode" and "partcode."  How can this
be done in R?  Is it also possible to produce the correlation among the
respective error variances (as in SPSS)?

Additional information


1.       MOTIVATION.  The question arises from David Kenny's work on
one-with-many reciprocal designs (e.g., a manager rate all subordinates, and
all subordinates rate the same manager).  These models estimate the variance
stemming from the one (e.g., managers) and the many (e.g., subordinates),
and the correlation among them (termed generalized reciprocity).  The data
and codes for SAS etc. are available at
http://davidakenny.net/kkc/c10/c10.htm.

2.       SPSS OUTPUT (download HTML file):
https://www.dropbox.com/s/eqch0kq6djtbsfx/One%20with%20many%20SPSS%20output.
htm?dl=1

Sincerely,

Avi Kluger
https://www.avi-kluger.com/


	[[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

--

_____________________________________________________________________

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Marya Verdel
_____________________________________________________________________

SAVE PAPER - THINK BEFORE PRINTING



More information about the R-sig-mixed-models mailing list