2

I'm trying to fit a mixed model in R. Actually I have a Stata code and want to do the same thing using R. The Stata code is

xtmixed laz c.x1##i.j4alloc_n c.x2##i.j4alloc_n ||childuid:age_m, cov(uns) var

I can't find how to specify 'unstructured' correlation structure in R. In the R help file, there is no 'unstructured' https://stat.ethz.ch/R-manual/R-devel/library/nlme/html/corClasses.html

user67275
  • 1
  • 9
  • 38
  • 64
  • 2
    Often times when folks want *unstructured* I think they are looking for `corSymm` (*general* correlation). That allows for correlations to be different between all observations in a group. If you additionally want to allow variances to differ among some factor, you may also need `varIdent`. – aosmith Oct 16 '14 at 16:15
  • 1
    I believe that unstructured correlation is actually the default. Have you tried `lme(laz~x1$i.j4alloc_n+x2$i.j4alloc_n, random=~age_m|childuid)` (my best guess at a translation) to see if you get similar results? A [reproducible example](http://tinyurl.com-000) would be nice ... – Ben Bolker Oct 16 '14 at 18:05
  • Unstructured is not default - independence is. Under `correlation` in `lme` documentation : "Defaults to NULL, corresponding to no within-group correlations." It appears that what some references/stat packages refer to as "unstructured" is referred to as "general" elsewhere, as @aosmith mentioned. The R documentation says "general" refers to a "general correlation matrix, with no additional structure." If you fit this structure and look at the variance-covariance matrix, it results in a different estimate for every parameter in the matrix like unstructured. – Meg Dec 08 '16 at 22:13

0 Answers0